* make sure to include url to malformed xml in error log

This commit is contained in:
Reinhard Pointner 2014-04-10 13:48:01 +00:00
parent 91bf489c0c
commit 208f8f1ed8
2 changed files with 10 additions and 6 deletions

View File

@ -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_MONTH = 30 * ONE_DAY;
private String resource;
private Class<T> type;
private long expirationTime;
protected final String resource;
protected final Class<T> type;
protected final long expirationTime;
private int retryCountLimit;
private long retryWaitTime;
protected final int retryCountLimit;
protected final long retryWaitTime;
public AbstractCachedResource(String resource, Class<T> type, long expirationTime, int retryCountLimit, long retryWaitTime) {
this.resource = resource;

View File

@ -49,7 +49,11 @@ public class CachedXmlResource extends AbstractCachedResource<String, String> {
XMLReader reader = sax.newSAXParser().getXMLReader();
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;
}