Apply patch from Nicolas De Loof for reduce open files during jxr process.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114442 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
d2d20eba42
commit
16073c0577
2 files changed
+62
-49
No files matched your search
@@ -58,10 +58,11 @@ import java.io.*;
|
||||
* determine package, class, and imports
|
||||
*
|
||||
* @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
|
||||
* @version $Id: JavaFileImpl.java,v 1.2 2003/10/02 00:18:52 dion Exp $
|
||||
* @version $Id: JavaFileImpl.java,v 1.3 2003/12/04 15:05:50 evenisse Exp $
|
||||
*/
|
||||
public class JavaFileImpl extends JavaFile
|
||||
{
|
||||
private Reader reader;
|
||||
|
||||
/**
|
||||
* Create a new JavaFileImpl that points to a given file...
|
||||
@@ -92,59 +93,68 @@ public class JavaFileImpl extends JavaFile
|
||||
private void parse()
|
||||
throws IOException
|
||||
{
|
||||
|
||||
StreamTokenizer stok = this.getTokenizer();
|
||||
|
||||
while (stok.nextToken() != StreamTokenizer.TT_EOF)
|
||||
StreamTokenizer stok = null;
|
||||
try
|
||||
{
|
||||
|
||||
if (stok.sval == null)
|
||||
stok = this.getTokenizer();
|
||||
|
||||
while (stok.nextToken() != StreamTokenizer.TT_EOF)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//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) == '.')
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
stok = null;
|
||||
if (this.reader != null) {
|
||||
this.reader.close();
|
||||
}
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Get a StreamTokenizer for this file. */
|
||||
@@ -157,7 +167,7 @@ public class JavaFileImpl extends JavaFile
|
||||
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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user