String.format("Unable to create an UnderFileSystem instance for path: %s", path)); for (Throwable t : errors) { e.addSuppressed(t);
@Override public TemporalAccessor parse(String input) { IllegalArgumentException failure = null; for (DateFormatter formatter : formatters) { try { return formatter.parse(input); // TODO: remove DateTimeParseException when JavaDateFormatter throws IAE } catch (IllegalArgumentException | DateTimeParseException e) { if (failure == null) { // wrap so the entire multi format is in the message failure = new IllegalArgumentException("failed to parse date field [" + input + "] with format [" + pattern + "]", e); } else { failure.addSuppressed(e); } } } throw failure; }
ex1.addSuppressed(ex); throw ex1;
/** * Creates a new Tree that can hold up to {@code capacity} nodes. */ public UndirectedTree(int capacity) { try { children = new int[capacity]; siblings = new int[capacity]; } catch (OutOfMemoryError | NegativeArraySizeException e) { IllegalArgumentException iae = new IllegalArgumentException("Invalid capacity: " + capacity); iae.addSuppressed(e); throw iae; } Arrays.fill(children, INVALID_NODE); Arrays.fill(siblings, INVALID_NODE); this.capacity = capacity; }
/** * Creates a new Tree that can hold up to {@code capacity} nodes. */ public UndirectedTree(int capacity) { try { children = new int[capacity]; siblings = new int[capacity]; } catch (OutOfMemoryError | NegativeArraySizeException e) { IllegalArgumentException iae = new IllegalArgumentException("Invalid capacity: " + capacity); iae.addSuppressed(e); throw iae; } Arrays.fill(children, INVALID_NODE); Arrays.fill(siblings, INVALID_NODE); this.capacity = capacity; }
/** * Parse the given string as a {@link SupportedRpcType} * or a user-defined {@link RpcType}. * * @param rpcType The string representation of an {@link RpcType}. * @return a {@link SupportedRpcType} or a user-defined {@link RpcType}. */ static RpcType valueOf(String rpcType) { final Throwable fromSupportedRpcType; try { // Try parsing it as a SupportedRpcType return SupportedRpcType.valueOfIgnoreCase(rpcType); } catch (Throwable t) { fromSupportedRpcType = t; } try { // Try using it as a class name return ReflectionUtils.newInstance( ReflectionUtils.getClass(rpcType, RpcType.class)); } catch(Throwable t) { final IllegalArgumentException iae = new IllegalArgumentException( "Invalid " + RpcType.class.getSimpleName() + ": \"" + rpcType + "\" " + " cannot be used as a user-defined " + RpcType.class.getSimpleName() + " and it is not a " + SupportedRpcType.class.getSimpleName() + "."); iae.addSuppressed(t); iae.addSuppressed(fromSupportedRpcType); throw iae; } }
/** * Parse the given string as a {@link SupportedRpcType} * or a user-defined {@link RpcType}. * * @param rpcType The string representation of an {@link RpcType}. * @return a {@link SupportedRpcType} or a user-defined {@link RpcType}. */ static RpcType valueOf(String rpcType) { final Throwable fromSupportedRpcType; try { // Try parsing it as a SupportedRpcType return SupportedRpcType.valueOfIgnoreCase(rpcType); } catch (Throwable t) { fromSupportedRpcType = t; } try { // Try using it as a class name return ReflectionUtils.newInstance( ReflectionUtils.getClass(rpcType, RpcType.class)); } catch(Throwable t) { final IllegalArgumentException iae = new IllegalArgumentException( "Invalid " + RpcType.class.getSimpleName() + ": \"" + rpcType + "\" " + " cannot be used as a user-defined " + RpcType.class.getSimpleName() + " and it is not a " + SupportedRpcType.class.getSimpleName() + "."); iae.addSuppressed(t); iae.addSuppressed(fromSupportedRpcType); throw iae; } }
String.format("Unable to create an UnderFileSystem instance for path: %s", path)); for (Throwable t : errors) { e.addSuppressed(t);
ex1.addSuppressed(ex); throw ex1;
ex1.addSuppressed(ex); throw ex1;
ex1.addSuppressed(ex); throw ex1;
/** * Parse the {@code value} either as a {@link TimeInstant} or as a {@link TimePeriod}. * * @param value the string value * * @return the time * * @throws IllegalArgumentException if the {@code value} does not represent a valud time instant or period */ public static Time parseTime(String value) throws IllegalArgumentException { try { return new TimeInstant(Instant.parse(value)); } catch (IllegalArgumentException ex1) { try { return new TimePeriod(Interval.parse(value)); } catch (IllegalArgumentException ex2) { ex2.addSuppressed(ex1); throw ex2; } } }
method = DefaultOperationMethod.redimension(method, sourceDimensions, targetDimensions); } catch (NoSuchIdentifierException | IllegalArgumentException se) { ex.addSuppressed(se); throw ex;
method = DefaultOperationMethod.redimension(method, sourceDimensions, targetDimensions); } catch (NoSuchIdentifierException | IllegalArgumentException se) { ex.addSuppressed(se); throw ex;