aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Lynggaard Hansen2012-07-01 06:19:21 (EDT)
committerHenrik Lynggaard Hansen2012-07-01 06:19:21 (EDT)
commitbe6be4e15435ceaf303dbd5663816b3a6d2e64dc (patch)
tree6f7d5b330f86a81462462af5c7b65d505a78c5d3
parentff36d0a9fed35303352ac7716fb2418a6fe6fc1d (diff)
downloadorg.eclipse.hudson.core-be6be4e15435ceaf303dbd5663816b3a6d2e64dc.zip
org.eclipse.hudson.core-be6be4e15435ceaf303dbd5663816b3a6d2e64dc.tar.gz
org.eclipse.hudson.core-be6be4e15435ceaf303dbd5663816b3a6d2e64dc.tar.bz2
Clean some findbugs, checktyle errors in CronTabList.refs/changes/63/6563/1
- synchronized not needed, since the tabs variable isn't change after construction. - Javadoc first sentence wshould end in a period. - Use braces in if statements - Change Vector to List. Change-Id: Ie4ed855fa059e566031c03f57bfe79aca77b662f Signed-off-by: Henrik Lynggaard Hansen <henrik@hlyh.dk>
-rw-r--r--hudson-core/src/main/java/hudson/scheduler/CronTabList.java27
1 files changed, 15 insertions, 12 deletions
diff --git a/hudson-core/src/main/java/hudson/scheduler/CronTabList.java b/hudson-core/src/main/java/hudson/scheduler/CronTabList.java
index 25234df..2e3ea5d 100644
--- a/hudson-core/src/main/java/hudson/scheduler/CronTabList.java
+++ b/hudson-core/src/main/java/hudson/scheduler/CronTabList.java
@@ -16,10 +16,10 @@
package hudson.scheduler;
+import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
-import java.util.Vector;
-
+import java.util.List;
import org.antlr.runtime.RecognitionException;
/**
@@ -28,19 +28,20 @@ import org.antlr.runtime.RecognitionException;
* @author Kohsuke Kawaguchi
*/
public final class CronTabList {
- private final Vector<CronTab> tabs;
+ private final List<CronTab> tabs;
public CronTabList(Collection<CronTab> tabs) {
- this.tabs = new Vector<CronTab>(tabs);
+ this.tabs = new ArrayList<CronTab>(tabs);
}
/**
- * Returns true if the given calendar matches
+ * Returns true if the given calendar matches.
*/
- public synchronized boolean check(Calendar cal) {
+ public boolean check(Calendar cal) {
for (CronTab tab : tabs) {
- if(tab.check(cal))
+ if (tab.check(cal)) {
return true;
+ }
}
return false;
}
@@ -57,23 +58,25 @@ public final class CronTabList {
public String checkSanity() {
for (CronTab tab : tabs) {
String s = tab.checkSanity();
- if(s!=null) return s;
+ if (s != null) {
+ return s;
+ }
}
return null;
}
public static CronTabList create(String format) throws RecognitionException {
- Vector<CronTab> r = new Vector<CronTab>();
+ List<CronTab> r = new ArrayList<CronTab>();
int lineNumber = 0;
for (String line : format.split("\\r?\\n")) {
lineNumber++;
line = line.trim();
- if(line.length()==0 || line.startsWith("#"))
+ if (line.length() == 0 || line.startsWith("#"))
continue; // ignorable line
try {
- r.add(new CronTab(line,lineNumber));
+ r.add(new CronTab(line, lineNumber));
} catch (RecognitionException e) {
- throw new BaseParser.SemanticException(Messages.CronTabList_InvalidInput(line,e.toString()),e);
+ throw new BaseParser.SemanticException(Messages.CronTabList_InvalidInput(line, e.toString()), e);
}
}
return new CronTabList(r);