0

I try to useUmlGraphDoc, however, every time I run the javadoc command, I get a weird error:

[javadoc] javadoc: warning - Errors running Graphviz on /private/tmp/test/docs/Class1.dot
[javadoc] Building Context view for class Fail
[javadoc] javadoc: warning - Errors running Graphviz on /private/tmp/test/docs/Class2.dot

My code looks like that:

import externalPackage.TestClass;

public abstract class Class1 {
    private TestClass myFail;

    public boolean doSomething(TestClass fail) {
        return true;
    }
}

public class Class2 extends Class1 {
    @Override
    public boolean doSomething(TestClass fail) {
        fail.toString();
        return false;
    }
}

build.xml

<project name="de.matt3o12.test" default="javadocs">    

    <path id="lib">
        <fileset dir="lib">
            <include name="**/*.jar" />
        </fileset>
    </path>

    <target name="javadocs">
        <javadoc verbose="true" destdir="docs" public="true">
            <classpath>
                <path refid="lib" />
                <path path="${javac.classpath}" />
            </classpath>
            <fileset dir="src">
                <filename name="**/*.java" />
            </fileset>

            <doclet name="org.umlgraph.doclet.UmlGraphDoc" path="lib/UMLGraph.jar">
                <param name="-inferrel"/>
                <param name="-inferdep"/>
                <param name="-hide" value="java.*"/>
                <param name="-collpackages" value="java.util.*"/>
                <param name="-qualify"/>
                <param name="-postfixpackage"/>
                <param name="-nodefontsize" value="9"/>
                <param name="-nodefontpackagesize" value="7"/>
                <param name="-link" value="http://java.sun.com/j2se/1.5.0/docs/guide/javadoc/doclet/spec"/>
                <param name="-link" value="http://java.sun.com/j2se/1.5/docs/api"/>
            </doclet>
        </javadoc>
    </target>
</project>

I'm using Mac OS X Lion and Mavericks. The dot version on my mavericks computer is dot - graphviz version 2.38.0. It is the newest binary package to download.
Here is zip file containing all classes (and libs) I used to generate this error. When you run the ANT script, an error like the on above will be generated. The docs look fine (even the UML diagrams), however, on my bigger project (where I got the error in the first place), some of the diagrams that generated the errors, don't work


These errors only occur when:

  • TestClass is in an external package (a jar containing the class is defined in classpath. javac works perfectly).
  • doSomething is overwritten
  • the private var myFail is set.

If the myFail is removed, or doSomething isn't overwritten (e.g. it isn't defined in Class1 or Class2), or TestClass is in the same package, no errors will occur.

Matt3o12
  • 4,192
  • 6
  • 32
  • 47
  • Maybe it would be a good idea to post some debug output, if available. What kind of error does Graphviz throw exactly? You can also post your dot files' content. – kriegaex Jun 02 '14 at 08:30
  • I just tried on Windows 8.1, also with GraphViz 2.38, freshly installed. I have no problems with a setup similar to yours. I must admit that I am not an Ant user, though. So I used a Maven plugin for this test. – kriegaex Jun 02 '14 at 09:28
  • @kriegaex could you test it with the ZIP archive I added to my post (using ANT)? Maybe it's a mac bug... How do I get debug output? I already set javadoc to verbose but the info javadoc gives doesn't seem to be relevant. – Matt3o12 Jun 02 '14 at 15:01

1 Answers1

2

I was able to reproduce the problem. It is not Mac-related, but a subtle bug caused by a single space character in the UMLGraph source code. It is already fixed in Git master (development version). I found out by cloning and bisecting the UMLGraph repo against the previous release (tag R5_6_6). I did this by building the library with Maven and running each bisected build with your Ant project. Finally I found that commit @8d77597 fixes the problem.

Bottom line: Just clone the repo from GitHub and build a snapshot version, then your problem should be gone. I am going to open an issue linking to this page here and asking for a bugfix release on behalf of you.

Update: This is the ticket asking for a new bugfix release. Crossing my fingers for you...

kriegaex
  • 63,017
  • 15
  • 111
  • 202