You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by st...@apache.org on 2005/06/26 19:45:55 UTC
svn commit: r201882 - in
/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang: enum/
enums/ exception/ math/
Author: stevencaswell
Date: Sun Jun 26 10:45:54 2005
New Revision: 201882
URL: http://svn.apache.org/viewcvs?rev=201882&view=rev
Log:
corrected style issues (mostly empty blocks and missing javadocs)
Modified:
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/Enum.java
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/EnumUtils.java
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/Enum.java
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/EnumUtils.java
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/ExceptionUtils.java
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableError.java
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableException.java
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableRuntimeException.java
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/math/NumberUtils.java
Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/Enum.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/Enum.java?rev=201882&r1=201881&r2=201882&view=diff
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/Enum.java (original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/Enum.java Sun Jun 26 10:45:54 2005
@@ -293,6 +293,7 @@
* <p>Restrictive constructor.</p>
*/
private Entry() {
+ ; // empty constructor
}
}
Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/EnumUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/EnumUtils.java?rev=201882&r1=201881&r2=201882&view=diff
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/EnumUtils.java (original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enum/EnumUtils.java Sun Jun 26 10:45:54 2005
@@ -40,6 +40,7 @@
* @since 2.0
*/
public EnumUtils() {
+ ; // empty constructor
}
/**
Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/Enum.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/Enum.java?rev=201882&r1=201881&r2=201882&view=diff
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/Enum.java (original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/Enum.java Sun Jun 26 10:45:54 2005
@@ -290,6 +290,7 @@
* <p>Restrictive constructor.</p>
*/
private Entry() {
+ ; // empty constructor
}
}
Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/EnumUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/EnumUtils.java?rev=201882&r1=201881&r2=201882&view=diff
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/EnumUtils.java (original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/enums/EnumUtils.java Sun Jun 26 10:45:54 2005
@@ -36,6 +36,7 @@
* @since 2.0
*/
public EnumUtils() {
+ ; // empty constructor
}
/**
Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/ExceptionUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/ExceptionUtils.java?rev=201882&r1=201881&r2=201882&view=diff
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/ExceptionUtils.java (original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/ExceptionUtils.java Sun Jun 26 10:45:54 2005
@@ -91,6 +91,7 @@
* to be created, although that is not normally necessary.</p>
*/
public ExceptionUtils() {
+ ; // empty constructor
}
//-----------------------------------------------------------------------
@@ -293,15 +294,20 @@
try {
method = throwable.getClass().getMethod(methodName, null);
} catch (NoSuchMethodException ignored) {
+ ; // exception ignored
} catch (SecurityException ignored) {
+ ; // exception ignored
}
if (method != null && Throwable.class.isAssignableFrom(method.getReturnType())) {
try {
return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
} catch (IllegalAccessException ignored) {
+ ; // exception ignored
} catch (IllegalArgumentException ignored) {
+ ; // exception ignored
} catch (InvocationTargetException ignored) {
+ ; // exception ignored
}
}
return null;
@@ -319,14 +325,18 @@
try {
field = throwable.getClass().getField(fieldName);
} catch (NoSuchFieldException ignored) {
+ ; // exception ignored
} catch (SecurityException ignored) {
+ ; // exception ignored
}
if (field != null && Throwable.class.isAssignableFrom(field.getType())) {
try {
return (Throwable) field.get(throwable);
} catch (IllegalAccessException ignored) {
+ ; // exception ignored
} catch (IllegalArgumentException ignored) {
+ ; // exception ignored
}
}
return null;
@@ -377,7 +387,9 @@
return true;
}
} catch (NoSuchMethodException ignored) {
+ ; // exception ignored
} catch (SecurityException ignored) {
+ ; // exception ignored
}
}
@@ -387,7 +399,9 @@
return true;
}
} catch (NoSuchFieldException ignored) {
+ ; // exception ignored
} catch (SecurityException ignored) {
+ ; // exception ignored
}
return false;
@@ -522,6 +536,17 @@
return indexOf(throwable, type, fromIndex, true);
}
+ /**
+ * <p>Worker method for the <code>indexOfType</code> methods.</p>
+ *
+ * @param throwable the throwable to inspect, may be null
+ * @param type the type to search for, subclasses match, null returns -1
+ * @param fromIndex the (zero based) index of the starting position,
+ * negative treated as zero, larger than chain size returns -1
+ * @param subclass if <code>true</code>, compares with {@link Class.isAssignableFrom(Class)}, otherwise compares
+ * using references
+ * @return index of the <code>type</code> within throwables nested withing the specified <code>throwable</code>
+ */
private static int indexOf(Throwable throwable, Class type, int fromIndex, boolean subclass) {
if (throwable == null || type == null) {
return -1;
Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableError.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableError.java?rev=201882&r1=201881&r2=201882&view=diff
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableError.java (original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableError.java Sun Jun 26 10:45:54 2005
@@ -83,6 +83,9 @@
this.cause = cause;
}
+ /**
+ * {@inheritDoc}
+ */
public Throwable getCause() {
return cause;
}
@@ -104,6 +107,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public String getMessage(int index) {
if (index == 0) {
return super.getMessage();
@@ -112,42 +118,72 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public String[] getMessages() {
return delegate.getMessages();
}
+ /**
+ * {@inheritDoc}
+ */
public Throwable getThrowable(int index) {
return delegate.getThrowable(index);
}
+ /**
+ * {@inheritDoc}
+ */
public int getThrowableCount() {
return delegate.getThrowableCount();
}
+ /**
+ * {@inheritDoc}
+ */
public Throwable[] getThrowables() {
return delegate.getThrowables();
}
+ /**
+ * {@inheritDoc}
+ */
public int indexOfThrowable(Class type) {
return delegate.indexOfThrowable(type, 0);
}
+ /**
+ * {@inheritDoc}
+ */
public int indexOfThrowable(Class type, int fromIndex) {
return delegate.indexOfThrowable(type, fromIndex);
}
+ /**
+ * {@inheritDoc}
+ */
public void printStackTrace() {
delegate.printStackTrace();
}
+ /**
+ * {@inheritDoc}
+ */
public void printStackTrace(PrintStream out) {
delegate.printStackTrace(out);
}
+ /**
+ * {@inheritDoc}
+ */
public void printStackTrace(PrintWriter out) {
delegate.printStackTrace(out);
}
+ /**
+ * {@inheritDoc}
+ */
public final void printPartialStackTrace(PrintWriter out) {
super.printStackTrace(out);
}
Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableException.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableException.java?rev=201882&r1=201881&r2=201882&view=diff
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableException.java (original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableException.java Sun Jun 26 10:45:54 2005
@@ -143,6 +143,9 @@
this.cause = cause;
}
+ /**
+ * {@inheritDoc}
+ */
public Throwable getCause() {
return cause;
}
@@ -164,6 +167,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public String getMessage(int index) {
if (index == 0) {
return super.getMessage();
@@ -172,42 +178,72 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public String[] getMessages() {
return delegate.getMessages();
}
+ /**
+ * {@inheritDoc}
+ */
public Throwable getThrowable(int index) {
return delegate.getThrowable(index);
}
+ /**
+ * {@inheritDoc}
+ */
public int getThrowableCount() {
return delegate.getThrowableCount();
}
+ /**
+ * {@inheritDoc}
+ */
public Throwable[] getThrowables() {
return delegate.getThrowables();
}
+ /**
+ * {@inheritDoc}
+ */
public int indexOfThrowable(Class type) {
return delegate.indexOfThrowable(type, 0);
}
+ /**
+ * {@inheritDoc}
+ */
public int indexOfThrowable(Class type, int fromIndex) {
return delegate.indexOfThrowable(type, fromIndex);
}
+ /**
+ * {@inheritDoc}
+ */
public void printStackTrace() {
delegate.printStackTrace();
}
+ /**
+ * {@inheritDoc}
+ */
public void printStackTrace(PrintStream out) {
delegate.printStackTrace(out);
}
+ /**
+ * {@inheritDoc}
+ */
public void printStackTrace(PrintWriter out) {
delegate.printStackTrace(out);
}
+ /**
+ * {@inheritDoc}
+ */
public final void printPartialStackTrace(PrintWriter out) {
super.printStackTrace(out);
}
Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableRuntimeException.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableRuntimeException.java?rev=201882&r1=201881&r2=201882&view=diff
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableRuntimeException.java (original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/exception/NestableRuntimeException.java Sun Jun 26 10:45:54 2005
@@ -87,6 +87,9 @@
this.cause = cause;
}
+ /**
+ * {@inheritDoc}
+ */
public Throwable getCause() {
return cause;
}
@@ -108,6 +111,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public String getMessage(int index) {
if (index == 0) {
return super.getMessage();
@@ -116,42 +122,72 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public String[] getMessages() {
return delegate.getMessages();
}
+ /**
+ * {@inheritDoc}
+ */
public Throwable getThrowable(int index) {
return delegate.getThrowable(index);
}
+ /**
+ * {@inheritDoc}
+ */
public int getThrowableCount() {
return delegate.getThrowableCount();
}
+ /**
+ * {@inheritDoc}
+ */
public Throwable[] getThrowables() {
return delegate.getThrowables();
}
+ /**
+ * {@inheritDoc}
+ */
public int indexOfThrowable(Class type) {
return delegate.indexOfThrowable(type, 0);
}
+ /**
+ * {@inheritDoc}
+ */
public int indexOfThrowable(Class type, int fromIndex) {
return delegate.indexOfThrowable(type, fromIndex);
}
+ /**
+ * {@inheritDoc}
+ */
public void printStackTrace() {
delegate.printStackTrace();
}
+ /**
+ * {@inheritDoc}
+ */
public void printStackTrace(PrintStream out) {
delegate.printStackTrace(out);
}
+ /**
+ * {@inheritDoc}
+ */
public void printStackTrace(PrintWriter out) {
delegate.printStackTrace(out);
}
+ /**
+ * {@inheritDoc}
+ */
public final void printPartialStackTrace(PrintWriter out) {
super.printStackTrace(out);
}
Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/math/NumberUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/math/NumberUtils.java?rev=201882&r1=201881&r2=201882&view=diff
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/math/NumberUtils.java (original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/math/NumberUtils.java Sun Jun 26 10:45:54 2005
@@ -82,6 +82,7 @@
* to operate.</p>
*/
public NumberUtils() {
+ ; // empty constructor
}
//-----------------------------------------------------------------------
@@ -472,6 +473,7 @@
}
} catch (NumberFormatException nfe) {
+ ; // empty catch
}
//Fall through
case 'd' :
@@ -482,10 +484,12 @@
return d;
}
} catch (NumberFormatException nfe) {
+ ; // empty constructor
}
try {
return createBigDecimal(numeric);
} catch (NumberFormatException e) {
+ ; // empty constructor
}
//Fall through
default :
@@ -505,10 +509,12 @@
try {
return createInteger(str);
} catch (NumberFormatException nfe) {
+ ; // empty contructor
}
try {
return createLong(str);
} catch (NumberFormatException nfe) {
+ ; // empty constructor
}
return createBigInteger(str);
@@ -521,6 +527,7 @@
return f;
}
} catch (NumberFormatException nfe) {
+ ; // empty constructor
}
try {
Double d = createDouble(str);
@@ -528,6 +535,7 @@
return d;
}
} catch (NumberFormatException nfe) {
+ ; // empty constructor
}
return createBigDecimal(str);
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: svn commit: r201882 - in /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang: enum/ enums/ exception/ math/
Posted by Steven Caswell <st...@gmail.com>.
Sounds reasonable. I'll make the code change, but I don't think there
is a checkstyle rule that will enforce it.
On 6/26/05, Stephen Colebourne <sc...@btopenworld.com> wrote:
> stevencaswell@apache.org wrote:
> > Log:
> > corrected style issues (mostly empty blocks and missing javadocs)
> > * <p>Restrictive constructor.</p>
> > */
> > private Entry() {
> > + ; // empty constructor
> > }
> > }
>
> I would suggest the following as a more logical way to handle this
>
> private Entry() {
> + super();
> }
>
> Personally, I believe that constructors should always have a this() or
> super(), and in fact that is the checkstyle rule I would prefer to see ;-)
>
> Stephen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
--
Steven Caswell
steven.caswell@gmail.com
Take back the web - http://www.mozilla.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: svn commit: r201882 - in /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang:
enum/ enums/ exception/ math/
Posted by Stephen Colebourne <sc...@btopenworld.com>.
stevencaswell@apache.org wrote:
> Log:
> corrected style issues (mostly empty blocks and missing javadocs)
> * <p>Restrictive constructor.</p>
> */
> private Entry() {
> + ; // empty constructor
> }
> }
I would suggest the following as a more logical way to handle this
private Entry() {
+ super();
}
Personally, I believe that constructors should always have a this() or
super(), and in fact that is the checkstyle rule I would prefer to see ;-)
Stephen
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org