You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ev...@apache.org on 2003/12/04 16:05:51 UTC

cvs commit: maven-plugins/jxr/xdocs changes.xml

evenisse    2003/12/04 07:05:50

  Modified:    jxr/src/main/org/apache/maven/jxr/pacman JavaFileImpl.java
               jxr/xdocs changes.xml
  Log:
  Apply patch from Nicolas De Loof for reduce open files during jxr process.
  
  Revision  Changes    Path
  1.3       +58 -48    maven-plugins/jxr/src/main/org/apache/maven/jxr/pacman/JavaFileImpl.java
  
  Index: JavaFileImpl.java
  ===================================================================
  RCS file: /home/cvs/maven-plugins/jxr/src/main/org/apache/maven/jxr/pacman/JavaFileImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JavaFileImpl.java	2 Oct 2003 00:18:52 -0000	1.2
  +++ JavaFileImpl.java	4 Dec 2003 15:05:50 -0000	1.3
  @@ -62,6 +62,7 @@
    */
   public class JavaFileImpl extends JavaFile
   {
  +    private Reader reader;
   
       /**
        * Create a new JavaFileImpl that points to a given file...
  @@ -92,59 +93,68 @@
       private void parse()
           throws IOException
       {
  -
  -        StreamTokenizer stok = this.getTokenizer();
  -
  -        while (stok.nextToken() != StreamTokenizer.TT_EOF)
  +        StreamTokenizer stok = null;
  +        try
           {
  -
  -            if (stok.sval == null)
  -            {
  -                continue;
  -            }
  -
  -            //set the package
  -            if (stok.sval.equals("package"))
  +            stok = this.getTokenizer();
  +    
  +            while (stok.nextToken() != StreamTokenizer.TT_EOF)
               {
  -                stok.nextToken();
  -                this.setPackageType(new PackageType(stok.sval));
  -            }
  -
  -            //set the imports
  -            if (stok.sval.equals("import"))
  -            {
  -                stok.nextToken();
  -
  -                String name = stok.sval;
  -
  -                /*
  -                WARNING: this is a bug/non-feature in the current
  -                StreamTokenizer.  We needed to set the comment char as "*"
  -                and packages that are imported with this (ex "test.*") will be
  -                stripped( and become "test." ).  Here we need to test for this
  -                and if necessary re-add the char.
  -                */
  -                if (name.charAt(name.length() - 1) == '.')
  +    
  +                if (stok.sval == null)
                   {
  -                    name = name + "*";
  +                    continue;
                   }
  -
  -                this.addImportType(new ImportType(name));
  +    
  +                //set the package
  +                if (stok.sval.equals("package"))
  +                {
  +                    stok.nextToken();
  +                    this.setPackageType(new PackageType(stok.sval));
  +                }
  +    
  +                //set the imports
  +                if (stok.sval.equals("import"))
  +                {
  +                    stok.nextToken();
  +    
  +                    String name = stok.sval;
  +    
  +                    /*
  +                    WARNING: this is a bug/non-feature in the current
  +                    StreamTokenizer.  We needed to set the comment char as "*"
  +                    and packages that are imported with this (ex "test.*") will be
  +                    stripped( and become "test." ).  Here we need to test for this
  +                    and if necessary re-add the char.
  +                    */
  +                    if (name.charAt(name.length() - 1) == '.')
  +                    {
  +                        name = name + "*";
  +                    }
  +    
  +                    this.addImportType(new ImportType(name));
  +                }
  +    
  +                //set the Class... if the class is found no more information is
  +                //valid so just break out of the while loop at this point.
  +                //set the imports
  +                if (stok.sval.equals("class") ||
  +                    stok.sval.equals("interface"))
  +                {
  +                    stok.nextToken();
  +                    this.setClassType(new ClassType(stok.sval));
  +                    break;
  +                }
  +    
               }
  -
  -            //set the Class... if the class is found no more information is
  -            //valid so just break out of the while loop at this point.
  -            //set the imports
  -            if (stok.sval.equals("class") ||
  -                stok.sval.equals("interface"))
  -            {
  -                stok.nextToken();
  -                this.setClassType(new ClassType(stok.sval));
  -                break;
  +        }
  +        finally
  +        {
  +            stok = null;
  +            if (this.reader != null) {
  +                this.reader.close();
               }
  -
           }
  -
       }
   
       /** Get a StreamTokenizer for this file.  */
  @@ -157,7 +167,7 @@
               throw new IOException(this.getFilename() + " does not exist!");
           }
   
  -        FileReader reader = new FileReader(this.getFilename());
  +        this.reader = new FileReader(this.getFilename());
   
           StreamTokenizer stok = new StreamTokenizer(reader);
           //int tok;
  
  
  
  1.12      +3 -0      maven-plugins/jxr/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/jxr/xdocs/changes.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- changes.xml	19 Oct 2003 13:47:41 -0000	1.11
  +++ changes.xml	4 Dec 2003 15:05:50 -0000	1.12
  @@ -9,6 +9,9 @@
     <body>
       
       <release version="1.3" date="in CVS">
  +      <action dev="evenisse" type="fix">
  +        Apply patch from Nicolas De Loof for reduce open files during jxr process.
  +      </action>
         <action dev="dion" type="fix">MAVEN-822</action>
         <action dev="dion" type="fix">MAVEN-797</action>
       </release>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org