Tabnine Logo
IllegalArgumentException.initCause
Code IndexAdd Tabnine to your IDE (free)

How to use
initCause
method
in
java.lang.IllegalArgumentException

Best Java code snippets using java.lang.IllegalArgumentException.initCause (Showing top 20 results out of 2,358)

origin: robovm/robovm

private IllegalArgumentException incorrectInputName(IOException e, String name) {
  IllegalArgumentException iae = new IllegalArgumentException("Incorrect input name:" + name);
  iae.initCause(e);
  throw iae;
}
origin: robovm/robovm

private IllegalArgumentException incorrectInputEncoding(IOException e) {
  IllegalArgumentException iae = new IllegalArgumentException("Incorrect input encoding");
  iae.initCause(e);
  throw iae;
}
origin: apache/geode

/**
 * Throws a {@link org.apache.geode.cache.CacheXmlException}
 */
@Override
public void fatalError(SAXParseException ex) throws SAXException {
 IllegalArgumentException ex2 = new IllegalArgumentException(
   "Fatal error while parsing XML.");
 ex2.initCause(ex);
 throw ex2;
}
origin: apache/geode

/**
 * Throws a {@link org.apache.geode.cache.CacheXmlException}
 */
@Override
public void error(SAXParseException ex) throws SAXException {
 IllegalArgumentException ex2 = new IllegalArgumentException(
   "Error while parsing XML.");
 ex2.initCause(ex);
 throw ex2;
}
origin: org.osgi/org.osgi.core

/**
 * Parse numeric component into an int.
 * 
 * @param value Numeric component
 * @param version Complete version string for exception message, if any
 * @return int value of numeric component
 */
private static int parseInt(String value, String version) {
  try {
    return Integer.parseInt(value);
  } catch (NumberFormatException e) {
    IllegalArgumentException iae = new IllegalArgumentException("invalid version \"" + version + "\": non-numeric \"" + value + "\"");
    iae.initCause(e);
    throw iae;
  }
}
origin: apache/activemq

private static URI createURI(String brokerURL) {
  try {
    return new URI(brokerURL);
  } catch (URISyntaxException e) {
    throw (IllegalArgumentException)new IllegalArgumentException("Invalid broker URI: " + brokerURL).initCause(e);
  }
}
origin: org.osgi/org.osgi.compendium

/**
 * Verify and obtain a required String property.
 * 
 * @param propName The name of the property
 * @return The value of the property or {@code null} if the property is not
 *         set.
 * @throws IllegalArgumentException when the property doesn't have the
 *         correct data type.
 */
private String verifyStringProperty(String propName) {
  Object r = properties.get(propName);
  try {
    return (String) r;
  } catch (ClassCastException e) {
    IllegalArgumentException iae = new IllegalArgumentException("property value is not a String: " + propName);
    iae.initCause(e);
    throw iae;
  }
}
origin: spotbugs/spotbugs

public void foo(File f) {
    try {
    FileOutputStream o = new FileOutputStream(f);
    o.write(0);
    o.close();
  } catch (IOException e) {
    IllegalArgumentException e2 = new  IllegalArgumentException("Bad file: " + f);
    e2.initCause(e);
  }
}
origin: spring-projects/spring-security

  /**
   * Parses the supplied LDAP URL.
   * @param url the URL (e.g.
   * <tt>ldap://monkeymachine:11389/dc=springframework,dc=org</tt>).
   * @return the URI object created from the URL
   * @throws IllegalArgumentException if the URL is null, empty or the URI syntax is
   * invalid.
   */

  private static URI parseLdapUrl(String url) {
    Assert.hasLength(url, "url must have length");

    try {
      return new URI(url);
    }
    catch (URISyntaxException e) {
      IllegalArgumentException iae = new IllegalArgumentException(
          "Unable to parse url: " + url);
      iae.initCause(e);
      throw iae;
    }
  }
}
origin: org.osgi/org.osgi.compendium

/**
 * Verify and obtain a required long property.
 * 
 * @param propName The name of the property
 * @return The value of the property or 0 if the property is not set.
 * @throws IllegalArgumentException when the property doesn't have the
 *         correct data type.
 */
private long verifyLongProperty(String propName) {
  Object r = properties.get(propName);
  if (r == null) {
    return 0l;
  }
  try {
    return ((Long) r).longValue();
  } catch (ClassCastException e) {
    IllegalArgumentException iae = new IllegalArgumentException("property value is not a Long: " + propName);
    iae.initCause(e);
    throw iae;
  }
}
origin: org.osgi/org.osgi.core

/**
 * Parse version component into a Version.
 * 
 * @param version version component string
 * @param range Complete range string for exception message, if any
 * @return Version
 */
private static Version parseVersion(String version, String range) {
  try {
    return Version.valueOf(version);
  } catch (IllegalArgumentException e) {
    IllegalArgumentException iae = new IllegalArgumentException("invalid range \"" + range + "\": " + e.getMessage());
    iae.initCause(e);
    throw iae;
  }
}
origin: org.osgi/org.osgi.core

/**
 * Parse filter string into a Filter object.
 * 
 * @param filterString The filter string to parse.
 * @return a Filter for this bundle.
 * @throws IllegalArgumentException If the filter syntax is invalid.
 */
