[patch] use the classpath version for gjdoc as well

View: New views
7 Messages — Rating Filter:   Alert me  

[patch] use the classpath version for gjdoc as well

by Matthias Klose-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

$ gjdoc-4.4 --version
java.lang.NullPointerException
   at java.io.InputStreamReader.read(InputStreamReader.java:244)
   at java.io.BufferedReader.fill(BufferedReader.java:370)
   at java.io.BufferedReader.readLine(BufferedReader.java:469)
   at java.util.Properties.load(Properties.java:203)
   at java.util.Properties.load(Properties.java:380)
   at gnu.classpath.tools.gjdoc.Main.getGjdocVersion(Main.java:1830)
   at gnu.classpath.tools.gjdoc.Main.start(Main.java:1131)
   at gnu.classpath.tools.gjdoc.Main.main(Main.java:883)

I don't see any version properties file in the tools.jar. The following patch
does use the same method to get the version number as every other tool in
classpath. Ok for the trunk and the branch?

2009-06-13  Alexander Sack  <asac@...>

        * tools/gnu/classpath/tools/gjdoc/Main.java (start): Use
        gnu.classpath.Configuration.CLASSPATH_VERSION as version number.
        * tools/classes/gnu/classpath/tools/gjdoc/Main.class: Regenerate.

--- tools/gnu/classpath/tools/gjdoc/Main.java (revision 148452)
+++ tools/gnu/classpath/tools/gjdoc/Main.java (working copy)
@@ -1128,7 +1128,7 @@
       //--- Show version and exit if requested by user

       if (option_showVersion) {
-        System.out.println("gjdoc " + getGjdocVersion());
+        System.out.println("gjdoc " +
gnu.classpath.Configuration.CLASSPATH_VERSION);
         System.exit(0);
       }

Re: [patch] use the classpath version for gjdoc as well

by Mark Wielaard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Matthias,

On Sat, 2009-06-13 at 10:12 -0400, Matthias Klose wrote:

> $ gjdoc-4.4 --version
> java.lang.NullPointerException
>    at java.io.InputStreamReader.read(InputStreamReader.java:244)
>    at java.io.BufferedReader.fill(BufferedReader.java:370)
>    at java.io.BufferedReader.readLine(BufferedReader.java:469)
>    at java.util.Properties.load(Properties.java:203)
>    at java.util.Properties.load(Properties.java:380)
>    at gnu.classpath.tools.gjdoc.Main.getGjdocVersion(Main.java:1830)
>    at gnu.classpath.tools.gjdoc.Main.start(Main.java:1131)
>    at gnu.classpath.tools.gjdoc.Main.main(Main.java:883)
>
> I don't see any version properties file in the tools.jar.

In GNU Classpath this comes from
tools/resource/gnu/classpath/tools/gjdoc/version.properties.in
Which is just one line:
gjdoc.version=@VERSION@

>  The following patch
> does use the same method to get the version number as every other tool in
> classpath. Ok for the trunk and the branch?
>
> 2009-06-13  Alexander Sack  <asac@...>
>
>         * tools/gnu/classpath/tools/gjdoc/Main.java (start): Use
>         gnu.classpath.Configuration.CLASSPATH_VERSION as version number.
>         * tools/classes/gnu/classpath/tools/gjdoc/Main.class: Regenerate.
>
> --- tools/gnu/classpath/tools/gjdoc/Main.java (revision 148452)
> +++ tools/gnu/classpath/tools/gjdoc/Main.java (working copy)
> @@ -1128,7 +1128,7 @@
>        //--- Show version and exit if requested by user
>
>        if (option_showVersion) {
> -        System.out.println("gjdoc " + getGjdocVersion());
> +        System.out.println("gjdoc " +
> gnu.classpath.Configuration.CLASSPATH_VERSION);
>          System.exit(0);
>        }

The idea is fine. But then please do also submit a patch to GNU
Classpath that just removes the whole getGjdocVersion() method.
Note that there is another variant called getDocletVersion() in
HtmlDoclet.java that you also want to change in this case.

