[java-identity-provider COMMIT] in /trunk: idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ByteAttribute...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Jan 23 01:38:10 EST 2015
Author: dfisher
Date: Fri Jan 23 01:38:10 2015
New Revision: 7272
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7272&view=rev
Log:
IDP-573
Add EmptyAttributeValue to represent nulls and zero length objects.
Attempt to handle the trickle down effects.
Still need updated unit tests.
Added:
trunk/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/EmptyAttributeValue.java
trunk/idp-attribute-api/src/test/java/net/shibboleth/idp/attribute/EmptyAttributeValueTest.java
Modified:
trunk/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ByteAttributeValue.java
trunk/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ScopedStringAttributeValue.java
trunk/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/StringAttributeValue.java
trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AttributeValueRegexpMatcher.java
trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AttributeValueStringMatcher.java
trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/impl/PrescopedAttributeDefinition.java
trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/impl/RegexSplitAttributeDefinition.java
trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedIdPAttributeImpl.java
trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/impl/TemplateAttributeDefinition.java
trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/mapped/impl/MappedAttributeDefinition.java
trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/StringAttributeValueMappingStrategy.java
trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/rdbms/impl/StringResultMappingStrategy.java
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/mapping/impl/ByteAttributeValueMapper.java
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/mapping/impl/ScopedStringAttributeValueMapper.java
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/mapping/impl/StringAttributeValueMapper.java
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/resolver/impl/AbstractPersistentIdDataConnector.java
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGenerator.java
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGenerator.java
trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/mapping/impl/AttributeValueMapperTest.java
Modified: trunk/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ByteAttributeValue.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ByteAttributeValue.java?rev=7272&r1=7271&r2=7272&view=diff
==============================================================================
--- trunk/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ByteAttributeValue.java (original)
+++ trunk/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ByteAttributeValue.java Fri Jan 23 01:38:10 2015
@@ -46,14 +46,12 @@
}
/** {@inheritDoc} */
- @Override
- public final byte[] getValue() {
+ @Override public final byte[] getValue() {
return value;
}
/** {@inheritDoc} */
- @Override
- @Nonnull @NotEmpty public String getDisplayValue() {
+ @Override @Nonnull @NotEmpty public String getDisplayValue() {
return "(binary data)";
}
@@ -76,8 +74,7 @@
}
/** {@inheritDoc} */
- @Override
- public boolean equals(@Nullable Object obj) {
+ @Override public boolean equals(@Nullable Object obj) {
if (obj == null) {
return false;
}
@@ -95,14 +92,29 @@
}
/** {@inheritDoc} */
- @Override
- public int hashCode() {
+ @Override public int hashCode() {
return Arrays.hashCode(value);
}
/** {@inheritDoc} */
- @Override
- public String toString() {
+ @Override public String toString() {
return MoreObjects.toStringHelper(this).add("value", value).toString();
}
+
+ /**
+ * Returns an {@link EmptyAttributeValue} or {@link ByteAttributeValue} as appropriate. This method should be
+ * preferred over the constructor when the value may be null or empty.
+ *
+ * @param value to inspect
+ * @return {@link EmptyAttributeValue} or {@link ByteAttributeValue}
+ */
+ @Nonnull public static IdPAttributeValue<?> valueOf(@Nullable final byte[] value) {
+ if (value == null) {
+ return EmptyAttributeValue.NULL;
+ } else if (value.length == 0) {
+ return EmptyAttributeValue.ZERO_LENGTH;
+ } else {
[... 648 lines stripped ...]
More information about the commits
mailing list