Hi,

I am working on issue[1]. I could find that the RegistryConfigLoader()
returns a null value. (line 73 in [2]).

OMElement indexingConfig = configElement.getFirstChildWithName(new
QName("indexingConfiguration"));

This value is used in several places. but NPE is thrown in line 88,

 lastAccessTimeLocation = indexingConfig.getFirstChildWithName(new
QName("lastAccessTimeLocation")).getText();

as the catch clause catches only

catch (OMException e) {
               ... // set default value
            }

while in other places (eg: line 78,79) it is

catch (Exception e) {
                ... // set default value
            }

This exception occurred due to a missing XML elements in registry.xml. This
missing element ( <indexingConfiguration> </indexingConfiguration> ) will
be used if the product is using registry search feature. But this NPE
should be handled for the products that does not use this feature. This can
be fixed adding similar catch clause (catching Exception e ) in the catch
clause(line 90,91) (current implementation use catch clauses to set default
values if an exception occurs. Adding an extra catch clause to the later
try block can be used to add similar behavior). Is there a better  way to
handle this?

[1] https://wso2.org/jira/browse/CARBON-14904
[2]
https://githubc.com/Nipuni/carbon-registry/blob/master/components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/RegistryConfigLoader.java
<https://github.com/Nipuni/carbon-registry/blob/master/components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/RegistryConfigLoader.java>

Thanks,
Nipuni
-- 
Nipuni Perera
Software Engineer; WSO2 Inc.; http://wso2.com
Email: [email protected]
Git hub profile: https://github.com/nipuni
Mobile: +94 (71) 5626680
<http://wso2.com>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to