Example usage for java.lang RuntimeException getClass

List of usage examples for java.lang RuntimeException getClass

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsg.CFAccXMsgSchemaMessageFormatter.java

public static String formatRspnException(String separator, RuntimeException e) {
    String retval = "<RspnException "
            + CFLibXmlUtil.formatRequiredXmlString(null, "Name", e.getClass().getName())
            + CFLibXmlUtil.formatRequiredXmlString(separator, "Message", e.getMessage()) + " />";
    return (retval);
}

From source file:com.diversityarrays.kdxplore.KDXplore.java

private static void doStaticInitChecks(boolean quiet) {
    try {//  w w w . ja  v a  2  s.c  o  m
        KdxConstants.runStaticInitChecks(true, quiet);
    } catch (RuntimeException e) {
        String msg = e.getClass().getName() + "\n" + e.getMessage(); //$NON-NLS-1$
        // deliberately NOT using MsgBox here
        JTextArea ta = new JTextArea(msg);
        ta.setEditable(false);
        JOptionPane.showMessageDialog(null, new JScrollPane(ta), "KDXplore Initialisation Error", //$NON-NLS-1$
                JOptionPane.ERROR_MESSAGE);
        System.exit(1);
    }
}

From source file:com.shigengyu.hyperion.services.WorkflowExecutionServiceImpl.java

private static final TransitionCompensationResult compensate(final WorkflowInstance workflowInstance,
        final WorkflowTransition transition, final RuntimeException e) {

    TransitionCompensationResult finalResult = TransitionCompensationResult.notCompensated();

    for (TransitionCompensation compensation : transition.getTransitionCompensations()) {
        if (!compensation.getException().isAssignableFrom(e.getClass())) {
            continue;
        }//from  w  w w  .  j ava  2 s.c  om

        TransitionCompensator compensator = compensation.getTransitionCompensator();
        if (compensator.canHandle(e)) {
            TransitionCompensationResult result = compensator.compensate(workflowInstance);
            if (result.getStatus() == Status.FAILED) {
                return result;
            } else {
                finalResult = result;
            }
        }
    }

    return finalResult;
}

From source file:org.taverna.server.master.utils.RuntimeExceptionWrapper.java

/**
 * Map an unexpected exception to one that can be correctly reported as a
 * problem.//from  ww w.java2  s .  c  om
 * 
 * @param exn
 *            The runtime exception being trapped.
 * @throws GeneralFailureException
 *             The known exception type that it is mapped to.
 */
@AfterThrowing(pointcut = "execution(* org.taverna.server.master.rest..*(..)) && !bean(*Provider.*)", throwing = "exn")
public void wrapRuntimeException(RuntimeException exn) throws GeneralFailureException {
    // Exclude security-related exceptions
    if (exn.getClass().getName().startsWith("org.springframework.security."))
        return;
    throw new GeneralFailureException(exn);
}

From source file:de.kaiserpfalzEdv.vaadin.PresentationHelper.java

@Subscribe
public void navigateTo(NavigateToEvent event) {
    LOG.debug("Navigate to: {}", event);

    try {/*from  ww w  .  j av a2s  .com*/
        UI.getCurrent().getNavigator().navigateTo(event.getPayload());
    } catch (RuntimeException e) {
        LOG.error(e.getClass().getSimpleName() + " caught: " + e.getMessage(), e);

        NotificationPayload error = new NotificationPayload(e.getMessage())
                .setCaption("error.navigation.generic-failure.caption");
        error(new ErrorNotificationEvent(this, error));
    }
}

From source file:com.expedia.seiso.web.controller.ExceptionHandlerAdvice.java

@ExceptionHandler(RuntimeException.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody/*  w w  w.  j  a va 2  s. c  om*/
public ErrorObject handleRuntimeException(RuntimeException e, WebRequest request) {
    log.error("Internal server error", e);
    val fullMsg = e.getClass().getName() + ": " + e.getMessage();
    return new ErrorObject(C.EC_INTERNAL_ERROR, fullMsg);
}

From source file:com.hybris.integration.controller.base.ApiExceptionHandler.java

@ExceptionHandler(RuntimeException.class)
@ResponseBody//from   w w  w .  j  a v a 2s . c o  m
public TmallAppResponse handleUnexpectedServerError(RuntimeException ex) {
    TmallAppResponse response = new TmallAppResponse();
    response.setCode(ResponseCode.INTERNAL_SERVER_ERROR.getCode());
    response.setMsg(ex.getClass().toString() + ":" + ex.getMessage());
    LOGGER.error(ex.getMessage(), ex);
    return response;
}

From source file:org.jugvale.peoplemanagement.client.service.RESTPersonService.java

private void handle(java.lang.RuntimeException e, Consumer<String> onFail) {
    e.printStackTrace();//from ww  w  .jav  a  2s.  c  om
    onFail.accept("Error: " + e.getMessage() + "; Exception: " + e.getClass().getSimpleName());
}

From source file:com._4dconcept.springframework.data.marklogic.core.MarklogicExceptionTranslator.java

@Override
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {

    // Check for well-known MarklogicException subclasses.

    String exception = ClassUtils.getShortName(ClassUtils.getUserClass(ex.getClass()));

    if (RESOURCE_FAILURE_EXCEPTIONS.contains(exception)) {
        return new DataAccessResourceFailureException(ex.getMessage(), ex);
    }/*from  ww  w  .j  ava  2s .  c  o m*/

    if (RESOURCE_USAGE_EXCEPTIONS.contains(exception)) {
        return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex);
    }

    if (DATA_INTEGRETY_EXCEPTIONS.contains(exception)) {
        return new DataIntegrityViolationException(ex.getMessage(), ex);
    }

    return null;
}

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

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

        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();

        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);
    }
}