* make sure to include url to malformed xml in error log
This commit is contained in:
parent
91bf489c0c
commit
208f8f1ed8
|
@ -18,12 +18,12 @@ public abstract class AbstractCachedResource<R, T extends Serializable> {
|
||||||
public static final long ONE_WEEK = 7 * ONE_DAY;
|
public static final long ONE_WEEK = 7 * ONE_DAY;
|
||||||
public static final long ONE_MONTH = 30 * ONE_DAY;
|
public static final long ONE_MONTH = 30 * ONE_DAY;
|
||||||
|
|
||||||
private String resource;
|
protected final String resource;
|
||||||
private Class<T> type;
|
protected final Class<T> type;
|
||||||
private long expirationTime;
|
protected final long expirationTime;
|
||||||
|
|
||||||
private int retryCountLimit;
|
protected final int retryCountLimit;
|
||||||
private long retryWaitTime;
|
protected final long retryWaitTime;
|
||||||
|
|
||||||
public AbstractCachedResource(String resource, Class<T> type, long expirationTime, int retryCountLimit, long retryWaitTime) {
|
public AbstractCachedResource(String resource, Class<T> type, long expirationTime, int retryCountLimit, long retryWaitTime) {
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
|
|
|
@ -49,7 +49,11 @@ public class CachedXmlResource extends AbstractCachedResource<String, String> {
|
||||||
|
|
||||||
XMLReader reader = sax.newSAXParser().getXMLReader();
|
XMLReader reader = sax.newSAXParser().getXMLReader();
|
||||||
reader.setErrorHandler(new DefaultHandler()); // unwind on error
|
reader.setErrorHandler(new DefaultHandler()); // unwind on error
|
||||||
reader.parse(new InputSource(new StringReader(data)));
|
try {
|
||||||
|
reader.parse(new InputSource(new StringReader(data)));
|
||||||
|
} catch (SAXException e) {
|
||||||
|
throw new IOException("Malformed XML: " + getResourceLocation(resource), e);
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue