Example usage for java.lang RuntimeException getMessage

List of usage examples for java.lang RuntimeException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSaxLoader.CFAsteriskSaxLoaderTenantHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {//w w  w  .  j  a v  a2  s . c o  m
        final String S_ProcName = "startElement";
        assert qName.equals("Tenant");

        CFAsteriskSaxLoader saxLoader = (CFAsteriskSaxLoader) getParser();
        if (saxLoader == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFAsteriskSchemaObj schemaObj = saxLoader.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        CFLibXmlCoreContext curContext = getParser().getCurContext();

        ICFSecurityTenantObj useTenant = saxLoader.getUseTenant();
        if (useTenant == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "saxLoader.useTenant");
        }

        curContext.putNamedValue("Object", useTenant);
    } catch (RuntimeException e) {
        throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    } catch (Error e) {
        throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    }
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamSaxLoader.CFBamSaxLoaderClusterHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {// w w  w  .j av a  2s  . c  o  m
        final String S_ProcName = "startElement";
        assert qName.equals("Cluster");

        CFBamSaxLoader saxLoader = (CFBamSaxLoader) getParser();
        if (saxLoader == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFBamSchemaObj schemaObj = saxLoader.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        CFLibXmlCoreContext curContext = getParser().getCurContext();

        ICFSecurityClusterObj useCluster = saxLoader.getUseCluster();
        if (useCluster == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "saxLoader.useCluster");
        }

        curContext.putNamedValue("Object", useCluster);
    } catch (RuntimeException e) {
        throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    } catch (Error e) {
        throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    }
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_9.CFBamSaxLoader.CFBamSaxLoaderTenantHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {//from w w  w .  j  a  va2 s  .co  m
        final String S_ProcName = "startElement";
        assert qName.equals("Tenant");

        CFBamSaxLoader saxLoader = (CFBamSaxLoader) getParser();
        if (saxLoader == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFBamSchemaObj schemaObj = saxLoader.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        CFLibXmlCoreContext curContext = getParser().getCurContext();

        ICFSecurityTenantObj useTenant = saxLoader.getUseTenant();
        if (useTenant == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "saxLoader.useTenant");
        }

        curContext.putNamedValue("Object", useTenant);
    } catch (RuntimeException e) {
        throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    } catch (Error e) {
        throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew "
                + e.getClass().getName() + " - " + e.getMessage(), e);
    }
}

From source file:com.thoughtworks.go.server.service.ServerConfigService.java

public void updateServerConfig(MailHost mailHost, LdapConfig ldapConfig, PasswordFileConfig passwordFileConfig,
        String artifactsDir, Double purgeStart, Double purgeUpto, String jobTimeout,
        boolean shouldAllowAutoLogin, String siteUrl, String secureSiteUrl, String taskRepositoryLocation,
        final HttpLocalizedOperationResult result, final String md5) {
    Context context = metricsProbeService.begin(ProbeType.SAVE_CONFIG_XML_THROUGH_SERVER_CONFIGURATION_TAB);
    try {// ww  w .ja v a 2  s . c o  m
        if (!mailHost.equals(new MailHost(new GoCipher()))) {
            validate(mailHost, result);
        }

        if (shouldAllowAutoLogin == false && !userService.canUserTurnOffAutoLogin()) {
            result.notAcceptable(LocalizedMessage.string("CANNOT_TURN_OFF_AUTO_LOGIN"));
            return;
        }

        if (result.isSuccessful()) {
            try {
                ConfigSaveState configSaveState = goConfigService.updateServerConfig(mailHost, ldapConfig,
                        passwordFileConfig, shouldAllowAutoLogin, md5, artifactsDir, purgeStart, purgeUpto,
                        jobTimeout, siteUrl, secureSiteUrl, taskRepositoryLocation);
                if (ConfigSaveState.MERGED.equals(configSaveState)) {
                    result.setMessage(LocalizedMessage.composite(
                            LocalizedMessage.string("SAVED_CONFIGURATION_SUCCESSFULLY"),
                            LocalizedMessage.string("CONFIG_MERGED")));
                } else if (ConfigSaveState.UPDATED.equals(configSaveState)) {
                    result.setMessage(LocalizedMessage.string("SAVED_CONFIGURATION_SUCCESSFULLY"));
                }
            } catch (RuntimeException exception) {
                updateFailed(exception.getMessage(), result);
            }
        }
    } finally {
        metricsProbeService.end(ProbeType.SAVE_CONFIG_XML_THROUGH_SERVER_CONFIGURATION_TAB, context);
    }
}

From source file:org.codehaus.groovy.grails.plugins.springsecurity.facebook.FacebookAuthenticationProcessingFilter.java

/**
 * Build an authentication from a login <code>auth_token</code>.
 * @param authToken  the <code>auth_token</code>
 * @param request  the http request/*w w w.j a  va  2s .  c  om*/
 * @param response  the http response
 * @param apiKey  the API key
 * @param secretKey  the secret key
 * @return  the auth token
 */
protected FacebookAuthenticationToken createToken(final String authToken, final HttpServletRequest request,
        final HttpServletResponse response, final String apiKey, final String secretKey) {

    try {
        FacebookWebappHelper<Document> helper = FacebookWebappHelper.newInstanceXml(request, response, apiKey,
                secretKey);

        if (helper.isLogin()) {
            String sessionKey = helper.doGetSession(authToken);
            return new FacebookAuthenticationToken(helper.getUser().longValue(), sessionKey);
        }

        return new FacebookAuthenticationToken(FacebookAuthenticationToken.Status.failure, null);
    } catch (RuntimeException e) {
        return new FacebookAuthenticationToken(FacebookAuthenticationToken.Status.error, e.getMessage());
    }
}

