QDox
  1. QDox
  2. QDOX-91

JavaClass.getSource().getURL() returns null

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Following code says better about bug

      File tempFile = File.createTempFile("xdoclet2", "");
      FileWriter writer = new FileWriter(tempFile);
      writer.write("package org.generama.tests;\n" +
      "\n" +
      "import java.net.URL;\n" +
      "\n" +
      "/**\n" +
      " * @author Anatol Pomozov\n" +
      " */\n" +
      "public class TestClass

      {\n" + " private URL hello;\n" + "}

      ");
      writer.close();

      JavaDocBuilder builder = new JavaDocBuilder();
      builder.addSource(tempFile);

      JavaClass klass = builder.getClassByName("TestClass");

      URL url = javaClass.getSource().getURL();
      //url is null!!! It is bug. url should point on file.

        Activity

        Hide
        Anatol Pomozov added a comment -

        Sorry seems that is not a bug, at least not that bug that I thought.

        JavaClass klass = builder.getClassByName("TestClass");

        sould be JavaClass klass = builder.getClassByName("org.generama.tests.TestClass");

        Class "TestClass" does not exists. so builder should not return class right??

        Show
        Anatol Pomozov added a comment - Sorry seems that is not a bug, at least not that bug that I thought. JavaClass klass = builder.getClassByName("TestClass"); sould be JavaClass klass = builder.getClassByName("org.generama.tests.TestClass"); Class "TestClass" does not exists. so builder should not return class right??
        Hide
        Dennis Lundberg added a comment -

        The following code prints the URL just fine using QDox version 1.5 as well as the latest version built from svn.

        import com.thoughtworks.qdox.JavaDocBuilder;
        import com.thoughtworks.qdox.model.JavaClass;
        
        import java.io.File;
        import java.io.FileWriter;
        import java.io.IOException;
        import java.net.URL;
        
        public class QDox91
        {
            public static void main(String[] args)
                throws IOException
            {
                File tempFile = File.createTempFile("xdoclet2", "");
                FileWriter writer = new FileWriter(tempFile);
                writer.write("package org.generama.tests;\n" +
                "\n" +
                "import java.net.URL;\n" +
                "\n" +
                "/**\n" +
                " * @author Anatol Pomozov\n" +
                " */\n" +
                "public class TestClass {\n" + " private URL hello;\n" + "}");
                writer.close();
        
                JavaDocBuilder builder = new JavaDocBuilder();
                builder.addSource(tempFile);
        
                JavaClass klass = builder.getClassByName("org.generama.tests.TestClass");
        
                URL url = klass.getSource().getURL();
        
                System.out.println(klass);
                System.out.println("----------------------------------------");
                System.out.println(url);
        
            }
        }
        
        Show
        Dennis Lundberg added a comment - The following code prints the URL just fine using QDox version 1.5 as well as the latest version built from svn. import com.thoughtworks.qdox.JavaDocBuilder; import com.thoughtworks.qdox.model.JavaClass; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.net.URL; public class QDox91 { public static void main( String [] args) throws IOException { File tempFile = File.createTempFile( "xdoclet2" , ""); FileWriter writer = new FileWriter(tempFile); writer.write( " package org.generama.tests;\n" + "\n" + " import java.net.URL;\n" + "\n" + "/**\n" + " * @author Anatol Pomozov\n" + " */\n" + " public class TestClass {\n" + " private URL hello;\n" + "}" ); writer.close(); JavaDocBuilder builder = new JavaDocBuilder(); builder.addSource(tempFile); JavaClass klass = builder.getClassByName( "org.generama.tests.TestClass" ); URL url = klass.getSource().getURL(); System .out.println(klass); System .out.println( "----------------------------------------" ); System .out.println(url); } }
        Dennis Lundberg made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Cannot Reproduce [ 5 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Anatol Pomozov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: