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:edu.northwestern.bioinformatics.studycalendar.domain.delta.DeltaNodeTypeTest.java

public void testThereIsOneDeltaNodeTypePerDeltaClass() throws Exception {
    List<String> errors = new ArrayList<String>();
    for (Class<? extends Delta> deltaClass : domainReflections.getSubTypesOf(Delta.class)) {
        if (Modifier.isAbstract(deltaClass.getModifiers()) || deltaClass.isAnonymousClass())
            continue;
        try {// w  w  w  . j a va2  s. co  m
            DeltaNodeType.valueForDeltaClass(deltaClass);
        } catch (IllegalArgumentException iae) {
            errors.add(iae.getMessage());
        }
    }

    if (!errors.isEmpty()) {
        fail("* " + StringUtils.join(errors.iterator(), "\n* "));
    }
}

From source file:edu.northwestern.bioinformatics.studycalendar.domain.delta.DeltaNodeTypeTest.java

public void testThereIsOneDeltaNodeTypePerChangeableClass() throws Exception {
    List<String> errors = new ArrayList<String>();
    for (Class<? extends Changeable> cClass : domainReflections.getSubTypesOf(Changeable.class)) {
        if (Modifier.isAbstract(cClass.getModifiers()) || cClass.isAnonymousClass())
            continue;
        try {/*from w  ww  .  ja v a2  s  .  com*/
            DeltaNodeType.valueForNodeClass(cClass);
        } catch (IllegalArgumentException iae) {
            errors.add(iae.getMessage());
        }
    }

    if (!errors.isEmpty()) {
        fail("* " + StringUtils.join(errors.iterator(), "\n* "));
    }
}

From source file:com.github.fge.jsonschema.core.load.configuration.LoadingConfigurationBuilderTest.java

@Test
public void cannotPreloadSchemaWithoutTopLevelId() {
    try {/*from   w  w  w  .  j  av  a  2s. c o  m*/
        cfg.preloadSchema(JacksonUtils.nodeFactory().objectNode());
        fail("No exception thrown!!");
    } catch (IllegalArgumentException e) {
        assertEquals(e.getMessage(), BUNDLE.getMessage("loadingCfg.noIDInSchema"));
    }
}

From source file:com.github.fge.jsonschema.core.load.configuration.LoadingConfigurationBuilderTest.java

@Test
public void cannotRegisterIllegalScheme() {
    final String scheme = "+24";
    try {/*from  ww  w . j a v  a  2s .  c  om*/
        cfg.addScheme(scheme, downloader);
        fail("No exception thrown!!");
    } catch (IllegalArgumentException e) {
        assertEquals(e.getMessage(), BUNDLE.printf("loadingCfg.illegalScheme", scheme));
    }
}

From source file:com.github.fge.jsonschema.core.load.configuration.LoadingConfigurationBuilderTest.java

@Test
public void cannotOverwriteAnAlreadyPresentSchema() {
    final String input = "http://json-schema.org/draft-04/schema#";
    try {//ww w.  j a va  2  s  .co m
        cfg.preloadSchema(input, JacksonUtils.nodeFactory().objectNode());
        fail("No exception thrown!!");
    } catch (IllegalArgumentException e) {
        assertEquals(e.getMessage(), BUNDLE.printf("loadingCfg.duplicateURI", input));
    }
}

From source file:io.kamax.mxisd.backend.wordpress.WordpressAuthProvider.java

@Override
public BackendAuthResult authenticate(_MatrixID mxid, String password) {
    try {//from  w ww.j a  va2s  .c o  m
        WordpressAuthData data = wordpress.authenticate(mxid.getLocalPart(), password);
        BackendAuthResult result = new BackendAuthResult();
        if (StringUtils.isNotBlank(data.getUserEmail())) {
            result.withThreePid(new ThreePid("email", data.getUserEmail()));
        }
        result.succeed(mxid.getId(), UserIdType.MatrixID.getId(), data.getUserDisplayName());
        return result;
    } catch (IllegalArgumentException e) {
        log.error("Authentication failed for {}: {}", mxid.getId(), e.getMessage());
        return BackendAuthResult.failure();
    }

}

From source file:com.k42b3.quantum.worker.FeedWorker.java

@Override
protected void fetch(HttpClient httpClient) {
    try {//  ww  w .  jav a  2s.c  o m
        String url = worker.getParams().get("url");
        HttpGet httpGet = new HttpGet(url);
        if (worker.getLastRequest() != null) {
            httpGet.addHeader("If-Modified-Since", DateUtils.formatDate(worker.getLastRequest()));
        }

        logger.info("Request " + url);

        HttpResponse response = httpClient.execute(httpGet);

        SyndFeedInput input = new SyndFeedInput();
        SyndFeed feed = input.build(new InputStreamReader(response.getEntity().getContent()));
        List<SyndEntry> entries = feed.getEntries();

        for (int i = 0; i < entries.size(); i++) {
            SyndEntry entry = entries.get(i);

            Message message = new Message();
            message.setMid(entry.getUri());
            message.setUrl(entry.getLink());
            message.setMessage(entry.getTitle());
            message.setProducer(worker.getParams().get("url"));
            message.setDate(entry.getPublishedDate());

            queue.push(this, message);
        }
    } catch (IllegalArgumentException e) {
        logger.error(e.getMessage(), e);
    } catch (FeedException e) {
        logger.error(e.getMessage(), e);
    } catch (ClientProtocolException e) {
        logger.error(e.getMessage(), e);
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
}

From source file:org.inbio.ait.web.ajax.controller.SelectAllController.java

@Override
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
    String layer = request.getParameter("layer");
    String errorMsj = "Error con los parmetros: " + layer;

    try {/*from ww w.  ja v  a  2s  .  co m*/
        //Get the list of polygons
        List<Polygon> polygons = this.allPolygonsManager.getAllPolygons(layer);
        return writeReponse(request, response, polygons);

    } catch (IllegalArgumentException iae) {
        throw new Exception(errorMsj + " " + iae.getMessage());
    }
}

From source file:com.espertech.esper.schedule.TestScheduleSpec.java

private void assertInvalid(EnumMap<ScheduleUnit, SortedSet<Integer>> unitValues) {
    try {/*from  w ww .  ja  v a2s.  c o  m*/
        new ScheduleSpec(unitValues, null, null, null);
        assertFalse(true);
    } catch (IllegalArgumentException ex) {
        log.debug(".assertInvalid Expected exception, msg=" + ex.getMessage());
        // Expected exception
    }
}

From source file:com.wisemapping.rest.BaseController.java

@ExceptionHandler(IllegalArgumentException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)//from www  .  j  a  va2s  . c  o  m
@ResponseBody
public RestErrors handleClientErrors(@NotNull IllegalArgumentException ex) {
    System.err.println(ex.getMessage());
    return new RestErrors(ex.getMessage(), Severity.WARNING);
}