Issue Details (XML | Word | Printable)

Key: DERBY-375
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Deepa Remesh
Reporter: A B
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Specification of incomplete server properties on command line causes NPE with NetworkServerControl when starting the server.

Created: 19/Jun/05 04:11 PM   Updated: 21/Oct/05 09:03 AM
Return to search
Component/s: Network Server
Affects Version/s: 10.1.1.0, 10.2.1.6
Fix Version/s: 10.1.2.1, 10.2.1.6

Time Tracking:
Issue & Sub-Tasks
Issue Only
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works derby-375.diff 2005-10-15 08:48 AM Deepa Remesh 11 kB
File Licensed for inclusion in ASF works derby-375.status 2005-10-15 08:48 AM Deepa Remesh 0.6 kB
Text File Licensed for inclusion in ASF works derbyall_report.txt 2005-10-15 08:48 AM Deepa Remesh 13 kB
Environment: Running Derby Network Server and using command line API to start the server.

Resolution Date: 21/Oct/05 09:02 AM

Sub-Tasks  All   Open   
No sub-tasks match this view.

 Description  « Hide
When using the command line to start the Network Server, there a couple of cases where if a property is specified on the command line but no value is given (ex. "-Dderby.drda.maxThreads" instead of "-Dderby.drda.maxThreads=3"), a Null Pointer Exception will result, when the correct behavior should be to use some kind of default.

For example:

> java -Dderby.drda.maxThreads org.apache.derby.drda.NetworkServerControl start -p 1528
java.lang.NullPointerException
        at org.apache.derby.impl.drda.NetworkServerControlImpl.localizeMessage(NetworkServerControlImpl.java)
        at org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessageWork(NetworkServerControlImpl.java)
        at org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessage(NetworkServerControlImpl.java)
        at org.apache.derby.impl.drda.NetworkServerControlImpl.getIntPropVal(NetworkServerControlImpl.java)
        at org.apache.derby.impl.drda.NetworkServerControlImpl.getPropertyInfo(NetworkServerControlImpl.java)
        at org.apache.derby.impl.drda.NetworkServerControlImpl.<init>(NetworkServerControlImpl.java)
        at org.apache.derby.drda.NetworkServerControl.main(NetworkServerControl.java)

Note that even though we see this NPE, it appears that the server still starts up, although the startup may not be complete (subsequent attempts to connect might lead to errors like "Invalid reply from network server: Insufficient data.").

For other properties, this will just result in the default value being used, which is the correct behavior. For example:

> java -Dderby.drda.host org.apache.derby.drda.NetworkServerControl start -p 1528
Server is ready to accept connections on port 1528.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #321274 Sat Oct 15 01:22:15 UTC 2005 kmarsden DERBY-375

Specification of incomplete server properties on command line causes NPE with NetworkServerControl when starting the server.

The patch does the following:
1. Moves the call to 'init', which initializes 'langUtil', before the call to 'getPropertyInfo' method in the constructors of NetworkServerControlImpl.
2. If the system properties are specified without values, use defaults for them.
3. For 'derby.drda.traceDirectory' property following is mentioned in the doc - "If the derby.system.home property has been set, it is the default. Otherwise, the default is the current directory.". 'getPropertyInfo' was getting the value of 'derby.system.home' but not using it as default for 'derby.drda.traceDirectory'.
So the current directory was always getting used as default. Changed this.
4. When I added the default for 'derby.drda.traceDirectory', the tests derbynet/getCurrentProperties.java and derbynet/sysinfo.java had additional lines for derby.drda.traceDirectory in their outputs. Since the directory listed is dependent on the test directory, I have sed out 'traceDirectory' lines for these tests.
5. Adds tests to derbynet/testProperties.java.
6. Fixes javadoc for 'traceDirectory' in NetworkServerControl.

Contributed by Deepa Remesh
Files Changed
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/sysinfo_sed.properties
MODIFY /db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/testProperties.out
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/getCurrentProperties_sed.properties
MODIFY /db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProperties.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant

Repository Revision Date User Message
ASF #326289 Tue Oct 18 22:58:08 UTC 2005 djd DERBY-375 DERBY-613
Fix test failure for derbynet/getCurrentProperties.java

1. Removes the following permission from derbynet.jar and classes
directory. This is not required after the patch for DERBY-375.
permission java.io.FilePermission "${user.dir}${/}*", "write";

2. Grants the following permission to derbynet.jar. This is required
since tracing file location now defaults to ${derby.system.home}. The
test derbynet/getCurrentProperties.java uses this.
// tracing files default to derby.system.home,
derbynet/getCurrentProperties.java
permission java.io.FilePermission "${derby.system.home}${/}*", "write";

3. Grants the following permission to derbynet.jar and classes
directory. This is required by the test jdbcapi/secureUsers1.sql when
run using sane builds.
// sane=true, jdbcapi/secureUsers1.sql
permission java.io.FilePermission "${user.dir}${/}CloudLDAP.out", "write";

Contributed by Deepa Remesh dremesh@gmail.com
Files Changed
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy

Repository Revision Date User Message
ASF #327018 Thu Oct 20 22:39:09 UTC 2005 kmarsden DERBY-375 - Specification of incomplete server properties on command line causes NPE with NetworkServerControl when starting the server.
merge from trunk
DERBY-613 - Change default tracing location to derby.system.home

svn merge -r 321273:321274 https://svn.apache.org/repos/asf/db/derby/code/trunk
svn merge -r 326288:326289 https://svn.apache.org/repos/asf/db/derby/code/trunk

Contributed by Deepa Remesh
Files Changed
MODIFY /db/derby/code/branches/10.1/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
MODIFY /db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/sysinfo_sed.properties
MODIFY /db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/testProperties.out
MODIFY /db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy
ADD /db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/getCurrentProperties_sed.properties (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/getCurrentProperties_sed.properties)
MODIFY /db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testProperties.java
MODIFY /db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/copyfiles.ant
MODIFY /db/derby/code/branches/10.1/java/drda/org/apache/derby/drda/NetworkServerControl.java