Cheers,

Mark


Re: [patch] use the classpath version for gjdoc as well

by Matthias Klose-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark Wielaard schrieb:

> Hi Matthias,
>
> On Sat, 2009-06-13 at 10:12 -0400, Matthias Klose wrote:
>> $ gjdoc-4.4 --version
>> java.lang.NullPointerException
>>    at java.io.InputStreamReader.read(InputStreamReader.java:244)
>>    at java.io.BufferedReader.fill(BufferedReader.java:370)
>>    at java.io.BufferedReader.readLine(BufferedReader.java:469)
>>    at java.util.Properties.load(Properties.java:203)
>>    at java.util.Properties.load(Properties.java:380)
>>    at gnu.classpath.tools.gjdoc.Main.getGjdocVersion(Main.java:1830)
>>    at gnu.classpath.tools.gjdoc.Main.start(Main.java:1131)
>>    at gnu.classpath.tools.gjdoc.Main.main(Main.java:883)
>>
>> I don't see any version properties file in the tools.jar.
>
> In GNU Classpath this comes from
> tools/resource/gnu/classpath/tools/gjdoc/version.properties.in
> Which is just one line:
> gjdoc.version=@VERSION@
I don't see this in libgcj.

>>  The following patch
>> does use the same method to get the version number as every other tool in
>> classpath. Ok for the trunk and the branch?
>>
>> 2009-06-13  Alexander Sack  <asac@...>
>>
>>         * tools/gnu/classpath/tools/gjdoc/Main.java (start): Use
>>         gnu.classpath.Configuration.CLASSPATH_VERSION as version number.
>>         * tools/classes/gnu/classpath/tools/gjdoc/Main.class: Regenerate.
>>
>> --- tools/gnu/classpath/tools/gjdoc/Main.java (revision 148452)
>> +++ tools/gnu/classpath/tools/gjdoc/Main.java (working copy)
>> @@ -1128,7 +1128,7 @@
>>        //--- Show version and exit if requested by user
>>
>>        if (option_showVersion) {
>> -        System.out.println("gjdoc " + getGjdocVersion());
>> +        System.out.println("gjdoc " +
>> gnu.classpath.Configuration.CLASSPATH_VERSION);
>>          System.exit(0);
>>        }
>
> The idea is fine. But then please do also submit a patch to GNU
> Classpath that just removes the whole getGjdocVersion() method.
> Note that there is another variant called getDocletVersion() in
> HtmlDoclet.java that you also want to change in this case.
attached.

I didn't remove the methods yet, so that the patch can be applied to the gcc-4.4
branch as well. This should be done in classpath only, and then imported into
libgcj.

ok for the attached patch on the libgcj branch and trunk?



2009-06-14  Matthias Klose  <doko@...>

        * tools/gnu/classpath/tools/gjdoc/Main.java (getGjdocVersion): Use
        gnu.classpath.Configuration.CLASSPATH_VERSION as version number.
        * tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
        (getDocletVersion): Likewise.
        * tools/classes/gnu/classpath/tools/gjdoc/Main.class: Regenerate.
        * tools/classes/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.class:
  Regenerate.

Index: tools/gnu/classpath/tools/gjdoc/Main.java
===================================================================
--- tools/gnu/classpath/tools/gjdoc/Main.java (revision 148452)
+++ tools/gnu/classpath/tools/gjdoc/Main.java (working copy)
@@ -1825,16 +1825,7 @@
   public String getGjdocVersion()
   {
     if (null == gjdocVersion) {
-      try {
-        Properties versionProperties = new Properties();
-        versionProperties.load(getClass().getResourceAsStream("version.properties"));
-        gjdocVersion = versionProperties.getProperty("gjdoc.version");
-      }
-      catch (IOException ignore) {
-      }
-      if (null == gjdocVersion) {
-        gjdocVersion = "unknown";
-      }
+      gjdocVersion = gnu.classpath.Configuration.CLASSPATH_VERSION;
     }
     return gjdocVersion;
   }
