|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2012 the original author or authors. |
| 2 | + * Copyright 2002-2013 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
33 | 33 | *
|
34 | 34 | * <p>Allows for reading from any Reader and writing to any Writer, for example
|
35 | 35 | * to specify a charset for a properties file. This is a capability that standard
|
36 |
| - * {@code java.util.Properties} unfortunately lacks up until JDK 1.5: |
37 |
| - * You can only load files using the ISO-8859-1 charset there. |
| 36 | + * {@code java.util.Properties} unfortunately lacked up until JDK 1.5: |
| 37 | + * You were only able to load files using the ISO-8859-1 charset there. |
38 | 38 | *
|
39 | 39 | * <p>Loading from and storing to a stream delegates to {@code Properties.load}
|
40 | 40 | * and {@code Properties.store}, respectively, to be fully compatible with
|
|
49 | 49 | * an encoding for a Reader/Writer (like ReloadableResourceBundleMessageSource's
|
50 | 50 | * "defaultEncoding" and "fileEncodings" properties).
|
51 | 51 | *
|
52 |
| - * <p>As of Spring 1.2.2, this implementation also supports properties XML files, |
53 |
| - * through the {@code loadFromXml} and {@code storeToXml} methods. |
54 |
| - * The default implementations delegate to JDK 1.5's corresponding methods, |
55 |
| - * throwing an exception if running on an older JDK. Those implementations |
56 |
| - * could be subclassed to apply custom XML handling on JDK 1.4, for example. |
57 |
| - * |
58 | 52 | * @author Juergen Hoeller
|
59 | 53 | * @since 10.03.2004
|
60 | 54 | * @see java.util.Properties
|
61 | 55 | * @see java.util.Properties#load
|
62 | 56 | * @see java.util.Properties#store
|
63 |
| - * @see org.springframework.context.support.ReloadableResourceBundleMessageSource#setPropertiesPersister |
64 |
| - * @see org.springframework.context.support.ReloadableResourceBundleMessageSource#setDefaultEncoding |
65 |
| - * @see org.springframework.context.support.ReloadableResourceBundleMessageSource#setFileEncodings |
66 | 57 | */
|
67 | 58 | public class DefaultPropertiesPersister implements PropertiesPersister {
|
68 | 59 |
|
@@ -228,30 +219,15 @@ protected String escape(String str, boolean isKey) {
|
228 | 219 |
|
229 | 220 |
|
230 | 221 | public void loadFromXml(Properties props, InputStream is) throws IOException {
|
231 |
| - try { |
232 |
| - props.loadFromXML(is); |
233 |
| - } |
234 |
| - catch (NoSuchMethodError err) { |
235 |
| - throw new IOException("Cannot load properties XML file - not running on JDK 1.5+: " + err.getMessage()); |
236 |
| - } |
| 222 | + props.loadFromXML(is); |
237 | 223 | }
|
238 | 224 |
|
239 | 225 | public void storeToXml(Properties props, OutputStream os, String header) throws IOException {
|
240 |
| - try { |
241 |
| - props.storeToXML(os, header); |
242 |
| - } |
243 |
| - catch (NoSuchMethodError err) { |
244 |
| - throw new IOException("Cannot store properties XML file - not running on JDK 1.5+: " + err.getMessage()); |
245 |
| - } |
| 226 | + props.storeToXML(os, header); |
246 | 227 | }
|
247 | 228 |
|
248 | 229 | public void storeToXml(Properties props, OutputStream os, String header, String encoding) throws IOException {
|
249 |
| - try { |
250 |
| - props.storeToXML(os, header, encoding); |
251 |
| - } |
252 |
| - catch (NoSuchMethodError err) { |
253 |
| - throw new IOException("Cannot store properties XML file - not running on JDK 1.5+: " + err.getMessage()); |
254 |
| - } |
| 230 | + props.storeToXML(os, header, encoding); |
255 | 231 | }
|
256 | 232 |
|
257 | 233 | }
|
0 commit comments