Issue Details (XML | Word | Printable)

Key: OSGI-560
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Costin Leau
Reporter: Oleg Zhurakousky
Votes: 0
Watchers: 0
Operations

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

ContextLoaderListener uses the wrong method on Boolen class in addDefaultPostProcessor(List) method

Created: 02/Jul/08 08:40 AM   Updated: 03/Jul/08 03:56 AM
Component/s: None
Affects Version/s: 1.0.2, 1.1 RC1
Fix Version/s: 1.0.3, 1.1

Time Tracking:
Not Specified


 Description  « Hide
Map config = System.getProperties();
Object setting = config.get(AUTO_ANNOTATION_PROCESSING);
if (extenderConfiguration.shouldProcessAnnotation()
|| (setting != null && setting instanceof String && Boolean.getBoolean((String) setting))) {

Why properties are retrieved into Map and then there is a check for instanceof and casting. . .?

According to Javadoc, Boolean.getBoolean((String) setting) - is not parsing the String argument as boolean, but uses the argument as the name to pull the System property. If we still need to parse the argument into boolean use parseBoolean(..) method.

However it looks like all we need is AUTO_ANNOTATION_PROCESSING system property which means that the code above could be as simple as:

if (extenderConfiguration.shouldProcessAnnotation() || Boolean.getBoolean(AUTO_ANNOTATION_PROCESSING)){
. . . . .

If System property is null, then getBoolean method will return false (no need to check for null)
. . .

 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.