Index: tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
===================================================================
--- tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java (revision 148452)
+++ tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java (working copy)
@@ -3736,20 +3736,7 @@
    protected String getDocletVersion()
    {
       if (null == docletVersion) {
-         try {
-            Properties versionProperties = new Properties();
-            InputStream in = getClass().getResourceAsStream("/version.properties");
-            if (in == null) {
-             in = new FileInputStream("src/resources/version.properties");
-            }
-            versionProperties.load(in);
-            docletVersion = versionProperties.getProperty("gjdoc.version");
-         }
-         catch (IOException ignore) {
-         }
-         if (null == docletVersion) {
-            docletVersion = "unknown";
-         }
+         docletVersion = gnu.classpath.Configuration.CLASSPATH_VERSION;
       }
       return docletVersion;
    }

Re: [patch] use the classpath version for gjdoc as well

by Andrew Haley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Matthias Klose wrote:
> Mark Wielaard schrieb:

>>> 2009-06-13  Alexander Sack  <asac@...>
>>>
>>>         * tools/gnu/classpath/tools/gjdoc/Main.java (start): Use
>>>         gnu.classpath.Configuration.CLASSPATH_VERSION as version number.
>>>         * tools/classes/gnu/classpath/tools/gjdoc/Main.class: Regenerate.
>>>
>>> --- tools/gnu/classpath/tools/gjdoc/Main.java (revision 148452)
>>> +++ tools/gnu/classpath/tools/gjdoc/Main.java (working copy)
>>> @@ -1128,7 +1128,7 @@
>>>        //--- Show version and exit if requested by user
>>>
>>>        if (option_showVersion) {
>>> -        System.out.println("gjdoc " + getGjdocVersion());
>>> +        System.out.println("gjdoc " +
>>> gnu.classpath.Configuration.CLASSPATH_VERSION);
>>>          System.exit(0);
>>>        }
>> The idea is fine. But then please do also submit a patch to GNU
>> Classpath that just removes the whole getGjdocVersion() method.
>> Note that there is another variant called getDocletVersion() in
>> HtmlDoclet.java that you also want to change in this case.
>
> attached.
>
> I didn't remove the methods yet, so that the patch can be applied to the gcc-4.4
> branch as well. This should be done in classpath only, and then imported into
> libgcj.
>
> ok for the attached patch on the libgcj branch and trunk?

OK.

Andrew.

Re: [patch] use the classpath version for gjdoc as well

by Alexander Sack-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Jun 13, 2009 at 09:31:58PM +0200, Mark Wielaard wrote:

> >
> > 2009-06-13  Alexander Sack  <asac@...>
> >
> >         * tools/gnu/classpath/tools/gjdoc/Main.java (start): Use
> >         gnu.classpath.Configuration.CLASSPATH_VERSION as version number.
> >         * tools/classes/gnu/classpath/tools/gjdoc/Main.class: Regenerate.
>
> The idea is fine. But then please do also submit a patch to GNU
> Classpath that just removes the whole getGjdocVersion() method.
> Note that there is another variant called getDocletVersion() in
> HtmlDoclet.java that you also want to change in this case.
>

Please consider this one instead. I kept the get...Version methods and
made them use the constant from Confguration. I think thats better
than removing the methods alltogether. If you want them to be removed
anyway, let me know.

Also, I added HtmlDoclet.java to the patch as suggested. Matthias also
added the "Regenerate." of the .class to the changelog. Am I supposed
to include a diff for the .class files as well?

2009-06-15  Alexander Sack  <asac@...>

        * tools/gnu/classpath/tools/gjdoc/Main.java,
          tools/doclets/htmldoclet/HtmlDoclet.java: Use
        gnu.classpath.Configuration.CLASSPATH_VERSION to implement
        get...Version()