private static Filter parseFilter(String filterString) {
  filterString = filterString.trim();
  if (filterString.equals("*")) {
    return null;
  }
  try {
    return FrameworkUtil.createFilter(filterString);
  } catch (InvalidSyntaxException e) {
    IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
    iae.initCause(e);
    throw iae;
  }
}
origin: Netflix/servo

 /**
  * It's a lot easier to configure and manage the location of the graphite server if we combine
  * the ip and port into a single string. Using a "fake" transport and the ipString means we get
  * standard host/port parsing (including domain names, ipv4 and ipv6) for free.
  */
 private static URI parseStringAsUri(String ipString) {
  try {
   URI uri = new URI("socket://" + ipString);
   if (uri.getHost() == null || uri.getPort() == -1) {
    throw new URISyntaxException(ipString, "URI must have host and port parts");
   }
   return uri;
  } catch (URISyntaxException e) {
   throw (IllegalArgumentException) new IllegalArgumentException(
     "Graphite server address needs to be defined as {host}:{port}.").initCause(e);
  }
 }
}
origin: org.osgi/org.osgi.core

/**
 * Parse filter string into a Filter object.
 * 
 * @param filterString The filter string to parse.
 * @return a Filter for this bundle. If the specified filterString is not a
 *         filter expression, then {@code null} is returned.
 * @throws IllegalArgumentException If the filter syntax is invalid.
 */
private static Filter parseFilter(String filterString) {
  filterString = filterString.trim();
  if (filterString.charAt(0) != '(') {
    return null;
  }
  try {
    return FrameworkUtil.createFilter(filterString);
  } catch (InvalidSyntaxException e) {
    IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
    iae.initCause(e);
    throw iae;
  }
}
origin: org.osgi/org.osgi.core

/**
 * Parse filter string into a Filter object.
 * 
 * @param filterString The filter string to parse.
 * @return a Filter for this bundle. If the specified filterString is not a
 *         filter expression, then {@code null} is returned.
 * @throws IllegalArgumentException If the filter syntax is invalid.
 */
private static Filter parseFilter(String filterString) {
  filterString = filterString.trim();
  if (filterString.charAt(0) != '(') {
    return null;
  }
  try {
    return FrameworkUtil.createFilter(filterString);
  } catch (InvalidSyntaxException e) {
    IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
    iae.initCause(e);
    throw iae;
  }
}
origin: org.osgi/org.osgi.core

/**
 * Parse filter string into a Filter object.
 * 
 * @param filterString The filter string to parse.
 * @return a Filter for this bundle. If the specified filterString is not a
 *         filter expression, then {@code null} is returned.
 * @throws IllegalArgumentException If the filter syntax is invalid.
 */
private static Filter parseFilter(String filterString) {
  filterString = filterString.trim();
  if (filterString.charAt(0) != '(') {
    return null;
  }
  try {
    return FrameworkUtil.createFilter(filterString);
  } catch (InvalidSyntaxException e) {
    IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
    iae.initCause(e);
    throw iae;
  }
}
origin: org.osgi/org.osgi.core

/**
 * Parse filter string into a Filter object.
 * 
 * @param filterString The filter string to parse.
 * @return a Filter for this bundle. If the specified filterString is
 *         {@code null} or equals "*", then {@code null} is returned to
 *         indicate a wildcard.
 * @throws IllegalArgumentException If the filter syntax is invalid.
 */
private static Filter parseFilter(String filterString) {
  if (filterString == null) {
    return null;
  }
  filterString = filterString.trim();
  if (filterString.equals("*")) {
    return null;
  }
  try {
    return FrameworkUtil.createFilter(filterString);
  } catch (InvalidSyntaxException e) {
    IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
    iae.initCause(e);
    throw iae;
  }
}
origin: org.osgi/org.osgi.compendium

/**
 * Parse filter string into a Filter object.
 * 
 * @param filterString The filter string to parse.
 * @return a Filter for this bundle.
 * @throws IllegalArgumentException If the filter syntax is invalid.
 */
private static Filter parseFilter(String filterString) {
  filterString = filterString.trim();
  if (filterString.equals("*")) {
    return null;
  }
  try {
    return FrameworkUtil.createFilter(filterString);
  } catch (InvalidSyntaxException e) {
    IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
    iae.initCause(e);
    throw iae;
  }
}
origin: org.osgi/org.osgi.compendium

/**
 * Parse filter string into a Filter object.
 * 
 * @param filterString The filter string to parse.
 * @return a Filter for this subsystem. If the specified filterString equals
 *         "*", then {@code null} is returned to indicate a wildcard.
 * @throws IllegalArgumentException If the filter syntax is invalid.
 */
private static Filter parseFilter(String filterString) {
  filterString = filterString.trim();
  if (filterString.equals("*")) {
    return null;
  }
  try {
    return FrameworkUtil.createFilter(filterString);
  } catch (InvalidSyntaxException e) {
    IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
    iae.initCause(e);
    throw iae;
  }
}
origin: line/armeria

  @Override
  public void unaryCall(SimpleRequest request, StreamObserver<SimpleResponse> responseObserver) {
    IllegalStateException e1 = new IllegalStateException("Exception 1");
    IllegalArgumentException e2 = new IllegalArgumentException();
    AssertionError e3 = new AssertionError("Exception 3");
    Exceptions.clearTrace(e3);
    RuntimeException e4 = new RuntimeException("Exception 4");
    e1.initCause(e2);
    e2.initCause(e3);
    e3.initCause(e4);
    Status status = Status.ABORTED.withCause(e1);
    responseObserver.onError(status.asRuntimeException());
  }
}
java.langIllegalArgumentExceptioninitCause

Popular methods of IllegalArgumentException

  • <init>
    Constructs a new exception with the specified cause and a detail message of (cause==null ? null : c
  • getMessage
  • printStackTrace
  • toString
  • getLocalizedMessage
  • getStackTrace
  • setStackTrace
  • getCause
  • addSuppressed
  • fillInStackTrace
  • getSuppressed
  • getSuppressed

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setContentView (Activity)
  • scheduleAtFixedRate (Timer)
  • getApplicationContext (Context)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now