stanfordnlp/CoreNLP · error · RuntimeException

Cannot create set of holidays.

Error message

Cannot create set of holidays.

What it means

getAllHolidays uses reflection to invoke every getter returning List<de.jollyday.config.Holiday> on a jollyday configuration object. If any reflective invocation fails (IllegalAccessException, InvocationTargetException from a getter, etc.), it wraps the failure in a RuntimeException with this message and the cause attached.

Solutions

  1. Read the wrapped cause (e.getCause()) to find the actual failing getter and address its root problem.
  2. Align the jollyday library version with the one Stanford CoreNLP's JollyDayHolidays was compiled against.
  3. Validate the holiday XML configuration loads correctly (the getters often fail because of lazily-parsed bad data).

Example fix

// before
// jollyday 0.4.x used with newer CoreNLP
dependencies { compile 'de.jollyday:jollyday:0.4.9' }
// after
// use the version matching the CoreNLP release
dependencies { compile 'de.jollyday:jollyday:0.5.8' }
Defensive patterns

Strategy: try-catch

Validate before calling

try {
  Class.forName("de.jollyday.config.Configuration");
} catch (ClassNotFoundException e) {
  throw new IllegalStateException("jollyday dependency missing from classpath");
}

Try / catch

try {
  JollyDayHolidays.getAllHolidays(config, set);
} catch (RuntimeException e) {
  Throwable root = e;
  while (root.getCause() != null) root = root.getCause();
  logger.severe("Holiday getter failed: " + root);
  throw e;
}

Prevention

When it happens

Trigger: Calling JollyDayHolidays.getAllHolidays(Configuration, Set) on a Configuration whose getter methods throw when invoked, or when a jollyday version change alters the config classes so getters fail or the cast to List<Holiday> fails.

Common situations: Upgrading/degrading the de.jollyday dependency so Configuration getter signatures change; security managers or module access blocking reflective invocation; a corrupted custom Configuration implementation.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/5be4236bb4acfb9d. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/time/JollyDayHolidays.java:121

        map.add(jh.label, jh);
      }
    }
    return map;
  }

  public CollectionValuedMap<String, JollyHoliday> getAllHolidaysCVMap(Configuration config) {
    Set<de.jollyday.config.Holiday> s = getAllHolidays(config);
    return getAllHolidaysCVMap(s);
  }

  public static void getAllHolidays(Holidays holidays, Set<de.jollyday.config.Holiday> allHolidays) {
    for (Method m : holidays.getClass().getMethods()) {
      if (isGetter(m) && m.getReturnType() == List.class) {
        try {
          List<de.jollyday.config.Holiday> l = (List<de.jollyday.config.Holiday>) m.invoke(holidays);
          allHolidays.addAll(l);
        } catch (Exception e) {
          throw new RuntimeException("Cannot create set of holidays.", e);
        }
      }
    }
  }

  public static void getAllHolidays(Configuration config, Set<de.jollyday.config.Holiday> allHolidays) {
    Holidays holidays = config.getHolidays();
    getAllHolidays(holidays, allHolidays);
    List<Configuration> subConfigs = config.getSubConfigurations();
    for (Configuration c:subConfigs) {
      getAllHolidays(c, allHolidays);
    }
  }

  public static Set<de.jollyday.config.Holiday> getAllHolidays(Configuration config) {
    Set<de.jollyday.config.Holiday> allHolidays = Generics.newHashSet();
    getAllHolidays(config, allHolidays);
    return allHolidays;

View on GitHub (pinned to 1b7edd19c4)