Refine search
/** * Return a general naming exception with a root cause. * * @param message the message * @param cause the exception cause, or {@code null} for none * @return the exception */ public static NamingException namingException(final String message, final Throwable cause) { final NamingException exception = new NamingException(message); if (cause != null) exception.initCause(cause); return exception; }
protected RedissonClient buildClient(String configPath) throws NamingException { Config config = null; try { config = Config.fromJSON(new File(configPath), getClass().getClassLoader()); } catch (IOException e) { // trying next format try { config = Config.fromYAML(new File(configPath), getClass().getClassLoader()); } catch (IOException e1) { NamingException ex = new NamingException("Can't parse yaml config " + configPath); ex.initCause(e1); throw ex; } } try { return Redisson.create(config); } catch (Exception e) { NamingException ex = new NamingException(); ex.initCause(e); throw ex; } }
protected RedissonClient buildClient(String configPath) throws NamingException { Config config = null; try { config = Config.fromJSON(new File(configPath), getClass().getClassLoader()); } catch (IOException e) { // trying next format try { config = Config.fromYAML(new File(configPath), getClass().getClassLoader()); } catch (IOException e1) { NamingException ex = new NamingException("Can't parse yaml config " + configPath); ex.initCause(e1); throw ex; } } try { return Redisson.create(config); } catch (Exception e) { NamingException ex = new NamingException(); ex.initCause(e); throw ex; } }
@Override public final NamingException cannotDeferenceObject(final Throwable cause) { final NamingException result = new NamingException(String.format(getLoggingLocale(), cannotDeferenceObject$str())); result.initCause(cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String cannotListNonContextBinding = "WFLYNAM0017: Unable to list a non Context binding.";
@Override public final NamingException failedToInstantiate(final Throwable cause, final String description, final String className, final ClassLoader classLoader) { final NamingException result = new NamingException(String.format(getLoggingLocale(), failedToInstantiate$str(), description, className, classLoader)); result.initCause(cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String failedToReadContextEntries = "WFLYNAM0028: Failed to read %s context entries.";
@Override public final NamingException objectFactoryCreationFailure(final Throwable cause) { final NamingException result = new NamingException(String.format(getLoggingLocale(), objectFactoryCreationFailure$str())); result.initCause(cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String readOnlyNamingContext = "WFLYNAM0043: Naming context is read-only";
@Override public final NamingException lookupError(final Throwable cause, final String name) { final NamingException result = new NamingException(String.format(getLoggingLocale(), lookupError$str(), name)); result.initCause(cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String serviceNotStarted = "WFLYNAM0063: %s service not started";
@Override public final NamingException obtainingDirContextCredentialFromAuthenticationContextFailed(final Throwable cause) { final NamingException result = new NamingException(String.format(getLoggingLocale(), obtainingDirContextCredentialFromAuthenticationContextFailed$str())); result.initCause(cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String authenticationFailedEvidenceVerification = "ELY01151: Evidence Verification Failed.";
@Override protected Context getURLOrDefaultInitCtx(String name) throws NamingException { String scheme = getURLScheme(name); if (scheme != null && !scheme.equals("java")) { ObjectFactory factory = urlContextFactories.get(scheme); if (factory != null) { try { return (Context) factory.getObjectInstance(null, null, null, myProps); }catch(NamingException e) { throw e; } catch (Exception e) { NamingException n = new NamingException(e.getMessage()); n.initCause(e); throw n; } } else { Context ctx = delegate.getInitialContext(myProps); if(ctx!=null) { return ctx; } } } return getDefaultInitCtx(); }
private Object processInvocation(Name name, HttpString method, String pathSegment, Name newName) throws NamingException { ProviderEnvironment environment = httpNamingProvider.getProviderEnvironment(); final RetryContext context = canRetry(environment) ? new RetryContext() : null; return performWithRetry((contextOrNull, name1, param) -> { try { HttpNamingProvider.HttpPeerIdentity peerIdentity = (HttpNamingProvider.HttpPeerIdentity) httpNamingProvider.getPeerIdentityForNamingUsingRetry(contextOrNull); StringBuilder sb = new StringBuilder(); String uriPath = peerIdentity.getUri().getPath(); sb.append(uriPath); if (!uriPath.endsWith("/")) { sb.append("/"); } sb.append(pathSegment) .append(URLEncoder.encode(name.toString(), StandardCharsets.UTF_8.name())); if (newName != null) { sb.append("?new="); sb.append(URLEncoder.encode(newName.toString(), StandardCharsets.UTF_8.name())); } final ClientRequest clientRequest = new ClientRequest() .setPath(sb.toString()) .setMethod(method); clientRequest.getRequestHeaders().put(Headers.ACCEPT, ACCEPT_VALUE); return performOperation(name1, peerIdentity.getUri(), clientRequest); } catch (UnsupportedEncodingException e) { NamingException namingException = new NamingException(e.getMessage()); namingException.initCause(e); throw namingException; } }, environment, context, name, null); }
members.add(DefaultAuthorizationMap.createGroupPrincipal(principalName, map.getGroupClass())); } catch (Exception e) { NamingException ne = new NamingException( "Can't create a group " + principalName + " of class " + map.getGroupClass()); ne.initCause(e); throw ne;
private void processInvocation(Name name, HttpString method, Object object, String pathSegment) throws NamingException { ProviderEnvironment environment = httpNamingProvider.getProviderEnvironment(); final RetryContext context = canRetry(environment) ? new RetryContext() : null; performWithRetry((contextOrNull, name1, param) -> { HttpNamingProvider.HttpPeerIdentity peerIdentity = (HttpNamingProvider.HttpPeerIdentity) httpNamingProvider.getPeerIdentityForNamingUsingRetry(contextOrNull); try { StringBuilder sb = new StringBuilder(); String uriPath = peerIdentity.getUri().getPath(); sb.append(uriPath); if (!uriPath.endsWith("/")) { sb.append("/"); } sb.append(pathSegment).append(URLEncoder.encode(name.toString(), StandardCharsets.UTF_8.name())); final ClientRequest clientRequest = new ClientRequest() .setPath(sb.toString()) .setMethod(method); clientRequest.getRequestHeaders().put(Headers.ACCEPT, ACCEPT_VALUE); if (object != null) { clientRequest.getRequestHeaders().put(Headers.CONTENT_TYPE, VALUE_TYPE.toString()); } performOperation(peerIdentity.getUri(), object, clientRequest); return null; } catch (UnsupportedEncodingException e) { NamingException namingException = new NamingException(e.getMessage()); namingException.initCause(e); throw namingException; } }, environment, context, name, object); }
Context ctx = NamingManager.getURLContext(scheme, environment); if (ctx == null) { throw new NamingException("scheme " + scheme + " not recognized"); throw e; } catch (Exception e) { throw (NamingException) new NamingException("could not look up : " + name).initCause(e);
result.get(); } catch (InterruptedException e) { NamingException namingException = new NamingException(e.getMessage()); namingException.initCause(e); throw namingException; } catch (ExecutionException e) { throw (NamingException) cause; } else { NamingException namingException = new NamingException(); namingException.initCause(cause); throw namingException;
Context ctx = NamingManager.getURLContext(scheme, environment); if (ctx == null) { throw new NamingException("scheme " + scheme + " not recognized"); throw e; } catch (Exception e) { throw (NamingException)new NamingException("could not look up : " + name).initCause(e);
return result.get(); } catch (InterruptedException e) { NamingException namingException = new NamingException(e.getMessage()); namingException.initCause(e); throw namingException; } catch (ExecutionException e) { throw communicationException; } else { NamingException namingException = new NamingException(); namingException.initCause(cause); throw namingException;
@Override protected final Object doOperation(HttpServerExchange exchange, String name) throws NamingException { ContentType contentType = ContentType.parse(exchange.getRequestHeaders().getFirst(Headers.CONTENT_TYPE)); if (contentType == null || !contentType.getType().equals("application/x-wf-jndi-jbmar-value") || contentType.getVersion() != 1) { exchange.setStatusCode(StatusCodes.BAD_REQUEST); exchange.endExchange(); return null; } final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); try (InputStream inputStream = exchange.getInputStream()) { Unmarshaller unmarshaller = MARSHALLER_FACTORY.createUnmarshaller(marshallingConfiguration); unmarshaller.start(new InputStreamByteInput(inputStream)); Object object = unmarshaller.readObject(); unmarshaller.finish(); doOperation(name, object); } catch (Exception e) { NamingException nm = new NamingException(e.getMessage()); nm.initCause(e); throw nm; } return null; }
Context ctx = NamingManager.getURLContext(scheme, environment); if (ctx == null) { throw new NamingException("scheme " + scheme + " not recognized"); throw e; } catch (Exception e) { throw (NamingException) new NamingException("could not look up : " + name).initCause(e);
/** * Return a general naming exception with a root cause. * * @param message the message * @param cause the exception cause, or {@code null} for none * @return the exception */ public static NamingException namingException(final String message, final Throwable cause) { final NamingException exception = new NamingException(message); if (cause != null) exception.initCause(cause); return exception; }
protected Object throwResourceNotFoundException(Exception e, ResourceInfo resourceInfo) throws NamingException { NamingException ne = new NamingException("Unable to lookup resource : " + resourceInfo); ne.initCause(e); throw ne; }