javax.management.RuntimeMBeanException.getTargetException()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(11.2k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中javax.management.RuntimeMBeanException.getTargetException方法的一些代码示例,展示了RuntimeMBeanException.getTargetException的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RuntimeMBeanException.getTargetException方法的具体详情如下:
包路径:javax.management.RuntimeMBeanException
类名称:RuntimeMBeanException
方法名:getTargetException

RuntimeMBeanException.getTargetException介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

throw ex.getTargetException();
  throw ((RuntimeMBeanException) rex).getTargetException();

代码示例来源:origin: org.springframework/spring-context

throw ex.getTargetException();
  throw ((RuntimeMBeanException) rex).getTargetException();

代码示例来源:origin: rhuss/jolokia

@SuppressWarnings({ "PMD.AvoidCatchingThrowable", "PMD.AvoidInstanceofChecksInCatchClause" })
private void handle(ServletRequestHandler pReqHandler,HttpServletRequest pReq, HttpServletResponse pResp) throws IOException {
  JSONAware json = null;
  try {
    // Check access policy
    requestHandler.checkAccess(allowDnsReverseLookup ? pReq.getRemoteHost() : null,
                  pReq.getRemoteAddr(),
                  getOriginOrReferer(pReq));
    // If a callback is given, check this is a valid javascript function name
    validateCallbackIfGiven(pReq);
    // Remember the agent URL upon the first request. Needed for discovery
    updateAgentDetailsIfNeeded(pReq);
    // Dispatch for the proper HTTP request method
    json = handleSecurely(pReqHandler, pReq, pResp);
  } catch (Throwable exp) {
    try {
      json = requestHandler.handleThrowable(
        exp instanceof RuntimeMBeanException ? ((RuntimeMBeanException) exp).getTargetException() : exp);
    } catch (Throwable exp2) {
      exp2.printStackTrace();
    }
  } finally {
    setCorsHeader(pReq, pResp);
    if (json == null) {
      json = requestHandler.handleThrowable(new Exception("Internal error while handling an exception"));
    }
    sendResponse(pResp, pReq, json);
  }
}

代码示例来源:origin: rhuss/jolokia

exp instanceof RuntimeMBeanException ? ((RuntimeMBeanException) exp).getTargetException() : exp);
} finally {
  sendResponse(pExchange, parsedUri, json);

代码示例来源:origin: org.jboss.seam/jboss-seam

public Object handleRuntimeMBeanException(ProxyContext ctx,
                     RuntimeMBeanException e,
                     Method m, Object[] args)
                     throws Exception
{
 // target is always a runtime exception, so its ok to throw it from here
 throw e.getTargetException();
}

代码示例来源:origin: org.jboss.jbossas/jboss-as-j2se

public Object handleRuntimeMBeanException(ProxyContext ctx,
                     RuntimeMBeanException e,
                     Method m, Object[] args)
                     throws Exception
{
 // target is always a runtime exception, so its ok to throw it from here
 throw e.getTargetException();
}

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Invoke the method
 * @return the result returned by the step method, or VOID_RESULT if the step method has a void return type
 */
public Object invoke(final String stepTokenId, List<String> args) {
  Object result;
  try {
    result = proxy.invokeStep(remoteStepId, stepTokenId, args);
  } catch (RuntimeMBeanException mbe) {
    RuntimeException targetException = mbe.getTargetException();
    throw targetException;
  } catch (Exception e) {
    throw new ChorusException(e);
  }
  return result;
}

代码示例来源:origin: org.ow2.jonas/jonas-management-extensions

targetExc = ((ReflectionException) e).getTargetException();
} else if (e instanceof RuntimeMBeanException) {
  targetExc = ((RuntimeMBeanException) e).getTargetException();
} else if (e instanceof RuntimeOperationsException) {
  targetExc = ((RuntimeOperationsException) e).getTargetException();

代码示例来源:origin: org.jboss.test/jboss-test

log.error("RuntimeMbeanException", e.getTargetException());
throw e.getTargetException();

代码示例来源:origin: org.jboss/jboss-test

log.error("RuntimeMbeanException", e.getTargetException());
throw e.getTargetException();

代码示例来源:origin: org.jmx4perl/j4p

@SuppressWarnings("PMD.AvoidCatchingThrowable")
private void handle(ServletRequestHandler pReqHandler,HttpServletRequest pReq, HttpServletResponse pResp) throws IOException {
  JSONAware json = null;
  int code = 200; // Success
  try {
    // Check access policy
    requestHandler.checkClientIPAccess(pReq.getRemoteHost(),pReq.getRemoteAddr());
    // Dispatch for the proper HTTP request method
    json = pReqHandler.handleRequest(pReq,pResp);
    code = requestHandler.extractResultCode(json);
    if (backendManager.isDebug()) {
      backendManager.info("Response: " + json);
    }
  } catch (RuntimeMBeanException exp) {
    JSONObject error = requestHandler.handleThrowable(exp.getTargetException());
    code = (Integer) error.get("status");
    json = error;
  } catch (Throwable exp) {
    JSONObject error = requestHandler.handleThrowable(exp);
    code = (Integer) error.get("status");
    json = error;
  } finally {
    sendResponse(pResp,code,json.toJSONString());
  }
}

代码示例来源:origin: org.jolokia/jolokia-osgi

@SuppressWarnings({ "PMD.AvoidCatchingThrowable", "PMD.AvoidInstanceofChecksInCatchClause" })
private void handle(ServletRequestHandler pReqHandler,HttpServletRequest pReq, HttpServletResponse pResp) throws IOException {
  JSONAware json = null;
  try {
    // Check access policy
    requestHandler.checkAccess(allowDnsReverseLookup ? pReq.getRemoteHost() : null,
                  pReq.getRemoteAddr(),
                  getOriginOrReferer(pReq));
    // If a callback is given, check this is a valid javascript function name
    validateCallbackIfGiven(pReq);
    // Remember the agent URL upon the first request. Needed for discovery
    updateAgentDetailsIfNeeded(pReq);
    // Dispatch for the proper HTTP request method
    json = handleSecurely(pReqHandler, pReq, pResp);
  } catch (Throwable exp) {
    try {
      json = requestHandler.handleThrowable(
        exp instanceof RuntimeMBeanException ? ((RuntimeMBeanException) exp).getTargetException() : exp);
    } catch (Throwable exp2) {
      exp2.printStackTrace();
    }
  } finally {
    setCorsHeader(pReq, pResp);
    if (json == null) {
      json = requestHandler.handleThrowable(new Exception("Internal error while handling an exception"));
    }
    sendResponse(pResp, pReq, json);
  }
}

代码示例来源:origin: org.jolokia/jolokia-core

@SuppressWarnings({ "PMD.AvoidCatchingThrowable", "PMD.AvoidInstanceofChecksInCatchClause" })
private void handle(ServletRequestHandler pReqHandler,HttpServletRequest pReq, HttpServletResponse pResp) throws IOException {
  JSONAware json = null;
  try {
    // Check access policy
    requestHandler.checkAccess(allowDnsReverseLookup ? pReq.getRemoteHost() : null,
                  pReq.getRemoteAddr(),
                  getOriginOrReferer(pReq));
    // If a callback is given, check this is a valid javascript function name
    validateCallbackIfGiven(pReq);
    // Remember the agent URL upon the first request. Needed for discovery
    updateAgentDetailsIfNeeded(pReq);
    // Dispatch for the proper HTTP request method
    json = handleSecurely(pReqHandler, pReq, pResp);
  } catch (Throwable exp) {
    try {
      json = requestHandler.handleThrowable(
        exp instanceof RuntimeMBeanException ? ((RuntimeMBeanException) exp).getTargetException() : exp);
    } catch (Throwable exp2) {
      exp2.printStackTrace();
    }
  } finally {
    setCorsHeader(pReq, pResp);
    if (json == null) {
      json = requestHandler.handleThrowable(new Exception("Internal error while handling an exception"));
    }
    sendResponse(pResp, pReq, json);
  }
}

代码示例来源:origin: org.jboss.jbossas/jboss-as-j2se

/**
* Attempt to decode the given Throwable.  If it
* is a container JMX exception, then the target
* is returned.  Otherwise the argument is returned.
*/
public static Throwable decode(final Throwable t)
{
 Throwable result = t;
 
 while (true)
 {
   if (result instanceof MBeanException)
    result = ((MBeanException) result).getTargetException();
   else if (result instanceof ReflectionException)
    result = ((ReflectionException) result).getTargetException();
   else if (result instanceof RuntimeOperationsException)
    result = ((RuntimeOperationsException) result).getTargetException();
   else if (result instanceof RuntimeMBeanException)
    result = ((RuntimeMBeanException) result).getTargetException();
   else if (result instanceof RuntimeErrorException)
    result = ((RuntimeErrorException) result).getTargetError();
   else
    // can't decode
    break;
 }
 return result;
}

代码示例来源:origin: org.jboss.jbossas/jboss-as-mbeans

throw new MBeanException(e.getTargetException(), e.getMessage());

代码示例来源:origin: org.jboss.mx/jboss-mbeans

throw new MBeanException(e.getTargetException(), e.getMessage());

代码示例来源:origin: com.nesscomputing.components/ness-jmx

private void handle(final ServletRequestHandler reqHandler, final HttpServletRequest req, final HttpServletResponse resp) throws IOException
{
  JSONAware json = null;
  try {
    // Check access policy
    requestHandler.checkClientIPAccess(req.getRemoteHost(), req.getRemoteAddr());
    // Dispatch for the proper HTTP request method
    json = reqHandler.handleRequest(req, resp);
    if (backendManager.isDebug()) {
      backendManager.debug("Response: " + json);
    }
  } catch (RuntimeMBeanException rme) {
    json = requestHandler.handleThrowable(rme.getTargetException());
  } catch (Throwable exp) {
    json = requestHandler.handleThrowable(exp);
  } finally {
    final String callback = req.getParameter(ConfigKey.CALLBACK.getKeyValue());
    if (callback != null) {
      // Send a JSONP response
      sendResponse(resp, "text/javascript", callback + "(" + json.toJSONString() +  ");");
    } else {
      sendResponse(resp, "application/json", json.toJSONString());
    }
  }
}

代码示例来源:origin: org.jolokia/jolokia-server-core

@SuppressWarnings({ "PMD.AvoidCatchingThrowable", "PMD.AvoidInstanceofChecksInCatchClause" })
private void handle(ServletRequestHandler pReqHandler,HttpServletRequest pReq, HttpServletResponse pResp) throws IOException {
  JSONAware json = null;
  try {
    // Check access policy
    requestHandler.checkAccess(allowDnsReverseLookup ? pReq.getRemoteHost() : null,
                  pReq.getRemoteAddr(),
                  getOriginOrReferer(pReq));
    // Remember the agent URL upon the first request. Needed for discovery
    updateAgentDetailsIfNeeded(pReq);
    // Set back channel
    prepareBackChannel(pReq);
    // Dispatch for the proper HTTP request method
    json = handleSecurely(pReqHandler, pReq, pResp);
  } catch (EmptyResponseException exp) {
    // Nothing needs to be done
    return;
  } catch (Throwable exp) {
    json = requestHandler.handleThrowable(
        exp instanceof RuntimeMBeanException ? ((RuntimeMBeanException) exp).getTargetException() : exp);
  } finally {
    releaseBackChannel();
    setCorsHeader(pReq, pResp);
  }
  sendAnswer(pReq, pResp, json);
}

代码示例来源:origin: apache/felix

public void writeError(HttpOutputStream out, HttpInputStream in, Exception e) throws IOException
{
  Exception t = e;
  if (e instanceof RuntimeMBeanException)
  {
    t = ((RuntimeMBeanException)e).getTargetException();
  }
  XSLTProcessor.log(LogService.LOG_INFO,"Processing error " + t.getMessage(),null);
  if (t instanceof HttpException)
  {
    processHttpException(in, out, (HttpException)e);
  }
  else if ((t instanceof MBeanException) && (((MBeanException)t).getTargetException() instanceof HttpException))
  {
    processHttpException(in, out, (HttpException)((MBeanException)t).getTargetException());
  }
  else if ((t instanceof ReflectionException) && (((ReflectionException)t).getTargetException() instanceof HttpException))
  {
    processHttpException(in, out, (HttpException)((ReflectionException)t).getTargetException());
  }
  else
  {
    out.setCode(HttpConstants.STATUS_INTERNAL_ERROR);
    out.setHeader("Content-Type", "text/html");
    out.sendHeaders();
  }
}

代码示例来源:origin: mx4j/mx4j-tools

public void writeError(HttpOutputStream out, HttpInputStream in, Exception e) throws IOException
{
 Logger log = getLogger();
 Exception t = e;
 if (e instanceof RuntimeMBeanException)
 {
   t = ((RuntimeMBeanException)e).getTargetException();
 }
 if (log.isEnabledFor(Logger.DEBUG)) log.debug("Processing error " + t.getMessage());
 if (t instanceof HttpException)
 {
   processHttpException(in, out, (HttpException)t);
 }
 else if ((t instanceof MBeanException) && (((MBeanException)t).getTargetException() instanceof HttpException))
 {
   processHttpException(in, out, (HttpException)((MBeanException)t).getTargetException());
 }
 else if ((t instanceof ReflectionException) && (((ReflectionException)t).getTargetException() instanceof HttpException))
 {
   processHttpException(in, out, (HttpException)((ReflectionException)t).getTargetException());
 }
 else
 {
   out.setCode(HttpConstants.STATUS_INTERNAL_ERROR);
   out.setHeader("Content-Type", "text/html");
   out.sendHeaders();
 }
}

相关文章