You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Peter Donald <do...@mad.scientist.com> on 2000/07/16 05:11:17 UTC

Re: cvs commit:jakarta-ant/src/main/org/apache/tools/ant/taskdefs Javadoc.java

At 09:47  15/7/00 -0500, you wrote:
>Yea, I thought about that 10 seconds after I hit
>'send', so I changed the source path to "com",
>which was closer, but still not right.
>
>After your message, I changed it to "./" and
>it STILL didn't work, but it found a WHOLE
>lot more files it could not evaluate the
>package for, and then it croaked...again,
>because there were no packagenames passed
>to javadoc. Something tells me I could just
>fork a JVM with the right commands and
>it would work (since it's working in a Makefile...)
>but Ant is doing some pre-processing, and either
>I'm not invoking it right, or it's losing track of what
>it's doing as it pre-processes....

I think the trouble lies at Javadoc.getPackageName() in lines
                if (line.trim().startsWith("package ") ||
                    line.trim().startsWith("package\t")) {
                    name = line.substring(8, line.indexOf(";")).trim();
                    break;
                }

Could it be that your package lines don't  start with either of these
patterns ?

Try changing it to something like 

final String cleanLine = line.trim();
if ( cleanLine.startsWith("package") {
   int start = 8;
   while( Character.isWhitespace( cleanLine.charAt(start) ) ) start++;
   final int end = line.indexOf(";");
   if( -1 == end ) {
	throw new Exception( "Task does not deal with multi-line package
declarations");
   }
   name = line.substring(start, end).trim();
   break;
}


I haven't got a compiler handy but that *should* do the trick. Have a shot
and if it works send patch to list :P


Cheers,

Pete

*------------------------------------------------------*
| "Nearly all men can stand adversity, but if you want |
| to test a man's character, give him power."          |
|       -Abraham Lincoln                               |
*------------------------------------------------------*

Re: cvscommit:jakarta-ant/src/main/org/apache/tools/ant/taskdefs Javadoc.java

Posted by Ken Wood <kw...@i2.com>.
I tried that. Thanks, but it didn't help.

There appears to be TWO problems. 

First, 
                line = reader.readLine(); 
                if (line == null) {
                    log("Could not evaluate package for " + file,
Project.MSG_WARN);
                    return null;
                }

is getting nulls:

[javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/com/i2/gs/ui/plaf/test/RolloverButtonUITest.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/com/i2/gs/ui/plaf/win97/test/Win97DesktopManagerTest.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/com/i2/gs/ui/plaf/win97/test/Win97LookAndFeelTest.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/com/i2/gs/web_archive/firewall/HTMLServlet.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/com/i2/gpm/hub/ui/test/AggregateAccessTest.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/com/i2/gpm/hub/ui/util/test/DateRangeTest.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/com/i2/gpm/hub/ui/util/test/VectorChartableTest.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/com/i2/rcp/web/util/test/WorkflowReaderTest.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/cfg/ext/event/RCPNewElementsEventHandler.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/cfg/ext/event/RCMEventHandler.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/cfg/ext/event/OpenForwardAuctionEventHandler.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/cfg/ext/event/CloseForwardAuctionEventHandler.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/bin/JRunConfig.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/datasets/dssme2/script/LoadSplit.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/datasets/dssme2/script/SMEDownload.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/datasets/dssme2/static_reports/DispatchServlet.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/rcp_spoke/RCP/code/source/authenticate.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/rcp_spoke/RCP/code/source/downloadFile.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/rcp_spoke/RCP/code/source/login.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/rcp_spoke/RCP/code/source/scheduler.java
  [javadoc] Could not evaluate package for
/view/kww_test_432/dvobs/gpm/rcp_spoke/RCP/code/source/uploadFile.java
  [javadoc] Javadoc execution
  [javadoc] javadoc: No packages or classes specified.

I've checked several of these files at random, and they in fact do NOT
have
the package statement. Well, OK, part of the issue here is that Ant is
looking at these files even though I explcitly listed the packages I
want, and these are NOT in in my list. I can't exlcude them since
Javadoc doesn't take the excludes argument. But it shouldn't
matter. There's a bigger problem else where because

        while (e.hasMoreElements()) {
            File file = (File) e.nextElement();
            String packageName = getPackageName(file);
            if (packageName != null) map.put(packageName, file);
        }

So, when getPackageName returns a null, it gets ignored.
When getPackageName returns non-null, it gets processed via map.put

But, this is as far as I've traced the problem.
Because, for whatever reason, when this runs:

        if ((packageNames != null) && (packageNames.length() > 0)) {
            Vector packages = new Vector();
            StringTokenizer tok = new StringTokenizer(packageNames, ",",
false);
            while (tok.hasMoreTokens()) {
                String name = tok.nextToken().trim();
                if (name.endsWith(".*")) {
                    packages.addElement(name);
                } else {
                    argList.addElement(name);
                }
            }
            if (packages.size() > 0) {
                evaluatePackages(sourcePath, packages, argList);
            }
        }

        if ((sourceFiles != null) && (sourceFiles.length() > 0)) {
            StringTokenizer tok = new StringTokenizer(sourceFiles, ",",
false);
            while (tok.hasMoreTokens()) {
                argList.addElement(tok.nextToken().trim());
            }
        }

         if (packageList != null) {
            argList.addElement("@" + packageList);
        }
        log("Javadoc args: " + argList.toString(), Project.MSG_VERBOSE);

it ends up with no packagenames in the argList and javadoc fails...



Peter Donald wrote:
> 
> At 09:47  15/7/00 -0500, you wrote:
> >Yea, I thought about that 10 seconds after I hit
> >'send', so I changed the source path to "com",
> >which was closer, but still not right.
> >
> >After your message, I changed it to "./" and
> >it STILL didn't work, but it found a WHOLE
> >lot more files it could not evaluate the
> >package for, and then it croaked...again,
> >because there were no packagenames passed
> >to javadoc. Something tells me I could just
> >fork a JVM with the right commands and
> >it would work (since it's working in a Makefile...)
> >but Ant is doing some pre-processing, and either
> >I'm not invoking it right, or it's losing track of what
> >it's doing as it pre-processes....
> 
> I think the trouble lies at Javadoc.getPackageName() in lines
>                 if (line.trim().startsWith("package ") ||
>                     line.trim().startsWith("package\t")) {
>                     name = line.substring(8, line.indexOf(";")).trim();
>                     break;
>                 }
> 
> Could it be that your package lines don't  start with either of these
> patterns ?
> 
> Try changing it to something like
> 
> final String cleanLine = line.trim();
> if ( cleanLine.startsWith("package") {
>    int start = 8;
>    while( Character.isWhitespace( cleanLine.charAt(start) ) ) start++;
>    final int end = line.indexOf(";");
>    if( -1 == end ) {
>         throw new Exception( "Task does not deal with multi-line package
> declarations");
>    }
>    name = line.substring(start, end).trim();
>    break;
> }
>