java.lang.IllegalArgumentException.addSuppressed()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(192)

本文整理了Java中java.lang.IllegalArgumentException.addSuppressed()方法的一些代码示例,展示了IllegalArgumentException.addSuppressed()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IllegalArgumentException.addSuppressed()方法的具体详情如下:
包路径:java.lang.IllegalArgumentException
类名称:IllegalArgumentException
方法名:addSuppressed

IllegalArgumentException.addSuppressed介绍

暂无

代码示例

代码示例来源:origin: Alluxio/alluxio

String.format("Unable to create an UnderFileSystem instance for path: %s", path));
for (Throwable t : errors) {
 e.addSuppressed(t);

代码示例来源:origin: org.elasticsearch/elasticsearch

@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;
}

代码示例来源:origin: org.elasticsearch/elasticsearch

ex1.addSuppressed(ex);
throw ex1;

代码示例来源:origin: neo4j-contrib/neo4j-graph-algorithms

/**
 * 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;
}

代码示例来源:origin: org.neo4j/graph-algorithms-core

/**
 * 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;
}

代码示例来源:origin: org.apache.ratis/ratis-common

/**
 * 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;
 }
}

代码示例来源:origin: apache/incubator-ratis

/**
 * 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;
 }
}

代码示例来源:origin: org.alluxio/alluxio-core-common

String.format("Unable to create an UnderFileSystem instance for path: %s", path));
for (Throwable t : errors) {
 e.addSuppressed(t);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

ex1.addSuppressed(ex);
throw ex1;

代码示例来源:origin: apache/servicemix-bundles

ex1.addSuppressed(ex);
throw ex1;

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

ex1.addSuppressed(ex);
throw ex1;

代码示例来源:origin: org.n52.series-api.db/dao

/**
 * 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;
    }
  }
}

代码示例来源:origin: org.apache.sis.core/sis-referencing

method = DefaultOperationMethod.redimension(method, sourceDimensions, targetDimensions);
} catch (NoSuchIdentifierException | IllegalArgumentException se) {
  ex.addSuppressed(se);
  throw ex;

代码示例来源:origin: apache/sis

method = DefaultOperationMethod.redimension(method, sourceDimensions, targetDimensions);
} catch (NoSuchIdentifierException | IllegalArgumentException se) {
  ex.addSuppressed(se);
  throw ex;

相关文章