Skip to content

Commit

Permalink
the last resort fallback needs to end in the current runtime
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Sep 6, 2023
1 parent 9203195 commit fb91140
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -12,6 +12,7 @@ target/
*.ipr
*.iws
.idea
.DS_Store

*.log
*.tlog
Expand Down
10 changes: 10 additions & 0 deletions jaxws-ri/docs/release-documentation/src/main/docbook/changelog.xml
Expand Up @@ -25,6 +25,16 @@
<title>Changelog</title>

<itemizedlist>
<listitem>
<para>4.0.2</para>

<itemizedlist>
<listitem>
<para>Replaces the last resort fallback to Java SE provided runtime by the fallback to the current WS runtime</para>
</listitem>
</itemizedlist>
</listitem>

<listitem>
<para>4.0.1</para>

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022 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
Expand Down Expand Up @@ -28,13 +28,10 @@
import jakarta.xml.ws.WebServiceException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.util.logging.Level;

/**
Expand All @@ -51,7 +48,7 @@
// TODO Move the logic of this class directly into MetroConfig class.
class MetroConfigLoader {

private static final String JAXWS_TUBES_JDK_XML_RESOURCE = "jaxws-tubes-default.xml";
private static final String JAXWS_TUBES_DEFAULT_XML_RESOURCE = "jaxws-tubes-default.xml";
private static final Logger LOGGER = Logger.getLogger(MetroConfigLoader.class);

private MetroConfigName defaultTubesConfigNames;
Expand Down Expand Up @@ -244,12 +241,18 @@ private static InputStream getConfigInputStream(URL resourceUrl) throws IOExcept
if (resourceUrl != null) {
is = resourceUrl.openStream();
} else {
is = MetroConfigLoader.class.getResourceAsStream(JAXWS_TUBES_JDK_XML_RESOURCE);
//the only case this can happen is when some extension does not provide
//a resource which it also defines; in pre-SE11 env, this would fallback
//to the runtime included in the JDK, in SE11+, we must be the fallback
URL resUrl = MetroConfigLoader.class.getResource(JAXWS_TUBES_DEFAULT_XML_RESOURCE);
LOGGER.config(TubelineassemblyMessages.MASM_0021_BUILTIN_CFG_FILE(JAXWS_TUBES_DEFAULT_XML_RESOURCE, resUrl));

if (is == null)
if (resUrl == null) {
throw LOGGER.logSevereException(
new IllegalStateException(
TubelineassemblyMessages.MASM_0001_DEFAULT_CFG_FILE_NOT_FOUND(JAXWS_TUBES_JDK_XML_RESOURCE)));
TubelineassemblyMessages.MASM_0001_DEFAULT_CFG_FILE_NOT_FOUND(JAXWS_TUBES_DEFAULT_XML_RESOURCE)));
}
is = resUrl.openStream();
}

return is;
Expand Down
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 1997, 2022 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
Expand All @@ -15,6 +15,9 @@
Document : jaxws-tubes-default.xml
Author : Marek Potociar
Description: The default JAX-WS tubes configuration file.
see also com.sun.xml.ws.assembler.MetroConfigLoader
and com/sun/xml/ws/assembler/jaxws-tubes-default.xml
-->

<metro xmlns='http://java.sun.com/xml/ns/metro/config' version="1.0">
Expand Down
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 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
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: BSD-3-Clause
-->

<!--
A copy of /META-INF/jaxws-tubes-default.xml serving as a hard fallback
as it used to be when this was included in SE (up to SE 10)
-->

<metro xmlns='http://java.sun.com/xml/ns/metro/config' version="1.0">
<tubelines default="#default-metro-tubeline">
<tubeline name="default-metro-tubeline">
<client-side>
<!--<tube-factory className="com.sun.xml.ws.assembler.jaxws.TerminalTubeFactory" />-->
<tube-factory className="com.sun.xml.ws.assembler.jaxws.HandlerTubeFactory" />
<tube-factory className="com.sun.xml.ws.assembler.jaxws.ValidationTubeFactory" />
<!--<tube-factory className="com.sun.xml.ws.assembler.jaxws.MonitoringTubeFactory" />-->
<tube-factory className="com.sun.xml.ws.assembler.jaxws.MustUnderstandTubeFactory" />
<tube-factory className="com.sun.xml.ws.assembler.jaxws.AddressingTubeFactory" />
<tube-factory className="com.sun.xml.ws.dump.MessageDumpingTubeFactory" />
<!-- TODO: secrity tube(?) -->
<tube-factory className="com.sun.xml.ws.assembler.jaxws.BasicTransportTubeFactory" />
</client-side>
<endpoint-side>
<!-- TODO: secrity tube(?) -->
<tube-factory className="com.sun.xml.ws.dump.MessageDumpingTubeFactory" />
<tube-factory className="com.sun.xml.ws.assembler.jaxws.AddressingTubeFactory" />
<tube-factory className="com.sun.xml.ws.assembler.jaxws.MustUnderstandTubeFactory" />
<tube-factory className="com.sun.xml.ws.assembler.jaxws.MonitoringTubeFactory" />
<tube-factory className="com.sun.xml.ws.assembler.jaxws.HandlerTubeFactory" />
<tube-factory className="com.sun.xml.ws.assembler.jaxws.ValidationTubeFactory" />
<tube-factory className="com.sun.xml.ws.assembler.jaxws.TerminalTubeFactory" />
</endpoint-side>
</tubeline>
</tubelines>
</metro>
@@ -1,5 +1,5 @@
#
# Copyright (c) 2010, 2021 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 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
Expand Down Expand Up @@ -31,7 +31,7 @@ MASM0009_CANNOT_FORM_VALID_URL = MASM0009: Cannot form a valid URL from the reso

MASM0010_ERROR_READING_CFG_FILE_FROM_LOCATION = MASM0010: Unable to unmarshall metro config file from location [ {0} ]

MASM0011_LOADING_RESOURCE = MASM0011: Trying to load [ {0} ] via parent resouce loader [ {1} ]
MASM0011_LOADING_RESOURCE = MASM0011: Trying to load [ {0} ] via parent resource loader [ {1} ]

MASM0012_LOADING_VIA_SERVLET_CONTEXT = MASM0012: Trying to load [ {0} ] via servlet context [ {1} ]

Expand All @@ -52,4 +52,6 @@ MASM0019_MSG_LOGGING_SYSTEM_PROPERTY_ILLEGAL_VALUE = MASM0019: Illegal logging l

MASM0020_ERROR_CREATING_URI_FROM_GENERATED_STRING = MASM0020: Unable to create a new URI instance for generated endpoint URI string [ {0} ]

MASM0021_BUILTIN_CFG_FILE = MASM0021: Built-in [ {0} ] configuration file located at [ {1} ]

MASM0050_DEPRECATED_TUBE = MASM0050: {0} factory has been deprecated, use {1} instead.

0 comments on commit fb91140

Please sign in to comment.