Changeset 1404

Show
Ignore:
Timestamp:
04/14/09 12:34:34 (3 years ago)
Author:
amandel
Message:

Whitespace cleanup

Location:
trunk
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/java/org/jcoderz/commons/types/EmailAddress.java

    r1205 r1404  
    9191 * </pre> 
    9292 * 
    93  * <p>The maximum length of an email address is: 64+1+255 characters (local-part + @ + domain). 
    94  * The minimum length of an email address is: 1+1+4 characters (local-part + @ + domain).</p> 
     93 * <p>The maximum length of an email address is:  
     94 * 64+1+255 characters (local-part + @ + domain). 
     95 * The minimum length of an email address is:  
     96 * 1+1+4 characters (local-part + @ + domain).</p> 
    9597 * 
    9698 * <p>A valid list of top-level domains is defined by the IANA. A top-level 
     
    123125  private static final String LET_DIG = "[a-zA-Z0-9]"; 
    124126  private static final String LET_DIG_HYP = "[a-zA-Z0-9-]"; 
    125   private static final String RFC_LABEL = LET_DIG + LET_DIG_HYP + "{0,61}" + LET_DIG; 
    126   private static final String DOMAIN = RFC_LABEL + "(\\." + RFC_LABEL + ")*\\." + LETTER + "{2,6}"; 
     127  private static final String RFC_LABEL  
     128      = LET_DIG + LET_DIG_HYP + "{0,61}" + LET_DIG; 
     129  private static final String DOMAIN  
     130      = RFC_LABEL + "(\\." + RFC_LABEL + ")*\\." + LETTER + "{2,6}"; 
    127131 
    128132  //Combined together, these form the allowed email regexp allowed by RFC 2822: 
     
    141145   * @param email The email address. 
    142146   */ 
    143   public EmailAddress(String email) 
     147  public EmailAddress (String email) 
    144148  { 
    145149    Assert.notNull(email, "email"); 
     
    156160    { 
    157161      throw new ArgumentMalformedException("email", email, 
    158           "The local part is longer than " + MAX_LENGTH_LOCAL_PART + " characters!"); 
     162          "The local part is longer than " + MAX_LENGTH_LOCAL_PART  
     163          + " characters!"); 
    159164    } 
    160165    if (mail.length() - at - 1 > MAX_LENGTH_DOMAIN) 
    161166    { 
    162167      throw new ArgumentMalformedException("email", email, 
    163           "The domain is longer than " + MAX_LENGTH_DOMAIN + " characters!"); 
     168          "The domain is longer than " + MAX_LENGTH_DOMAIN  
     169          + " characters!"); 
    164170    } 
    165171    mLocalPart = mail.substring(0, at); 
     
    171177 
    172178  /** 
    173    * Factory method for converting a String into an instance of type EmailAddress. 
     179   * Factory method for converting a String into an instance of type  
     180   * EmailAddress. 
    174181   * 
    175182   * @param email the email address to parse 
     
    183190  /** 
    184191   * Returns the local part of the address. 
    185    * 
    186192   * @return the local part of the address. 
    187193   */ 
    188   public String getName() 
     194  public String getName () 
    189195  { 
    190196    return mLocalPart; 
     
    194200  /** 
    195201   * Returns the domain name of the address. 
    196    * 
    197202   * @return the domain name of the address. 
    198203   */ 
    199   public String getDomain() 
     204  public String getDomain () 
    200205  { 
    201206    return mDomain; 
     
    205210  /** 
    206211   * Returns the top-level domain name of the address. 
    207    * 
    208212   * @return the top-level domain name of the address. 
    209213   */ 
    210   public String getTopLevelDomain() 
     214  public String getTopLevelDomain () 
    211215  { 
    212216    return mTopLevelDomain; 
    213217  } 
    214218 
    215  
    216   /** 
    217    * Returns the full email address. 
    218    * 
    219    * @return the full email address. 
    220    */ 
    221   public String getAddress() 
    222   { 
    223     return mLocalPart + "@" + mDomain; 
    224   } 
    225219 
    226220  /** 
     
    228222   * @return the full email address. 
    229223   */ 
    230   public String toString() 
     224  public String getAddress () 
    231225  { 
    232226    return mLocalPart + "@" + mDomain; 
     
    234228 
    235229  /** 
     230   * Returns the full email address. 
     231   * @return the full email address. 
     232   */ 
     233  public String toString () 
     234  { 
     235    return mLocalPart + "@" + mDomain; 
     236  } 
     237 
     238  /** 
    236239   * Returns the true if this email address equals the other. 
     240   * @param obj the object to compare to. 
    237241   * @return the true if this email address equals the other. 
    238242   * @see java.lang.Object#equals(java.lang.Object) 
    239243   */ 
    240   public boolean equals(Object obj) 
     244  public boolean equals (Object obj) 
    241245  { 
    242246    boolean result = false; 
     
    261265   * @return the hash code for this email. 
    262266   */ 
    263   public int hashCode() 
     267  public int hashCode () 
    264268  { 
    265269    int hashCode = HashCodeUtil.hash(HashCodeUtil.SEED, mLocalPart); 
  • trunk/src/java/org/jcoderz/phoenix/report/CheckstyleReportReader.java

    r1310 r1404  
    4646import javax.xml.bind.JAXBException; 
    4747 
     48import org.jcoderz.commons.util.IoUtil; 
    4849import org.jcoderz.phoenix.checkstyle.jaxb.Checkstyle; 
    4950import org.jcoderz.phoenix.report.jaxb.Item; 
     
    8182         throws FileNotFoundException, JAXBException 
    8283   { 
    83       mReportDocument = (Checkstyle) getUnmarshaller().unmarshal( 
    84             new FileInputStream(f)); 
     84      final FileInputStream is = new FileInputStream(f); 
     85      try 
     86      { 
     87          mReportDocument  
     88              = (Checkstyle) getUnmarshaller().unmarshal(is); 
     89      } 
     90      finally 
     91      { 
     92          IoUtil.close(is); 
     93      } 
    8594   } 
    8695 
     
    190199   } 
    191200 
    192    private static String sourceToClass(String source) 
     201   private static String sourceToClass (String source) 
    193202   { 
    194203       final int i = source.lastIndexOf('.'); 
  • trunk/src/java/org/jcoderz/phoenix/report/EmmaReportReader.java

    r1219 r1404  
    3333package org.jcoderz.phoenix.report; 
    3434 
     35import java.io.File; 
     36import java.io.IOException; 
     37import java.util.ArrayList; 
     38import java.util.HashMap; 
     39import java.util.Iterator; 
     40import java.util.List; 
     41import java.util.Map; 
     42import java.util.Map.Entry; 
     43import java.util.logging.Level; 
     44import java.util.logging.Logger; 
     45 
     46import javax.xml.bind.JAXBException; 
     47 
     48import org.jcoderz.phoenix.report.jaxb.Item; 
     49import org.jcoderz.phoenix.report.jaxb.ObjectFactory; 
     50 
    3551import com.vladium.emma.data.ClassDescriptor; 
    3652import com.vladium.emma.data.DataFactory; 
     
    4056import com.vladium.emma.data.MethodDescriptor; 
    4157import com.vladium.emma.data.ICoverageData.DataHolder; 
    42  
    43 import java.io.File; 
    44 import java.io.IOException; 
    45 import java.util.ArrayList; 
    46 import java.util.HashMap; 
    47 import java.util.HashSet; 
    48 import java.util.Iterator; 
    49 import java.util.List; 
    50 import java.util.Map; 
    51 import java.util.Set; 
    52 import java.util.Map.Entry; 
    53 import java.util.logging.Level; 
    54 import java.util.logging.Logger; 
    55  
    56 import javax.xml.bind.JAXBException; 
    57  
    58 import org.jcoderz.phoenix.report.jaxb.Item; 
    59 import org.jcoderz.phoenix.report.jaxb.ObjectFactory; 
    6058 
    6159/** 
     
    105103            { 
    106104                logger.warning( 
    107                     "Read no meta data from emma in file '" + f + "'." ); 
     105                    "Read no meta data from emma in file '" + f + "'."); 
    108106            } 
    109107            if (mEmmaCoverageData == null) 
    110108            { 
    111109                logger.warning( 
    112                     "Read no coverage info from emma in file '" + f + "'." ); 
     110                    "Read no coverage info from emma in file '" + f + "'."); 
    113111            } 
    114112        } 
     
    126124        final Map itemMap = new HashMap(); 
    127125 
    128         final Iterator i = mEmmaMetaData.iterator(); 
     126        final Iterator<ClassDescriptor> i = mEmmaMetaData.iterator(); 
    129127        while (i.hasNext()) 
    130128        { 
    131             ClassDescriptor clazz = (ClassDescriptor) i.next(); 
     129            final ClassDescriptor clazz = i.next(); 
    132130            final String srcFileName = clazz.getSrcFileName(); 
    133131            final String fileName; 
     
    210208        final ClassDescriptor clazz, DataHolder coverage) 
    211209    { 
    212         MethodDescriptor[] methods = clazz.getMethods(); 
    213         final Map<Integer,CoverageDetail> lineCoverage 
    214             = new HashMap<Integer,CoverageDetail>(); 
     210        final MethodDescriptor[] methods = clazz.getMethods(); 
     211        final Map<Integer, CoverageDetail> lineCoverage 
     212            = new HashMap<Integer, CoverageDetail>(); 
    215213        for (int methodNr = 0; methodNr < methods.length; methodNr++) 
    216214        { 
     
    220218            { 
    221219                boolean[] methodCoverage = null; 
    222                 if (coverage!= null && coverage.m_coverage.length > methodNr) 
     220                if (coverage != null && coverage.m_coverage.length > methodNr) 
    223221                { 
    224222                    methodCoverage = coverage.m_coverage[methodNr]; 
     
    228226                    blockNr < map.length; blockNr++) 
    229227                { 
    230                     int[] blockLines = map[blockNr]; 
     228                    final int[] blockLines = map[blockNr]; 
    231229                    if (methodCoverage != null 
    232230                        && methodCoverage.length > blockNr 
     
    313311 
    314312 
    315     private class CoverageDetail 
    316     { 
    317         int mNotVisitedBranches; 
    318         int mVisitedBranches; 
     313    private static class CoverageDetail 
     314    { 
     315        private int mNotVisitedBranches; 
     316        private int mVisitedBranches; 
    319317    } 
    320318} 
  • trunk/src/java/org/jcoderz/phoenix/report/Java2Html.java

    r1400 r1404  
    7575 
    7676/** 
    77  * TODO: Fix CVS links 
    78  * TODO: Refactor! 
    7977 * TODO: Link to current build 
    8078 * TODO: Link to CC home 
    8179 * TODO: Add @media printer??? 
    82  * TODO: Add doku 
    83  * TODO: Codestyle 
    84  * TODO: Generate error group view 
    8580 * 
    8681 * @author Andreas Mandel 
     
    113108   private static final String SORT_BY_COVERAGE_INDEX = "index_c.html"; 
    114109 
    115    /** Marker for ccs stypes used as the last row in a table. */ 
     110   /** Marker for ccs styles used as the last row in a table. */ 
    116111   private static final String LAST_MARKER = "_last"; 
    117112 
     
    436431      mGlobalSummary = new FileSummary(); 
    437432 
    438 //      final Iterator files = report.getFile().iterator(); 
    439  
    440433      for (final org.jcoderz.phoenix.report.jaxb.File file 
    441434          : (List<org.jcoderz.phoenix.report.jaxb.File>) report.getFile()) 
     
    443436         try 
    444437         { 
    445             if (file.getName().endsWith(".java")) 
    446             { 
    447                // TODO parentDir = project-home (from jcoderz report xml) 
    448                java2html(new java.io.File(file.getName()), file); 
    449             } 
    450             else 
    451             { 
    452                mGlobalFindings.add(file); 
    453             } 
     438            java2html(new java.io.File(file.getName()), file); 
    454439         } 
    455440         catch (Exception ex) 
    456441         { 
    457442            logger.log(Level.SEVERE, 
    458                   "Failed to generate report for '" + file.getName() + "'.", 
    459                   ex); 
     443                "Failed to generate report for '" + file.getName() + "'.", ex); 
    460444            mGlobalFindings.add(file); 
    461445         } 
     
    485469      sc.createCharts(); 
    486470 
    487       // copy the stylesheet and the icons 
    488471      copyStylesheet(); 
    489472      copyIcons(); 
     
    828811                  bw.write("         (" + pos + ")\n"); 
    829812                  bw.write("   </td>\n"); 
    830                   bw.write("   <td></td><td></td><td></td>\n"); // linenumber 
     813                  bw.write("   <td></td><td></td><td></td>\n"); // line number 
    831814                  bw.write("   <td width='100%' class='findings-data'>\n"); 
    832815                  bw.write(XmlUtil.escape(item.getMessage())); 
  • trunk/src/java/org/jcoderz/phoenix/report/ReportMerger.java

    r1393 r1404  
    194194   } 
    195195 
    196     private void findNewFindings(org.jcoderz.phoenix.report.jaxb.File newFile, 
     196    private void findNewFindings (org.jcoderz.phoenix.report.jaxb.File newFile, 
    197197        org.jcoderz.phoenix.report.jaxb.File oldFile) 
    198198    { 
     
    209209        // the rest... 
    210210        flaggAllAsNew(newFindings); 
    211         for(Item item:(List<Item>) oldFindings) 
     211        for (Item item : (List<Item>) oldFindings) 
    212212        { 
    213213            addAsOld(newFile.getItem(), item); 
     
    218218    private void flaggAllAsNew (final List<Item> newFindings) 
    219219    { 
    220         for(Item item:(List<Item>) newFindings) 
     220        for (Item item : (List<Item>) newFindings) 
    221221        { 
    222222            if (item.getSeverity().getPenalty() > 0 
     
    325325       final String fileName = newFile.getName(); 
    326326       org.jcoderz.phoenix.report.jaxb.File result = null; 
    327        for(org.jcoderz.phoenix.report.jaxb.File file :  
     327       for (org.jcoderz.phoenix.report.jaxb.File file :  
    328328           (List<org.jcoderz.phoenix.report.jaxb.File>) oldReport.getFile()) 
    329329       { 
  • trunk/src/java/org/jcoderz/phoenix/report/ResourceInfo.java

    r1047 r1404  
    158158    { 
    159159        ResourceInfo result = null; 
    160         for (ResourceInfo resource: RESOURCES.values()) 
     160        for (ResourceInfo resource : RESOURCES.values()) 
    161161        { 
    162162            if (resource.getClassname().equals(className) 
  • trunk/test/java/org/jcoderz/commons/types/samples/BaseClassTest.java

    r1293 r1404  
    4545{ 
    4646    /** 
    47      * Test the inheritance should call super.equals(); 
     47     * Test the inheritance should call super.equals(). 
    4848     */ 
    49     public void testInheritanceEquals() 
     49    public void testInheritanceEquals () 
    5050    { 
    5151        final SampleValueObject value = new SampleValueObject(); 
     
    6262 
    6363    /** 
    64      * Test the inheritance should call super.hashCode(); 
     64     * Test the inheritance should call super.hashCode(). 
    6565     */ 
    66     public void testInheritanceHashCode() 
     66    public void testInheritanceHashCode () 
    6767    { 
    6868        final SampleValueObject value = new SampleValueObject(); 
     
    7474        value2.setTestValueBase(0); 
    7575 
    76         assertTrue("Base class fields not honored in hash code.", 
    77             value.hashCode() != value2.hashCode()); 
     76        assertFalse("Base class fields not honored in hash code.", 
     77            value.hashCode() == value2.hashCode()); 
    7878    } 
    7979 
    8080    /** 
    81      * Test the inheritance should call super.toString(); 
     81     * Test the inheritance should call super.toString(). 
    8282     */ 
    83     public void testInheritanceToString() 
     83    public void testInheritanceToString () 
    8484    { 
    8585        final SampleValueObject value = new SampleValueObject(); 
     
    8888 
    8989        assertTrue("Can't see base class fields in string output.", 
    90             value.toString().indexOf("0") > -1); 
     90            value.toString().indexOf('0') > -1); 
    9191    } 
    9292}