From 208f8f1ed8eed82f64a0f11c7271e21958b6a4f6 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 10 Apr 2014 13:48:01 +0000 Subject: [PATCH] * make sure to include url to malformed xml in error log --- .../filebot/web/AbstractCachedResource.java | 10 +++++----- .../net/sourceforge/filebot/web/CachedXmlResource.java | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/source/net/sourceforge/filebot/web/AbstractCachedResource.java b/source/net/sourceforge/filebot/web/AbstractCachedResource.java index b37d02ba..d070c021 100644 --- a/source/net/sourceforge/filebot/web/AbstractCachedResource.java +++ b/source/net/sourceforge/filebot/web/AbstractCachedResource.java @@ -18,12 +18,12 @@ public abstract class AbstractCachedResource { public static final long ONE_WEEK = 7 * ONE_DAY; public static final long ONE_MONTH = 30 * ONE_DAY; - private String resource; - private Class type; - private long expirationTime; + protected final String resource; + protected final Class type; + protected final long expirationTime; - private int retryCountLimit; - private long retryWaitTime; + protected final int retryCountLimit; + protected final long retryWaitTime; public AbstractCachedResource(String resource, Class type, long expirationTime, int retryCountLimit, long retryWaitTime) { this.resource = resource; diff --git a/source/net/sourceforge/filebot/web/CachedXmlResource.java b/source/net/sourceforge/filebot/web/CachedXmlResource.java index f71cba81..bf871c37 100644 --- a/source/net/sourceforge/filebot/web/CachedXmlResource.java +++ b/source/net/sourceforge/filebot/web/CachedXmlResource.java @@ -49,7 +49,11 @@ public class CachedXmlResource extends AbstractCachedResource { 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; }