Skip to content

Commit e5d9378

Browse files
committed
Removed pre-JDK-1.5 checks
1 parent 049169d commit e5d9378

File tree

1 file changed

+6
-30
lines changed

1 file changed

+6
-30
lines changed

spring-core/src/main/java/org/springframework/util/DefaultPropertiesPersister.java

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,8 +33,8 @@
3333
*
3434
* <p>Allows for reading from any Reader and writing to any Writer, for example
3535
* 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.
3838
*
3939
* <p>Loading from and storing to a stream delegates to {@code Properties.load}
4040
* and {@code Properties.store}, respectively, to be fully compatible with
@@ -49,20 +49,11 @@
4949
* an encoding for a Reader/Writer (like ReloadableResourceBundleMessageSource's
5050
* "defaultEncoding" and "fileEncodings" properties).
5151
*
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-
*
5852
* @author Juergen Hoeller
5953
* @since 10.03.2004
6054
* @see java.util.Properties
6155
* @see java.util.Properties#load
6256
* @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
6657
*/
6758
public class DefaultPropertiesPersister implements PropertiesPersister {
6859

@@ -228,30 +219,15 @@ protected String escape(String str, boolean isKey) {
228219

229220

230221
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);
237223
}
238224

239225
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);
246227
}
247228

248229
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);
255231
}
256232

257233
}

0 commit comments

Comments
 (0)