Example usage for java.lang IllegalArgumentException getMessage

List of usage examples for java.lang IllegalArgumentException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:de.innovationgate.wgpublisher.design.fs.AbstractDesignFile.java

public void processDesignHeader(String line, DesignMetadataInfo md)
        throws InstantiationException, IllegalAccessException, IOException, WGDesignSyncException {

    if (line.startsWith("##MDFILE")) {
        //getOrCreateMetadataFile();
    } else {/*from ww w  .j a  v a 2  s  .c om*/
        try {
            md.processDesignHeader(line);
        }
        // Thrown on problems parsing the design header
        catch (IllegalArgumentException e) {
            getLog().error(e.getMessage());
        }
    }

}

From source file:jurbano.melodyshape.ui.ConsoleUIObserver.java

/**
 * {@inheritDoc}//from   ww  w .  j  a v  a 2  s . c  o  m
 */
@Override
public void start() {
    /**
     * Parse Command Line Options
     */
    boolean parsed = this.parseArguments();
    if (!parsed)
        System.exit(1);

    if (this.hOpt) {
        this.printUsage(this.options);
        return;
    }

    // queries
    ArrayList<Melody> queries = null;
    try {
        this.verbose(2, "Reading queries...");
        queries = MelodyShape.readQueries(this.qOpt);
        this.verbose(2, "done (" + queries.size() + " melodies).\n");
    } catch (IllegalArgumentException ex) {
        System.err.println("Error: " + ex.getMessage());
        System.exit(1);
    }
    // documents
    MelodyCollection coll = null;
    try {
        this.verbose(2, "Reading collection...");
        coll = MelodyShape.readCollection(this.cOpt);
        this.verbose(2, "done (" + coll.size() + " melodies).\n");
    } catch (IllegalArgumentException ex) {
        System.err.println("Error: " + ex.getMessage());
        System.exit(1);
    }
    // algorithm
    this.verbose(2, "Instantiating algorithm...");
    MelodyComparer comparer = MelodyShape.getMainComparer(this.aOpt, coll);
    ResultRanker ranker = MelodyShape.getMainRanker(this.aOpt, coll);
    MelodyComparer comparerRerank = MelodyShape.getRerankComparer(this.aOpt, coll); // for 201x-shapetime
    ResultRanker rankerRerank = MelodyShape.getRerankRanker(this.aOpt, coll); // for 201x-shapetime

    this.verbose(2, "done.\n\n");
    this.verbose(2, "  Comparer: " + comparer.getName() + "\n");
    if (this.aOpt.equals("2012-shapetime") || this.aOpt.equals("2013-shapetime")
            || this.aOpt.equals("2014-shapetime") || this.aOpt.equals("2015-shapetime"))
        this.verbose(2, "    Ranker: " + comparerRerank.getName() + "\n");
    else
        this.verbose(2, "    Ranker: " + ranker.getName() + "\n");
    this.verbose(2, "   Threads: " + this.tOpt + "\n");

    /**
     * Run Algorithm
     **/
    for (int queryNum = 0; queryNum < queries.size(); queryNum++) {
        Melody query = queries.get(queryNum);

        this.verbose(1, "(" + (queryNum + 1) + "/" + queries.size() + ") " + query.getId() + "...");
        this.verbose(2, "(" + (queryNum + 1) + "/" + queries.size() + ") " + query.getId() + ":");

        long before = System.currentTimeMillis();
        Result[] results = MelodyShape.runAlgorithm(comparer, comparerRerank, ranker, rankerRerank, this.kOpt,
                queries, queryNum, coll, this.tOpt, this);
        long after = System.currentTimeMillis();

        this.verbose(1, "done.\n");
        this.verbose(2, "done (" + (after - before) / 1000 + " sec).\n");

        this.printResults(queries, queryNum, results);
    }
}

From source file:cz.PA165.vozovyPark.dao.ServiceIntervalDAOTest.java

/**
 *
 *//*from   w ww . j av a 2s.  co  m*/
@Test
public void testCreateWithNullArgument() {
    try {
        serviceIntervalDAO.createSI(null);
        Assert.fail("Exception for null argument was not throwed!");
    } catch (IllegalArgumentException ex) {
    } catch (Exception ex) {
        Assert.fail("Unknown exception type was throwed: " + ex + " " + ex.getMessage());
    }
}

From source file:cz.PA165.vozovyPark.dao.ServiceIntervalDAOTest.java

/**
 *
 *//*from  w ww.  ja  v a2s.  com*/
@Test
public void testUpdateWithNullArgument() {
    try {
        serviceIntervalDAO.updateSI(null);
        Assert.fail("Exception for null argument was not throwed!");
    } catch (IllegalArgumentException ex) {
    } catch (Exception ex) {
        Assert.fail("Unknown exception type was throwed: " + ex + " " + ex.getMessage());
    }
}

