commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Caswell <steven.casw...@gmail.com>
Subject Re: [lang] customizing the PMD report [WAS Re: added empty statement to empty catch blocks [WAS: svn commit: r202043 - in /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang: NumberUtils.java SerializationUtils.java enum/Enum.java enu
Date Wed, 29 Jun 2005 21:12:48 GMT
Actually, I was proposing to leave the ; in to mark the empty
statement (sorry I wasn't clear).This is the simplest way to make PMD
know about the empty statement.

On 6/29/05, Gary Gregory <ggregory@seagullsoftware.com> wrote:
> I am +1 on removing the ";" and making the style checker behave with
> reason.
> 
> IMHO, an empty catch block is OK IFF it is { // documented in-line }. I
> have my Eclipse settings set to warn me of this but I know not everyone
> uses Eclipse.
> 
> Gary
> 
> -----Original Message-----
> From: Steven Caswell [mailto:steven.caswell@gmail.com]
> Sent: Wednesday, June 29, 2005 1:41 PM
> To: Jakarta Commons Developers List
> Subject: [lang] customizing the PMD report [WAS Re: added empty
> statement to empty catch blocks [WAS: svn commit: r202043 - in
> /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang:
> NumberUtils.java SerializationUtils.java enum/Enum.java enums/E
> 
> As I mentioned peviously, I added an empty statement to catch blocks
> because an empty catch block is not a good thing and an empty
> statement is a way to at least show there was a modicum of thought to
> having the catch do nothing. The empty statement works for some style
> checkers like Checkstyle but doesn't work with the default setting in
> PMD (it get reported as an empty statement outside a loop). I propose
> to add a custom ruleset to the PMD report generated by maven to
> include the catch block as an allowable place for an empty statement.
> 
> On 6/27/05, Steven Caswell <steven.caswell@gmail.com> wrote:
> > Yep. In this case throwing a bone to the PMD checker.Of course if I
> > had actually rerun the PMD report before committing I would have
> > realized that it also doesn't like an empty statement outside of a
> > loop, so I really didn't fix anything PMD-wise. I'll have to rethink
> > that particular bone.
> >
> > On 6/27/05, James Carman <james@carmanconsulting.com> wrote:
> > > Some style checkers won't allow you to have empty code blocks.  You
> must at
> > > least have one empty statement.
> > >
> > > -----Original Message-----
> > > From: Gary Gregory [mailto:ggregory@seagullsoftware.com]
> > > Sent: Monday, June 27, 2005 4:54 PM
> > > To: Jakarta Commons Developers List
> > > Subject: added empty statement to empty catch blocks [WAS: svn
> commit:
> > > r202043 - in
> > > /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang:
> > > NumberUtils.java SerializationUtils.java enum/Enum.java
> enums/Enum.java
> > > math/NumberUtils.java]
> > >
> > > Hello:
> > >
> > > What is the reason for this change?
> > >
> > > -                            //Too big for a long
> > > +                            ; //Too big for a long
> > >
> > > It looks very odd to me.
> > >
> > > Thanks,
> > > Gary
> > >
> > > -----Original Message-----
> > > From: stevencaswell@apache.org [mailto:stevencaswell@apache.org]
> > > Sent: Monday, June 27, 2005 1:24 PM
> > > To: commons-cvs@jakarta.apache.org
> > > Subject: svn commit: r202043 - in
> > > /jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang:
> > > NumberUtils.java SerializationUtils.java enum/Enum.java
> enums/Enum.java
> > > math/NumberUtils.java
> > >
> > > Author: stevencaswell
> > > Date: Mon Jun 27 13:24:10 2005
> > > New Revision: 202043
> > >
> > > URL: http://svn.apache.org/viewcvs?rev=202043&view=rev
> > > Log:
> > > added empty statement to empty catch blocks
> > >
> > > Modified:
> > >
> > >
> jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Numbe
> > > rUtils.java
> > >
> > >
> jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Seria
> > > lizationUtils.java
> > >
> > >
> 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/enums
> > > /Enum.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/Numbe
> > > rUtils.java
> > > URL:
> > >
> http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/java
> > >
> /org/apache/commons/lang/NumberUtils.java?rev=202043&r1=202042&r2=202043
> > > &view=diff
> > >
> ========================================================================
> > > ======
> > > ---
> > >
> jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Numbe
> > > rUtils.java (original)
> > > +++
> > >
> jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Numbe
> > > rUtils.java Mon Jun 27 13:24:10 2005
> > > @@ -197,7 +197,7 @@
> > >                          try {
> > >                              return createLong(numeric);
> > >                          } catch (NumberFormatException nfe) {
> > > -                            //Too big for a long
> > > +                            ; //Too big for a long
> > >                          }
> > >                          return createBigInteger(numeric);
> > >
> > >
> > > Modified:
> > >
> jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Seria
> > > lizationUtils.java
> > > URL:
> > >
> http://svn.apache.org/viewcvs/jakarta/commons/proper/lang/trunk/src/java
> > >
> /org/apache/commons/lang/SerializationUtils.java?rev=202043&r1=202042&r2
> > > =202043&view=diff
> > >
> ========================================================================
> > > ======
> > > ---
> > >
> jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Seria
> > > lizationUtils.java (original)
> > > +++
> > >
> jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Seria
> > > lizationUtils.java Mon Jun 27 13:24:10 2005
> > > @@ -114,7 +114,7 @@
> > >                      out.close();
> > >                  }
> > >              } catch (IOException ex) {
> > > -                // ignore;
> > > +                ; // ignore
> > >              }
> > >          }
> > >      }
> > > @@ -170,7 +170,7 @@
> > >                      in.close();
> > >                  }
> > >              } catch (IOException ex) {
> > > -                // ignore
> > > +                ; // ignore
> > >              }
> > >          }
> > >      }
> > >
> > > 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=202043&r1=202042&r2=202043&v
> > > iew=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 Mon Jun 27 13:24:10 2005
> > > @@ -548,11 +548,11 @@
> > >                  String name = (String) mth.invoke(other, null);
> > >                  return iName.equals(name);
> > >              } catch (NoSuchMethodException e) {
> > > -                // ignore - should never happen
> > > +                ; // ignore - should never happen
> > >              } catch (IllegalAccessException e) {
> > > -                // ignore - should never happen
> > > +                ; // ignore - should never happen
> > >              } catch (InvocationTargetException e) {
> > > -                // ignore - should never happen
> > > +                ; // ignore - should never happen
> > >              }
> > >              return false;
> > >          }
> > >
> > > 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=202043&r1=202042&r2=202043&
> > > 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 Mon Jun 27 13:24:10 2005
> > > @@ -548,11 +548,11 @@
> > >                  String name = (String) mth.invoke(other, null);
> > >                  return iName.equals(name);
> > >              } catch (NoSuchMethodException e) {
> > > -                // ignore - should never happen
> > > +                ; // ignore - should never happen
> > >              } catch (IllegalAccessException e) {
> > > -                // ignore - should never happen
> > > +                ; // ignore - should never happen
> > >              } catch (InvocationTargetException e) {
> > > -                // ignore - should never happen
> > > +                ; // ignore - should never happen
> > >              }
> > >              return false;
> > >          }
> > >
> > > 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=202043&r1=202042&r2=2
> > > 02043&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 Mon Jun 27 13:24:10 2005
> > > @@ -456,7 +456,7 @@
> > >                          try {
> > >                              return createLong(numeric);
> > >                          } catch (NumberFormatException nfe) {
> > > -                            //Too big for a long
> > > +                            ; //Too big for a long
> > >                          }
> > >                          return createBigInteger(numeric);
> > >
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > 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
> >
> 
> 
> --
> 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
> 
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message