Index: src/main/java/com/sun/ejb/EJBUtils.java =================================================================== --- src/main/java/com/sun/ejb/EJBUtils.java (révision 21044) +++ src/main/java/com/sun/ejb/EJBUtils.java (copie de travail) @@ -138,7 +138,7 @@ ( (ejbStaticCodegenProp != null) && ejbStaticCodegenProp.equalsIgnoreCase("true")); - ejbUseStaticCodegen_ = new Boolean(useStaticCodegen); + ejbUseStaticCodegen_ = Boolean.valueOf(useStaticCodegen); _logger.log(Level.FINE, "EJB Static codegen is " + (useStaticCodegen ? "ENABLED" : "DISABLED") + Index: src/main/java/com/sun/ejb/containers/BaseContainer.java =================================================================== --- src/main/java/com/sun/ejb/containers/BaseContainer.java (révision 21044) +++ src/main/java/com/sun/ejb/containers/BaseContainer.java (copie de travail) @@ -400,7 +400,7 @@ protected BaseContainer(ContainerType type, EjbDescriptor ejbDesc, ClassLoader loader) throws Exception { - this.containerType = containerType; + this.containerType = type; try { this.loader = loader; Index: src/main/java/com/sun/ejb/containers/EjbContainerUtilImpl.java =================================================================== --- src/main/java/com/sun/ejb/containers/EjbContainerUtilImpl.java (révision 21044) +++ src/main/java/com/sun/ejb/containers/EjbContainerUtilImpl.java (copie de travail) @@ -275,7 +275,7 @@ } // Various pieces of data associated with a tx. Store directly // in J2EETransaction to avoid repeated Map lookups. - private class TxData { + private static class TxData { ContainerSynchronization sync; Vector beans; } Index: src/main/java/com/sun/ejb/containers/InvocationHandlerUtil.java =================================================================== --- src/main/java/com/sun/ejb/containers/InvocationHandlerUtil.java (révision 21044) +++ src/main/java/com/sun/ejb/containers/InvocationHandlerUtil.java (copie de travail) @@ -68,10 +68,10 @@ Proxy.getInvocationHandler(args[0]) : args[0]; result = handler.equals(other); } - returnValue = new Boolean(result); + returnValue = Boolean.valueOf(result); break; case 'h' : - returnValue = new Integer(handler.hashCode()); + returnValue = Integer.valueOf(handler.hashCode()); break; case 't' : returnValue = handler.toString(); Index: src/main/java/com/sun/ejb/containers/EJBTimerService.java =================================================================== --- src/main/java/com/sun/ejb/containers/EJBTimerService.java (révision 21044) +++ src/main/java/com/sun/ejb/containers/EJBTimerService.java (copie de travail) @@ -56,6 +56,7 @@ import java.io.BufferedReader; import java.io.PrintWriter; import java.io.Serializable; +import java.io.IOException; import com.sun.logging.LogDomains; @@ -670,7 +671,7 @@ timerLocal_.cancelTimers(timers); } catch(Exception e) { logger.log(Level.WARNING, "ejb.cancel_entity_timers", - new Object[] { new Long(containerId), primaryKey }); + new Object[] { Long.valueOf(containerId), primaryKey }); logger.log(Level.WARNING, "", e); } } @@ -730,7 +731,7 @@ } catch(Exception ex) { logger.log(Level.WARNING, "destroy_timers_error", - new Object[] { new Long(containerId) }); + new Object[] { Long.valueOf(containerId) }); logger.log(Level.WARNING, "", ex); return; } finally { @@ -740,7 +741,7 @@ // Most likely caused by two or more server instances trying // to delete the timers for the same ejb at the same time. logger.log(Level.WARNING, "destroy_timers_error", - new Object[] { new Long(containerId) }); + new Object[] { Long.valueOf(containerId) }); logger.log(Level.WARNING, "", e); } } @@ -1015,7 +1016,7 @@ info); } catch(Exception e) { logger.log(Level.SEVERE, "ejb.create_timer_failure", - new Object[] { new Long(containerId), + new Object[] { Long.valueOf(containerId), timedObjectPrimaryKey, info }); logger.log(Level.SEVERE, "", e); @@ -1386,7 +1387,7 @@ logger.log(Level.INFO, "ejb.timer_exceeded_max_deliveries", new Object[] { timerState.toString(), - new Integer(numDeliv)}); + Integer.valueOf(numDeliv)}); expungeTimer(timerId, true); } } else if( timerState.isPeriodic() ) { @@ -1632,7 +1633,7 @@ // @@@ Add cluster ID - return new String(nextTimerIdCounter_ + + return (nextTimerIdCounter_ + TIMER_ID_SEP + nextTimerIdMillis_ + TIMER_ID_SEP + serverName_ + TIMER_ID_SEP + domainName_); @@ -1671,7 +1672,7 @@ // // Note : this class supports concurrent access. // - private class TimerCache { + private static class TimerCache { // Maps timer id to timer state. private Map timers_; @@ -1705,7 +1706,7 @@ timers_.put(timerId, timerState); - Long containerId = new Long(timerState.getContainerId()); + Long containerId = Long.valueOf(timerState.getContainerId()); Object containerInfo = containerTimers_.get(containerId); @@ -1722,8 +1723,8 @@ } entityBeans.add(timerState.getTimedObjectPrimaryKey()); } else { - Long timerCount = (containerInfo == null) ? new Long(1) : - new Long(((Long) containerInfo).longValue() + 1); + Long timerCount = (containerInfo == null) ? Long.valueOf(1) : + Long.valueOf(((Long) containerInfo).longValue() + 1); containerTimers_.put(containerId, timerCount); } @@ -1746,7 +1747,7 @@ return; } - Long containerId = new Long(timerState.getContainerId()); + Long containerId = Long.valueOf(timerState.getContainerId()); Object containerInfo = containerTimers_.get(containerId); if( containerInfo != null ) { @@ -1768,7 +1769,7 @@ // Only one left -- blow away the container containerTimers_.remove(containerId); } else { - Long newCount = new Long(timerCount - 1); + Long newCount = Long.valueOf(timerCount - 1); containerTimers_.put(containerId, newCount); } } @@ -1783,7 +1784,7 @@ // True if the given entity bean has any timers and false otherwise. public synchronized boolean entityBeanHasTimers(long containerId, Object pkey) { - Object containerInfo = containerTimers_.get(new Long(containerId)); + Object containerInfo = containerTimers_.get(Long.valueOf(containerId)); return (containerInfo != null) ? ((Collection) containerInfo).contains(pkey) : false; } @@ -1791,7 +1792,7 @@ // True if the ejb represented by this container id has any timers // and false otherwise. public synchronized boolean containerHasTimers(long containerId) { - return containerTimers_.containsKey(new Long(containerId)); + return containerTimers_.containsKey(Long.valueOf(containerId)); } // Placeholder for logic to ensure timer cache consistency. @@ -1819,6 +1820,8 @@ private long getTimerServiceDownAt() { long timerServiceWentDownAt = -1; + FileReader fr = null; + BufferedReader br = null; try { File timerServiceShutdownFile = getTimerServiceShutdownFile(); @@ -1826,8 +1829,8 @@ DateFormat dateFormat = new SimpleDateFormat(TIMER_SERVICE_DOWNTIME_FORMAT); - FileReader fr = new FileReader(timerServiceShutdownFile); - BufferedReader br = new BufferedReader(fr, 128); + fr = new FileReader(timerServiceShutdownFile); + br = new BufferedReader(fr, 128); String line = br.readLine(); Date myDate = dateFormat.parse(line); @@ -1842,6 +1845,19 @@ logger.log(Level.WARNING, "ejb.timer_service_shutdown_unknown", new Object[] { "" }); logger.log(Level.WARNING, "", th); + } finally { + try { + if (br != null) { + br.close(); + } + if (fr != null) { + fr.close(); + } + } catch (IOException err) { + logger.log(Level.WARNING, "ejb.timer_service_shutdown_unknown", + new Object[] { "" }); + logger.log(Level.WARNING, "", err); + } } return timerServiceWentDownAt; } Index: src/main/java/com/sun/ejb/containers/EJBLocalObjectInvocationHandler.java =================================================================== --- src/main/java/com/sun/ejb/containers/EJBLocalObjectInvocationHandler.java (révision 21044) +++ src/main/java/com/sun/ejb/containers/EJBLocalObjectInvocationHandler.java (copie de travail) @@ -233,7 +233,7 @@ EJBLocalObjectImpl otherImpl = EJBLocalObjectImpl.toEJBLocalObjectImpl(other); - returnValue = new Boolean(super.isIdentical(otherImpl)); + returnValue = Boolean.valueOf(super.isIdentical(otherImpl)); break; case 'g' : Index: src/main/java/com/sun/ejb/containers/util/MethodMap.java =================================================================== --- src/main/java/com/sun/ejb/containers/util/MethodMap.java (révision 21044) +++ src/main/java/com/sun/ejb/containers/util/MethodMap.java (copie de travail) @@ -176,7 +176,7 @@ int bucket = getBucket(next); - if( !occupied.contains(new Integer(bucket)) ) { + if( !occupied.contains(Integer.valueOf(bucket)) ) { MethodInfo methodInfo = new MethodInfo(); methodInfo.key = next; @@ -188,7 +188,7 @@ methodInfo_[bucket] = methodInfo; - occupied.add(new Integer(bucket)); + occupied.add(Integer.valueOf(bucket)); } else { // there's a clash for this bucket, so null it out and @@ -240,7 +240,7 @@ } - private class MethodInfo { + private static class MethodInfo { public Class declaringClass; public Method key; public Object value; Index: src/main/java/com/sun/ejb/portable/HandleDelegateUtil.java =================================================================== --- src/main/java/com/sun/ejb/portable/HandleDelegateUtil.java (révision 21044) +++ src/main/java/com/sun/ejb/portable/HandleDelegateUtil.java (copie de travail) @@ -133,13 +133,13 @@ synchronized(HandleDelegateUtil.class) { if( !checkedJndiProperties ) { + FileInputStream fis = null; try { String jndiPropertyFileName = System.getProperty(JNDI_PROPERTY_FILE_NAME); if( jndiPropertyFileName != null ) { - FileInputStream fis = - new FileInputStream(jndiPropertyFileName); + fis = new FileInputStream(jndiPropertyFileName); jndiProperties = new Properties(); jndiProperties.load(fis); // Let an exception encountered here bubble up, so @@ -150,6 +150,9 @@ // Always set to true so we don't keep doing this // system property and file access multiple times checkedJndiProperties = true; + if (fis != null) { + fis.close(); + } } } } Index: src/main/java/com/sun/ejb/base/stats/MethodMonitor.java =================================================================== --- src/main/java/com/sun/ejb/base/stats/MethodMonitor.java (révision 21044) +++ src/main/java/com/sun/ejb/base/stats/MethodMonitor.java (copie de travail) @@ -86,7 +86,7 @@ list = new ArrayList(5); execThreadLocal.set(list); } - list.add(new Long(System.currentTimeMillis())); + list.add(Long.valueOf(System.currentTimeMillis())); synchronized (lock) { invocationCount++; }