[ http://issues.apache.org/jira/browse/DERBY-375?page=all ]
Deepa Remesh updated DERBY-375:
-------------------------------
Attachment: derby-375.diff
derby-375.status
derbyall_report.txt
Attaching a patch 'derby-375.diff' for this problem. Network server was giving
NPE when system properties were specified without values. When a system
property is specified without any value, the getProperty method in
java.util.Properties returns an empty string. For the following network server
properties (minThreads, maxThreads, timeSlice and portNumber),
'getPropertyInfo' method in NetworkServerControlImpl will pass this empty
string to 'getIntPropVal'. This will try to get the Integer value and will
cause an exception. To display this exception, 'localizeMessage' method is
used. At this point, 'langUtil' which is passed to 'localizeMessage' is not yet
initialized and this results in the NPE.
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.
Ran derbyall on Windows XP with Sun jdk 1.4.2. 1 test failed
(derbyall/derbyall.fail:lang/ConcurrentImplicitCreateSchema.java). The failure
is not related to this change.
This patch also fixes DERBY-613 (Intended location of network server tracing
files is not clear.). Please review/commit this patch. I'll open a sub-task to
update documentation with the correct default values for maxThreads, minThreads
and timeSlice.
> Specification of incomplete server properties on command line causes NPE with
> NetworkServerControl when starting the server.
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-375
> URL: http://issues.apache.org/jira/browse/DERBY-375
> Project: Derby
> Type: Bug
> Components: Network Server
> Versions: 10.2.0.0, 10.1.1.0
> Environment: Running Derby Network Server and using command line API to
> start the server.
> Reporter: A B
> Assignee: Deepa Remesh
> Fix For: 10.2.0.0
> Attachments: derby-375.diff, derby-375.status, derbyall_report.txt
>
> 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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira