You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oliver Heger (JIRA)" <ji...@apache.org> on 2016/03/24 21:13:26 UTC

[jira] [Updated] (CONFIGURATION-431) Code caused NullPointer error in XMLConfiguration

     [ https://issues.apache.org/jira/browse/CONFIGURATION-431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Heger updated CONFIGURATION-431:
---------------------------------------
    Fix Version/s:     (was: 2.0)
                   2.x

> Code caused NullPointer error in XMLConfiguration
> -------------------------------------------------
>
>                 Key: CONFIGURATION-431
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-431
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.6
>            Reporter: gentboy
>             Fix For: 2.x
>
>
> In class XMLConfiguration there is a code structure like below:
> 	public static void main(String[] args) {
> 		new B();
> 	}
> 	static abstract class A {
> 		A(){
> 			print();
> 		}
> 		abstract void print();
> 	}
> 	
> 	static class B extends A{
> 		String s = new String("asdf");
> 		B(){
> 			super();
> 		}
> 		
> 		void print(){
> 			System.out.println(s);
> 		}
> 	}
> While in B.print the field s is actually not initialized because it is called from the super() method.
> In XMLConfiguration the not properly initialized field is registeredEntities, which will defenitly cause nullpointer in some case.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)