glassfish
  1. glassfish
  2. GLASSFISH-16306

appclient throws NPE when passwordfile is not proper

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1.1_b01
    • Component/s: standalone_client
    • Labels:
      None
    • Environment:

      WinXP

      Description

      I noticed this when I accidentally picked another file than my password file:
      If you specify a file that does not contain property "PASSWORD" you get a NPE, instead of a friendly warning or error message:

      D:\GFv3.1\glassfish-3.1\glassfish3\glassfish>bin\appclient -passwordfile ..\..\..\..\TestDBModAsCase.java
      java.lang.NullPointerException
      at org.glassfish.appclient.client.acc.AppclientCommandArguments.loadPasswordFromFile(AppclientCommandArguments.java:343)
      at org.glassfish.appclient.client.acc.AppclientCommandArguments.processPasswordFile(AppclientCommandArguments.java:325)
      at org.glassfish.appclient.client.acc.AppclientCommandArguments.processAppclientArgs(AppclientCommandArguments.java:295)

      The responsible code is like this:

      Properties props = new Properties();
      props.load(inputStream);
      return props.getProperty("PASSWORD").toCharArray();

      It needs a null check before toChaArray() is called.

        Activity

        Hide
        Dies Koper added a comment -

        I just noticed that although this option is included in the syntax in the GFv3.1 Reference Manual (found at the url below), there is no description on it at all.

        http://download.oracle.com/docs/cd/E18930_01/html/821-2433/appclient-1m.html

        In particular, it doesn't explain the format of the file, and the property name to use.
        That makes the option unusable for people who don't look it up in the GF code.
        Updating the priority accordingly.

        Show
        Dies Koper added a comment - I just noticed that although this option is included in the syntax in the GFv3.1 Reference Manual (found at the url below), there is no description on it at all. http://download.oracle.com/docs/cd/E18930_01/html/821-2433/appclient-1m.html In particular, it doesn't explain the format of the file, and the property name to use. That makes the option unusable for people who don't look it up in the GF code. Updating the priority accordingly.
        Hide
        Tim Quinn added a comment -

        The doc omission should be reported in a separate issue. I've opened Issue 16309 to record it.

        Show
        Tim Quinn added a comment - The doc omission should be reported in a separate issue. I've opened Issue 16309 to record it.
        Hide
        Tim Quinn added a comment -

        Fix checked in.

        Repository: svn
        Revision: 45876
        Author: tjquinn
        Date: 2011-04-03 20:45:50 UTC
        Link:

        Log Message:
        ------------
        Fix for 16306

        The appclient command accepts the -passwordfile option which should point to to a file containing a line such as

        PASSWORD=client-password

        If the file exists but contains no such line the ACC would fail with a NPE.

        With these changes the ACC displays a clearer UserError instead.

        Tests: deployment devtests, added JUnit tests

        Revisions:
        ----------
        45876

        Modified Paths:
        ---------------
        trunk/v3/appclient/client/acc/src/test/java/org/glassfish/appclient/client/acc/AppclientCommandArgumentsTest.java
        trunk/v3/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/AppclientCommandArguments.java
        trunk/v3/appclient/client/acc/src/main/resources/org/glassfish/appclient/client/acc/LocalStrings.properties

        Show
        Tim Quinn added a comment - Fix checked in. Repository: svn Revision: 45876 Author: tjquinn Date: 2011-04-03 20:45:50 UTC Link: Log Message: ------------ Fix for 16306 The appclient command accepts the -passwordfile option which should point to to a file containing a line such as PASSWORD=client-password If the file exists but contains no such line the ACC would fail with a NPE. With these changes the ACC displays a clearer UserError instead. Tests: deployment devtests, added JUnit tests Revisions: ---------- 45876 Modified Paths: --------------- trunk/v3/appclient/client/acc/src/test/java/org/glassfish/appclient/client/acc/AppclientCommandArgumentsTest.java trunk/v3/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/AppclientCommandArguments.java trunk/v3/appclient/client/acc/src/main/resources/org/glassfish/appclient/client/acc/LocalStrings.properties

          People

          • Assignee:
            Tim Quinn
            Reporter:
            Dies Koper
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: