The following document contains the results of PMD's CPD 4.1.
| File | Line |
|---|---|
| org\apache\commons\resources\impl\JDBCResources.java | 136 |
| org\apache\commons\resources\impl\PropertyResources.java | 112 |
String name = baseUrl + getLocaleSuffix(locale) + ".properties";
InputStream stream = null;
try {
// Open an input stream to the URL for this locale (if any)
if (getLog().isTraceEnabled()) {
getLog().trace("Absolute URL is '" + name + "'");
}
URL url = new URL(name);
stream = url.openStream();
// Parse the input stream and populate the name-value mappings map
if (getLog().isTraceEnabled()) {
getLog().trace("Parsing input resource");
}
props.load(stream);
} catch (FileNotFoundException e) {
// Log and swallow this exception
if (getLog().isDebugEnabled()) {
getLog().debug("No resources for locale '" + locale +
"' from base '" + baseUrl + "'");
}
props.clear();
} catch (IOException e) {
getLog().warn("IOException loading locale '" + locale +
"' from base '" + baseUrl + "'", e);
props.clear();
} finally {
// Close the input stream that was opened earlier
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
getLog().error("Error closing stream.", e);
}
stream = null;
}
}
| |
| File | Line |
|---|---|
| org\apache\commons\resources\impl\PropertyResources.java | 130 |
| org\apache\commons\resources\impl\WebappPropertyResources.java | 165 |
} catch (FileNotFoundException e) {
// Log and swallow this exception
if (getLog().isDebugEnabled()) {
getLog().debug("No resources for locale '" + locale +
"' from base '" + baseUrl + "'");
}
props.clear();
} catch (IOException e) {
getLog().warn("IOException loading locale '" + locale +
"' from base '" + baseUrl + "'", e);
props.clear();
} finally {
// Close the input stream that was opened earlier
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
getLog().error("Error closing stream.", e);
}
stream = null;
}
}
// Return the populated (or empty) properties
return (props);
}
/**
* Accessor method for Log instance.
*
* The Log instance variable is transient and
* accessing it through this method ensures it
* is re-initialized when this instance is
* de-serialized.
*
* @return The Log instance.
*/
private Log getLog() {
if (log == null) {
log = LogFactory.getLog(WebappPropertyResources.class);
| |
| File | Line |
|---|---|
| org\apache\commons\resources\impl\WebappXMLResources.java | 163 |
| org\apache\commons\resources\impl\XMLResources.java | 156 |
} catch (FileNotFoundException e) {
// Log and swallow this exception
if (getLog().isDebugEnabled()) {
getLog().debug("No resources for locale '" + locale +
"' from base '" + baseUrl + "'");
}
map.clear();
} catch (IOException e) {
// Log and swallow this exception
getLog().warn("IOException loading locale '" + locale +
"' from base '" + baseUrl + "'", e);
map.clear();
} catch (SAXException e) {
// Log and swallow this exception
getLog().warn("SAXException loading locale '" + locale +
"' from base '" + baseUrl + "'", e);
map.clear();
} finally {
// Close the input stream that was opened earlier
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
| |
| File | Line |
|---|---|
| org\apache\commons\resources\impl\WebappXMLResources.java | 142 |
| org\apache\commons\resources\impl\XMLResources.java | 137 |
if (getLog().isTraceEnabled()) {
getLog().trace("Creating Digester instance");
}
Digester digester = new Digester();
digester.setNamespaceAware(false);
digester.setValidating(false);
digester.push(map);
digester.addCallMethod("resources/resource", "put", 2,
new String[] { "java.lang.Object",
"java.lang.Object" });
digester.addCallParam("resources/resource", 0, "id");
digester.addCallParam("resources/resource", 1);
// Parse the input stream and populate the name-value mappings map
if (getLog().isTraceEnabled()) {
getLog().trace("Parsing input resource");
}
digester.parse(stream);
} catch (FileNotFoundException e) {
| |
| File | Line |
|---|---|
| org\apache\commons\resources\impl\JDBCResources.java | 154 |
| org\apache\commons\resources\impl\WebappPropertyResources.java | 165 |
} catch (FileNotFoundException e) {
// Log and swallow this exception
if (getLog().isDebugEnabled()) {
getLog().debug("No resources for locale '" + locale +
"' from base '" + baseUrl + "'");
}
props.clear();
} catch (IOException e) {
getLog().warn("IOException loading locale '" + locale +
"' from base '" + baseUrl + "'", e);
props.clear();
} finally {
// Close the input stream that was opened earlier
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
getLog().error("Error closing stream.", e);
}
stream = null;
}
}
| |