Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WFNC-33] Wrong URI protocol in EJB client context produces StackOverflowException with EJB Client 4 #34

Merged
merged 1 commit into from
Jun 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/main/java/org/wildfly/naming/client/WildFlyRootContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import org.wildfly.common.Assert;
import org.wildfly.common.expression.Expression;
import org.wildfly.naming.client._private.Messages;
import org.wildfly.naming.client.util.EnvironmentUtils;
import org.wildfly.naming.client.util.FastHashtable;
import org.wildfly.naming.client.util.NamingUtils;
import org.wildfly.security.auth.client.AuthenticationConfiguration;
Expand Down Expand Up @@ -462,12 +463,15 @@ private ContextResult getProviderContext(final String nameScheme) throws NamingE
// by default, support an empty local root context
return new ContextResult(NamingUtils.emptyContext(getEnvironment()), false);
}
String uriScheme = nameScheme;
boolean supportsUriSchemes = false;
// get active naming providers
for (NamingProviderFactory providerFactory : namingProviderFactories) {
boolean supportsUriSchemes = true;
supportsUriSchemes = true;
for (URI providerUri : providerUris) {
if (! providerFactory.supportsUriScheme(providerUri.getScheme(), getEnvironment())) {
supportsUriSchemes = false;
uriScheme = providerUri.getScheme();
break;
}
}
Expand All @@ -487,6 +491,11 @@ private ContextResult getProviderContext(final String nameScheme) throws NamingE
return new ContextResult(context, true);
}
}

if (!supportsUriSchemes) {
throw Messages.log.invalidURLSchemeName(uriScheme);
}

throw Messages.log.noProviderForUri(nameScheme);
}

Expand Down Expand Up @@ -518,6 +527,10 @@ private List<URI> getProviderUris() throws NamingException {
// fall back to EJB connection properties
final String connectionNameList = ((String) env.getOrDefault(EJB_REMOTE_CONNECTIONS, "")).trim();
if (! connectionNameList.isEmpty()) {

// Cleanup Context.URL_PKG_PREFIXES in order to avoid possible side effects due to legacy package prefix
getEnvironment().remove(Context.URL_PKG_PREFIXES);

Messages.log.deprecatedProperties();
final String[] names = connectionNameList.split("\\s*,\\s*");
final List<URI> uriList = new ArrayList<>(names.length);
Expand Down