| author | Henrik Lynggaard Hansen | 2012-07-01 06:19:21 (EDT) |
|---|---|---|
| committer | Henrik Lynggaard Hansen | 2012-07-01 06:19:21 (EDT) |
| commit | be6be4e15435ceaf303dbd5663816b3a6d2e64dc (patch) (side-by-side diff) | |
| tree | 6f7d5b330f86a81462462af5c7b65d505a78c5d3 | |
| parent | ff36d0a9fed35303352ac7716fb2418a6fe6fc1d (diff) | |
| download | org.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.java | 27 |
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); |

