本文整理了Java中java.lang.SecurityException.getCause()
方法的一些代码示例,展示了SecurityException.getCause()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SecurityException.getCause()
方法的具体详情如下:
包路径:java.lang.SecurityException
类名称:SecurityException
方法名:getCause
暂无
代码示例来源:origin: oracle/helidon
private AuthenticationResponse cachedResponse(String token, Tracer tracer, SpanContext tracingSpan) {
try {
GoogleIdToken gToken = tokenParser.apply(jsonFactory, token);
GoogleIdToken.Payload payload = gToken.getPayload();
// validate timeout
if (verifyLocal(payload)) {
return subjectCache.computeValue(token,
() -> verifyGoogle(token, gToken, tracer, tracingSpan))
.map(CachedRecord::getSubject)
.map(AuthenticationResponse::success)
.orElseGet(() -> fail(null));
} else {
subjectCache.remove(token);
return fail(null);
}
} catch (SecurityException e) {
if (e.getCause() instanceof IOException) {
return failInvalidRequest((IOException) e.getCause());
}
return fail(e.getCause());
} catch (Exception e) {
return fail(e);
}
}
代码示例来源:origin: kiegroup/jbpm
private Object getValueOfField(String fieldname, Class<?> sourceClass, Object source ) {
String sourceClassName = sourceClass.getName();
Field field = null;
try {
field = sourceClass.getDeclaredField(fieldname);
field.setAccessible(true);
} catch (SecurityException e) {
fail("Unable to retrieve " + fieldname + " field from " + sourceClassName + ": " + e.getCause());
} catch (NoSuchFieldException e) {
fail("Unable to retrieve " + fieldname + " field from " + sourceClassName + ": " + e.getCause());
}
assertNotNull("." + fieldname + " field is null!?!", field);
Object fieldValue = null;
try {
fieldValue = field.get(source);
} catch (IllegalArgumentException e) {
fail("Unable to retrieve value of " + fieldname + " from " + sourceClassName + ": " + e.getCause());
} catch (IllegalAccessException e) {
fail("Unable to retrieve value of " + fieldname + " from " + sourceClassName + ": " + e.getCause());
}
return fieldValue;
}
代码示例来源:origin: kiegroup/jbpm
field.setAccessible(true);
} catch (SecurityException e) {
fail("Unable to retrieve " + fieldname + " field from " + sourceClassName + ": " + e.getCause());
} catch (NoSuchFieldException e) {
fail("Unable to retrieve " + fieldname + " field from " + sourceClassName + ": " + e.getCause());
代码示例来源:origin: resteasy/Resteasy
throw new ApplicationException(e.getCause());
代码示例来源:origin: org.jboss.weld.se/weld-se
public static void rethrowException(SecurityException e, Class<? extends RuntimeException> exceptionToThrow) {
rethrowException(e.getCause() != null ? e.getCause() : e, exceptionToThrow);
}
代码示例来源:origin: weld/core
public static void rethrowException(SecurityException e, Class<? extends RuntimeException> exceptionToThrow) {
rethrowException(e.getCause() != null ? e.getCause() : e, exceptionToThrow);
}
代码示例来源:origin: weld/core
public static void rethrowException(SecurityException e, Class<? extends RuntimeException> exceptionToThrow) {
rethrowException(e.getCause() != null ? e.getCause() : e, exceptionToThrow);
}
代码示例来源:origin: weld/core
public static void rethrowException(SecurityException e, Class<? extends RuntimeException> exceptionToThrow) {
rethrowException(e.getCause() != null ? e.getCause() : e, exceptionToThrow);
}
代码示例来源:origin: org.jboss.weld.se/weld-se-shaded
public static void rethrowException(SecurityException e, Class<? extends RuntimeException> exceptionToThrow) {
rethrowException(e.getCause() != null ? e.getCause() : e, exceptionToThrow);
}
代码示例来源:origin: org.jboss.weld.servlet/weld-servlet-shaded
public static void rethrowException(SecurityException e, Class<? extends RuntimeException> exceptionToThrow) {
rethrowException(e.getCause() != null ? e.getCause() : e, exceptionToThrow);
}
代码示例来源:origin: org.mobicents.core/mobicents-core-jar
/**
* Remove a link name binding from a resource adaptor entity.
*
* @param linkName
* the link name.
*/
public void removeRaLink(String linkName) throws Exception {
try {
if (linkName != null)
sci.invokeOperation("-removeRaLink", linkName, null, null);
} catch (java.lang.SecurityException seEx) {
// Log the error
log.error("Security Exception: " + sci.commandBean + "."
+ sci.commandString + "\n" + seEx.getCause().toString(),
seEx);
throw seEx;
} catch (Exception e) {
// Log the error
log.error("Bad result: " + sci.commandBean + "."
+ sci.commandString + "\n" + e.getCause().toString(), e);
throw e;
}
}
代码示例来源:origin: org.mobicents.core/mobicents-core-jar
/**
* Remove a profile table.
*
* @param profileTableName
* the name of the profile table to remove.
*/
public void removeProfileTable(String profileTableName) throws Exception {
try {
sci.invokeOperation("-removeProfileTable", profileTableName, null,
null);
} catch (java.lang.SecurityException seEx) {
// Log the error
log.error("Security Exception: " + sci.commandBean + "."
+ sci.commandString + "\n" + seEx.getCause().toString(),
seEx);
throw seEx;
} catch (Exception e) {
// Log the error
log.error("Bad result: " + sci.commandBean + "."
+ sci.commandString + "\n" + e.getCause().toString(), e);
throw e;
}
}
代码示例来源:origin: org.mobicents.core/mobicents-core-jar
/**
* Activate a Service. The Service must currently be in the
* ServiceState.INACTIVE state, and transitions to ServiceState.ACTIVE state
* during this method invocation.
*
* @param serviceId
* the component identifier of the Service.
*/
public void activateService(String serviceId) throws Exception {
try {
if (serviceId != null)
sci.invokeOperation("-activateService", serviceId, null, null);
} catch (java.lang.SecurityException seEx) {
// Log the error
log.error("Security Exception: " + sci.commandBean + "."
+ sci.commandString + "\n" + seEx.getCause().toString(),
seEx);
throw seEx;
} catch (Exception e) {
// Log the error
log.error("Bad result: " + sci.commandBean + "."
+ sci.commandString + "\n" + e.getCause().toString(), e);
throw e;
}
}
代码示例来源:origin: org.mobicents.core/mobicents-core-jar
/**
* Deactivate a resource adaptor entity. The resource adaptor entity must be
* in the ResourceAdaptorEntityState.ACTIVE state, and transitions to the
* ResourceAdaptorEntityState.STOPPING state during this method invocation.
* The resource adaptor entity spontaneously returns to the
* ResourceAdaptorEntityState.INACTIVE state once all activities created by
* the resource adaptor entity have ended.
*
* @param entityName
* the name of the resource adaptor entity.
*/
public void deactivateRaEntity(String entityName) throws Exception {
try {
if (entityName != null) {
sci.invokeOperation("-deactivateRaEntity", entityName, null,
null);
}
} catch (java.lang.SecurityException seEx) {
// Log the error
log.error("Security Exception: " + sci.commandBean + "."
+ sci.commandString + "\n" + seEx.getCause().toString(),
seEx);
throw seEx;
} catch (Exception e) {
// Log the error
log.error("Bad result: " + sci.commandBean + "."
+ sci.commandString + "\n" + e.getCause().toString(), e);
throw e;
}
}
代码示例来源:origin: org.mobicents.core/mobicents-core-jar
/**
* Uninstall the Service or RA
*
* @param url
*/
public void unInstall(String url) throws Exception {
try {
if (url != null)
sci.invokeOperation("-uninstall", StringPropertyReplacer
.replaceProperties(url), null, null);
} catch (java.lang.SecurityException seEx) {
// Log the error
log.error("Security Exception: " + sci.commandBean + "."
+ sci.commandString + "\n" + seEx.getCause().toString(),
seEx);
throw seEx;
} catch (Exception e) {
// Log the error
log.error("Bad result: " + sci.commandBean + "."
+ sci.commandString + "\n" + e.getCause().toString(), e);
throw e;
}
}
代码示例来源:origin: org.exoplatform.jcr/exo.jcr.component.core
/**
* {@inheritDoc}
*/
public void onCommit()
{
ChangesItem changesItem = pendingChanges.get();
try
{
pushChangesToCoordinator(changesItem.extractSyncChanges());
changesLog.add(changesItem);
}
catch (SecurityException e)
{
throw new IllegalStateException("Can't push changes to coordinator", e.getCause());
}
catch (RPCException e)
{
throw new IllegalStateException("Can't push changes to coordinator", e.getCause());
}
finally
{
pendingChanges.remove();
}
}
代码示例来源:origin: io.undertow/undertow-servlet
@Override
public void login(final String username, final String password) throws ServletException {
if (username == null || password == null) {
throw UndertowServletMessages.MESSAGES.loginFailed();
}
SecurityContext sc = exchange.getSecurityContext();
if (sc.isAuthenticated()) {
throw UndertowServletMessages.MESSAGES.userAlreadyLoggedIn();
}
boolean login = false;
try {
login = sc.login(username, password);
}
catch (SecurityException se) {
if (se.getCause() instanceof ServletException)
throw (ServletException) se.getCause();
throw new ServletException(se);
}
if (!login) {
throw UndertowServletMessages.MESSAGES.loginFailed();
}
}
代码示例来源:origin: apache/cxf
protected byte[] encryptInternal(JweEncryptionInternal state, byte[] content) {
try {
SecretKey createCekSecretKey = createCekSecretKey(state);
byte[] encryptedBytes = CryptoUtils.encryptBytes(content, createCekSecretKey, state.keyProps);
// Here we're finished with the SecretKey we created, so we can destroy it
try {
createCekSecretKey.destroy();
} catch (DestroyFailedException e) {
// ignore
}
return encryptedBytes;
} catch (SecurityException ex) {
LOG.fine(ex.getMessage());
if (ex.getCause() instanceof NoSuchAlgorithmException) {
LOG.warning("Unsupported algorithm: " + state.keyProps.getKeyAlgo());
throw new JweException(JweException.Error.INVALID_CONTENT_ALGORITHM);
}
throw new JweException(JweException.Error.CONTENT_ENCRYPTION_FAILURE, ex);
}
}
protected byte[] getActualCipher(byte[] cipher) {
代码示例来源:origin: org.apache.cxf/cxf-rt-rs-security-jose
protected byte[] encryptInternal(JweEncryptionInternal state, byte[] content) {
try {
SecretKey createCekSecretKey = createCekSecretKey(state);
byte[] encryptedBytes = CryptoUtils.encryptBytes(content, createCekSecretKey, state.keyProps);
// Here we're finished with the SecretKey we created, so we can destroy it
try {
createCekSecretKey.destroy();
} catch (DestroyFailedException e) {
// ignore
}
return encryptedBytes;
} catch (SecurityException ex) {
LOG.fine(ex.getMessage());
if (ex.getCause() instanceof NoSuchAlgorithmException) {
LOG.warning("Unsupported algorithm: " + state.keyProps.getKeyAlgo());
throw new JweException(JweException.Error.INVALID_CONTENT_ALGORITHM);
}
throw new JweException(JweException.Error.CONTENT_ENCRYPTION_FAILURE, ex);
}
}
protected byte[] getActualCipher(byte[] cipher) {
代码示例来源:origin: org.jbpm/jbpm-bpmn2
private Object getValueOfField(String fieldname, Class<?> sourceClass, Object source ) {
String sourceClassName = sourceClass.getName();
Field field = null;
try {
field = sourceClass.getDeclaredField(fieldname);
field.setAccessible(true);
} catch (SecurityException e) {
fail("Unable to retrieve " + fieldname + " field from " + sourceClassName + ": " + e.getCause());
} catch (NoSuchFieldException e) {
fail("Unable to retrieve " + fieldname + " field from " + sourceClassName + ": " + e.getCause());
}
assertNotNull("." + fieldname + " field is null!?!", field);
Object fieldValue = null;
try {
fieldValue = field.get(source);
} catch (IllegalArgumentException e) {
fail("Unable to retrieve value of " + fieldname + " from " + sourceClassName + ": " + e.getCause());
} catch (IllegalAccessException e) {
fail("Unable to retrieve value of " + fieldname + " from " + sourceClassName + ": " + e.getCause());
}
return fieldValue;
}
内容来源于网络,如有侵权,请联系作者删除!