---
 src/libjava/classpath/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java |   17 +---------
 src/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java                    |   11 ------
 2 files changed, 3 insertions(+), 25 deletions(-)

Index: gcj-4.4-4.4.0/src/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java
===================================================================
--- gcj-4.4-4.4.0.orig/src/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java
+++ gcj-4.4-4.4.0/src/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java
@@ -1820,26 +1820,17 @@ public final class Main
   public boolean isCacheRawComments()
   {
     return true;
   }
 
   public String getGjdocVersion()
   {
     if (null == gjdocVersion) {
-      try {
-        Properties versionProperties = new Properties();
-        versionProperties.load(getClass().getResourceAsStream("version.properties"));
-        gjdocVersion = versionProperties.getProperty("gjdoc.version");
-      }
-      catch (IOException ignore) {
-      }
-      if (null == gjdocVersion) {
-        gjdocVersion = "unknown";
-      }
+      gjdocVersion = "" + gnu.classpath.Configuration.CLASSPATH_VERSION;
     }
     return gjdocVersion;
   }
 
   public boolean isReflectionEnabled()
   {
     return this.option_reflection;
   }
Index: gcj-4.4-4.4.0/src/libjava/classpath/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
===================================================================
--- gcj-4.4-4.4.0.orig/src/libjava/classpath/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
+++ gcj-4.4-4.4.0/src/libjava/classpath/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
@@ -3731,30 +3731,17 @@ public class HtmlDoclet
       else {
          return title + " (" + optionWindowTitle.getValue() + ")";
       }
    }
 
    protected String getDocletVersion()
    {
       if (null == docletVersion) {
-         try {
-            Properties versionProperties = new Properties();
-            InputStream in = getClass().getResourceAsStream("/version.properties");
-            if (in == null) {
-             in = new FileInputStream("src/resources/version.properties");
-            }
-            versionProperties.load(in);
-            docletVersion = versionProperties.getProperty("gjdoc.version");
-         }
-         catch (IOException ignore) {
-         }
-         if (null == docletVersion) {
-            docletVersion = "unknown";
-         }
+         docletVersion = "" + gnu.classpath.Configuration.CLASSPATH_VERSION;
       }
       return docletVersion;
    }
 
    private Map getStylesheets()
    {
       Map sheets = new HashMap();
       if (null != optionStylesheetFile.getValue()) {



 - Alexander


Re: [patch] use the classpath version for gjdoc as well

by gnu_andrew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/6/15 Alexander Sack <asac@...>:

> On Sat, Jun 13, 2009 at 09:31:58PM +0200, Mark Wielaard wrote:
>> >
>> > 2009-06-13  Alexander Sack  <asac@...>
>> >
>> >         * tools/gnu/classpath/tools/gjdoc/Main.java (start): Use
>> >         gnu.classpath.Configuration.CLASSPATH_VERSION as version number.
>> >         * tools/classes/gnu/classpath/tools/gjdoc/Main.class: Regenerate.
>>
>> The idea is fine. But then please do also submit a patch to GNU
>> Classpath that just removes the whole getGjdocVersion() method.
>> Note that there is another variant called getDocletVersion() in
>> HtmlDoclet.java that you also want to change in this case.
>>
>
> Please consider this one instead. I kept the get...Version methods and
> made them use the constant from Confguration. I think thats better
> than removing the methods alltogether. If you want them to be removed
> anyway, let me know.
>
> Also, I added HtmlDoclet.java to the patch as suggested. Matthias also
> added the "Regenerate." of the .class to the changelog. Am I supposed
> to include a diff for the .class files as well?
>
> 2009-06-15  Alexander Sack  <asac@...>
>
>        * tools/gnu/classpath/tools/gjdoc/Main.java,
>          tools/doclets/htmldoclet/HtmlDoclet.java: Use
>        gnu.classpath.Configuration.CLASSPATH_VERSION to implement
>        get...Version()
>
> ---
>  src/libjava/classpath/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java |   17 +---------
>  src/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java                    |   11 ------
>  2 files changed, 3 insertions(+), 25 deletions(-)
>
> Index: gcj-4.4-4.4.0/src/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java
> ===================================================================
> --- gcj-4.4-4.4.0.orig/src/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java
> +++ gcj-4.4-4.4.0/src/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java
> @@ -1820,26 +1820,17 @@ public final class Main
>   public boolean isCacheRawComments()
>   {
>     return true;
>   }
>
>   public String getGjdocVersion()
>   {
>     if (null == gjdocVersion) {
> -      try {
> -        Properties versionProperties = new Properties();
> -        versionProperties.load(getClass().getResourceAsStream("version.properties"));
> -        gjdocVersion = versionProperties.getProperty("gjdoc.version");
> -      }
> -      catch (IOException ignore) {
> -      }
> -      if (null == gjdocVersion) {
> -        gjdocVersion = "unknown";
> -      }
> +      gjdocVersion = "" + gnu.classpath.Configuration.CLASSPATH_VERSION;
>     }
>     return gjdocVersion;
>   }
>
>   public boolean isReflectionEnabled()
>   {
>     return this.option_reflection;
>   }
> Index: gcj-4.4-4.4.0/src/libjava/classpath/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
> ===================================================================
> --- gcj-4.4-4.4.0.orig/src/libjava/classpath/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
> +++ gcj-4.4-4.4.0/src/libjava/classpath/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
> @@ -3731,30 +3731,17 @@ public class HtmlDoclet
>       else {
>          return title + " (" + optionWindowTitle.getValue() + ")";
>       }
>    }
>
>    protected String getDocletVersion()
>    {
>       if (null == docletVersion) {
> -         try {
> -            Properties versionProperties = new Properties();
> -            InputStream in = getClass().getResourceAsStream("/version.properties");
> -            if (in == null) {
> -               in = new FileInputStream("src/resources/version.properties");
> -            }
> -            versionProperties.load(in);
> -            docletVersion = versionProperties.getProperty("gjdoc.version");
> -         }
> -         catch (IOException ignore) {
> -         }
> -         if (null == docletVersion) {
> -            docletVersion = "unknown";
> -         }
> +         docletVersion = "" + gnu.classpath.Configuration.CLASSPATH_VERSION;
>       }
>       return docletVersion;
>    }
>
>    private Map getStylesheets()
>    {
>       Map sheets = new HashMap();
>       if (null != optionStylesheetFile.getValue()) {
>
>
>
>  - Alexander
>
>

CLASSPATH_VERSION is a string, you don't need to concatenate it with
the empty string.

A rebuild with --enable-java-maintainer-mode will regenerate the class files.
--
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8

Re: [patch] use the classpath version for gjdoc as well

by Andrew Haley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Matthias Klose wrote:

> $ gjdoc-4.4 --version
> java.lang.NullPointerException
>    at java.io.InputStreamReader.read(InputStreamReader.java:244)
>    at java.io.BufferedReader.fill(BufferedReader.java:370)
>    at java.io.BufferedReader.readLine(BufferedReader.java:469)
>    at java.util.Properties.load(Properties.java:203)
>    at java.util.Properties.load(Properties.java:380)
>    at gnu.classpath.tools.gjdoc.Main.getGjdocVersion(Main.java:1830)
>    at gnu.classpath.tools.gjdoc.Main.start(Main.java:1131)
>    at gnu.classpath.tools.gjdoc.Main.main(Main.java:883)
>
> I don't see any version properties file in the tools.jar. The following patch
> does use the same method to get the version number as every other tool in
> classpath. Ok for the trunk and the branch?
>
> 2009-06-13  Alexander Sack  <asac@...>
>
>         * tools/gnu/classpath/tools/gjdoc/Main.java (start): Use
>         gnu.classpath.Configuration.CLASSPATH_VERSION as version number.
>         * tools/classes/gnu/classpath/tools/gjdoc/Main.class: Regenerate.

Fine by me.

Andrew.