Example usage for java.lang IllegalArgumentException setStackTrace

List of usage examples for java.lang IllegalArgumentException setStackTrace

Introduction

In this page you can find the example usage for java.lang IllegalArgumentException setStackTrace.

Prototype

public void setStackTrace(StackTraceElement[] stackTrace) 

Source Link

Document

Sets the stack trace elements that will be returned by #getStackTrace() and printed by #printStackTrace() and related methods.

Usage

From source file:io.cloudslang.content.json.utils.JsonUtils.java

@NotNull
public static IllegalArgumentException hammerIllegalArgumentExceptionWithMessage(@NotNull final String message,
        @NotNull final Throwable throwable) {
    final IllegalArgumentException iae = new IllegalArgumentException(message);
    iae.setStackTrace(throwable.getStackTrace());
    return iae;// ww w .  java 2  s .  c  o m
}

From source file:hm.binkley.util.XPropsConverter.java

@SuppressWarnings("unchecked")
private static <T> Class<T> tokenFor(final String type) {
    try {// w ww .jav a2s .  co m
        return (Class<T>) Class.forName(type);
    } catch (final ClassNotFoundException e) {
        final IllegalArgumentException x = new IllegalArgumentException(type + ": " + e);
        x.setStackTrace(e.getStackTrace());
        throw x;
    }
}

From source file:net.gbmb.collector.RecordController.java

@ExceptionHandler(IllegalArgumentException.class)
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public Exception handleIllegalArgumentException(IllegalArgumentException ex) {
    // clean stack trace from object
    ex.setStackTrace(new StackTraceElement[0]);
    return ex;//from   w  w w  .  j a  va 2s. c  o  m
}

From source file:org.apache.openjpa.kernel.BrokerImpl.java

public Object newInstance(Class cls) {
    assertOpen();//from  w w w.  j a  v  a  2s  . co  m

    if (!cls.isInterface() && Modifier.isAbstract(cls.getModifiers()))
        throw new UnsupportedOperationException(_loc.get("new-abstract", cls).getMessage());

    // 1.5 doesn't initialize classes without a true Class.forName
    if (!PCRegistry.isRegistered(cls)) {
        try {
            Class.forName(cls.getName(), true,
                    AccessController.doPrivileged(J2DoPrivHelper.getClassLoaderAction(cls)));
        } catch (Throwable t) {
        }
    }

    if (_repo.getMetaData(cls, getClassLoader(), false) == null)
        throw new IllegalArgumentException(_loc.get("no-interface-metadata", cls.getName()).getMessage());

    try {
        return PCRegistry.newInstance(cls, null, false);
    } catch (IllegalStateException ise) {
        IllegalArgumentException iae = new IllegalArgumentException(ise.getMessage());
        iae.setStackTrace(ise.getStackTrace());
        throw iae;
    }
}

From source file:org.everit.osgi.dev.lqmg.LQMGMain.java

private static String evaluateMandatoryOptionValue(final String key, final CommandLine commandLine,
        final Options options) {
    String result = commandLine.getOptionValue(key);
    if (result == null) {
        LQMGMain.printHelp(options);//from  w  ww  .j a  v  a  2s.  c o m
        IllegalArgumentException e = new IllegalArgumentException("Missing mandatory argument: " + key);
        e.setStackTrace(new StackTraceElement[0]);
        throw e;
    }
    return result;
}

From source file:org.geomajas.plugin.deskmanager.domain.types.XmlSerialisationType.java

private Object fromXmlString(String xmlString) {
    if (xmlString == null) {
        return null;
    }//from w ww.j a  v a 2  s . c om
    try {
        ByteArrayInputStream is = new ByteArrayInputStream(xmlString.getBytes(ENCODING));
        XMLDecoder decoder = new XMLDecoder(is);
        return decoder.readObject();
    } catch (UnsupportedEncodingException e) {
        LOG.warn(e.getLocalizedMessage());
        IllegalArgumentException ex = new IllegalArgumentException("cannot disassemble the object");
        ex.setStackTrace(e.getStackTrace());
        throw ex;
    }
}