You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2022/06/21 02:59:59 UTC

[logging-log4j2] branch master updated (31e00849cc -> f7f715db99)

This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


    from 31e00849cc Correct compilation error
     new 9af27fcca0 Replace magic constants with named constants
     new 9cd8c17bdc Apply code cleanup suggestions
     new 44ba08a980 Weaken access modifiers in final class
     new 6f95002a62 Fix typos
     new f7f715db99 Throw IllegalArgumentException earlier

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../log4j/core/util/CronExpressionTest.java        |  54 +++++-----
 .../logging/log4j/core/util/CronExpression.java    | 120 ++++++++++-----------
 2 files changed, 87 insertions(+), 87 deletions(-)


[logging-log4j2] 01/05: Replace magic constants with named constants

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 9af27fcca00cdf172d8afdb9167fb69663fcfffd
Author: Matt Sicker <ma...@apache.org>
AuthorDate: Mon Jun 20 17:04:26 2022 -0500

    Replace magic constants with named constants
    
    Signed-off-by: Matt Sicker <ma...@apache.org>
---
 .../log4j/core/util/CronExpressionTest.java        | 54 +++++++++++-----------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/CronExpressionTest.java b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/CronExpressionTest.java
index 007a40ecec..a151de6b43 100644
--- a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/CronExpressionTest.java
+++ b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/CronExpressionTest.java
@@ -23,7 +23,7 @@ import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
 
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * Class Description goes here.
@@ -34,63 +34,63 @@ public class CronExpressionTest {
     @Test
     public void testDayOfMonth() throws Exception {
         final CronExpression parser = new CronExpression("0 */15,12 7-11,13-17 * * ?");
-        final Date date = new GregorianCalendar(2015, 11, 2).getTime();
+        final Date date = new GregorianCalendar(2015, Calendar.DECEMBER, 2).getTime();
         final Date fireDate = parser.getNextValidTimeAfter(date);
-        final Date expected = new GregorianCalendar(2015, 11, 2, 7, 0, 0).getTime();
+        final Date expected = new GregorianCalendar(2015, Calendar.DECEMBER, 2, 7, 0, 0).getTime();
         assertEquals(expected, fireDate, "Dates not equal.");
     }
 
     @Test
     public void testDayOfWeek() throws Exception {
         final CronExpression parser = new CronExpression("0 */15,12 7-11,13-17 ? * Fri");
-        final Date date = new GregorianCalendar(2015, 11, 2).getTime();
+        final Date date = new GregorianCalendar(2015, Calendar.DECEMBER, 2).getTime();
         final Date fireDate = parser.getNextValidTimeAfter(date);
-        final Date expected = new GregorianCalendar(2015, 11, 4, 7, 0, 0).getTime();
+        final Date expected = new GregorianCalendar(2015, Calendar.DECEMBER, 4, 7, 0, 0).getTime();
         assertEquals(expected, fireDate, "Dates not equal.");
     }
 
     @Test
     public void testNextMonth() throws Exception {
         final CronExpression parser = new CronExpression("0 */15,12 7-11,13-17 1 * ?");
-        final Date date = new GregorianCalendar(2015, 11, 2).getTime();
+        final Date date = new GregorianCalendar(2015, Calendar.DECEMBER, 2).getTime();
         final Date fireDate = parser.getNextValidTimeAfter(date);
-        final Date expected = new GregorianCalendar(2016, 0, 1, 7, 0, 0).getTime();
+        final Date expected = new GregorianCalendar(2016, Calendar.JANUARY, 1, 7, 0, 0).getTime();
         assertEquals(expected, fireDate, "Dates not equal.");
     }
 
     @Test
     public void testLastDayOfMonth() throws Exception {
         final CronExpression parser = new CronExpression("0 */15,12 7-11,13-17 L * ?");
-        final Date date = new GregorianCalendar(2015, 10, 2).getTime();
+        final Date date = new GregorianCalendar(2015, Calendar.NOVEMBER, 2).getTime();
         final Date fireDate = parser.getNextValidTimeAfter(date);
-        final Date expected = new GregorianCalendar(2015, 10, 30, 7, 0, 0).getTime();
+        final Date expected = new GregorianCalendar(2015, Calendar.NOVEMBER, 30, 7, 0, 0).getTime();
         assertEquals(expected, fireDate, "Dates not equal.");
     }
 
     @Test
     public void testNextDay() throws Exception {
         final CronExpression parser = new CronExpression("0 0 0 * * ?");
-        final Date date = new GregorianCalendar(2015, 10, 2).getTime();
+        final Date date = new GregorianCalendar(2015, Calendar.NOVEMBER, 2).getTime();
         final Date fireDate = parser.getNextValidTimeAfter(date);
-        final Date expected = new GregorianCalendar(2015, 10, 3, 0, 0, 0).getTime();
+        final Date expected = new GregorianCalendar(2015, Calendar.NOVEMBER, 3, 0, 0, 0).getTime();
         assertEquals(expected, fireDate, "Dates not equal.");
     }
 
     @Test
     public void testPrevFireTime1() throws Exception {
         final CronExpression parser = new CronExpression("0 */15,12 7-11,13-17 L * ?");
-        final Date date = new GregorianCalendar(2015, 10, 2).getTime();
+        final Date date = new GregorianCalendar(2015, Calendar.NOVEMBER, 2).getTime();
         final Date fireDate = parser.getPrevFireTime(date);
-        final Date expected = new GregorianCalendar(2015, 9, 31, 17, 45, 0).getTime();
+        final Date expected = new GregorianCalendar(2015, Calendar.OCTOBER, 31, 17, 45, 0).getTime();
         assertEquals(expected, fireDate, "Dates not equal.");
     }
 
     @Test
     public void testPrevFireTime2() throws Exception {
         final CronExpression parser = new CronExpression("0 0/5 14,18 * * ?");
-        final Date date = new GregorianCalendar(2015, 10, 2).getTime();
+        final Date date = new GregorianCalendar(2015, Calendar.NOVEMBER, 2).getTime();
         final Date fireDate = parser.getPrevFireTime(date);
-        final Date expected = new GregorianCalendar(2015, 10, 1, 18, 55, 0).getTime();
+        final Date expected = new GregorianCalendar(2015, Calendar.NOVEMBER, 1, 18, 55, 0).getTime();
         assertEquals(expected, fireDate, "Dates not equal.");
     }
 
@@ -100,9 +100,9 @@ public class CronExpressionTest {
     @Test
     public void testPrevFireTime3() throws Exception {
         final CronExpression parser = new CronExpression("0 35/10 * * * ?");
-        final Date date = new GregorianCalendar(2015, 10, 2).getTime();
+        final Date date = new GregorianCalendar(2015, Calendar.NOVEMBER, 2).getTime();
         final Date fireDate = parser.getPrevFireTime(date);
-        final Date expected = new GregorianCalendar(2015, 10, 1, 23, 55, 0).getTime();
+        final Date expected = new GregorianCalendar(2015, Calendar.NOVEMBER, 1, 23, 55, 0).getTime();
         assertEquals(expected, fireDate, "Dates not equal.");
     }
 
@@ -113,9 +113,9 @@ public class CronExpressionTest {
     @Test
     public void testPrevFireTimeTenFifteen() throws Exception {
         final CronExpression parser = new CronExpression("0 15 10 * * ? *");
-        final Date date = new GregorianCalendar(2015, 10, 2).getTime();
+        final Date date = new GregorianCalendar(2015, Calendar.NOVEMBER, 2).getTime();
         final Date fireDate = parser.getPrevFireTime(date);
-        final Date expected = new GregorianCalendar(2015, 10, 1, 10, 15, 0).getTime();
+        final Date expected = new GregorianCalendar(2015, Calendar.NOVEMBER, 1, 10, 15, 0).getTime();
         assertEquals(expected, fireDate, "Dates not equal.");
     }
 
@@ -125,9 +125,9 @@ public class CronExpressionTest {
     @Test
     public void testPrevFireTimeTwoPM() throws Exception {
         final CronExpression parser = new CronExpression("0 * 14 * * ?");
-        final Date date = new GregorianCalendar(2015, 10, 2).getTime();
+        final Date date = new GregorianCalendar(2015, Calendar.NOVEMBER, 2).getTime();
         final Date fireDate = parser.getPrevFireTime(date);
-        final Date expected = new GregorianCalendar(2015, 10, 1, 14, 59, 0).getTime();
+        final Date expected = new GregorianCalendar(2015, Calendar.NOVEMBER, 1, 14, 59, 0).getTime();
         assertEquals(expected, fireDate, "Dates not equal.");
     }
 
@@ -137,9 +137,9 @@ public class CronExpressionTest {
     @Test
     public void testPrevFireTimeMarch() throws Exception {
         final CronExpression parser = new CronExpression("0 10,44 14 ? 3 WED");
-        final Date date = new GregorianCalendar(2015, 10, 2).getTime();
+        final Date date = new GregorianCalendar(2015, Calendar.NOVEMBER, 2).getTime();
         final Date fireDate = parser.getPrevFireTime(date);
-        final Date expected = new GregorianCalendar(2015, 2, 25, 14, 44, 0).getTime();
+        final Date expected = new GregorianCalendar(2015, Calendar.MARCH, 25, 14, 44, 0).getTime();
         assertEquals(expected, fireDate, "Dates not equal.");
     }
 
@@ -149,9 +149,9 @@ public class CronExpressionTest {
     @Test
     public void testPrevFireTimeThirdFriday() throws Exception {
         final CronExpression parser = new CronExpression("0 15 10 ? * 6#3");
-        final Date date = new GregorianCalendar(2015, 10, 2).getTime();
+        final Date date = new GregorianCalendar(2015, Calendar.NOVEMBER, 2).getTime();
         final Date fireDate = parser.getPrevFireTime(date);
-        final Date expected = new GregorianCalendar(2015, 9, 16, 10, 15, 0).getTime();
+        final Date expected = new GregorianCalendar(2015, Calendar.OCTOBER, 16, 10, 15, 0).getTime();
         assertEquals(expected, fireDate, "Dates not equal.");
     }
 
@@ -162,14 +162,14 @@ public class CronExpressionTest {
     @Test
     public void testTimeBeforeMilliseconds() throws Exception {
         final CronExpression parser = new CronExpression("0 0 0 * * ?");
-        final GregorianCalendar cal = new GregorianCalendar(2015, 10, 2, 0, 0, 0);
+        final GregorianCalendar cal = new GregorianCalendar(2015, Calendar.NOVEMBER, 2, 0, 0, 0);
         cal.set(Calendar.MILLISECOND, 100);
         final Date date = cal.getTime();
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
         System.err.println(sdf.format(date));
         final Date fireDate = parser.getTimeBefore(date);
         System.err.println(sdf.format(fireDate));
-        final Date expected = new GregorianCalendar(2015, 10, 1, 0, 0, 0).getTime();
+        final Date expected = new GregorianCalendar(2015, Calendar.NOVEMBER, 1, 0, 0, 0).getTime();
         assertEquals(expected, fireDate, "Dates not equal.");
     }
 


[logging-log4j2] 04/05: Fix typos

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 6f95002a62afc19061c1970d078e10b00cf1e3b4
Author: Matt Sicker <ma...@apache.org>
AuthorDate: Mon Jun 20 17:25:46 2022 -0500

    Fix typos
    
    Signed-off-by: Matt Sicker <ma...@apache.org>
---
 .../main/java/org/apache/logging/log4j/core/util/CronExpression.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java
index 3902f3b7d7..c5423cf852 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java
@@ -583,14 +583,14 @@ public final class CronExpression {
             }
             if (type != DAY_OF_WEEK && type != DAY_OF_MONTH) {
                 throw new ParseException(
-                        "'?' can only be specfied for Day-of-Month or Day-of-Week.",
+                        "'?' can only be specified for Day-of-Month or Day-of-Week.",
                         i);
             }
             if (type == DAY_OF_WEEK && !lastdayOfMonth) {
                 final int val = daysOfMonth.last();
                 if (val == NO_SPEC_INT) {
                     throw new ParseException(
-                            "'?' can only be specfied for Day-of-Month -OR- Day-of-Week.",
+                            "'?' can only be specified for Day-of-Month -OR- Day-of-Week.",
                             i);
                 }
             }


[logging-log4j2] 02/05: Apply code cleanup suggestions

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 9cd8c17bdcf166d2d77fa390c634f80c67c65563
Author: Matt Sicker <ma...@apache.org>
AuthorDate: Mon Jun 20 17:21:19 2022 -0500

    Apply code cleanup suggestions
    
    - Magic constants
    - Redundant comparisons
    - Make inner class static
    
    Signed-off-by: Matt Sicker <ma...@apache.org>
---
 .../logging/log4j/core/util/CronExpression.java    | 26 +++++++++++-----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java
index c6816d8fcd..9eb670fd90 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java
@@ -254,7 +254,7 @@ public final class CronExpression {
     public static final int MAX_YEAR = Calendar.getInstance().get(Calendar.YEAR) + 100;
     public static final Calendar MIN_CAL = Calendar.getInstance();
     static {
-        MIN_CAL.set(1970, 0, 1);
+        MIN_CAL.set(1970, Calendar.JANUARY, 1);
     }
     public static final Date MIN_DATE = MIN_CAL.getTime();
 
@@ -991,28 +991,28 @@ public final class CronExpression {
             if (stopAt == -1) {
                 stopAt = 59;
             }
-            if (startAt == -1 || startAt == ALL_SPEC_INT) {
+            if (startAt == ALL_SPEC_INT) {
                 startAt = 0;
             }
         } else if (type == HOUR) {
             if (stopAt == -1) {
                 stopAt = 23;
             }
-            if (startAt == -1 || startAt == ALL_SPEC_INT) {
+            if (startAt == ALL_SPEC_INT) {
                 startAt = 0;
             }
         } else if (type == DAY_OF_MONTH) {
             if (stopAt == -1) {
                 stopAt = 31;
             }
-            if (startAt == -1 || startAt == ALL_SPEC_INT) {
+            if (startAt == ALL_SPEC_INT) {
                 startAt = 1;
             }
         } else if (type == MONTH) {
             if (stopAt == -1) {
                 stopAt = 12;
             }
-            if (startAt == -1 || startAt == ALL_SPEC_INT) {
+            if (startAt == ALL_SPEC_INT) {
                 startAt = 1;
             }
         } else if (type == DAY_OF_WEEK) {
@@ -1180,7 +1180,7 @@ public final class CronExpression {
 
             // get second.................................................
             st = seconds.tailSet(sec);
-            if (st != null && st.size() != 0) {
+            if (st.size() != 0) {
                 sec = st.first();
             } else {
                 sec = seconds.first();
@@ -1195,7 +1195,7 @@ public final class CronExpression {
 
             // get minute.................................................
             st = minutes.tailSet(min);
-            if (st != null && st.size() != 0) {
+            if (st.size() != 0) {
                 t = min;
                 min = st.first();
             } else {
@@ -1216,7 +1216,7 @@ public final class CronExpression {
 
             // get hour...................................................
             st = hours.tailSet(hr);
-            if (st != null && st.size() != 0) {
+            if (st.size() != 0) {
                 t = hr;
                 hr = st.first();
             } else {
@@ -1331,7 +1331,7 @@ public final class CronExpression {
                         day = daysOfMonth.first();
                         mon++;
                     }
-                } else if (st != null && st.size() != 0) {
+                } else if (st.size() != 0) {
                     t = day;
                     day = st.first();
                     // make sure we don't over-run a short month, such as february
@@ -1445,7 +1445,7 @@ public final class CronExpression {
                     int dow = daysOfWeek.first(); // desired
                     // d-o-w
                     st = daysOfWeek.tailSet(cDow);
-                    if (st != null && st.size() > 0) {
+                    if (st.size() > 0) {
                         dow = st.first();
                     }
 
@@ -1499,7 +1499,7 @@ public final class CronExpression {
 
             // get month...................................................
             st = months.tailSet(mon);
-            if (st != null && st.size() != 0) {
+            if (st.size() != 0) {
                 t = mon;
                 mon = st.first();
             } else {
@@ -1526,7 +1526,7 @@ public final class CronExpression {
 
             // get year...................................................
             st = years.tailSet(year);
-            if (st != null && st.size() != 0) {
+            if (st.size() != 0) {
                 t = year;
                 year = st.first();
             } else {
@@ -1678,7 +1678,7 @@ public final class CronExpression {
     }
 
 
-    private class ValueSet {
+    private static class ValueSet {
         public int value;
 
         public int pos;


[logging-log4j2] 05/05: Throw IllegalArgumentException earlier

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit f7f715db9950d9cca765c25e95a846d0f4329d71
Author: Matt Sicker <ma...@apache.org>
AuthorDate: Mon Jun 20 17:26:38 2022 -0500

    Throw IllegalArgumentException earlier
    
    This avoids some potential NullPointerExceptions according to static code analysis.
    
    Signed-off-by: Matt Sicker <ma...@apache.org>
---
 .../main/java/org/apache/logging/log4j/core/util/CronExpression.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java
index c5423cf852..39a95dd15b 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java
@@ -1098,7 +1098,7 @@ public final class CronExpression {
             case YEAR:
                 return years;
             default:
-                return null;
+                throw new IllegalArgumentException("Unexpected type: " + type);
         }
     }
 


[logging-log4j2] 03/05: Weaken access modifiers in final class

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 44ba08a9803e29afc3a0680c952ff79dc9ad7cfe
Author: Matt Sicker <ma...@apache.org>
AuthorDate: Mon Jun 20 17:22:11 2022 -0500

    Weaken access modifiers in final class
    
    Signed-off-by: Matt Sicker <ma...@apache.org>
---
 .../logging/log4j/core/util/CronExpression.java    | 88 +++++++++++-----------
 1 file changed, 44 insertions(+), 44 deletions(-)

diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java
index 9eb670fd90..3902f3b7d7 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/CronExpression.java
@@ -196,20 +196,20 @@ import java.util.TreeSet;
  */
 public final class CronExpression {
 
-    protected static final int SECOND = 0;
-    protected static final int MINUTE = 1;
-    protected static final int HOUR = 2;
-    protected static final int DAY_OF_MONTH = 3;
-    protected static final int MONTH = 4;
-    protected static final int DAY_OF_WEEK = 5;
-    protected static final int YEAR = 6;
-    protected static final int ALL_SPEC_INT = 99; // '*'
-    protected static final int NO_SPEC_INT = 98; // '?'
-    protected static final Integer ALL_SPEC = ALL_SPEC_INT;
-    protected static final Integer NO_SPEC = NO_SPEC_INT;
-
-    protected static final Map<String, Integer> monthMap = new HashMap<>(20);
-    protected static final Map<String, Integer> dayMap = new HashMap<>(60);
+    private static final int SECOND = 0;
+    private static final int MINUTE = 1;
+    private static final int HOUR = 2;
+    private static final int DAY_OF_MONTH = 3;
+    private static final int MONTH = 4;
+    private static final int DAY_OF_WEEK = 5;
+    private static final int YEAR = 6;
+    private static final int ALL_SPEC_INT = 99; // '*'
+    private static final int NO_SPEC_INT = 98; // '?'
+    private static final Integer ALL_SPEC = ALL_SPEC_INT;
+    private static final Integer NO_SPEC = NO_SPEC_INT;
+
+    private static final Map<String, Integer> monthMap = new HashMap<>(20);
+    private static final Map<String, Integer> dayMap = new HashMap<>(60);
 
     static {
         monthMap.put("JAN", 0);
@@ -236,20 +236,20 @@ public final class CronExpression {
 
     private final String cronExpression;
     private TimeZone timeZone = null;
-    protected transient TreeSet<Integer> seconds;
-    protected transient TreeSet<Integer> minutes;
-    protected transient TreeSet<Integer> hours;
-    protected transient TreeSet<Integer> daysOfMonth;
-    protected transient TreeSet<Integer> months;
-    protected transient TreeSet<Integer> daysOfWeek;
-    protected transient TreeSet<Integer> years;
-
-    protected transient boolean lastdayOfWeek = false;
-    protected transient int nthdayOfWeek = 0;
-    protected transient boolean lastdayOfMonth = false;
-    protected transient boolean nearestWeekday = false;
-    protected transient int lastdayOffset = 0;
-    protected transient boolean expressionParsed = false;
+    private transient TreeSet<Integer> seconds;
+    private transient TreeSet<Integer> minutes;
+    private transient TreeSet<Integer> hours;
+    private transient TreeSet<Integer> daysOfMonth;
+    private transient TreeSet<Integer> months;
+    private transient TreeSet<Integer> daysOfWeek;
+    private transient TreeSet<Integer> years;
+
+    private transient boolean lastdayOfWeek = false;
+    private transient int nthdayOfWeek = 0;
+    private transient boolean lastdayOfMonth = false;
+    private transient boolean nearestWeekday = false;
+    private transient int lastdayOffset = 0;
+    private transient boolean expressionParsed = false;
 
     public static final int MAX_YEAR = Calendar.getInstance().get(Calendar.YEAR) + 100;
     public static final Calendar MIN_CAL = Calendar.getInstance();
@@ -412,7 +412,7 @@ public final class CronExpression {
     //
     ////////////////////////////////////////////////////////////////////////////
 
-    protected void buildExpression(final String expression) throws ParseException {
+    private void buildExpression(final String expression) throws ParseException {
         expressionParsed = true;
 
         try {
@@ -498,7 +498,7 @@ public final class CronExpression {
         }
     }
 
-    protected int storeExpressionVals(final int pos, final String s, final int type)
+    private int storeExpressionVals(final int pos, final String s, final int type)
             throws ParseException {
 
         int incr = 0;
@@ -689,7 +689,7 @@ public final class CronExpression {
         return i;
     }
 
-    protected int checkNext(final int pos, final String s, final int val, final int type)
+    private int checkNext(final int pos, final String s, final int val, final int type)
             throws ParseException {
 
         int end = -1;
@@ -866,7 +866,7 @@ public final class CronExpression {
         return buf.toString();
     }
 
-    protected String getExpressionSetSummary(final java.util.Set<Integer> set) {
+    private String getExpressionSetSummary(final java.util.Set<Integer> set) {
 
         if (set.contains(NO_SPEC)) {
             return "?";
@@ -892,7 +892,7 @@ public final class CronExpression {
         return buf.toString();
     }
 
-    protected String getExpressionSetSummary(final java.util.ArrayList<Integer> list) {
+    private String getExpressionSetSummary(final java.util.ArrayList<Integer> list) {
 
         if (list.contains(NO_SPEC)) {
             return "?";
@@ -918,7 +918,7 @@ public final class CronExpression {
         return buf.toString();
     }
 
-    protected int skipWhiteSpace(int i, final String s) {
+    private int skipWhiteSpace(int i, final String s) {
         for (; i < s.length() && (s.charAt(i) == ' ' || s.charAt(i) == '\t'); i++) {
             // empty
         }
@@ -926,7 +926,7 @@ public final class CronExpression {
         return i;
     }
 
-    protected int findNextWhiteSpace(int i, final String s) {
+    private int findNextWhiteSpace(int i, final String s) {
         for (; i < s.length() && (s.charAt(i) != ' ' || s.charAt(i) != '\t'); i++) {
             // empty
         }
@@ -934,7 +934,7 @@ public final class CronExpression {
         return i;
     }
 
-    protected void addToSet(final int val, final int end, int incr, final int type)
+    private void addToSet(final int val, final int end, int incr, final int type)
             throws ParseException {
 
         final TreeSet<Integer> set = getSet(type);
@@ -1102,7 +1102,7 @@ public final class CronExpression {
         }
     }
 
-    protected ValueSet getValue(final int v, final String s, int i) {
+    private ValueSet getValue(final int v, final String s, int i) {
         char c = s.charAt(i);
         final StringBuilder s1 = new StringBuilder(String.valueOf(v));
         while (c >= '0' && c <= '9') {
@@ -1120,13 +1120,13 @@ public final class CronExpression {
         return val;
     }
 
-    protected int getNumericValue(final String s, final int i) {
+    private int getNumericValue(final String s, final int i) {
         final int endOfVal = findNextWhiteSpace(i, s);
         final String val = s.substring(i, endOfVal);
         return Integer.parseInt(val);
     }
 
-    protected int getMonthNumber(final String s) {
+    private int getMonthNumber(final String s) {
         final Integer integer = monthMap.get(s);
 
         if (integer == null) {
@@ -1136,7 +1136,7 @@ public final class CronExpression {
         return integer;
     }
 
-    protected int getDayOfWeekNumber(final String s) {
+    private int getDayOfWeekNumber(final String s) {
         final Integer integer = dayMap.get(s);
 
         if (integer == null) {
@@ -1559,14 +1559,14 @@ public final class CronExpression {
      * @param cal  the calendar to operate on
      * @param hour the hour to set
      */
-    protected void setCalendarHour(final Calendar cal, final int hour) {
+    private void setCalendarHour(final Calendar cal, final int hour) {
         cal.set(java.util.Calendar.HOUR_OF_DAY, hour);
         if (cal.get(java.util.Calendar.HOUR_OF_DAY) != hour && hour != 24) {
             cal.set(java.util.Calendar.HOUR_OF_DAY, hour + 1);
         }
     }
 
-    protected Date getTimeBefore(final Date targetDate) {
+    Date getTimeBefore(final Date targetDate) {
         final Calendar cl = Calendar.getInstance(getTimeZone());
 
         // CronTrigger does not deal with milliseconds, so truncate target
@@ -1640,11 +1640,11 @@ public final class CronExpression {
         return null;
     }
 
-    protected boolean isLeapYear(final int year) {
+    private boolean isLeapYear(final int year) {
         return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0));
     }
 
-    protected int getLastDayOfMonth(final int monthNum, final int year) {
+    private int getLastDayOfMonth(final int monthNum, final int year) {
 
         switch (monthNum) {
             case 1: