diff --git a/src/java/org/apache/commons/lang/Entities.java b/src/java/org/apache/commons/lang/Entities.java index 08c595bea..e2f21a862 100644 --- a/src/java/org/apache/commons/lang/Entities.java +++ b/src/java/org/apache/commons/lang/Entities.java @@ -69,7 +69,7 @@ import java.util.TreeMap; * @author Alexander Day Chaffee * @author Gary Gregory * @since 2.0 - * @version $Id: Entities.java,v 1.14 2003/09/07 14:32:34 psteitz Exp $ + * @version $Id: Entities.java,v 1.15 2003/09/13 03:11:29 psteitz Exp $ */ class Entities { @@ -431,8 +431,9 @@ class Entities { public int value(String name) { Object value = mapNameToValue.get(name); - if (value == null) + if (value == null) { return -1; + } return ((Integer) value).intValue(); } } @@ -453,8 +454,9 @@ class Entities { public int value(String name) { Object value = mapNameToValue.get(name); - if (value == null) + if (value == null) { return -1; + } return ((Integer) value).intValue(); } } @@ -572,12 +574,13 @@ class Entities { int mid = (low + high) >> 1; int midVal = values[mid]; - if (midVal < key) + if (midVal < key) { low = mid + 1; - else if (midVal > key) + } else if (midVal > key) { high = mid - 1; - else + } else { return mid; // key found + } } return -(low + 1); // key not found. } @@ -585,7 +588,9 @@ class Entities { public void add(String name, int value) { ensureCapacity(size + 1); int insertAt = binarySearch(value); - if (insertAt > 0) return; // note: this means you can't insert the same value twice + if (insertAt > 0) { + return; // note: this means you can't insert the same value twice + } insertAt = -(insertAt + 1); // binarySearch returns it negative and off-by-one System.arraycopy(values, insertAt, values, insertAt + 1, size - insertAt); values[insertAt] = value; @@ -596,7 +601,9 @@ class Entities { public String name(int value) { int index = binarySearch(value); - if (index < 0) return null; + if (index < 0) { + return null; + } return names[index]; } } diff --git a/src/java/org/apache/commons/lang/exception/NestableDelegate.java b/src/java/org/apache/commons/lang/exception/NestableDelegate.java index 63b0b5f5c..f7d80bc73 100644 --- a/src/java/org/apache/commons/lang/exception/NestableDelegate.java +++ b/src/java/org/apache/commons/lang/exception/NestableDelegate.java @@ -79,7 +79,7 @@ import java.util.List; * @author Sean C. Sullivan * @author Stephen Colebourne * @since 1.0 - * @version $Id: NestableDelegate.java,v 1.21 2003/09/07 14:32:35 psteitz Exp $ + * @version $Id: NestableDelegate.java,v 1.22 2003/09/13 03:11:30 psteitz Exp $ */ public class NestableDelegate implements Serializable { @@ -344,7 +344,9 @@ public class NestableDelegate implements Serializable { } // Remove the repeated lines in the stack - if (trimStackFrames) trimStackFrames(stacks); + if (trimStackFrames) { + trimStackFrames(stacks); + } synchronized (out) { for (Iterator iter=stacks.iterator(); iter.hasNext();) { @@ -352,8 +354,9 @@ public class NestableDelegate implements Serializable { for (int i=0, len=st.length; i < len; i++) { out.println(st[i]); } - if (iter.hasNext()) + if (iter.hasNext()) { out.print(separatorLine); + } } } } diff --git a/src/java/org/apache/commons/lang/math/NumberUtils.java b/src/java/org/apache/commons/lang/math/NumberUtils.java index 6104a79e9..69b84e8d1 100644 --- a/src/java/org/apache/commons/lang/math/NumberUtils.java +++ b/src/java/org/apache/commons/lang/math/NumberUtils.java @@ -71,7 +71,7 @@ import org.apache.commons.lang.StringUtils; * @author Gary Gregory * @author Fredrik Westermarck * @since 2.0 - * @version $Id: NumberUtils.java,v 1.13 2003/09/07 14:32:35 psteitz Exp $ + * @version $Id: NumberUtils.java,v 1.14 2003/09/13 03:11:30 psteitz Exp $ */ public class NumberUtils { @@ -129,6 +129,12 @@ public class NumberUtils { * *

If the string is null, zero is returned.

* + *
+     *   NumberUtils.stringToInt(null) = 0
+     *   NumberUtils.stringToInt("")   = 0
+     *   NumberUtils.stringToInt("1")  = 1
+     * 
+ * * @param str the string to convert, may be null * @return the int represented by the string, or zero if * conversion fails @@ -143,6 +149,12 @@ public class NumberUtils { * *

If the string is null, the default value is returned.

* + *
+     *   NumberUtils.stringToInt(null, 1) = 1
+     *   NumberUtils.stringToInt("", 1)   = 1
+     *   NumberUtils.stringToInt("1", 0)  = 1
+     * 
+ * * @param str the string to convert, may be null * @param defaultValue the default value * @return the int represented by the string, or the default if conversion fails @@ -161,6 +173,12 @@ public class NumberUtils { * *

If the string is null, zero is returned.

* + *
+     *   NumberUtils.stringToLong(null) = 0L
+     *   NumberUtils.stringToLong("")   = 0L
+     *   NumberUtils.stringToLong("1")  = 1L
+     * 
+ * * @param str the string to convert, may be null * @return the long represented by the string, or 0 if * conversion fails @@ -176,6 +194,12 @@ public class NumberUtils { * *

If the string is null, the default value is returned.

* + *
+     *   NumberUtils.stringToLong(null, 1L) = 1L
+     *   NumberUtils.stringToLong("", 1L)   = 1L
+     *   NumberUtils.stringToLong("1", 0L)  = 1L
+     * 
+ * * @param str the string to convert, may be null * @param defaultValue the default value * @return the long represented by the string, or the default if conversion fails @@ -196,6 +220,12 @@ public class NumberUtils { *

If the string str is null, * 0.0f is returned.

* + *
+     *   NumberUtils.stringToFloat(null)   = 0.0f
+     *   NumberUtils.stringToFloat("")     = 0.0f
+     *   NumberUtils.stringToFloat("1.5")  = 1.5f
+     * 
+ * * @param str the string to convert, may be null * @return the float represented by the string, or 0.0f * if conversion fails @@ -212,6 +242,12 @@ public class NumberUtils { *

If the string str is null, the default * value is returned.

* + *
+     *   NumberUtils.stringToFloat(null, 1.1f)   = 1.0f
+     *   NumberUtils.stringToFloat("", 1.1f)     = 1.1f
+     *   NumberUtils.stringToFloat("1.5", 0.0f)  = 1.5f
+     * 
+ * * @param str the string to convert, may be null * @param defaultValue the default value * @return the float represented by the string, or defaultValue @@ -219,7 +255,7 @@ public class NumberUtils { * @since 2.1 */ public static float stringToFloat(String str, float defaultValue) { - if(str==null) { + if (str == null) { return defaultValue; } try { @@ -236,6 +272,12 @@ public class NumberUtils { *

If the string str is null, * 0.0d is returned.

* + *
+     *   NumberUtils.stringToDouble(null)   = 0.0d
+     *   NumberUtils.stringToDouble("")     = 0.0d
+     *   NumberUtils.stringToDouble("1.5")  = 1.5d
+     * 
+ * * @param str the string to convert, may be null * @return the double represented by the string, or 0.0d * if conversion fails @@ -252,6 +294,12 @@ public class NumberUtils { *

If the string str is null, the default * value is returned.

* + *
+     *   NumberUtils.stringToDouble(null, 1.1d)   = 1.1d
+     *   NumberUtils.stringToDouble("", 1.1d)     = 1.1d
+     *   NumberUtils.stringToDouble("1.5", 0.0d)  = 1.5d
+     * 
+ * * @param str the string to convert, may be null * @param defaultValue the default value * @return the double represented by the string, or defaultValue @@ -259,7 +307,7 @@ public class NumberUtils { * @since 2.1 */ public static double stringToDouble(String str, double defaultValue) { - if(str==null) { + if (str == null) { return defaultValue; } try { diff --git a/src/java/org/apache/commons/lang/reflect/MethodUtils.java b/src/java/org/apache/commons/lang/reflect/MethodUtils.java index 19a3deed8..5eb3ee9e5 100644 --- a/src/java/org/apache/commons/lang/reflect/MethodUtils.java +++ b/src/java/org/apache/commons/lang/reflect/MethodUtils.java @@ -76,7 +76,7 @@ import org.apache.commons.lang.ArrayUtils; * @author Jan Sorensen * @author Robert Burrell Donkin * @author Gary Gregory - * @version $Id: MethodUtils.java,v 1.16 2003/09/07 14:32:35 psteitz Exp $ + * @version $Id: MethodUtils.java,v 1.17 2003/09/13 03:11:30 psteitz Exp $ */ public class MethodUtils { @@ -400,10 +400,11 @@ public class MethodUtils { object.getClass(), methodName, parameterTypes); - if (method == null) + if (method == null) { throw new ReflectionException("No such accessible method: " + methodName + "() on object: " + object.getClass().getName()); - + } + try { return method.invoke(object, args); @@ -491,8 +492,9 @@ public class MethodUtils { for (int i = 0; i < interfaces.length; i++) { // Is this interface public? - if (!Modifier.isPublic(interfaces[i].getModifiers())) + if (!Modifier.isPublic(interfaces[i].getModifiers())) { continue; + } // Does the method exist on this interface? try { @@ -501,16 +503,18 @@ public class MethodUtils { } catch (NoSuchMethodException e) { // empty } - if (method != null) + if (method != null) { break; + } // Recursively check our parent interfaces method = getAccessibleMethodFromInterfaceNest(interfaces[i], methodName, parameterTypes); - if (method != null) + if (method != null) { break; + } }