--- old/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/parser/ParserContext.java 2015-05-26 14:06:30.000000000 +0200 +++ new/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/parser/ParserContext.java 2015-05-26 14:06:29.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,8 @@ import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; +import java.io.IOException; +import java.io.InputStream; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -81,20 +83,18 @@ this.owner = owner; this.parser = parser; - try { - parse(new InputSource(ParserContext.class.getResource("datatypes.xsd").toExternalForm())); + try (InputStream is = ParserContext.class.getResourceAsStream("datatypes.xsd")) { + InputSource source = new InputSource(is); + source.setSystemId("datatypes.xsd"); + parse(source); SchemaImpl xs = (SchemaImpl) - schemaSet.getSchema("http://www.w3.org/2001/XMLSchema"); + schemaSet.getSchema("http://www.w3.org/2001/XMLSchema"); xs.addSimpleType(schemaSet.anySimpleType,true); xs.addComplexType(schemaSet.anyType,true); - } catch( SAXException e ) { + } catch( SAXException | IOException e ) { // this must be a bug of XSOM - if(e.getException()!=null) - e.getException().printStackTrace(); - else - e.printStackTrace(); - throw new InternalError(); + throw new InternalError(e.getMessage()); } }