"cluster configuration service not available", e); } catch (UnknownHostException e) { throw new GemFireConfigException(e.getLocalizedMessage(), e);
content = content.replaceAll("\\$\\{job_engine\\}", inetAddress.getCanonicalHostName()); } catch (UnknownHostException e) { logger.warn(e.getLocalizedMessage(), e);
private InetAddress resolveAddress(String host) throws DataConnectionException { try { return InetAddress.getByName(host); } catch (UnknownHostException ex) { throw new DataConnectionException(ex.getLocalizedMessage(), ex); } } /*
/** * Gets the name of the local machine. */ public static String getHostName() { try { java.net.InetAddress localMachine = java.net.InetAddress.getLocalHost(); return localMachine.getHostName(); } catch (java.net.UnknownHostException e) { HillviewLogger.instance.error("Cannot get host name", e); return e.getLocalizedMessage(); } }
public void unbindRemoteContextObserver(ContextObserver contextObserver, Map<String, Object> properties) { try { Logger.getLogger(this.getClass()).info( "Removing Remote " + ContextObserver.class.getSimpleName() + ": " + contextObserver + propertiesToString(properties)); URI authorityURI = obtainAuthorityURI(properties); remoteContextObservers.remove(authorityURI); } catch (UnknownHostException ex) { Logger.getLogger(this.getClass()).error(ex.getLocalizedMessage(), ex); } }
private static InetAddress parseInetAddress(final ModelNode model, final ExpressionResolver expressionResolver) throws OperationFailedException { final String rawAddress = expressionResolver.resolveExpressions(model).asString(); try { return InetAddress.getByName(rawAddress); } catch (UnknownHostException e) { throw new ParsingException(ControllerLogger.ROOT_LOGGER.invalidAddress(model.asString(), e.getLocalizedMessage())); } }
private static InetAddress parseInetAddress(final ModelNode model, final ExpressionResolver expressionResolver) throws OperationFailedException { final String rawAddress = expressionResolver.resolveExpressions(model).asString(); try { return InetAddress.getByName(rawAddress); } catch (UnknownHostException e) { throw new ParsingException(MESSAGES.invalidAddress(model.asString(), e.getLocalizedMessage())); } }
private static InetAddress parseInetAddress(final ModelNode model, final ExpressionResolver expressionResolver) throws OperationFailedException { final String rawAddress = expressionResolver.resolveExpressions(model).asString(); try { return InetAddress.getByName(rawAddress); } catch (UnknownHostException e) { throw new ParsingException(MESSAGES.invalidAddress(model.asString(), e.getLocalizedMessage())); } }
private static InetAddress parseInetAddress(final ModelNode model, final ExpressionResolver expressionResolver) throws OperationFailedException { final String rawAddress = expressionResolver.resolveExpressions(model).asString(); try { return InetAddress.getByName(rawAddress); } catch (UnknownHostException e) { throw new ParsingException(ControllerLogger.ROOT_LOGGER.invalidAddress(model.asString(), e.getLocalizedMessage())); } }
private void handleBindingReinstall(OperationContext context, String bindingName, ModelNode bindingModel) throws OperationFailedException { context.removeService(OutboundSocketBinding.OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME.append(bindingName)); try { if (remoteDestination) { RemoteDestinationOutboundSocketBindingAddHandler.installOutboundSocketBindingService(context, bindingModel, bindingName); } else { LocalDestinationOutboundSocketBindingAddHandler.installOutboundSocketBindingService(context, bindingModel, bindingName); } } catch (UnknownHostException e) { throw new OperationFailedException(new ModelNode().set(e.getLocalizedMessage())); } }
private void handleBindingReinstall(OperationContext context, String bindingName, ModelNode bindingModel) throws OperationFailedException { context.removeService(OutboundSocketBinding.OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME.append(bindingName)); try { if (remoteDestination) { RemoteDestinationOutboundSocketBindingAddHandler.installOutboundSocketBindingService(context, bindingModel, bindingName); } else { LocalDestinationOutboundSocketBindingAddHandler.installOutboundSocketBindingService(context, bindingModel, bindingName); } } catch (UnknownHostException e) { throw new OperationFailedException(new ModelNode().set(e.getLocalizedMessage())); } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException { PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); String name = address.getLastElement().getValue(); try { newControllers.add(installBindingService(context, model, name, verificationHandler)); } catch (UnknownHostException e) { throw new OperationFailedException(new ModelNode().set(e.getLocalizedMessage())); } }
private void validateAddressMask(String value, Location location) throws XMLStreamException { final String[] split = value.split("/"); try { if (split.length != 2) { throw new XMLStreamException(MESSAGES.invalidAddressMaskValue(value), location); } // todo - possible DNS hit here final InetAddress addr = InetAddress.getByName(split[0]); // Validate both parts of the split addr.getAddress(); Integer.parseInt(split[1]); } catch (final NumberFormatException e) { throw new XMLStreamException(MESSAGES.invalidAddressMask(split[1], e.getLocalizedMessage()), location, e); } catch (final UnknownHostException e) { throw new XMLStreamException(MESSAGES.invalidAddressValue(split[0], e.getLocalizedMessage()), location, e); } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException { PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); String name = address.getLastElement().getValue(); try { newControllers.add(installBindingService(context, model, name, verificationHandler)); } catch (UnknownHostException e) { throw new OperationFailedException(new ModelNode().set(e.getLocalizedMessage())); } }
private void printHostName() { try { buildInfo.println(Messages.console_publishFromHost_message(InetAddress.getLocalHost().getHostName())); } catch (UnknownHostException uhe) { LOGGER.log(Level.WARNING, Messages.exception_failedToGetHostName(), uhe); buildInfo.println(Messages.console_publishFromHost_unknown(uhe.getLocalizedMessage())); } }
/** * @param numConnections */ private void createAsyncMultipleConnections(EventConsumerInfo ecinfo, int numConnections) { for (int i=0; i < numConnections; i++) { ChannelFuture cf = null; try { cf = m_bootstrap.connect(new InetSocketAddress( InetAddress.getByName(ecinfo.getAdvertisement().getHostName()), ecinfo.getAdvertisement().getListenTcpPort())); } catch (UnknownHostException e) { LOGGER.error( "failed to connect to Host - " + ecinfo.getAdvertisement().getHostName() + " - " + e.getLocalizedMessage()); } final EventConsumerActivationRequest ar = new EventConsumerActivationRequest( this, ecinfo, m_transportConfig.getMaxNettyBackLog(), cf.channel()); // not sure if it makes sense to make this final if (cf != null) cf.addListener(ar); } }
private static InterfaceCriteria createSubnetMatchCriteria(final ModelNode model) throws ParsingException { String value; String[] split = null; try { value = model.asString(); split = value.split("/"); if (split.length != 2) { throw new ParsingException(ControllerLogger.ROOT_LOGGER.invalidAddressMaskValue(value)); } // todo - possible DNS hit here final InetAddress addr = InetAddress.getByName(split[0]); // Validate both parts of the split final byte[] net = addr.getAddress(); final int mask = Integer.parseInt(split[1]); return new SubnetMatchInterfaceCriteria(net, mask); } catch (final NumberFormatException e) { throw new ParsingException(ControllerLogger.ROOT_LOGGER.invalidAddressMask(split[1], e.getLocalizedMessage())); } catch (final UnknownHostException e) { throw new ParsingException(ControllerLogger.ROOT_LOGGER.invalidAddressValue(split[0], e.getLocalizedMessage())); } }
private static InterfaceCriteria createSubnetMatchCriteria(final ModelNode model) throws ParsingException { String value; String[] split = null; try { value = model.asString(); split = value.split("/"); if (split.length != 2) { throw new ParsingException(ControllerLogger.ROOT_LOGGER.invalidAddressMaskValue(value)); } // todo - possible DNS hit here final InetAddress addr = InetAddress.getByName(split[0]); // Validate both parts of the split final byte[] net = addr.getAddress(); final int mask = Integer.parseInt(split[1]); return new SubnetMatchInterfaceCriteria(net, mask); } catch (final NumberFormatException e) { throw new ParsingException(ControllerLogger.ROOT_LOGGER.invalidAddressMask(split[1], e.getLocalizedMessage())); } catch (final UnknownHostException e) { throw new ParsingException(ControllerLogger.ROOT_LOGGER.invalidAddressValue(split[0], e.getLocalizedMessage())); } }
public static ParsedResult parseMasked(ModelNode value) throws OperationFailedException { final String[] split = value.asString().split("/"); if (split.length != 2) { throw new OperationFailedException(ControllerLogger.ROOT_LOGGER.invalidAddressMaskValue(value.asString())); } try { // TODO - replace with non-dns routine InetAddress address = InetAddress.getByName(split[0]); int mask = Integer.parseInt(split[1]); int max = address.getAddress().length * 8; if (mask > max) { throw new OperationFailedException(ControllerLogger.ROOT_LOGGER.invalidAddressMask(split[1], "> " + max)); } else if (mask < 0) { throw new OperationFailedException(ControllerLogger.ROOT_LOGGER.invalidAddressMask(split[1], "< 0")); } return new ParsedResult(address, mask); } catch (final UnknownHostException e) { throw new OperationFailedException(ControllerLogger.ROOT_LOGGER.invalidAddressValue(split[0], e.getLocalizedMessage())); } catch (final NumberFormatException e) { throw new OperationFailedException(ControllerLogger.ROOT_LOGGER.invalidAddressMask(split[1], e.getLocalizedMessage())); } }
public static ParsedResult parseMasked(ModelNode value) throws OperationFailedException { final String[] split = value.asString().split("/"); if (split.length != 2) { throw new OperationFailedException(MESSAGES.invalidAddressMaskValue(value.asString())); } try { // TODO - replace with non-dns routine InetAddress address = InetAddress.getByName(split[0]); int mask = Integer.parseInt(split[1]); int max = address.getAddress().length * 8; if (mask > max) { throw new OperationFailedException(MESSAGES.invalidAddressMask(split[1], "> " + max)); } else if (mask < 0) { throw new OperationFailedException(MESSAGES.invalidAddressMask(split[1], "< 0")); } return new ParsedResult(address, mask); } catch (final UnknownHostException e) { throw new OperationFailedException(MESSAGES.invalidAddressValue(split[0], e.getLocalizedMessage())); } catch (final NumberFormatException e) { throw new OperationFailedException(MESSAGES.invalidAddressMask(split[1], e.getLocalizedMessage())); } }