2424
2525package hudson .scheduler ;
2626
27+ import antlr .ANTLRException ;
2728import edu .umd .cs .findbugs .annotations .CheckForNull ;
2829import edu .umd .cs .findbugs .annotations .NonNull ;
2930import java .util .Calendar ;
@@ -83,9 +84,9 @@ public String checkSanity() {
8384 public static @ CheckForNull String getValidTimezone (String timezone ) {
8485 String [] validIDs = TimeZone .getAvailableIDs ();
8586 for (String str : validIDs ) {
86- if (str != null && str .equals (timezone )) {
87- return timezone ;
88- }
87+ if (str != null && str .equals (timezone )) {
88+ return timezone ;
89+ }
8990 }
9091 return null ;
9192 }
@@ -117,7 +118,11 @@ public static CronTabList create(@NonNull String format, Hash hash) {
117118 if (timezone != null ) {
118119 LOGGER .log (Level .CONFIG , "CRON with timezone {0}" , timezone );
119120 } else {
120- throw new IllegalArgumentException ("Invalid or unsupported timezone '" + timezoneString + "'" );
121+ /*
122+ * @deprecated use {@link IllegalArgumentException}
123+ * Some plugins might not catch : IllegalArgumentException & break
124+ */
125+ throw new ANTLRException ("Invalid or unsupported timezone '" + timezoneString + "'" );
121126 }
122127 continue ;
123128 }
@@ -127,7 +132,11 @@ public static CronTabList create(@NonNull String format, Hash hash) {
127132 try {
128133 r .add (new CronTab (line , lineNumber , hash , timezone ));
129134 } catch (IllegalArgumentException e ) {
130- throw new IllegalArgumentException (Messages .CronTabList_InvalidInput (line , e .getMessage ()), e );
135+ /*
136+ * @deprecated use {@link IllegalArgumentException}
137+ * Some plugins might catch : IllegalArgumentException & break
138+ */
139+ throw new ANTLRException (Messages .CronTabList_InvalidInput (line , e .getMessage ()), e );
131140 }
132141 }
133142
@@ -159,4 +168,4 @@ public static CronTabList create(@NonNull String format, Hash hash) {
159168 }
160169
161170 private static final Logger LOGGER = Logger .getLogger (CronTabList .class .getName ());
162- }
171+ }
0 commit comments