src/net/fortuna/ical4j/model/TimeZoneRegistryImpl.java

changeset 4
45d57ecba757
parent 0
fb9019fb1bf7
child 5
e0e108e77052
equal deleted inserted replaced
0:8c51ffbebeb9 1:8f09883c4f39
71 private static final Map DEFAULT_TIMEZONES = new ConcurrentHashMap(); 71 private static final Map DEFAULT_TIMEZONES = new ConcurrentHashMap();
72 72
73 private static final Properties ALIASES = new Properties(); 73 private static final Properties ALIASES = new Properties();
74 static { 74 static {
75 try { 75 try {
76 //ALIASES.load(ResourceLoader.getResourceAsStream("net/fortuna/ical4j/model/tz.alias")); 76 ALIASES.load(ResourceLoader.getResourceAsStream("net/fortuna/ical4j/model/tz.alias"));
77 ALIASES.load(TimeZoneRegistryImpl.class.getResourceAsStream("tz.alias")); 77 }
78 }
79 catch (IOException ioe) { 78 catch (IOException ioe) {
80 LogFactory.getLog(TimeZoneRegistryImpl.class).warn( 79 LogFactory.getLog(TimeZoneRegistryImpl.class).warn(
81 "Error loading timezone aliases: " + ioe.getMessage()); 80 "Error loading timezone aliases: " + ioe.getMessage());
81 }
82 try {
83 ALIASES.load(ResourceLoader.getResourceAsStream("tz.alias"));
84 }
85 catch (Exception e) {
86 LogFactory.getLog(TimeZoneRegistryImpl.class).debug(
87 "Error loading custom timezone aliases: " + e.getMessage());
82 } 88 }
83 } 89 }
84 90
85 private Map timezones; 91 private Map timezones;
86 92
178 184
179 /** 185 /**
180 * Loads an existing VTimeZone from the classpath corresponding to the specified Java timezone. 186 * Loads an existing VTimeZone from the classpath corresponding to the specified Java timezone.
181 */ 187 */
182 private VTimeZone loadVTimeZone(final String id) throws IOException, ParserException { 188 private VTimeZone loadVTimeZone(final String id) throws IOException, ParserException {
183 //final URL resource = ResourceLoader.getResource(resourcePrefix + id + ".ics"); 189 final URL resource = ResourceLoader.getResource(resourcePrefix + id + ".ics");
184 final URL resource = TimeZoneRegistryImpl.class.getClassLoader().getResource(resourcePrefix + id + ".ics");
185 if (resource != null) { 190 if (resource != null) {
186 final CalendarBuilder builder = new CalendarBuilder(); 191 final CalendarBuilder builder = new CalendarBuilder();
187 final Calendar calendar = builder.build(resource.openStream()); 192 final Calendar calendar = builder.build(resource.openStream());
188 final VTimeZone vTimeZone = (VTimeZone) calendar.getComponent(Component.VTIMEZONE); 193 final VTimeZone vTimeZone = (VTimeZone) calendar.getComponent(Component.VTIMEZONE);
189 // load any available updates for the timezone.. can be explicility disabled via configuration 194 // load any available updates for the timezone.. can be explicility disabled via configuration

mercurial