diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/api/impl/s2j/SchemaCompilerImpl.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/api/impl/s2j/SchemaCompilerImpl.java index 568ee86cd..eee113317 100644 --- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/api/impl/s2j/SchemaCompilerImpl.java +++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/api/impl/s2j/SchemaCompilerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -40,8 +40,6 @@ import com.sun.xml.bind.unmarshaller.DOMScanner; import com.sun.xml.bind.v2.util.XmlFactory; import com.sun.xml.xsom.XSSchemaSet; -import java.nio.file.Files; -import java.nio.file.Paths; import org.w3c.dom.Element; import org.w3c.dom.ls.LSInput; @@ -215,11 +213,9 @@ public LSInput resolveResource(String type, String namespaceURI, String publicId // XSOM passes the namespace URI to the publicID parameter. // we do the same here . InputSource is = opts.entityResolver.resolveEntity(namespaceURI, systemId == null ? "" : systemId); - return isExists(is) ? new LSInputSAXWrapper(is) : null; - } catch (SAXException e) { - // TODO: is this sufficient? - return null; - } catch (IOException e) { + if (is == null) return null; + return new LSInputSAXWrapper(is); + } catch (SAXException | IOException e) { // TODO: is this sufficient? return null; } @@ -293,21 +289,6 @@ public void fatalError(SAXParseException exception) { errorListener.fatalError(exception); } - private static boolean isExists(InputSource is) { - if (is == null) { - return false; - } - try { - URI uri = new URI(is.getSystemId()); - if ("file".equals(uri.getScheme())) { - return Files.exists(Paths.get(uri)); - } - } catch (URISyntaxException ex) { - //ignore, let it be handled by parser as is - } - return true; - } - /** * We use JAXP 1.3 to do a schema correctness check, but we know * it doesn't always work. So in case some people hit the problem, diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/internalizer/DOMForest.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/internalizer/DOMForest.java index bf53e0deb..615d11179 100644 --- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/internalizer/DOMForest.java +++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/internalizer/DOMForest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -43,10 +43,6 @@ import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Paths; import java.util.*; import static com.sun.xml.bind.v2.util.XmlFactory.allowExternalAccess; @@ -267,26 +263,13 @@ public Document parse( String systemId, boolean root ) throws SAXException, IOEx InputSource is=null; // allow entity resolver to find the actual byte stream. - if( entityResolver!=null ) { - is = entityResolver.resolveEntity(null,systemId); + if (entityResolver != null) { + is = entityResolver.resolveEntity(null, systemId); } if (is == null) { is = new InputSource(systemId); - } else { - try { - URI uri = new URI(is.getSystemId()); - if ("file".equals(uri.getScheme())) { - if (!Files.exists(Paths.get(uri))) { - //resolved file does not exist, warn and let's continue with original systemId - errorReceiver.warning(null, Messages.format( - Messages.DOMFOREST_CATALOG_INVALID_ENTRY, is.getSystemId(), systemId)); - is = new InputSource(systemId); - } - } - } catch (URISyntaxException ex) { - //ignore, let it be handled by parser as is - } } + // but we still use the original system Id as the key. return parse( systemId, is, root ); } diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/internalizer/Messages.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/internalizer/Messages.java index b75e82c3c..c7f2ac0a6 100644 --- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/internalizer/Messages.java +++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/internalizer/Messages.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -66,7 +66,5 @@ static String format( String property, Object... args ) { "ERR_GENERAL_SCHEMA_CORRECTNESS_ERROR"; static final String DOMFOREST_INPUTSOURCE_IOEXCEPTION = // arg:2 "DOMFOREST_INPUTSOURCE_IOEXCEPTION"; - static final String DOMFOREST_CATALOG_INVALID_ENTRY = // arg:2 - "DOMFOREST_CATALOG_INVALID_ENTRY"; } diff --git a/jaxb-ri/xjc/src/main/resources/com/sun/tools/xjc/reader/internalizer/MessageBundle.properties b/jaxb-ri/xjc/src/main/resources/com/sun/tools/xjc/reader/internalizer/MessageBundle.properties index f50c4d2f7..9655d1c39 100644 --- a/jaxb-ri/xjc/src/main/resources/com/sun/tools/xjc/reader/internalizer/MessageBundle.properties +++ b/jaxb-ri/xjc/src/main/resources/com/sun/tools/xjc/reader/internalizer/MessageBundle.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved. # # This program and the accompanying materials are made available under the # terms of the Eclipse Distribution License v. 1.0, which is available at @@ -88,6 +88,3 @@ ERR_FILENAME_IS_NOT_URI = \ DOMFOREST_INPUTSOURCE_IOEXCEPTION = \ IOException thrown when processing "{0}". Exception: {1}. - -DOMFOREST_CATALOG_INVALID_ENTRY = \ - Catalog points to non-existent resource: "{0}". Trying to reach "{1}" directly.