View | Details | Raw Unified | Return to bug 43174
Collapse All | Expand All

(-)StandardManager.java (-54 / +26 lines)
Lines 345-390 Link Here
345
            return;
345
            return;
346
        if (log.isDebugEnabled())
346
        if (log.isDebugEnabled())
347
            log.debug(sm.getString("standardManager.loading", pathname));
347
            log.debug(sm.getString("standardManager.loading", pathname));
348
        FileInputStream fis = null;
349
        ObjectInputStream ois = null;
350
        Loader loader = null;
351
        ClassLoader classLoader = null;
352
        try {
353
            fis = new FileInputStream(file.getAbsolutePath());
354
            BufferedInputStream bis = new BufferedInputStream(fis);
355
            if (container != null)
356
                loader = container.getLoader();
357
            if (loader != null)
358
                classLoader = loader.getClassLoader();
359
            if (classLoader != null) {
360
                if (log.isDebugEnabled())
361
                    log.debug("Creating custom object input stream for class loader ");
362
                ois = new CustomObjectInputStream(bis, classLoader);
363
            } else {
364
                if (log.isDebugEnabled())
365
                    log.debug("Creating standard object input stream");
366
                ois = new ObjectInputStream(bis);
367
            }
368
        } catch (FileNotFoundException e) {
369
            if (log.isDebugEnabled())
370
                log.debug("No persisted data file found");
371
            return;
372
        } catch (IOException e) {
373
            log.error(sm.getString("standardManager.loading.ioe", e), e);
374
            if (ois != null) {
375
                try {
376
                    ois.close();
377
                } catch (IOException f) {
378
                    ;
379
                }
380
                ois = null;
381
            }
382
            throw e;
383
        }
384
348
385
        // Load the previously unloaded active sessions
349
        // Load the previously unloaded active sessions
386
        synchronized (sessions) {
350
        synchronized (sessions) {
351
            FileInputStream fis = null;
352
            ObjectInputStream ois = null;
353
            Loader loader = null;
354
            ClassLoader classLoader = null;
387
            try {
355
            try {
356
                fis = new FileInputStream(file.getAbsolutePath());
357
                BufferedInputStream bis = new BufferedInputStream(fis);
358
                if (container != null)
359
                    loader = container.getLoader();
360
                if (loader != null)
361
                    classLoader = loader.getClassLoader();
362
                if (classLoader != null) {
363
                    if (log.isDebugEnabled())
364
                        log.debug("Creating custom object input stream for class loader ");
365
                    ois = new CustomObjectInputStream(bis, classLoader);
366
                } else {
367
                    if (log.isDebugEnabled())
368
                        log.debug("Creating standard object input stream");
369
                    ois = new ObjectInputStream(bis);
370
                }
371
388
                Integer count = (Integer) ois.readObject();
372
                Integer count = (Integer) ois.readObject();
389
                int n = count.intValue();
373
                int n = count.intValue();
390
                if (log.isDebugEnabled())
374
                if (log.isDebugEnabled())
Lines 397-423 Link Here
397
                    session.activate();
381
                    session.activate();
398
                    session.endAccess();
382
                    session.endAccess();
399
                }
383
                }
384
            } catch (FileNotFoundException e) {
385
                if (log.isDebugEnabled())
386
                    log.debug("No persisted data file found");
387
                return;
400
            } catch (ClassNotFoundException e) {
388
            } catch (ClassNotFoundException e) {
401
              log.error(sm.getString("standardManager.loading.cnfe", e), e);
389
                log.error(sm.getString("standardManager.loading.cnfe", e), e);
402
                if (ois != null) {
403
                    try {
404
                        ois.close();
405
                    } catch (IOException f) {
406
                        ;
407
                    }
408
                    ois = null;
409
                }
410
                throw e;
390
                throw e;
411
            } catch (IOException e) {
391
            } catch (IOException e) {
412
              log.error(sm.getString("standardManager.loading.ioe", e), e);
392
                log.error(sm.getString("standardManager.loading.ioe", e), e);
413
                if (ois != null) {
414
                    try {
415
                        ois.close();
416
                    } catch (IOException f) {
417
                        ;
418
                    }
419
                    ois = null;
420
                }
421
                throw e;
393
                throw e;
422
            } finally {
394
            } finally {
423
                // Close the input stream
395
                // Close the input stream

Return to bug 43174