UmlGraphDoc Errors running Graphviz on

497 Views Asked by At

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.

1

There are 1 best solutions below

2
On BEST ANSWER

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...