List of usage examples for org.apache.commons.lang3.exception ContextedRuntimeException addContextValue
@Override public ContextedRuntimeException addContextValue(final String label, final Object value)
From source file:com.rodaxsoft.junit.mailgun.MemberDetailsConverter.java
@Override public <T> T convert(Class<T> type, Object value) { MemberDetails details = null;/* w w w . jav a 2s .c om*/ if (value instanceof JSONObject) { JSONObject obj = (JSONObject) value; details = new MemberDetails(); try { BeanUtils.populate(details, obj); } catch (IllegalAccessException | InvocationTargetException e) { ContextedRuntimeException cre; cre = new ContextedRuntimeException("Bean population error", e); cre.addContextValue("value", obj); throw cre; } } return type.cast(details); }
From source file:com.rodaxsoft.http.JerseyRESTConnection.java
/** * Validates the <code>invocationBuilder</code> *//* w w w .j a v a 2 s . c o m*/ private void validate() { if (null == invocationBuilder) { ContextedRuntimeException cre = new ContextedRuntimeException("Must configure request before invoking"); cre.addContextValue("URI", webTarget.getUri()); cre.addContextValue("target", webTarget.toString()); throw cre; } }
From source file:com.wolvereness.bluebutton.Version.java
/** * @param properties The properties to load from * @throws UnsupportedEncodingException If UTF8 isn't supported *///from w ww. ja v a 2s . com public Version(final Properties properties) throws UnsupportedEncodingException { try { this.branch = getProperty(properties, "git.branch"); this.buildTime = getProperty(properties, "git.build.time"); this.buildUserEmail = getProperty(properties, "git.build.user.email"); this.buildUserName = getProperty(properties, "git.build.user.name"); this.commitId = getProperty(properties, "git.commit.id"); this.commitMessageFull = getProperty(properties, "git.commit.message.full"); this.commitMessageShort = getProperty(properties, "git.commit.message.short"); this.commitTime = getProperty(properties, "git.commit.time"); this.commitUserEmail = getProperty(properties, "git.commit.user.email"); this.commitUserName = getProperty(properties, "git.commit.user.name"); this.describe = getProperty(properties, "git.commit.id.describe"); } catch (final Throwable t) { final ContextedRuntimeException ex = new ContextedRuntimeException("Failed to read properties", t); for (final Entry<Object, Object> entry : properties.entrySet()) { ex.addContextValue(entry.getKey() == null ? null : entry.getKey().toString(), entry.getValue()); } throw ex; } }
From source file:org.force66.cxfutils.reflect.ReflectUtils.java
public static Object safeInvokeExactMethod(final Object object, final String methodName, Object... args) { try {//from w w w .j av a2s . co m return MethodUtils.invokeExactMethod(object, methodName, args); } catch (Exception e) { ContextedRuntimeException ce = new ContextedRuntimeException("Error invoking method", e) .addContextValue("methodName", methodName).addContextValue("object", object); if (args != null) { for (int offset = 0; offset < args.length; offset++) { ce.addContextValue("arg " + offset, args[offset]); } } throw ce; } }