From source file:com.francetelecom.clara.cloud.activation.plugin.cf.infrastructure.FileFetcherUtil.java

public String getDeployableType(String filename) {
    String filetype;//  www  .j ava 2  s . c om
    try {
        filetype = filename.substring(filename.lastIndexOf(".") + 1);
    } catch (RuntimeException e) {
        throw new TechnicalException("IAAS cargo deployment : incorrect file type, error=" + e.getMessage());
    }
    if ("xml".equals(filetype)) {
        filetype = "file";
    } else if ("jar".equals(filetype)) {
        filetype = "bundle";
    } else if (!"ear".equals(filetype) && !"rar".equals(filetype)) {
        throw new TechnicalException("IAAS cargo deployment : incorrect file type (" + filetype + ")");
    }
    return filetype;
}

From source file:com.gemstone.gemfire.management.internal.RestAgent.java

public synchronized void start(GemFireCacheImpl cache) {
    if (!this.running && this.config.getHttpServicePort() != 0 && !isManagementRestServiceRunning(cache)) {
        try {//from ww  w .  j  a v a  2  s.co m
            startHttpService();
            this.running = true;
            cache.setRESTServiceRunning(true);

            // create region to hold query information (queryId, queryString). Added
            // for the developer REST APIs
            RestAgent.createParameterizedQueryRegion();

        } catch (RuntimeException e) {
            logger.debug(e.getMessage(), e);
        }
    }

}

From source file:com.googlecode.ehcache.annotations.integration.CacheableTest.java

@Test
public void testExceptionCaching() {
    Assert.assertEquals(0, cacheableTestInterface.interfaceAnnotatedExceptionCachedCount());
    Assert.assertEquals(0, cacheableTestInterface.interfaceAnnotatedExceptionCachedThrowsCount());

    Assert.assertEquals("interfaceAnnotatedExceptionCached(false)",
            cacheableTestInterface.interfaceAnnotatedExceptionCached(false));
    Assert.assertEquals(1, cacheableTestInterface.interfaceAnnotatedExceptionCachedCount());
    Assert.assertEquals(0, cacheableTestInterface.interfaceAnnotatedExceptionCachedThrowsCount());

    Assert.assertEquals("interfaceAnnotatedExceptionCached(false)",
            cacheableTestInterface.interfaceAnnotatedExceptionCached(false));
    Assert.assertEquals(1, cacheableTestInterface.interfaceAnnotatedExceptionCachedCount());
    Assert.assertEquals(0, cacheableTestInterface.interfaceAnnotatedExceptionCachedThrowsCount());

    try {/*from  www .ja va2  s. c o  m*/
        cacheableTestInterface.interfaceAnnotatedExceptionCached(true);
        Assert.fail("interfaceAnnotatedExceptionCached(true) should have thrown an exception");
    } catch (RuntimeException re) {
        Assert.assertEquals("throwsException was true", re.getMessage());
    }
    Assert.assertEquals(1, cacheableTestInterface.interfaceAnnotatedExceptionCachedCount());
    Assert.assertEquals(1, cacheableTestInterface.interfaceAnnotatedExceptionCachedThrowsCount());

    try {
        cacheableTestInterface.interfaceAnnotatedExceptionCached(true);
        Assert.fail("interfaceAnnotatedExceptionCached(true) should have thrown an exception");
    } catch (RuntimeException re) {
        Assert.assertEquals("throwsException was true", re.getMessage());
    }
    Assert.assertEquals(1, cacheableTestInterface.interfaceAnnotatedExceptionCachedCount());
    Assert.assertEquals(1, cacheableTestInterface.interfaceAnnotatedExceptionCachedThrowsCount());
}

From source file:org.n52.cario.gep.inbound.TrackInboundAdapter.java

@Override
protected synchronized GeoEvent createGeoEvent(InputStream input) {
    try {//from   w w  w. j a v a 2s.c o  m
        int preSize = this.eventQueue.size();
        logger.debug("Queue size before: {}", preSize);
        Map<?, ?> json = JsonUtil.createJson(input);
        int jsonFeatureCount = appendFeaturesToQueue(json);
        logger.debug("# of features in track's JSON: {}", jsonFeatureCount);
        logger.debug("Queue size after: {}", this.eventQueue.size());

        if ((this.eventQueue.size() - preSize) != jsonFeatureCount) {
            logger.warn("Could not process every feature of the Track. Expected {} but processed {}",
                    jsonFeatureCount, this.eventQueue.size() - preSize);
        }

        return this.eventQueue.poll();
    } catch (RuntimeException e) {
        logger.warn(e.getMessage(), e);
        return null;
    } catch (IOException e) {
        logger.warn(e.getMessage(), e);
        return null;
    }
}

From source file:jenkins.plugins.coverity.CoverityTool.CovAnalyzeCommandTest.java

@Test
public void additionalArgumentsTest_WithParseException() throws IOException, InterruptedException {
    InvocationAssistance invocationAssistance = new InvocationAssistanceBuilder().withAnalyzeArguments("\'")
            .build();/*www. j  a v a2  s .c o m*/
    CoverityPublisher publisher = new CoverityPublisherBuilder().withInvocationAssistance(invocationAssistance)
            .build();

    Command covAnalyzeCommand = new CovAnalyzeCommand(build, launcher, listener, publisher, StringUtils.EMPTY,
            envVars);
    try {
        covAnalyzeCommand.runCommand();
        fail("RuntimeException should have been thrown");
    } catch (RuntimeException e) {
        assertEquals("ParseException occurred during tokenizing the cov analyze additional arguments.",
                e.getMessage());
    }
}