From source file:cz.PA165.vozovyPark.dao.ServiceIntervalDAOTest.java

/**
 *
 *///from   w w w .  ja v  a2 s. com
@Test
public void testRemoveWithNullArgument() {
    try {
        serviceIntervalDAO.removeSI(null);
        Assert.fail("Exception for null argument was not throwed!");
    } catch (IllegalArgumentException ex) {
    } catch (Exception ex) {
        Assert.fail("Unknown exception type was throwed: " + ex + " " + ex.getMessage());
    }
}

From source file:cz.PA165.vozovyPark.dao.ServiceIntervalDAOTest.java

/**
 *
 *//*from   w  w  w.  java 2 s .c  om*/
@Test
public void testGetByIdWithNullArgument() {
    try {
        serviceIntervalDAO.getById(null);
        Assert.fail("Exception for null argument was not throwed!");
    } catch (IllegalArgumentException ex) {
    } catch (Exception ex) {
        Assert.fail("Unknown exception type was throwed: " + ex + " " + ex.getMessage());
    }
}

From source file:cz.PA165.vozovyPark.dao.ServiceIntervalDAOTest.java

/**
 *
 *//*  w ww .  ja  v a2  s . co m*/
@Test
public void testFindAllByVehicleWithNullArgument() {
    try {
        serviceIntervalDAO.findAllByVehicle(null);
        Assert.fail("Exception for null argument was not throwed!");
    } catch (IllegalArgumentException ex) {
    } catch (Exception ex) {
        Assert.fail("Unknown exception type was throwed: " + ex + " " + ex.getMessage());
    }
}

From source file:org.jolokia.client.request.J4pReadIntegrationTest.java

@Test
public void mbeanPattern() throws MalformedObjectNameException, J4pException {
    for (J4pReadRequest req : readRequests("*:type=attribute", "LongSeconds")) {
        J4pReadResponse resp = j4pClient.execute(req);
        assertEquals(1, resp.getObjectNames().size());
        Map respVal = resp.getValue();
        assertTrue(respVal.containsKey(itSetup.getAttributeMBean()));
        Map attrs = (Map) respVal.get(itSetup.getAttributeMBean());
        assertEquals(1, attrs.size());/*w  w  w  . ja va2  s.co m*/
        assertTrue(attrs.containsKey("LongSeconds"));

        Set<String> attrSet = new HashSet<String>(
                resp.getAttributes(new ObjectName(itSetup.getAttributeMBean())));
        assertEquals(1, attrSet.size());
        assertTrue(attrSet.contains("LongSeconds"));

        try {
            resp.getAttributes(new ObjectName("blub:type=bla"));
            fail();
        } catch (IllegalArgumentException exp) {
            assertTrue(exp.getMessage().contains("blub:type=bla"));
        }

        try {
            resp.getAttributes();
            fail();
        } catch (IllegalArgumentException exp) {
            assertTrue(exp.getMessage().contains("*:type=attribute"));
        }

        try {
            resp.getValue("LongSeconds");
            fail();
        } catch (IllegalArgumentException exp) {
            assertTrue(exp.getMessage().contains("non-pattern"));
        }
    }
}

From source file:au.org.ala.delta.intkey.ui.CharacterValueInputDialog.java

@Action
public void characterValueInputDialog_Images() {
    try {/* www . j  a  v a  2s .c  o  m*/
        handleBtnImagesClicked();
    } catch (IllegalArgumentException ex) {
        // Display error message if unable to display
        ((Intkey) Application.getInstance())
                .displayErrorMessage(UIUtils.getResourceString("CouldNotDisplayImage.error", ex.getMessage()));
    }
}

From source file:ca.uhn.hunit.iface.AbstractJmsInterfaceImpl.java

/**
 * {@inheritDoc}//from   ww w. j  a  va 2s .  c o m
 */
@Override
protected void doStart() throws InterfaceWontStartException {
    try {
        myConnectionFactory = (ConnectionFactory) myConstructor
                .newInstance(myConstructorArgsTableModel.getArgArray());
    } catch (IllegalArgumentException e1) {
        throw new InterfaceWontStartException(this, e1.getMessage());
    } catch (InstantiationException e1) {
        throw new InterfaceWontStartException(this, e1.getMessage());
    } catch (IllegalAccessException e1) {
        throw new InterfaceWontStartException(this, e1.getMessage());
    } catch (InvocationTargetException e1) {
        throw new InterfaceWontStartException(this, e1.getMessage());
    }

    myConnectionFactory = new JmsConnectionFactory(myConnectionFactory, myUsername, myPassword);
    myJmsTemplate = new JmsTemplate(myConnectionFactory);
    myJmsTemplate.setReceiveTimeout(1000);
    myJmsTemplate.setPubSubDomain(myPubSubDomain);
}