[kepler-dev] possible bug in DocManager.java

Christopher Brooks cxh at eecs.berkeley.edu
Mon Apr 23 15:48:24 PDT 2007


Hi Chad,

Getting the documentation for Sinewave works in the devel version of
Ptolemy II built from CVS today.

However, it was printing a stacktrace about Sinewave not being found,
it looks like the "See also" was failing:

java.lang.ClassNotFoundException: ptolemy.actor.lib.Sinewave
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:164)
        at ptolemy.vergil.actor.DocManager.docClassNameToURL(DocManager.java:438
)
        at ptolemy.vergil.actor.DocManager.getSeeAlso(DocManager.java:799)
        at ptolemy.vergil.actor.DocViewer._init(DocViewer.java:960)
        at ptolemy.vergil.actor.DocViewer.<init>(DocViewer.java:114)
        at ptolemy.vergil.actor.DocTableau.<init>(DocTableau.java:90)
        at ptolemy.vergil.basic.GetDocumentationAction.showDocAttributeTableau(G
etDocumentationAction.java:364)
        at ptolemy.vergil.basic.GetDocumentationAction.actionPerformed(GetDocumentationAction.java:156)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
        at java.awt.Component.processMouseEvent(Component.java:5501)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
        at java.awt.Component.processEvent(Component.java:5266)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3968)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
        at java.awt.Container.dispatchEventImpl(Container.java:2010)
        at java.awt.Window.dispatchEventImpl(Window.java:1778)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

I modified vergil/actor/DocManager.java so that we catch and ignore
the exception, which gets rid of the message. 

DocManager is set up to print any stacktraces and then return null.
Perhaps it should be modified so that it does not try to look up the
Java class on an Actor Oriented class such as Sinewave, but I think
ignoring the exception is right, because the portion of getSeeAlso()
that is calling docClassNameToURL() and triggering printing the
exception is:

            URL toRead = docClassNameToURL(_configuration, className, true,
                    true, true, false);
            if (toRead != null) {
                result.append("<li><a href=\"" + toRead.toExternalForm()
                        + "\">");
                if (toRead.toExternalForm().endsWith(".html")) {
                    result.append("Javadoc Documentation");
                } else if (toRead.toExternalForm().endsWith(".java")) {
                    result.append("Java Source");
                } else if (toRead.toExternalForm().endsWith(".xml")) {
                    result.append("Class Documentation");
                }
                result.append("</a></li>");
            }

The Sinewave Actor Oriented class does not have Javadoc or Java
source, and it looks like we already have the Class Documentation, so
I think we are set.

Edward?

_Christopher
--------

    Hi,
    
    I've recently run across a ClassNotFoundException when trying to view 
    the documentation for Sinewave in Kepler.  I've traced it to 
    DocManager.java where, in the method docClassNameToURL, there is a call 
    to Class.forName().  The problem is that Sinewave is a moml class, not a 
    java class so this fails.  I'm not sure if the changes I put into the 
    documentation system a few months ago might have caused this or if it is 
    just a bug.  Has anyone else (specifically those running ptii without 
    kepler) had this problem?
    
    thanks,
    chad
    
    ---------------------------------------------------------------------------
   -
    Posted to the ptolemy-hackers mailing list.  Please send administrative
    mail for this list to: ptolemy-hackers-request at ptolemy.eecs.berkeley.edu
--------


More information about the Kepler-dev mailing list