[java-identity-provider COMMIT] /trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction....
noreply at shibboleth.net
noreply at shibboleth.net
Wed Jul 23 14:30:32 EDT 2014
Author: scantor
Date: Wed Jul 23 14:30:32 2014
New Revision: 6338
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6338&view=rev
Log:
Fix constraint, and the constraint violation in the message checker.
Modified:
trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java
Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java?rev=6338&r1=6337&r2=6338&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java (original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java Wed Jul 23 14:30:32 2014
@@ -351,24 +351,26 @@
*/
protected void handleError(
@Nonnull final ProfileRequestContext<InboundMessageType, OutboundMessageType> profileRequestContext,
- @Nonnull final AuthenticationContext authenticationContext, @Nonnull @NotEmpty final String message,
+ @Nonnull final AuthenticationContext authenticationContext, @Nullable final String message,
@Nonnull @NotEmpty final String eventId) {
-
- final MessageChecker checker = new MessageChecker(message);
-
+
boolean eventSet = false;
-
- for (final Map.Entry<String, Collection<String>> entry : classifiedMessages.entrySet()) {
- if (Iterables.any(entry.getValue(), checker)) {
- authenticationContext.getSubcontext(AuthenticationErrorContext.class, true).getClassifiedErrors().add(
- entry.getKey());
- if (!eventSet) {
- eventSet = true;
- ActionSupport.buildEvent(profileRequestContext, entry.getKey());
+
+ if (!Strings.isNullOrEmpty(message)) {
+ final MessageChecker checker = new MessageChecker(message);
+
+ for (final Map.Entry<String, Collection<String>> entry : classifiedMessages.entrySet()) {
+ if (Iterables.any(entry.getValue(), checker)) {
+ authenticationContext.getSubcontext(AuthenticationErrorContext.class,
+ true).getClassifiedErrors().add(entry.getKey());
+ if (!eventSet) {
+ eventSet = true;
+ ActionSupport.buildEvent(profileRequestContext, entry.getKey());
+ }
}
}
}
-
+
if (!eventSet) {
ActionSupport.buildEvent(profileRequestContext, eventId);
}
@@ -391,24 +393,26 @@
*/
protected void handleWarning(
@Nonnull final ProfileRequestContext<InboundMessageType, OutboundMessageType> profileRequestContext,
- @Nonnull final AuthenticationContext authenticationContext, @Nonnull @NotEmpty final String message,
+ @Nonnull final AuthenticationContext authenticationContext, @Nullable final String message,
@Nonnull @NotEmpty final String eventId) {
- final MessageChecker checker = new MessageChecker(message);
-
boolean eventSet = false;
- for (Map.Entry<String, Collection<String>> entry : classifiedMessages.entrySet()) {
- if (Iterables.any(entry.getValue(), checker)) {
- authenticationContext.getSubcontext(AuthenticationWarningContext.class,
- true).getClassifiedWarnings().add(entry.getKey());
- if (!eventSet) {
- eventSet = true;
- ActionSupport.buildEvent(profileRequestContext, entry.getKey());
+ if (!Strings.isNullOrEmpty(message)) {
+ final MessageChecker checker = new MessageChecker(message);
+
+ for (Map.Entry<String, Collection<String>> entry : classifiedMessages.entrySet()) {
+ if (Iterables.any(entry.getValue(), checker)) {
+ authenticationContext.getSubcontext(AuthenticationWarningContext.class,
+ true).getClassifiedWarnings().add(entry.getKey());
+ if (!eventSet) {
+ eventSet = true;
+ ActionSupport.buildEvent(profileRequestContext, entry.getKey());
+ }
}
}
}
-
+
if (!eventSet) {
ActionSupport.buildEvent(profileRequestContext, eventId);
}
@@ -426,7 +430,7 @@
* @param msg to operate on
*/
public MessageChecker(@Nonnull @NotEmpty final String msg) {
- Constraint.isNotNull(Strings.isNullOrEmpty(msg), "Message cannot be null or empty");
+ Constraint.isFalse(Strings.isNullOrEmpty(msg), "Message cannot be null or empty");
s = msg;
}
More information about the commits
mailing list