Commits

Anonymous committed 7998323

misc minor code clean-up/fixes via FindBugs.

git-svn-id: http://svn.opensymphony.com/svn/quartz/trunk@89669f7d36a-ea1c-0410-88ea-9fd03e4c9665

Comments (0)

Files changed (12)

src/java/org/quartz/CronExpression.java

     protected static final Integer ALL_SPEC = new Integer(ALL_SPEC_INT);
     protected static final Integer NO_SPEC = new Integer(NO_SPEC_INT);
     
-    protected static Map monthMap = new HashMap(20);
-    protected static Map dayMap = new HashMap(60);
+    protected static final Map monthMap = new HashMap(20);
+    protected static final Map dayMap = new HashMap(60);
     static {
         monthMap.put("JAN", new Integer(0));
         monthMap.put("FEB", new Integer(1));

src/java/org/quartz/SimpleTrigger.java

      * ending timestamp.
      * </p>
      */
-    public static int REPEAT_INDEFINITELY = -1;
+    public static final int REPEAT_INDEFINITELY = -1;
 
     private static final int YEAR_TO_GIVEUP_SCHEDULING_AT = 2299;
     

src/java/org/quartz/ee/jta/UserTransactionHelper.java

     private static class UserTransactionWithContext implements UserTransaction {
         InitialContext context;
         UserTransaction userTransaction;
-        TransactionManager tm;
         
         public UserTransactionWithContext() throws SchedulerException {
             try {

src/java/org/quartz/impl/StdSchedulerFactory.java

                         propSrc = "default file in current working dir: 'quartz.properties'";
                     }
     
-                    in = new FileInputStream(propFileName);
-                    props.load(new BufferedInputStream(in));
+                    in = new BufferedInputStream(new FileInputStream(propFileName));
+                    props.load(in);
     
                 } catch (IOException ioe) {
                     initException = new SchedulerException("Properties file: '"
                 
                 propSrc = "specified file: '" + requestedFile + "' in the class resource path.";
                 
+                in = new BufferedInputStream(in);
                 try {
-                    props.load(new BufferedInputStream(in));
+                    props.load(in);
                 } catch (IOException ioe) {
                     initException = new SchedulerException("Properties file: '"
                             + requestedFile + "' could not be read.", ioe);
                     + filename + "' could not be read.", ioe);
             throw initException;
         }
+        finally {
+        	if(is != null)
+        		try { is.close(); } catch(IOException ignore) {}
+        }
 
         initialize(props);
     }

src/java/org/quartz/impl/calendar/AnnualCalendar.java

      */
     public boolean isDayExcluded(java.util.Calendar day) {
 
-    	 // Check baseCalendar first
-        if (! super.isTimeIncluded(day.getTime().getTime())) {
-         return true;
-        } 
-        
     	if (day == null) {
             throw new IllegalArgumentException(
                     "Parameter day must not be null");
         }
 
+    	 // Check baseCalendar first
+        if (! super.isTimeIncluded(day.getTime().getTime())) {
+         return true;
+        } 
+        
         int dmonth = day.get(java.util.Calendar.MONTH);
         int dday = day.get(java.util.Calendar.DAY_OF_MONTH);
 
         if (day1 < day2) {
         	return -1;
         }
-        if (day1 > day1) {
+        if (day1 > day2) {
         	return 1;
         }
         return 0;

src/java/org/quartz/impl/jdbcjobstore/DB2v6Delegate.java

 
             return count;
         } finally {
+        	closeResultSet(rs);
             closeStatement(ps);
         }
     }
                 return 0;
             }
         } finally {
+        	closeResultSet(rs);
             closeStatement(ps);
         }
     }
 
             return count;
         } finally {
+        	closeResultSet(rs);
             closeStatement(ps);
         }
     }
 
             return count;
         } finally {
+        	closeResultSet(rs);
             closeStatement(ps);
         }
     }

src/java/org/quartz/impl/jdbcjobstore/StdJDBCDelegate.java

             
             ByteArrayOutputStream baos = null;
             try {
-                serializeObject(entry.getValue());
+                baos = serializeObject(entry.getValue());
             } catch (IOException e) {
                 return entry.getKey();
             } finally {

src/java/org/quartz/jobs/FileScanJob.java

  */
 public class FileScanJob implements StatefulJob {
 
-    public static String FILE_NAME = "FILE_NAME";
-    public static String FILE_SCAN_LISTENER_NAME = "FILE_SCAN_LISTENER_NAME";
-    private static String LAST_MODIFIED_TIME = "LAST_MODIFIED_TIME";
+    public static final String FILE_NAME = "FILE_NAME";
+    public static final String FILE_SCAN_LISTENER_NAME = "FILE_SCAN_LISTENER_NAME";
+    private static final String LAST_MODIFIED_TIME = "LAST_MODIFIED_TIME";
     
     private final Log log = LogFactory.getLog(getClass());
 

src/java/org/quartz/jobs/ee/ejb/EJBInvokerJob.java

 
     public void execute(JobExecutionContext context)
         throws JobExecutionException {
-        JobDetail detail = context.getJobDetail();
-
         JobDataMap dataMap = context.getMergedJobDataMap();
 
         String ejb = dataMap.getString(EJB_JNDI_NAME_KEY);

src/java/org/quartz/jobs/ee/jmx/JMXInvokerJob.java

                                 types[k]=Double.class.getName();
                                 break;
                             case 's':
-                                params[k]=new String(jobDataMap.getString(parts[1]));
+                                params[k]=jobDataMap.getString(parts[1]);
                                 types[k]=String.class.getName();
                                 break;
                             case 'b':

src/java/org/quartz/simpl/RAMJobStore.java

         TriggerWrapper tw = (TriggerWrapper) triggersByFQN.get(TriggerWrapper
                 .getTriggerNameKey(triggerName, groupName));
 
-        Trigger trig = tw.getTrigger();
-
         // does the trigger exist?
         if (tw == null || tw.trigger == null) {
             return;
         }
+
+        Trigger trig = tw.getTrigger();
+
         // if the trigger is not paused resuming it does not make sense...
         if (tw.state != TriggerWrapper.STATE_PAUSED &&
                 tw.state != TriggerWrapper.STATE_PAUSED_BLOCKED) {

src/java/org/quartz/utils/DirtyFlagMap.java

 
         return map.equals(((DirtyFlagMap) obj).getWrappedMap());
     }
+    
+    public int hashCode()
+    {
+    	return map.hashCode();
+    }
 
     public Object get(Object key) {
         return map.get(key);
         public int size() { return collection.size(); }
         public boolean isEmpty() { return collection.isEmpty(); }
         public boolean contains(Object o) { return collection.contains(o); }
-        public boolean add(Object o) { return add(o); } // Not supported
+        public boolean add(Object o) { return collection.add(o); } // Not supported
         public boolean addAll(Collection c) { return collection.addAll(c); } // Not supported
         public boolean containsAll(Collection c) { return collection.containsAll(c); }
         public Object[] toArray() { return collection.toArray(); }