Fix brace positions
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1077921 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
30e369723d
commit
79cddd4ea5
|
@ -570,13 +570,11 @@ public class BooleanUtils {
|
|||
case 1: {
|
||||
char ch0 = str.charAt(0);
|
||||
if ((ch0 == 'y' || ch0 == 'Y') ||
|
||||
(ch0 == 't' || ch0 == 'T'))
|
||||
{
|
||||
(ch0 == 't' || ch0 == 'T')) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if ((ch0 == 'n' || ch0 == 'N') ||
|
||||
(ch0 == 'f' || ch0 == 'F'))
|
||||
{
|
||||
(ch0 == 'f' || ch0 == 'F')) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
break;
|
||||
|
@ -585,13 +583,11 @@ public class BooleanUtils {
|
|||
char ch0 = str.charAt(0);
|
||||
char ch1 = str.charAt(1);
|
||||
if ((ch0 == 'o' || ch0 == 'O') &&
|
||||
(ch1 == 'n' || ch1 == 'N') )
|
||||
{
|
||||
(ch1 == 'n' || ch1 == 'N') ) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if ((ch0 == 'n' || ch0 == 'N') &&
|
||||
(ch1 == 'o' || ch1 == 'O') )
|
||||
{
|
||||
(ch1 == 'o' || ch1 == 'O') ) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
break;
|
||||
|
@ -602,14 +598,12 @@ public class BooleanUtils {
|
|||
char ch2 = str.charAt(2);
|
||||
if ((ch0 == 'y' || ch0 == 'Y') &&
|
||||
(ch1 == 'e' || ch1 == 'E') &&
|
||||
(ch2 == 's' || ch2 == 'S') )
|
||||
{
|
||||
(ch2 == 's' || ch2 == 'S') ) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if ((ch0 == 'o' || ch0 == 'O') &&
|
||||
(ch1 == 'f' || ch1 == 'F') &&
|
||||
(ch2 == 'f' || ch2 == 'F') )
|
||||
{
|
||||
(ch2 == 'f' || ch2 == 'F') ) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
break;
|
||||
|
@ -622,8 +616,7 @@ public class BooleanUtils {
|
|||
if ((ch0 == 't' || ch0 == 'T') &&
|
||||
(ch1 == 'r' || ch1 == 'R') &&
|
||||
(ch2 == 'u' || ch2 == 'U') &&
|
||||
(ch3 == 'e' || ch3 == 'E') )
|
||||
{
|
||||
(ch3 == 'e' || ch3 == 'E') ) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -638,8 +631,7 @@ public class BooleanUtils {
|
|||
(ch1 == 'a' || ch1 == 'A') &&
|
||||
(ch2 == 'l' || ch2 == 'L') &&
|
||||
(ch3 == 's' || ch3 == 'S') &&
|
||||
(ch4 == 'e' || ch4 == 'E') )
|
||||
{
|
||||
(ch4 == 'e' || ch4 == 'E') ) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -250,9 +250,8 @@ public class RandomStringUtils {
|
|||
ch = chars[random.nextInt(gap) + start];
|
||||
}
|
||||
if ((letters && Character.isLetter(ch))
|
||||
|| (numbers && Character.isDigit(ch))
|
||||
|| (!letters && !numbers))
|
||||
{
|
||||
|| (numbers && Character.isDigit(ch))
|
||||
|| (!letters && !numbers)) {
|
||||
if(ch >= 56320 && ch <= 57343) {
|
||||
if(count == 0) {
|
||||
count++;
|
||||
|
|
|
@ -2725,9 +2725,8 @@ public class StringUtils {
|
|||
* @return an array of parsed Strings, <code>null</code> if null String input
|
||||
* @since 2.4
|
||||
*/
|
||||
private static String[] splitByWholeSeparatorWorker(String str, String separator, int max,
|
||||
boolean preserveAllTokens)
|
||||
{
|
||||
private static String[] splitByWholeSeparatorWorker(
|
||||
String str, String separator, int max, boolean preserveAllTokens) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -4035,16 +4034,14 @@ public class StringUtils {
|
|||
* and/or size 0)
|
||||
* @since 2.4
|
||||
*/
|
||||
private static String replaceEach(String text, String[] searchList, String[] replacementList,
|
||||
boolean repeat, int timeToLive)
|
||||
{
|
||||
private static String replaceEach(
|
||||
String text, String[] searchList, String[] replacementList, boolean repeat, int timeToLive) {
|
||||
|
||||
// mchyzer Performance note: This creates very few new objects (one major goal)
|
||||
// let me know if there are performance requests, we can create a harness to measure
|
||||
|
||||
if (text == null || text.length() == 0 || searchList == null ||
|
||||
searchList.length == 0 || replacementList == null || replacementList.length == 0)
|
||||
{
|
||||
searchList.length == 0 || replacementList == null || replacementList.length == 0) {
|
||||
return text;
|
||||
}
|
||||
|
||||
|
@ -4076,8 +4073,7 @@ public class StringUtils {
|
|||
// NOTE: logic duplicated below START
|
||||
for (int i = 0; i < searchLength; i++) {
|
||||
if (noMoreMatchesForReplIndex[i] || searchList[i] == null ||
|
||||
searchList[i].length() == 0 || replacementList[i] == null)
|
||||
{
|
||||
searchList[i].length() == 0 || replacementList[i] == null) {
|
||||
continue;
|
||||
}
|
||||
tempIndex = text.indexOf(searchList[i]);
|
||||
|
@ -4135,8 +4131,7 @@ public class StringUtils {
|
|||
// NOTE: logic mostly duplicated above START
|
||||
for (int i = 0; i < searchLength; i++) {
|
||||
if (noMoreMatchesForReplIndex[i] || searchList[i] == null ||
|
||||
searchList[i].length() == 0 || replacementList[i] == null)
|
||||
{
|
||||
searchList[i].length() == 0 || replacementList[i] == null) {
|
||||
continue;
|
||||
}
|
||||
tempIndex = text.indexOf(searchList[i], start);
|
||||
|
|
|
@ -802,10 +802,8 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the character sequence does not match the pattern
|
||||
* @see #matchesPattern(CharSequence, String, String, Object...)
|
||||
*/
|
||||
public static void matchesPattern(CharSequence input, String pattern)
|
||||
{
|
||||
if (Pattern.matches(pattern, input) == false)
|
||||
{
|
||||
public static void matchesPattern(CharSequence input, String pattern) {
|
||||
if (Pattern.matches(pattern, input) == false) {
|
||||
throw new IllegalArgumentException(String.format(DEFAULT_MATCHES_PATTERN_EX, input, pattern));
|
||||
}
|
||||
}
|
||||
|
@ -825,10 +823,8 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the character sequence does not match the pattern
|
||||
* @see #matchesPattern(CharSequence, String)
|
||||
*/
|
||||
public static void matchesPattern(CharSequence input, String pattern, String message, Object... values)
|
||||
{
|
||||
if (Pattern.matches(pattern, input) == false)
|
||||
{
|
||||
public static void matchesPattern(CharSequence input, String pattern, String message, Object... values) {
|
||||
if (Pattern.matches(pattern, input) == false) {
|
||||
throw new IllegalArgumentException(String.format(message, values));
|
||||
}
|
||||
}
|
||||
|
@ -845,10 +841,8 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the value falls out of the boundaries
|
||||
* @see #inclusiveBetween(Object, Object, Comparable, String, Object...)
|
||||
*/
|
||||
public static <T> void inclusiveBetween(T start, T end, Comparable<T> value)
|
||||
{
|
||||
if (value.compareTo(start) < 0 || value.compareTo(end) > 0)
|
||||
{
|
||||
public static <T> void inclusiveBetween(T start, T end, Comparable<T> value) {
|
||||
if (value.compareTo(start) < 0 || value.compareTo(end) > 0) {
|
||||
throw new IllegalArgumentException(String.format(DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end));
|
||||
}
|
||||
}
|
||||
|
@ -868,10 +862,8 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the value falls out of the boundaries
|
||||
* @see #inclusiveBetween(Object, Object, Comparable)
|
||||
*/
|
||||
public static <T> void inclusiveBetween(T start, T end, Comparable<T> value, String message, Object... values)
|
||||
{
|
||||
if (value.compareTo(start) < 0 || value.compareTo(end) > 0)
|
||||
{
|
||||
public static <T> void inclusiveBetween(T start, T end, Comparable<T> value, String message, Object... values) {
|
||||
if (value.compareTo(start) < 0 || value.compareTo(end) > 0) {
|
||||
throw new IllegalArgumentException(String.format(message, values));
|
||||
}
|
||||
}
|
||||
|
@ -888,10 +880,8 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the value falls out of the boundaries
|
||||
* @see #exclusiveBetween(Object, Object, Comparable, String, Object...)
|
||||
*/
|
||||
public static <T> void exclusiveBetween(T start, T end, Comparable<T> value)
|
||||
{
|
||||
if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0)
|
||||
{
|
||||
public static <T> void exclusiveBetween(T start, T end, Comparable<T> value) {
|
||||
if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0) {
|
||||
throw new IllegalArgumentException(String.format(DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end));
|
||||
}
|
||||
}
|
||||
|
@ -911,10 +901,8 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if the value falls out of the boundaries
|
||||
* @see #exclusiveBetween(Object, Object, Comparable)
|
||||
*/
|
||||
public static <T> void exclusiveBetween(T start, T end, Comparable<T> value, String message, Object... values)
|
||||
{
|
||||
if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0)
|
||||
{
|
||||
public static <T> void exclusiveBetween(T start, T end, Comparable<T> value, String message, Object... values) {
|
||||
if (value.compareTo(start) <= 0 || value.compareTo(end) >= 0) {
|
||||
throw new IllegalArgumentException(String.format(message, values));
|
||||
}
|
||||
}
|
||||
|
@ -934,10 +922,8 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if argument is not of specified class
|
||||
* @see #isInstanceOf(Class, Object, String, Object...)
|
||||
*/
|
||||
public static void isInstanceOf(Class<?> type, Object o)
|
||||
{
|
||||
if (type.isInstance(o) == false)
|
||||
{
|
||||
public static void isInstanceOf(Class<?> type, Object o) {
|
||||
if (type.isInstance(o) == false) {
|
||||
throw new IllegalArgumentException(String.format(DEFAULT_IS_INSTANCE_OF_EX_MESSAGE, type.getName()));
|
||||
}
|
||||
}
|
||||
|
@ -956,10 +942,8 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if argument is not of specified class
|
||||
* @see #isInstanceOf(Class, Object)
|
||||
*/
|
||||
public static void isInstanceOf(Class<?> type, Object o, String message, Object... values)
|
||||
{
|
||||
if (type.isInstance(o) == false)
|
||||
{
|
||||
public static void isInstanceOf(Class<?> type, Object o, String message, Object... values) {
|
||||
if (type.isInstance(o) == false) {
|
||||
throw new IllegalArgumentException(String.format(message, values));
|
||||
}
|
||||
}
|
||||
|
@ -979,10 +963,8 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if argument can not be converted to the specified class
|
||||
* @see #isAssignableFrom(Class, Class, String, Object...)
|
||||
*/
|
||||
public static void isAssignableFrom(Class<?> superType, Class<?> type)
|
||||
{
|
||||
if (superType.isAssignableFrom(type) == false)
|
||||
{
|
||||
public static void isAssignableFrom(Class<?> superType, Class<?> type) {
|
||||
if (superType.isAssignableFrom(type) == false) {
|
||||
throw new IllegalArgumentException(String.format(DEFAULT_IS_ASSIGNABLE_EX_MESSAGE, superType.getName()));
|
||||
}
|
||||
}
|
||||
|
@ -1004,10 +986,8 @@ public class Validate {
|
|||
* @throws IllegalArgumentException if argument can not be converted to the specified class
|
||||
* @see #isAssignableFrom(Class, Class)
|
||||
*/
|
||||
public static void isAssignableFrom(Class<?> superType, Class<?> type, String message, Object... values)
|
||||
{
|
||||
if (superType.isAssignableFrom(type) == false)
|
||||
{
|
||||
public static void isAssignableFrom(Class<?> superType, Class<?> type, String message, Object... values) {
|
||||
if (superType.isAssignableFrom(type) == false) {
|
||||
throw new IllegalArgumentException(String.format(message, values));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,9 +268,8 @@ public class CompareToBuilder implements Builder<Integer> {
|
|||
* with <code>lhs</code>
|
||||
* @since 2.0
|
||||
*/
|
||||
public static int reflectionCompare(Object lhs, Object rhs, boolean compareTransients,
|
||||
Class<?> reflectUpToClass)
|
||||
{
|
||||
public static int reflectionCompare(
|
||||
Object lhs, Object rhs, boolean compareTransients, Class<?> reflectUpToClass) {
|
||||
return reflectionCompare(lhs, rhs, compareTransients, reflectUpToClass, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,8 @@ import org.apache.commons.lang3.Validate;
|
|||
* @since 3.0
|
||||
* @version $Id$
|
||||
*/
|
||||
public class EventListenerSupport<L> implements Serializable
|
||||
{
|
||||
public class EventListenerSupport<L> implements Serializable {
|
||||
|
||||
/** Serialization version */
|
||||
private static final long serialVersionUID = 3593265990380473632L;
|
||||
|
||||
|
@ -101,8 +101,7 @@ public class EventListenerSupport<L> implements Serializable
|
|||
* @throws IllegalArgumentException if <code>listenerInterface</code> is
|
||||
* not an interface.
|
||||
*/
|
||||
public static <T> EventListenerSupport<T> create(Class<T> listenerInterface)
|
||||
{
|
||||
public static <T> EventListenerSupport<T> create(Class<T> listenerInterface) {
|
||||
return new EventListenerSupport<T>(listenerInterface);
|
||||
}
|
||||
|
||||
|
@ -118,8 +117,7 @@ public class EventListenerSupport<L> implements Serializable
|
|||
* @throws IllegalArgumentException if <code>listenerInterface</code> is
|
||||
* not an interface.
|
||||
*/
|
||||
public EventListenerSupport(Class<L> listenerInterface)
|
||||
{
|
||||
public EventListenerSupport(Class<L> listenerInterface) {
|
||||
this(listenerInterface, Thread.currentThread().getContextClassLoader());
|
||||
}
|
||||
|
||||
|
@ -136,8 +134,7 @@ public class EventListenerSupport<L> implements Serializable
|
|||
* @throws IllegalArgumentException if <code>listenerInterface</code> is
|
||||
* not an interface.
|
||||
*/
|
||||
public EventListenerSupport(Class<L> listenerInterface, ClassLoader classLoader)
|
||||
{
|
||||
public EventListenerSupport(Class<L> listenerInterface, ClassLoader classLoader) {
|
||||
this();
|
||||
Validate.notNull(listenerInterface, "Listener interface cannot be null.");
|
||||
Validate.notNull(classLoader, "ClassLoader cannot be null.");
|
||||
|
@ -161,8 +158,7 @@ public class EventListenerSupport<L> implements Serializable
|
|||
* @return a proxy object which can be used to call listener methods on all
|
||||
* of the registered event listeners
|
||||
*/
|
||||
public L fire()
|
||||
{
|
||||
public L fire() {
|
||||
return proxy;
|
||||
}
|
||||
|
||||
|
@ -178,8 +174,7 @@ public class EventListenerSupport<L> implements Serializable
|
|||
* @throws NullPointerException if <code>listener</code> is
|
||||
* <code>null</code>.
|
||||
*/
|
||||
public void addListener(L listener)
|
||||
{
|
||||
public void addListener(L listener) {
|
||||
Validate.notNull(listener, "Listener object cannot be null.");
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
@ -189,8 +184,7 @@ public class EventListenerSupport<L> implements Serializable
|
|||
*
|
||||
* @return the number of registered listeners.
|
||||
*/
|
||||
int getListenerCount()
|
||||
{
|
||||
int getListenerCount() {
|
||||
return listeners.size();
|
||||
}
|
||||
|
||||
|
@ -202,8 +196,7 @@ public class EventListenerSupport<L> implements Serializable
|
|||
* @throws NullPointerException if <code>listener</code> is
|
||||
* <code>null</code>.
|
||||
*/
|
||||
public void removeListener(L listener)
|
||||
{
|
||||
public void removeListener(L listener) {
|
||||
Validate.notNull(listener, "Listener object cannot be null.");
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
@ -296,8 +289,7 @@ public class EventListenerSupport<L> implements Serializable
|
|||
/**
|
||||
* An invocation handler used to dispatch the event(s) to all the listeners.
|
||||
*/
|
||||
protected class ProxyInvocationHandler implements InvocationHandler
|
||||
{
|
||||
protected class ProxyInvocationHandler implements InvocationHandler {
|
||||
/** Serialization version */
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -311,11 +303,8 @@ public class EventListenerSupport<L> implements Serializable
|
|||
* listeners.
|
||||
* @param args event arguments to propagate to the listeners.
|
||||
*/
|
||||
public Object invoke(Object proxy, Method method, Object[] args)
|
||||
throws Throwable
|
||||
{
|
||||
for (L listener : listeners)
|
||||
{
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
for (L listener : listeners) {
|
||||
method.invoke(listener, args);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -33,8 +33,8 @@ import org.apache.commons.lang3.reflect.MethodUtils;
|
|||
* @since 3.0
|
||||
* @version $Id$
|
||||
*/
|
||||
public class EventUtils
|
||||
{
|
||||
public class EventUtils {
|
||||
|
||||
/**
|
||||
* Adds an event listener to the specified source. This looks for an "add" method corresponding to the event
|
||||
* type (addActionListener, for example).
|
||||
|
@ -45,22 +45,14 @@ public class EventUtils
|
|||
*
|
||||
* @throws IllegalArgumentException if the object doesn't support the listener type
|
||||
*/
|
||||
public static <L> void addEventListener(Object eventSource, Class<L> listenerType, L listener)
|
||||
{
|
||||
try
|
||||
{
|
||||
public static <L> void addEventListener(Object eventSource, Class<L> listenerType, L listener) {
|
||||
try {
|
||||
MethodUtils.invokeMethod(eventSource, "add" + listenerType.getSimpleName(), listener);
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new IllegalArgumentException("Class " + eventSource.getClass().getName() + " does not have a public add" + listenerType.getSimpleName() + " method which takes a parameter of type " + listenerType.getName() + ".");
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new IllegalArgumentException("Class " + eventSource.getClass().getName() + " does not have an accessible add" + listenerType.getSimpleName () + " method which takes a parameter of type " + listenerType.getName() + ".");
|
||||
}
|
||||
catch (InvocationTargetException e)
|
||||
{
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new RuntimeException("Unable to add listener.", e.getCause());
|
||||
}
|
||||
}
|
||||
|
@ -76,43 +68,34 @@ public class EventUtils
|
|||
* @param eventTypes the event types (method names) from the listener interface (if none specified, all will be
|
||||
* supported)
|
||||
*/
|
||||
public static <L> void bindEventsToMethod(Object target, String methodName, Object eventSource, Class<L> listenerType, String... eventTypes)
|
||||
{
|
||||
public static <L> void bindEventsToMethod(Object target, String methodName, Object eventSource, Class<L> listenerType, String... eventTypes) {
|
||||
final L listener = listenerType.cast(Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class[] { listenerType }, new EventBindingInvocationHandler(target, methodName, eventTypes)));
|
||||
addEventListener(eventSource, listenerType, listener);
|
||||
}
|
||||
|
||||
private static class EventBindingInvocationHandler implements InvocationHandler
|
||||
{
|
||||
private static class EventBindingInvocationHandler implements InvocationHandler {
|
||||
private final Object target;
|
||||
private final String methodName;
|
||||
private final Set<String> eventTypes;
|
||||
|
||||
public EventBindingInvocationHandler(final Object target, final String methodName, String[] eventTypes)
|
||||
{
|
||||
public EventBindingInvocationHandler(final Object target, final String methodName, String[] eventTypes) {
|
||||
this.target = target;
|
||||
this.methodName = methodName;
|
||||
this.eventTypes = new HashSet<String>(Arrays.asList(eventTypes));
|
||||
}
|
||||
|
||||
public Object invoke(final Object proxy, final Method method, final Object[] parameters) throws Throwable
|
||||
{
|
||||
if ( eventTypes.isEmpty() || eventTypes.contains(method.getName()))
|
||||
{
|
||||
if (hasMatchingParametersMethod(method))
|
||||
{
|
||||
public Object invoke(final Object proxy, final Method method, final Object[] parameters) throws Throwable {
|
||||
if ( eventTypes.isEmpty() || eventTypes.contains(method.getName())) {
|
||||
if (hasMatchingParametersMethod(method)) {
|
||||
return MethodUtils.invokeMethod(target, methodName, parameters);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return MethodUtils.invokeMethod(target, methodName);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean hasMatchingParametersMethod(final Method method)
|
||||
{
|
||||
private boolean hasMatchingParametersMethod(final Method method) {
|
||||
return MethodUtils.getAccessibleMethod(target.getClass(), methodName, method.getParameterTypes()) != null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,8 +58,7 @@ class DefaultExceptionContext implements ExceptionContext, Serializable {
|
|||
while (contextValueMap.containsKey(key)) {
|
||||
Object information = contextValueMap.get(key);
|
||||
if ((value == null && information == null)
|
||||
|| (value != null && value.equals(information)))
|
||||
{
|
||||
|| (value != null && value.equals(information))) {
|
||||
return this;
|
||||
}
|
||||
key = label + "[" + ++i +"]";
|
||||
|
@ -132,12 +131,10 @@ class DefaultExceptionContext implements ExceptionContext, Serializable {
|
|||
value = this.contextValueMap.get(label);
|
||||
if (value == null) {
|
||||
buffer.append("null");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
valueStr = value.toString();
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
valueStr = "Exception thrown on toString(): " + ExceptionUtils.getStackTrace(e);
|
||||
}
|
||||
buffer.append(valueStr);
|
||||
|
|
|
@ -98,8 +98,7 @@ public class MutableObject<T> implements Mutable<T>, Serializable {
|
|||
if (this.getClass() == obj.getClass()) {
|
||||
MutableObject<?> that = (MutableObject<?>) obj;
|
||||
return this.value.equals(that.value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1174,8 +1174,7 @@ public class StrBuilder implements CharSequence, Appendable {
|
|||
public StrBuilder appendSeparator(char standard, char defaultIfEmpty) {
|
||||
if (size() > 0) {
|
||||
append(standard);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
append(defaultIfEmpty);
|
||||
}
|
||||
return this;
|
||||
|
|
|
@ -174,15 +174,13 @@ public class StrSubstitutor {
|
|||
* @param valueProperties the properties with values, may be null
|
||||
* @return the result of the replace operation
|
||||
*/
|
||||
public static String replace(Object source, Properties valueProperties)
|
||||
{
|
||||
public static String replace(Object source, Properties valueProperties) {
|
||||
if (valueProperties == null) {
|
||||
return source.toString();
|
||||
}
|
||||
Map<String,String> valueMap = new HashMap<String,String>();
|
||||
Enumeration<?> propNames = valueProperties.propertyNames();
|
||||
while (propNames.hasMoreElements())
|
||||
{
|
||||
while (propNames.hasMoreElements()) {
|
||||
String propName = (String)propNames.nextElement();
|
||||
String propValue = valueProperties.getProperty(propName);
|
||||
valueMap.put(propName, propValue);
|
||||
|
|
|
@ -726,8 +726,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable {
|
|||
* then the length of string
|
||||
*/
|
||||
private int readWithQuotes(char[] chars, int start, int len, StrBuilder workArea,
|
||||
List<String> tokens, int quoteStart, int quoteLen)
|
||||
{
|
||||
List<String> tokens, int quoteStart, int quoteLen) {
|
||||
// Loop until we've found the end of the quoted
|
||||
// string or the end of the input
|
||||
workArea.clear();
|
||||
|
|
|
@ -348,12 +348,10 @@ public class DurationFormatUtils {
|
|||
days += start.getActualMaximum(Calendar.DAY_OF_YEAR) - start.get(Calendar.DAY_OF_YEAR);
|
||||
|
||||
// Not sure I grok why this is needed, but the brutal tests show it is
|
||||
if(start instanceof GregorianCalendar) {
|
||||
if( (start.get(Calendar.MONTH) == Calendar.FEBRUARY) &&
|
||||
(start.get(Calendar.DAY_OF_MONTH) == 29 ) )
|
||||
{
|
||||
days += 1;
|
||||
}
|
||||
if (start instanceof GregorianCalendar &&
|
||||
start.get(Calendar.MONTH) == Calendar.FEBRUARY &&
|
||||
start.get(Calendar.DAY_OF_MONTH) == 29) {
|
||||
days += 1;
|
||||
}
|
||||
|
||||
start.add(Calendar.YEAR, 1);
|
||||
|
|
Loading…
Reference in New Issue