Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8148570

TzdbZoneRulesCompiler.java throws Null Pointer Exception While Compiling and building TZDB data file

XMLWordPrintable

    • b22
    • b106
    • generic
    • generic

      While Compiling the tzdata2016a the below NPE is thrown:
      java.lang.NullPointerException
                      at build.tools.tzdb.ZoneRules.writeRule(ZoneRules.java:235)
                      at build.tools.tzdb.ZoneRules.writeExternal(ZoneRules.java:186)
                      at build.tools.tzdb.TzdbZoneRulesCompiler.outputFile(TzdbZoneRulesCompiler.java:266)
                      at build.tools.tzdb.TzdbZoneRulesCompiler.compile(TzdbZoneRulesCompiler.java:217)
                      at build.tools.tzdb.TzdbZoneRulesCompiler.main(TzdbZoneRulesCompiler.java:89)
       
      It fails for the below Transition Rules:
      TransitionRule[Gap +03:30 to +04:30, MARCH 21 at 00:00 WALL, standard offset +03:30]
      TransitionRule[Overlap +04:30 to +03:30, SEPTEMBER 21 at 00:00 WALL, standard offset +03:30]
      which corresponds to:
      Rule Iran 2036 max - Mar 21 0:00 1:00 D
      Rule Iran 2036 max - Sep 21 0:00 0 S

       
      Obviously, ZoneRules.java:235 lacks null check for the DayOfWeek field of ZoneOffsetTransitionRule.
       
      As per the ZoneOffsetTransitionRule constructor definition:
      "@param dayOfWeek the required day-of-week, null if the month-day should not be changed"
       
      All other parameters are "not null", so need for the null check while reading and writing those.
       
      Solution: Before getting day-of-week value(an integer value from 1 to 7) from DayOfWeek field of ZoneOffsetTransitionRule a null check is necessary in ZoneRules.java line no. 235

            rpatil Ramanand Patil (Inactive)
            rpatil Ramanand Patil (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: