[FIXED JENKINS-20951] XmlFile.read/unmarshal needs to catch general XStreamException so as to include CannotResolveClassException, thrown when a TopLevelItem provided by a plugin is unloadable.

This commit is contained in:
Jesse Glick committed 2013-12-10 18:50:33 -05:00
1 parent fcdf749912
commit a58e198f8a
6 files changed
+62 -8

No files matched your search

+3 -7
View File
@@ -24,7 +24,7 @@
package hudson;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.ConversionException;
import com.thoughtworks.xstream.XStreamException;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.StreamException;
@@ -140,9 +140,7 @@ public final class XmlFile {
InputStream in = new BufferedInputStream(new FileInputStream(file));
try {
return xs.fromXML(in);
} catch(StreamException e) {
throw new IOException("Unable to read "+file,e);
} catch(ConversionException e) {
} catch (XStreamException e) {
throw new IOException("Unable to read "+file,e);
} catch(Error e) {// mostly reflection errors
throw new IOException("Unable to read "+file,e);
@@ -163,9 +161,7 @@ public final class XmlFile {
try {
// TODO: expose XStream the driver from XStream
return xs.unmarshal(DEFAULT_DRIVER.createReader(in), o);
} catch (StreamException e) {
throw new IOException("Unable to read "+file,e);
} catch(ConversionException e) {
} catch (XStreamException e) {
throw new IOException("Unable to read "+file,e);
} catch(Error e) {// mostly reflection errors
throw new IOException("Unable to read "+file,e);