Example usage for java.lang IllegalArgumentException printStackTrace

List of usage examples for java.lang IllegalArgumentException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.gs.obevo.util.ArgsParser.java

public <T> T parse(String[] args, T inputArgs) {
    try {//ww  w .j  a  va 2 s  .  c om
        List<String> extraArgs = Args.parse(inputArgs, args);

        if (extraArgs.size() > 0) {
            Args.usage(inputArgs);
            System.err.println("Passed in unnecessary args: " + StringUtils.join(extraArgs, "; "));
            System.exit(-1);
        }
    } catch (IllegalArgumentException exc) {
        Args.usage(inputArgs);
        exc.printStackTrace();
        System.exit(-1);
    }

    LOG.info("Arguments parsed: " + inputArgs.toString());

    return inputArgs;
}

From source file:at.alladin.rmbt.controlServer.NdtResultResource.java

@Post("json")
public String request(final String entity) {
    addAllowOrigin();/*from www. ja  v  a2  s  . c  o m*/
    final JSONObject answer = new JSONObject();

    try {
        final JSONObject request = new JSONObject(entity);

        //            System.out.println(request.toString(4));

        final String testUuidString;

        // TODO remove test_token
        if (request.has("test_token")) {
            final String[] token = request.getString("test_token").split("_");
            testUuidString = token[0];
        } else if (request.has("test_uuid")) {
            testUuidString = request.getString("test_uuid");
        } else
            throw new IllegalArgumentException();

        final Test test = new Test(conn);
        final UUID testUuid = UUID.fromString(testUuidString);
        final long testId = test.getTestByUuid(testUuid);
        if (testId < 0)
            throw new IllegalArgumentException();

        final TestNdt ndt = new TestNdt(conn);
        ((LongField) ndt.getField("test_id")).setValue(testId);
        ndt.setFields(request);
        ndt.storeTest();

    } catch (final IllegalArgumentException e) {
        e.printStackTrace();
    } catch (final JSONException e) {
        e.printStackTrace();
    }

    return answer.toString();
}

From source file:org.commoncrawl.util.RPCStructIntrospector.java

public void dumpProperties(Object o) {
    for (Method m : getters.values()) {
        try {//from   ww w .j a  va  2 s. co  m
            System.out.println(m.invoke(o, null));
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

From source file:at.molindo.esi4j.example.db.ArticleServiceImpl.java

private SyndFeed retrieve(URL feedUrl) {
    try {/*  w  w  w  .  j  a va 2  s . com*/
        SyndFeed feed = _feedFetcher.retrieveFeed(feedUrl);
        log.info("fetched " + feed.getUri());
        return feed;
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (FeedException e) {
        e.printStackTrace();
    } catch (FetcherException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:guineu.modules.dataanalysis.anova.AnovaTestTask.java

private double anova(List<String> groups, PeakListRow row) {
    try {/*www.j ava 2 s  .  c o  m*/
        DescriptiveStatistics stats1 = new DescriptiveStatistics();
        List<double[]> classes = new ArrayList<double[]>();
        for (String group : groups) {
            List<Double> values = new ArrayList<Double>();
            for (String name : dataset.getAllColumnNames()) {
                if (dataset.getParametersValue(name, parameter) != null
                        && dataset.getParametersValue(name, parameter).equals(group)) {
                    try {
                        values.add((Double) row.getPeak(name));
                        stats1.addValue((Double) row.getPeak(name));
                    } catch (Exception e) {
                        System.out.println(row.getPeak(name));
                    }

                }
            }
            double[] valuesArray = new double[values.size()];
            for (int i = 0; i < values.size(); i++) {
                valuesArray[i] = values.get(i).doubleValue();
            }

            classes.add(valuesArray);
        }

        if (stats1.getVariance() == 0)
            return -1;
        return TestUtils.oneWayAnovaPValue(classes);
    } catch (IllegalArgumentException ex) {
        ex.printStackTrace();
        return -1;
    } catch (MathException ex) {
        ex.printStackTrace();
        return -1;
    }
}

From source file:com.projity.functor.ReflectionPredicate.java

public boolean evaluate(Object arg0) {
    try {//from www . j  a v  a 2 s  .  com
        return ((Boolean) method.invoke(arg0, null)).booleanValue();
    } catch (IllegalArgumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return false;
}

From source file:io.seventyone.mongoutils.MongoConverterImplementation.java

@Override
public <T> T entityFrom(Document document, Class<T> entityClass) {

    if (document == null || entityClass == null) {
        return null;
    }// ww  w  .j a  va 2  s  .  c  o  m

    T entity = null;
    try {
        entity = getObjectMapper().convertValue(document, entityClass);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    }

    return entity;
}

From source file:io.seventyone.mongoutils.MongoConverterImplementation.java

@Override
public Document documentFrom(Object object) {

    if (object == null) {
        return null;
    }/*from w w w .j a v  a  2  s .com*/

    Document document = null;
    try {
        document = getObjectMapper().convertValue(object, Document.class);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    }

    return document;
}

From source file:org.kalypso.model.wspm.core.gml.classifications.Style.java

@Override
public TYPE getType() {
    final String typeName = getParameterValue(IStyleParameterConstants.PARAMETER_TYPE);
    if (StringUtils.isBlank(typeName))
        return null;

    try {/*from  ww w  .jav a  2 s .c o  m*/
        return IStyleParameterConstants.TYPE.valueOf(typeName);
    } catch (final IllegalArgumentException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:org.jnrain.mobile.SettingsFragmentAdapter.java

public void addItem(int xmlId, int titleResId, Class<? extends PreferenceListFragment> klass) {
    PreferenceListFragment frag;/*from  ww w  .  j a  va 2  s.  co m*/
    try {
        frag = (PreferenceListFragment) klass.getConstructor(int.class).newInstance(xmlId);
    } catch (IllegalArgumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return;
    } catch (InstantiationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return;
    } catch (IllegalAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return;
    } catch (InvocationTargetException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return;
    } catch (NoSuchMethodException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return;
    }

    // retain state
    frag.setRetainInstance(true);

    _contents.add(frag);
    _titles.add(_ctx.getString(titleResId));

    notifyDataSetChanged();
}