JBoss Portal SVN: r12433 - modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth.
by portal-commits@lists.jboss.org
Author: sviluppatorefico
Date: 2009-01-06 15:19:30 -0500 (Tue, 06 Jan 2009)
New Revision: 12433
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java
Log:
see https://jira.jboss.org/jira/browse/JBPORTAL-2268
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java 2009-01-06 20:18:16 UTC (rev 12432)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java 2009-01-06 20:19:30 UTC (rev 12433)
@@ -256,8 +256,8 @@
Object enabledS;
enabledS = getUserProfileModule().getProperty(user,
User.INFO_USER_ENABLED);
- if (enabledS != null && (enabledS instanceof Boolean)) {
- enabled = ((Boolean)enabledS).booleanValue();
+ if (enabledS != null) {
+ enabled = new Boolean(enabledS.toString());
}
} catch (Exception e) {
e.printStackTrace();
17 years, 3 months
JBoss Portal SVN: r12432 - modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth.
by portal-commits@lists.jboss.org
Author: sviluppatorefico
Date: 2009-01-06 15:18:16 -0500 (Tue, 06 Jan 2009)
New Revision: 12432
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/IdentityLoginModule.java
Log:
see https://jira.jboss.org/jira/browse/JBPORTAL-2268
Modified: modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/IdentityLoginModule.java
===================================================================
--- modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/IdentityLoginModule.java 2009-01-06 20:15:03 UTC (rev 12431)
+++ modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/IdentityLoginModule.java 2009-01-06 20:18:16 UTC (rev 12432)
@@ -241,8 +241,8 @@
Object enabledS;
enabledS = getUserProfileModule().getProperty(user,
User.INFO_USER_ENABLED);
- if (enabledS != null && (enabledS instanceof Boolean)) {
- enabled = ((Boolean)enabledS).booleanValue();
+ if (enabledS != null) {
+ enabled = new Boolean(enabledS.toString());
}
} catch (Exception e) {
e.printStackTrace();
17 years, 3 months
JBoss Portal SVN: r12430 - in modules/common/trunk: common/src/main/java/org/jboss/portal/common/util and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-01-06 14:05:09 -0500 (Tue, 06 Jan 2009)
New Revision: 12430
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/AbstractTypedMap.java
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/ParameterMap.java
modules/common/trunk/releaseLibs.sh
Log:
- Fixed an error in Converte.identity.equals method.
- Fixed improper error reporting.
- Minor clean-ups.
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/AbstractTypedMap.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/AbstractTypedMap.java 2009-01-06 01:12:52 UTC (rev 12429)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/AbstractTypedMap.java 2009-01-06 19:05:09 UTC (rev 12430)
@@ -22,18 +22,17 @@
******************************************************************************/
package org.jboss.portal.common.util;
-import java.util.Map;
-import java.util.Set;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.HashMap;
import java.util.AbstractCollection;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
/**
- * A map implementations that use a conversion mechanism to provide a type mapping
- * between the external types declared by the map and the internal representations
- * backed by the internal map.
+ * A map implementations that use a conversion mechanism to provide a type mapping between the external types declared
+ * by the map and the internal representations backed by the internal map.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
@@ -41,9 +40,7 @@
public abstract class AbstractTypedMap<EK, EV, IK, IV> implements Map<EK, EV>
{
- /**
- * Transform an input to an output.
- */
+ /** Transform an input to an output. */
private abstract static class Transformer<Out, In>
{
/**
@@ -56,10 +53,10 @@
}
/**
- * Defines a converter that converts an internal value to an external value and vice versa.
- * Null values will not passed as arguments to the methods and if a conversion method returns
- * a null value it will be considered as a conversion failure although the implementations should
- * not rely and this behavior and rather rely on a adapted exception.
+ * Defines a converter that converts an internal value to an external value and vice versa. Null values will not
+ * passed as arguments to the methods and if a conversion method returns a null value it will be considered as a
+ * conversion failure although the implementations should not rely and this behavior and rather rely on a adapted
+ * exception.
*/
public abstract static class Converter<E, I>
{
@@ -78,13 +75,13 @@
protected boolean equals(Object left, Object right)
{
- return left.equals(false);
+ return left.equals(right);
}
};
public static <T> Converter<T, T> identityConverter()
{
- return (Converter<T,T>)identity;
+ return (Converter<T, T>)identity;
}
private final Transformer<I, E> keyUnwrapper = new Transformer<I, E>()
@@ -102,7 +99,7 @@
//
if (i == null)
{
- throw new IllegalArgumentException("The provided input " + i + " was converted to a null output");
+ throw new IllegalArgumentException("The provided input " + e + " was converted to a null output");
}
//
@@ -125,7 +122,7 @@
//
if (e == null)
{
- throw new IllegalStateException("The provided input " + e + " was converted to a null output");
+ throw new IllegalStateException("The provided input " + i + " was converted to a null output");
}
//
@@ -154,7 +151,7 @@
*
* @param external the external value
* @return the the internal value
- * @throws ClassCastException if the class of the specified argument prevents it from being converter
+ * @throws ClassCastException if the class of the specified argument prevents it from being converter
* @throws IllegalArgumentException if some aspect of this argument prevents it from being converted
*/
protected abstract I getInternal(E external) throws IllegalArgumentException, ClassCastException;
@@ -164,23 +161,23 @@
*
* @param internal the internal value
* @return the external value
- * @throws ClassCastException if the class of the specified argument prevents it from being converter
+ * @throws ClassCastException if the class of the specified argument prevents it from being converter
* @throws IllegalArgumentException if some aspect of this argument prevents it from being converted
*/
protected abstract E getExternal(I internal) throws IllegalArgumentException, ClassCastException;
/**
- * Compare internal values, the passed argument are never null so the method does not need to check
- * nullity of the arguments.
+ * Compare internal values, the passed argument are never null so the method does not need to check nullity of the
+ * arguments.
*
- * @param left the left value
+ * @param left the left value
* @param right the right value
* @return true if the values are considered equals
*/
protected abstract boolean equals(I left, I right);
}
- private static <I> boolean safeEquals(I left, I right, Converter<?, I> converter)
+ private static <I> boolean safeEquals(I left, I right, Converter<?, I> converter)
{
// Check the internal value, it should not be null
return !(left == null || right == null) && converter.equals(left, right);
@@ -351,7 +348,7 @@
}
if (o instanceof Map)
{
- Map<EK, EV> that = (Map<EK,EV>)o;
+ Map<EK, EV> that = (Map<EK, EV>)o;
Map<IK, IV> delegate = getDelegate();
// Must have same sizes
@@ -412,9 +409,7 @@
return getDelegate().toString();
}
- /**
- * Validates and unwraps the map.
- */
+ /** Validates and unwraps the map. */
protected final Map<IK, IV> convert(Map<? extends EK, ? extends EV> t) throws IllegalArgumentException, NullPointerException, ClassCastException
{
if (t == null)
@@ -431,9 +426,7 @@
return u;
}
- /**
- * Replace the content with the new map which is validated before replacement.
- */
+ /** Replace the content with the new map which is validated before replacement. */
public final void replace(Map<EK, EV> map) throws ClassCastException, NullPointerException, IllegalArgumentException
{
Map<IK, IV> tmp = convert(map);
@@ -444,9 +437,7 @@
delegate.putAll(tmp);
}
- /**
- * Validate the content.
- */
+ /** Validate the content. */
public final void validate() throws ClassCastException, NullPointerException, IllegalArgumentException
{
for (Entry<IK, IV> entry : getDelegate().entrySet())
@@ -456,7 +447,7 @@
}
}
- private static class TypedCollection<E,I> extends AbstractCollection<E>
+ private static class TypedCollection<E, I> extends AbstractCollection<E>
{
/** . */
@@ -689,7 +680,7 @@
}
}
- private final class KeySet extends TypedCollection<EK,IK> implements Set<EK>
+ private final class KeySet extends TypedCollection<EK, IK> implements Set<EK>
{
public KeySet()
{
@@ -760,7 +751,7 @@
}
}
- private final class ValueCollection extends TypedCollection<EV,IV>
+ private final class ValueCollection extends TypedCollection<EV, IV>
{
public ValueCollection()
{
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/ParameterMap.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/ParameterMap.java 2009-01-06 01:12:52 UTC (rev 12429)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/ParameterMap.java 2009-01-06 19:05:09 UTC (rev 12430)
@@ -22,16 +22,16 @@
******************************************************************************/
package org.jboss.portal.common.util;
+import java.io.IOException;
+import java.io.Serializable;
import java.util.Arrays;
-import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
-import java.io.Serializable;
-import java.io.IOException;
+import java.util.Map;
/**
- * A decorator that enforce the map content to be <String,String[]>. It also provides capabilities for
- * making a copy of the value either on a read or on a write.
+ * A decorator that enforce the map content to be <String,String[]>. It also provides capabilities for making a copy of
+ * the value either on a read or on a write.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6671 $
@@ -61,7 +61,7 @@
/**
* Copy the parameter map.
*
- * @param map the parameter map to copy
+ * @param map the parameter map to copy
* @param accessMode the access mode
* @return a parameter map initialized from the argument map
* @throws NullPointerException if the map contains a null key or a null value
@@ -72,10 +72,7 @@
*/
public static ParameterMap clone(Map<String, String[]> map, AccessMode accessMode) throws NullPointerException, ClassCastException, IllegalArgumentException
{
- if (map == null)
- {
- throw new IllegalArgumentException("No null map accepted");
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(map, "map to be cloned");
//
HashMap<String, String[]> delegate = new HashMap<String, String[]>(map);
@@ -83,8 +80,8 @@
}
/**
- * Safely wrap the map as a portlet parameters object. If the map is already a parameter map object, just return
- * that object otherwise return a wrapper around the map.
+ * Safely wrap the map as a portlet parameters object. If the map is already a parameter map object, just return that
+ * object otherwise return a wrapper around the map.
*
* @param map the map
* @return the portlet parameters
@@ -95,10 +92,10 @@
}
/**
- * Safely wrap the map as a portlet parameters object. If the map is already a parameter map object, just return
- * that object with the new access mode otherwise return a wrapper around the map.
+ * Safely wrap the map as a portlet parameters object. If the map is already a parameter map object, just return that
+ * object with the new access mode otherwise return a wrapper around the map.
*
- * @param map the map
+ * @param map the map
* @param accessMode the access mode
* @return the portlet parameters
*/
@@ -137,14 +134,8 @@
public ParameterMap(Map<String, String[]> delegate, AccessMode accessMode)
{
- if (delegate == null)
- {
- throw new IllegalArgumentException("No null delegate accepted");
- }
- if (delegate == null)
- {
- throw new IllegalArgumentException("No null access mode accepted");
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(delegate, "delegate");
+ ParameterValidation.throwIllegalArgExceptionIfNull(accessMode, "access");
//
this.delegate = delegate;
@@ -154,23 +145,12 @@
/**
* Exposed through the <code>as(AccessMode accessMode)</code> method.
*
- * @param that the map to rewrap
+ * @param that the map to rewrap
* @param accessMode the new access mode
*/
private ParameterMap(ParameterMap that, AccessMode accessMode)
{
- if (that == null)
- {
- throw new IllegalArgumentException("No null parameter map accepted");
- }
- if (that == null)
- {
- throw new IllegalArgumentException("No null access mode accepted");
- }
-
- //
- this.delegate = that.delegate;
- this.accessMode = accessMode;
+ this(that != null ? that.delegate : null, accessMode);
}
public AccessMode getAccessMode()
@@ -207,10 +187,7 @@
*/
public String getValue(String name) throws IllegalArgumentException
{
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "parameter name");
// Access delegate directly to avoid copy on read when it is enabled
String[] value = delegate.get(name);
@@ -228,10 +205,7 @@
*/
public String[] getValues(String name) throws IllegalArgumentException
{
- if (name == null)
- {
- throw new IllegalArgumentException("No null name");
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "parameter name");
//
return get(name);
@@ -246,14 +220,8 @@
*/
public void setValue(String name, String value) throws IllegalArgumentException
{
- if (name == null)
- {
- throw new IllegalArgumentException("No null name");
- }
- if (value == null)
- {
- throw new IllegalArgumentException("No null name");
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "parameter name");
+ ParameterValidation.throwIllegalArgExceptionIfNull(value, "parrameter value");
// Access delegate directly to avoid copy on read write it is enabled
delegate.put(name, new String[]{value});
@@ -265,18 +233,13 @@
* @param name the parameter name
* @param values the parameter values
* @throws NullPointerException if the name or the value is null
- * @throws IllegalArgumentException if the name is null or the values is null or the values length is zero or contains a null element
+ * @throws IllegalArgumentException if the name is null or the values is null or the values length is zero or
+ * contains a null element
*/
public void setValues(String name, String[] values) throws IllegalArgumentException
{
- if (name == null)
- {
- throw new IllegalArgumentException("No null name");
- }
- if (values == null)
- {
- throw new IllegalArgumentException("No null name");
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "parameter name");
+ ParameterValidation.throwIllegalArgExceptionIfNull(values, "parameter values");
//
put(name, values);
@@ -373,26 +336,26 @@
{
return external;
}
+
protected String getExternal(String internal)
{
return internal;
}
+
protected boolean equals(String left, String right)
{
return left.equals(right);
}
}
- /**
- * Defines how the state of the values of a parameter map are managed.
- */
+ /** Defines how the state of the values of a parameter map are managed. */
public static class AccessMode
{
/**
* Factory method for an access mode.
*
- * @param copyValueOnRead if true the value will be copied on a read
+ * @param copyValueOnRead if true the value will be copied on a read
* @param copyValueOnWrite if true the value will be copied on a write
* @return the convenient access mode
*/
@@ -452,14 +415,13 @@
}
/**
- * Only check are made to the value. The only valid values accepted
- * are string arrays with non zero length and containing non null
- * values.
+ * Only check are made to the value. The only valid values accepted are string arrays with non zero length and
+ * containing non null values.
*
* @param external
* @return
- * @throws NullPointerException if the value is null
- * @throws ClassCastException if the value type is not an array of string
+ * @throws NullPointerException if the value is null
+ * @throws ClassCastException if the value type is not an array of string
* @throws IllegalArgumentException if the array length is zero or one of the array value is null
*/
protected String[] getInternal(String[] external) throws IllegalArgumentException, ClassCastException, NullPointerException
@@ -470,7 +432,7 @@
}
//
- for (int i = external.length - 1;i >= 0;i--)
+ for (int i = external.length - 1; i >= 0; i--)
{
if (external[i] == null)
{
Modified: modules/common/trunk/releaseLibs.sh
===================================================================
--- modules/common/trunk/releaseLibs.sh 2009-01-06 01:12:52 UTC (rev 12429)
+++ modules/common/trunk/releaseLibs.sh 2009-01-06 19:05:09 UTC (rev 12430)
@@ -22,6 +22,6 @@
fi
-cp common/target/common-common-1.2.0-SNAPSHOT.jar $loc/portal-common-lib.jar
-cp mc/target/common-mc-1.2.0-SNAPSHOT.jar $loc/portal-common-mc-lib.jar
-cp portal/target/common-portal-1.2.0-SNAPSHOT.jar $loc/portal-common-portal-lib.jar
+cp common/target/common-common-trunk-SNAPSHOT.jar $loc/portal-common-lib.jar
+cp mc/target/common-mc-trunk-SNAPSHOT.jar $loc/portal-common-mc-lib.jar
+cp portal/target/common-portal-trunk-SNAPSHOT.jar $loc/portal-common-portal-lib.jar
17 years, 3 months