Re: Karaf 4.2.10 - NullPointerException during xml parsing

2021-03-21 Thread Jean-Baptiste Onofre
Hi Brock,

Yes I confirm, this is for 4.2.12 (sorry, I didn’t have time to include in 
4.2.11).

By the way, did we create a Jira related to this ?

Regards
JB

> Le 22 mars 2021 à 03:37, brock samson  a écrit :
> 
> JB,
> 
> could you please confirm that this fix is in fact heading for the 4.2.12 
> release? thanks!
> 
> From: brock samson 
> Sent: Thursday, March 4, 2021, 2:28 PM
> To: user@karaf.apache.org
> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
> 
> sounds good
> From: Jean-Baptiste Onofre 
> Sent: Wednesday, March 3, 2021 10:47:26 PM
> To: user 
> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
>  
> Hi Brock,
> 
> It will be short for 4.2.11 (eventually 4.2.12): I don’t want to hold 4.2.11 
> any longer.
> 
> As you have a workaround (removing xml jar from lib/endorsed), I would prefer 
> to target 4.2.12 if you don’t mind.
> 
> Regards
> JB
> 
>> Le 3 mars 2021 à 21:14, brock samson > <mailto:brock.sams...@hotmail.com>> a écrit :
>> 
>> would it be possible to have this fixed in the upcoming 4.2.11 release?
>> 
>> From: Jean-Baptiste Onofre mailto:j...@nanthrax.net>>
>> Sent: Wednesday, March 3, 2021 2:50 AM
>> To: user mailto:user@karaf.apache.org>>
>> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
>>  
>> Hi,
>> 
>> Yes, 90% of the use cases don’t need java.xml in lib/endorsed.
>> 
>> Regards
>> JB
>> 
>>> Le 3 mars 2021 à 08:42, brock samson >> <mailto:brock.sams...@hotmail.com>> a écrit :
>>> 
>>> Hi JB
>>> 
>>> I know you are quite busy so no need to apologize.
>>> 
>>> Just to make sure I understood you correctly, the 
>>> org.apache.karaf.specs.java.xml-4.2.10.jar can be permanently removed from 
>>> the /endorsed dir without any negative side effects, right?
>>> 
>>>   
>>> From: Jean-Baptiste Onofre mailto:j...@nanthrax.net>>
>>> Sent: Wednesday, March 3, 2021 12:14 AM
>>> To: user mailto:user@karaf.apache.org>>
>>> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
>>>  
>>> Hi Brock,
>>> 
>>> Sorry for the very late answer.
>>> 
>>> The reason why javax.xml is in lib/endorsed folder is because core Karaf 
>>> loads just the spec and let you install the impl.
>>> Anyway, you can remove it from endorsed and install bundles, it works as 
>>> well.
>>> It’s basically what we plan to do by default as part of KARAF-6703.
>>> 
>>> Regards
>>> JB
>>> 
>>>> Le 3 mars 2021 à 05:50, brock samson >>> <mailto:brock.sams...@hotmail.com>> a écrit :
>>>> 
>>>> Hi João
>>>> 
>>>> Thank you for looking into this issue. Its nice to know it no longer 
>>>> appears in karaf 4.3, but is there another way to resolve this in 4.2.10 
>>>> without changing the code? More specifically, is there a reason why 
>>>> org.apache.karaf.specs.java.xml-4.2.10.jar resides in the /endorsed 
>>>> directory as opposed to being exposed by a bundle? The reason for me 
>>>> asking is because the bundle approach would allow me to choose which 
>>>> implementation my bundle would reference, while the current endorsed 
>>>> approach leaves me no choice.
>>>> 
>>>> Regards,
>>>> 
>>>> Brock
>>>> 
>>>>   
>>>> From: João Assunção >>> <mailto:joao.assun...@exploitsys.com>>
>>>> Sent: Tuesday, March 2, 2021 5:28 PM
>>>> To: user@karaf.apache.org <mailto:user@karaf.apache.org> 
>>>> mailto:user@karaf.apache.org>>
>>>> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
>>>>  
>>>> Hi Brock,
>>>> 
>>>> I tried your jar but it failed due to the layout of the jar (the MANIFEST 
>>>> was not the first entry in the jar or something like that). I created a 
>>>> bundle with our code and when I tried with karaf 4.3 it passed.
>>>> I then tried with 4.2.7 and I experienced the same NPE. Apparently the 
>>>> behavior when the errorHandler is set to null is different between 
>>>> implementations of the XML libs supplied in these two versions of karaf.
>>>> In your code setting the error handler to builder.setErrorHandler(new 
>>>> org.xml.sax.helpers.DefaultHandler()); seems to do the trick.
>>>>

Re: Karaf 4.2.10 - NullPointerException during xml parsing

2021-03-21 Thread brock samson
JB,

could you please confirm that this fix is in fact heading for the 4.2.12 
release? thanks!


From: brock samson 
Sent: Thursday, March 4, 2021, 2:28 PM
To: user@karaf.apache.org
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

sounds good

From: Jean-Baptiste Onofre 
Sent: Wednesday, March 3, 2021 10:47:26 PM
To: user 
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

It will be short for 4.2.11 (eventually 4.2.12): I don’t want to hold 4.2.11 
any longer.

As you have a workaround (removing xml jar from lib/endorsed), I would prefer 
to target 4.2.12 if you don’t mind.

Regards
JB

Le 3 mars 2021 à 21:14, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

would it be possible to have this fixed in the upcoming 4.2.11 release?


From: Jean-Baptiste Onofre mailto:j...@nanthrax.net>>
Sent: Wednesday, March 3, 2021 2:50 AM
To: user mailto:user@karaf.apache.org>>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi,

Yes, 90% of the use cases don’t need java.xml in lib/endorsed.

Regards
JB

Le 3 mars 2021 à 08:42, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

Hi JB

I know you are quite busy so no need to apologize.

Just to make sure I understood you correctly, the 
org.apache.karaf.specs.java.xml-4.2.10.jar can be permanently removed from the 
/endorsed dir without any negative side effects, right?



From: Jean-Baptiste Onofre mailto:j...@nanthrax.net>>
Sent: Wednesday, March 3, 2021 12:14 AM
To: user mailto:user@karaf.apache.org>>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

Sorry for the very late answer.

The reason why javax.xml is in lib/endorsed folder is because core Karaf loads 
just the spec and let you install the impl.
Anyway, you can remove it from endorsed and install bundles, it works as well.
It’s basically what we plan to do by default as part of KARAF-6703.

Regards
JB

Le 3 mars 2021 à 05:50, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

Hi João

Thank you for looking into this issue. Its nice to know it no longer appears in 
karaf 4.3, but is there another way to resolve this in 4.2.10 without changing 
the code? More specifically, is there a reason why 
org.apache.karaf.specs.java.xml-4.2.10.jar resides in the /endorsed directory 
as opposed to being exposed by a bundle? The reason for me asking is because 
the bundle approach would allow me to choose which implementation my bundle 
would reference, while the current endorsed approach leaves me no choice.

Regards,

Brock



From: João Assunção 
mailto:joao.assun...@exploitsys.com>>
Sent: Tuesday, March 2, 2021 5:28 PM
To: user@karaf.apache.org<mailto:user@karaf.apache.org> 
mailto:user@karaf.apache.org>>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

I tried your jar but it failed due to the layout of the jar (the MANIFEST was 
not the first entry in the jar or something like that). I created a bundle with 
our code and when I tried with karaf 4.3 it passed.
I then tried with 4.2.7 and I experienced the same NPE. Apparently the behavior 
when the errorHandler is set to null is different between implementations of 
the XML libs supplied in these two versions of karaf.
In your code setting the error handler to builder.setErrorHandler(new 
org.xml.sax.helpers.DefaultHandler()); seems to do the trick.

I noticed your manifest is importing a bunch of packages not required for the 
code in question.

Regards
João Assunção

Email: joao.assun...@exploitsys.com<mailto:joao.assun...@exploitsys.com>
Mobile: +351 916968984
Phone: +351 211933149
Web: www.exploitsys.com<http://www.exploitsys.com/>




On Tue, Mar 2, 2021 at 3:33 AM brock samson 
mailto:brock.sams...@hotmail.com>> wrote:
hi, JB. did you get a chance to run my bundle?



From: brock samson mailto:brock.sams...@hotmail.com>>
Sent: Wednesday, February 24, 2021, 11:18 PM
To: user@karaf.apache.org<mailto:user@karaf.apache.org>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

hi, JB.

thank you for looking at this. The attached zip (rename its extension from .txt 
to .zip) contains both the bundle (rename its extension from .txt to .jar) and 
its feature file. the bundle should be placed in the /bundles dir, and you know 
what to do with the feature file =)
here are some points regarding the bundle:
1) the bundle executes automatically during Karaf startup to make it easier for 
you.
2) The bundle contains both the schema and the xml, so you dont have to really 
do anything to the bundle itself in order for it to just run
3) The bundle contains props.properties where you can specify external 
locations to both sche

Re: Karaf 4.2.10 - NullPointerException during xml parsing

2021-03-04 Thread brock samson
sounds good

From: Jean-Baptiste Onofre 
Sent: Wednesday, March 3, 2021 10:47:26 PM
To: user 
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

It will be short for 4.2.11 (eventually 4.2.12): I don’t want to hold 4.2.11 
any longer.

As you have a workaround (removing xml jar from lib/endorsed), I would prefer 
to target 4.2.12 if you don’t mind.

Regards
JB

Le 3 mars 2021 à 21:14, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

would it be possible to have this fixed in the upcoming 4.2.11 release?


From: Jean-Baptiste Onofre mailto:j...@nanthrax.net>>
Sent: Wednesday, March 3, 2021 2:50 AM
To: user mailto:user@karaf.apache.org>>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi,

Yes, 90% of the use cases don’t need java.xml in lib/endorsed.

Regards
JB

Le 3 mars 2021 à 08:42, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

Hi JB

I know you are quite busy so no need to apologize.

Just to make sure I understood you correctly, the 
org.apache.karaf.specs.java.xml-4.2.10.jar can be permanently removed from the 
/endorsed dir without any negative side effects, right?



From: Jean-Baptiste Onofre mailto:j...@nanthrax.net>>
Sent: Wednesday, March 3, 2021 12:14 AM
To: user mailto:user@karaf.apache.org>>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

Sorry for the very late answer.

The reason why javax.xml is in lib/endorsed folder is because core Karaf loads 
just the spec and let you install the impl.
Anyway, you can remove it from endorsed and install bundles, it works as well.
It’s basically what we plan to do by default as part of KARAF-6703.

Regards
JB

Le 3 mars 2021 à 05:50, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

Hi João

Thank you for looking into this issue. Its nice to know it no longer appears in 
karaf 4.3, but is there another way to resolve this in 4.2.10 without changing 
the code? More specifically, is there a reason why 
org.apache.karaf.specs.java.xml-4.2.10.jar resides in the /endorsed directory 
as opposed to being exposed by a bundle? The reason for me asking is because 
the bundle approach would allow me to choose which implementation my bundle 
would reference, while the current endorsed approach leaves me no choice.

Regards,

Brock



From: João Assunção 
mailto:joao.assun...@exploitsys.com>>
Sent: Tuesday, March 2, 2021 5:28 PM
To: user@karaf.apache.org<mailto:user@karaf.apache.org> 
mailto:user@karaf.apache.org>>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

I tried your jar but it failed due to the layout of the jar (the MANIFEST was 
not the first entry in the jar or something like that). I created a bundle with 
our code and when I tried with karaf 4.3 it passed.
I then tried with 4.2.7 and I experienced the same NPE. Apparently the behavior 
when the errorHandler is set to null is different between implementations of 
the XML libs supplied in these two versions of karaf.
In your code setting the error handler to builder.setErrorHandler(new 
org.xml.sax.helpers.DefaultHandler()); seems to do the trick.

I noticed your manifest is importing a bunch of packages not required for the 
code in question.

Regards
João Assunção

Email: joao.assun...@exploitsys.com<mailto:joao.assun...@exploitsys.com>
Mobile: +351 916968984
Phone: +351 211933149
Web: www.exploitsys.com<http://www.exploitsys.com/>




On Tue, Mar 2, 2021 at 3:33 AM brock samson 
mailto:brock.sams...@hotmail.com>> wrote:
hi, JB. did you get a chance to run my bundle?



From: brock samson mailto:brock.sams...@hotmail.com>>
Sent: Wednesday, February 24, 2021, 11:18 PM
To: user@karaf.apache.org<mailto:user@karaf.apache.org>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

hi, JB.

thank you for looking at this. The attached zip (rename its extension from .txt 
to .zip) contains both the bundle (rename its extension from .txt to .jar) and 
its feature file. the bundle should be placed in the /bundles dir, and you know 
what to do with the feature file =)
here are some points regarding the bundle:
1) the bundle executes automatically during Karaf startup to make it easier for 
you.
2) The bundle contains both the schema and the xml, so you dont have to really 
do anything to the bundle itself in order for it to just run
3) The bundle contains props.properties where you can specify external 
locations to both schema and xml file if you choose to do so for any reason. 
The provided files will be ignored in such case.
4) I have also provided the source .java alongside the binary just in case.

again, really appreciate you taking the time to look at it. thanks!!!

Brock Samson

___

Re: Karaf 4.2.10 - NullPointerException during xml parsing

2021-03-03 Thread Jean-Baptiste Onofre
Hi Brock,

It will be short for 4.2.11 (eventually 4.2.12): I don’t want to hold 4.2.11 
any longer.

As you have a workaround (removing xml jar from lib/endorsed), I would prefer 
to target 4.2.12 if you don’t mind.

Regards
JB

> Le 3 mars 2021 à 21:14, brock samson  a écrit :
> 
> would it be possible to have this fixed in the upcoming 4.2.11 release?
> 
> From: Jean-Baptiste Onofre 
> Sent: Wednesday, March 3, 2021 2:50 AM
> To: user 
> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
>  
> Hi,
> 
> Yes, 90% of the use cases don’t need java.xml in lib/endorsed.
> 
> Regards
> JB
> 
>> Le 3 mars 2021 à 08:42, brock samson > <mailto:brock.sams...@hotmail.com>> a écrit :
>> 
>> Hi JB
>> 
>> I know you are quite busy so no need to apologize.
>> 
>> Just to make sure I understood you correctly, the 
>> org.apache.karaf.specs.java.xml-4.2.10.jar can be permanently removed from 
>> the /endorsed dir without any negative side effects, right?
>> 
>>  
>> From: Jean-Baptiste Onofre mailto:j...@nanthrax.net>>
>> Sent: Wednesday, March 3, 2021 12:14 AM
>> To: user mailto:user@karaf.apache.org>>
>> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
>>  
>> Hi Brock,
>> 
>> Sorry for the very late answer.
>> 
>> The reason why javax.xml is in lib/endorsed folder is because core Karaf 
>> loads just the spec and let you install the impl.
>> Anyway, you can remove it from endorsed and install bundles, it works as 
>> well.
>> It’s basically what we plan to do by default as part of KARAF-6703.
>> 
>> Regards
>> JB
>> 
>>> Le 3 mars 2021 à 05:50, brock samson >> <mailto:brock.sams...@hotmail.com>> a écrit :
>>> 
>>> Hi João
>>> 
>>> Thank you for looking into this issue. Its nice to know it no longer 
>>> appears in karaf 4.3, but is there another way to resolve this in 4.2.10 
>>> without changing the code? More specifically, is there a reason why 
>>> org.apache.karaf.specs.java.xml-4.2.10.jar resides in the /endorsed 
>>> directory as opposed to being exposed by a bundle? The reason for me asking 
>>> is because the bundle approach would allow me to choose which 
>>> implementation my bundle would reference, while the current endorsed 
>>> approach leaves me no choice.
>>> 
>>> Regards,
>>> 
>>> Brock
>>> 
>>>  
>>> From: João Assunção >> <mailto:joao.assun...@exploitsys.com>>
>>> Sent: Tuesday, March 2, 2021 5:28 PM
>>> To: user@karaf.apache.org <mailto:user@karaf.apache.org> 
>>> mailto:user@karaf.apache.org>>
>>> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
>>>  
>>> Hi Brock,
>>> 
>>> I tried your jar but it failed due to the layout of the jar (the MANIFEST 
>>> was not the first entry in the jar or something like that). I created a 
>>> bundle with our code and when I tried with karaf 4.3 it passed.
>>> I then tried with 4.2.7 and I experienced the same NPE. Apparently the 
>>> behavior when the errorHandler is set to null is different between 
>>> implementations of the XML libs supplied in these two versions of karaf.
>>> In your code setting the error handler to builder.setErrorHandler(new 
>>> org.xml.sax.helpers.DefaultHandler()); seems to do the trick.
>>> 
>>> I noticed your manifest is importing a bunch of packages not required for 
>>> the code in question. 
>>> 
>>> Regards
>>> João Assunção
>>> 
>>> Email: joao.assun...@exploitsys.com <mailto:joao.assun...@exploitsys.com>
>>> Mobile: +351 916968984
>>> Phone: +351 211933149
>>> Web: www.exploitsys.com <http://www.exploitsys.com/>
>>> 
>>> 
>>> 
>>> 
>>> On Tue, Mar 2, 2021 at 3:33 AM brock samson >> <mailto:brock.sams...@hotmail.com>> wrote:
>>> hi, JB. did you get a chance to run my bundle?
>>> 
>>>  
>>> From: brock samson >> <mailto:brock.sams...@hotmail.com>>
>>> Sent: Wednesday, February 24, 2021, 11:18 PM
>>> To: user@karaf.apache.org <mailto:user@karaf.apache.org>
>>> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
>>> 
>>> hi, JB.
>>> 
>>> thank you for looking at this. The attached zip (rename its extension from 
>>> .txt to .zip) contains both the bundle (rename its extension fro

Re: Karaf 4.2.10 - NullPointerException during xml parsing

2021-03-03 Thread brock samson
would it be possible to have this fixed in the upcoming 4.2.11 release?


From: Jean-Baptiste Onofre 
Sent: Wednesday, March 3, 2021 2:50 AM
To: user 
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi,

Yes, 90% of the use cases don’t need java.xml in lib/endorsed.

Regards
JB

Le 3 mars 2021 à 08:42, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

Hi JB

I know you are quite busy so no need to apologize.

Just to make sure I understood you correctly, the 
org.apache.karaf.specs.java.xml-4.2.10.jar can be permanently removed from the 
/endorsed dir without any negative side effects, right?


From: Jean-Baptiste Onofre mailto:j...@nanthrax.net>>
Sent: Wednesday, March 3, 2021 12:14 AM
To: user mailto:user@karaf.apache.org>>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

Sorry for the very late answer.

The reason why javax.xml is in lib/endorsed folder is because core Karaf loads 
just the spec and let you install the impl.
Anyway, you can remove it from endorsed and install bundles, it works as well.
It’s basically what we plan to do by default as part of KARAF-6703.

Regards
JB

Le 3 mars 2021 à 05:50, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

Hi João

Thank you for looking into this issue. Its nice to know it no longer appears in 
karaf 4.3, but is there another way to resolve this in 4.2.10 without changing 
the code? More specifically, is there a reason why 
org.apache.karaf.specs.java.xml-4.2.10.jar resides in the /endorsed directory 
as opposed to being exposed by a bundle? The reason for me asking is because 
the bundle approach would allow me to choose which implementation my bundle 
would reference, while the current endorsed approach leaves me no choice.

Regards,

Brock



From: João Assunção 
mailto:joao.assun...@exploitsys.com>>
Sent: Tuesday, March 2, 2021 5:28 PM
To: user@karaf.apache.org<mailto:user@karaf.apache.org> 
mailto:user@karaf.apache.org>>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

I tried your jar but it failed due to the layout of the jar (the MANIFEST was 
not the first entry in the jar or something like that). I created a bundle with 
our code and when I tried with karaf 4.3 it passed.
I then tried with 4.2.7 and I experienced the same NPE. Apparently the behavior 
when the errorHandler is set to null is different between implementations of 
the XML libs supplied in these two versions of karaf.
In your code setting the error handler to builder.setErrorHandler(new 
org.xml.sax.helpers.DefaultHandler()); seems to do the trick.

I noticed your manifest is importing a bunch of packages not required for the 
code in question.

Regards
João Assunção

Email: joao.assun...@exploitsys.com<mailto:joao.assun...@exploitsys.com>
Mobile: +351 916968984
Phone: +351 211933149
Web: www.exploitsys.com<http://www.exploitsys.com/>




On Tue, Mar 2, 2021 at 3:33 AM brock samson 
mailto:brock.sams...@hotmail.com>> wrote:
hi, JB. did you get a chance to run my bundle?



From: brock samson mailto:brock.sams...@hotmail.com>>
Sent: Wednesday, February 24, 2021, 11:18 PM
To: user@karaf.apache.org<mailto:user@karaf.apache.org>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

hi, JB.

thank you for looking at this. The attached zip (rename its extension from .txt 
to .zip) contains both the bundle (rename its extension from .txt to .jar) and 
its feature file. the bundle should be placed in the /bundles dir, and you know 
what to do with the feature file =)
here are some points regarding the bundle:
1) the bundle executes automatically during Karaf startup to make it easier for 
you.
2) The bundle contains both the schema and the xml, so you dont have to really 
do anything to the bundle itself in order for it to just run
3) The bundle contains props.properties where you can specify external 
locations to both schema and xml file if you choose to do so for any reason. 
The provided files will be ignored in such case.
4) I have also provided the source .java alongside the binary just in case.

again, really appreciate you taking the time to look at it. thanks!!!

Brock Samson



From: Jean-Baptiste Onofre mailto:j...@nanthrax.net>>
Sent: Tuesday, February 23, 2021 11:56 AM
To: user@karaf.apache.org<mailto:user@karaf.apache.org> 
mailto:user@karaf.apache.org>>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

Maybe you have xerces installed as bundle in your distribution ?

It sounds like a version mismatch.

Can you share the bundles installed ?

Thanks,
Regards
JB

Le 23 févr. 2021 à 16:55, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

Hello,

I am using Karaf 4.2.10 a

Re: Karaf 4.2.10 - NullPointerException during xml parsing

2021-03-02 Thread Jean-Baptiste Onofre
Hi,

Yes, 90% of the use cases don’t need java.xml in lib/endorsed.

Regards
JB

> Le 3 mars 2021 à 08:42, brock samson  a écrit :
> 
> Hi JB
> 
> I know you are quite busy so no need to apologize.
> 
> Just to make sure I understood you correctly, the 
> org.apache.karaf.specs.java.xml-4.2.10.jar can be permanently removed from 
> the /endorsed dir without any negative side effects, right?
> 
> From: Jean-Baptiste Onofre 
> Sent: Wednesday, March 3, 2021 12:14 AM
> To: user 
> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
>  
> Hi Brock,
> 
> Sorry for the very late answer.
> 
> The reason why javax.xml is in lib/endorsed folder is because core Karaf 
> loads just the spec and let you install the impl.
> Anyway, you can remove it from endorsed and install bundles, it works as well.
> It’s basically what we plan to do by default as part of KARAF-6703.
> 
> Regards
> JB
> 
>> Le 3 mars 2021 à 05:50, brock samson > <mailto:brock.sams...@hotmail.com>> a écrit :
>> 
>> Hi João
>> 
>> Thank you for looking into this issue. Its nice to know it no longer appears 
>> in karaf 4.3, but is there another way to resolve this in 4.2.10 without 
>> changing the code? More specifically, is there a reason why 
>> org.apache.karaf.specs.java.xml-4.2.10.jar resides in the /endorsed 
>> directory as opposed to being exposed by a bundle? The reason for me asking 
>> is because the bundle approach would allow me to choose which implementation 
>> my bundle would reference, while the current endorsed approach leaves me no 
>> choice.
>> 
>> Regards,
>> 
>> Brock
>> 
>>  
>> From: João Assunção > <mailto:joao.assun...@exploitsys.com>>
>> Sent: Tuesday, March 2, 2021 5:28 PM
>> To: user@karaf.apache.org <mailto:user@karaf.apache.org> 
>> mailto:user@karaf.apache.org>>
>> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
>>  
>> Hi Brock,
>> 
>> I tried your jar but it failed due to the layout of the jar (the MANIFEST 
>> was not the first entry in the jar or something like that). I created a 
>> bundle with our code and when I tried with karaf 4.3 it passed.
>> I then tried with 4.2.7 and I experienced the same NPE. Apparently the 
>> behavior when the errorHandler is set to null is different between 
>> implementations of the XML libs supplied in these two versions of karaf.
>> In your code setting the error handler to builder.setErrorHandler(new 
>> org.xml.sax.helpers.DefaultHandler()); seems to do the trick.
>> 
>> I noticed your manifest is importing a bunch of packages not required for 
>> the code in question. 
>> 
>> Regards
>> João Assunção
>> 
>> Email: joao.assun...@exploitsys.com <mailto:joao.assun...@exploitsys.com>
>> Mobile: +351 916968984
>> Phone: +351 211933149
>> Web: www.exploitsys.com <http://www.exploitsys.com/>
>> 
>> 
>> 
>> 
>> On Tue, Mar 2, 2021 at 3:33 AM brock samson > <mailto:brock.sams...@hotmail.com>> wrote:
>> hi, JB. did you get a chance to run my bundle?
>> 
>>  
>> From: brock samson > <mailto:brock.sams...@hotmail.com>>
>> Sent: Wednesday, February 24, 2021, 11:18 PM
>> To: user@karaf.apache.org <mailto:user@karaf.apache.org>
>> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
>> 
>> hi, JB.
>> 
>> thank you for looking at this. The attached zip (rename its extension from 
>> .txt to .zip) contains both the bundle (rename its extension from .txt to 
>> .jar) and its feature file. the bundle should be placed in the /bundles dir, 
>> and you know what to do with the feature file =)
>> here are some points regarding the bundle:
>> 1) the bundle executes automatically during Karaf startup to make it easier 
>> for you.
>> 2) The bundle contains both the schema and the xml, so you dont have to 
>> really do anything to the bundle itself in order for it to just run
>> 3) The bundle contains props.properties where you can specify external 
>> locations to both schema and xml file if you choose to do so for any reason. 
>> The provided files will be ignored in such case.
>> 4) I have also provided the source .java alongside the binary just in case.
>> 
>> again, really appreciate you taking the time to look at it. thanks!!!
>> 
>> Brock Samson
>> 
>>  
>> From: Jean-Baptiste Onofre mailto:j...@nanthrax.net>>
>> Sent: Tuesday, February 2

Re: Karaf 4.2.10 - NullPointerException during xml parsing

2021-03-02 Thread brock samson
Hi JB

I know you are quite busy so no need to apologize.

Just to make sure I understood you correctly, the 
org.apache.karaf.specs.java.xml-4.2.10.jar can be permanently removed from the 
/endorsed dir without any negative side effects, right?


From: Jean-Baptiste Onofre 
Sent: Wednesday, March 3, 2021 12:14 AM
To: user 
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

Sorry for the very late answer.

The reason why javax.xml is in lib/endorsed folder is because core Karaf loads 
just the spec and let you install the impl.
Anyway, you can remove it from endorsed and install bundles, it works as well.
It’s basically what we plan to do by default as part of KARAF-6703.

Regards
JB

Le 3 mars 2021 à 05:50, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

Hi João

Thank you for looking into this issue. Its nice to know it no longer appears in 
karaf 4.3, but is there another way to resolve this in 4.2.10 without changing 
the code? More specifically, is there a reason why 
org.apache.karaf.specs.java.xml-4.2.10.jar resides in the /endorsed directory 
as opposed to being exposed by a bundle? The reason for me asking is because 
the bundle approach would allow me to choose which implementation my bundle 
would reference, while the current endorsed approach leaves me no choice.

Regards,

Brock


From: João Assunção 
mailto:joao.assun...@exploitsys.com>>
Sent: Tuesday, March 2, 2021 5:28 PM
To: user@karaf.apache.org<mailto:user@karaf.apache.org> 
mailto:user@karaf.apache.org>>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

I tried your jar but it failed due to the layout of the jar (the MANIFEST was 
not the first entry in the jar or something like that). I created a bundle with 
our code and when I tried with karaf 4.3 it passed.
I then tried with 4.2.7 and I experienced the same NPE. Apparently the behavior 
when the errorHandler is set to null is different between implementations of 
the XML libs supplied in these two versions of karaf.
In your code setting the error handler to builder.setErrorHandler(new 
org.xml.sax.helpers.DefaultHandler()); seems to do the trick.

I noticed your manifest is importing a bunch of packages not required for the 
code in question.

Regards
João Assunção

Email: joao.assun...@exploitsys.com<mailto:joao.assun...@exploitsys.com>
Mobile: +351 916968984
Phone: +351 211933149
Web: www.exploitsys.com<http://www.exploitsys.com/>




On Tue, Mar 2, 2021 at 3:33 AM brock samson 
mailto:brock.sams...@hotmail.com>> wrote:
hi, JB. did you get a chance to run my bundle?


From: brock samson mailto:brock.sams...@hotmail.com>>
Sent: Wednesday, February 24, 2021, 11:18 PM
To: user@karaf.apache.org<mailto:user@karaf.apache.org>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

hi, JB.

thank you for looking at this. The attached zip (rename its extension from .txt 
to .zip) contains both the bundle (rename its extension from .txt to .jar) and 
its feature file. the bundle should be placed in the /bundles dir, and you know 
what to do with the feature file =)
here are some points regarding the bundle:
1) the bundle executes automatically during Karaf startup to make it easier for 
you.
2) The bundle contains both the schema and the xml, so you dont have to really 
do anything to the bundle itself in order for it to just run
3) The bundle contains props.properties where you can specify external 
locations to both schema and xml file if you choose to do so for any reason. 
The provided files will be ignored in such case.
4) I have also provided the source .java alongside the binary just in case.

again, really appreciate you taking the time to look at it. thanks!!!

Brock Samson


From: Jean-Baptiste Onofre mailto:j...@nanthrax.net>>
Sent: Tuesday, February 23, 2021 11:56 AM
To: user@karaf.apache.org<mailto:user@karaf.apache.org> 
mailto:user@karaf.apache.org>>
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

Maybe you have xerces installed as bundle in your distribution ?

It sounds like a version mismatch.

Can you share the bundles installed ?

Thanks,
Regards
JB

Le 23 févr. 2021 à 16:55, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

Hello,

I am using Karaf 4.2.10 and attempting to perform a rather simple xml parsing:

Caused by: java.lang.NullPointerException
at org.apache.xerces.util.ErrorHandlerProxy.error(Unknown 
Source) ~[!/:?]
at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:137)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
 ~[?:1.8.0_102]
at 
com.sun.org.apac

Re: Karaf 4.2.10 - NullPointerException during xml parsing

2021-03-02 Thread Jean-Baptiste Onofre
Hi Brock,

Sorry for the very late answer.

The reason why javax.xml is in lib/endorsed folder is because core Karaf loads 
just the spec and let you install the impl.
Anyway, you can remove it from endorsed and install bundles, it works as well.
It’s basically what we plan to do by default as part of KARAF-6703.

Regards
JB

> Le 3 mars 2021 à 05:50, brock samson  a écrit :
> 
> Hi João
> 
> Thank you for looking into this issue. Its nice to know it no longer appears 
> in karaf 4.3, but is there another way to resolve this in 4.2.10 without 
> changing the code? More specifically, is there a reason why 
> org.apache.karaf.specs.java.xml-4.2.10.jar resides in the /endorsed directory 
> as opposed to being exposed by a bundle? The reason for me asking is because 
> the bundle approach would allow me to choose which implementation my bundle 
> would reference, while the current endorsed approach leaves me no choice.
> 
> Regards,
> 
> Brock
> 
> From: João Assunção 
> Sent: Tuesday, March 2, 2021 5:28 PM
> To: user@karaf.apache.org 
> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
>  
> Hi Brock,
> 
> I tried your jar but it failed due to the layout of the jar (the MANIFEST was 
> not the first entry in the jar or something like that). I created a bundle 
> with our code and when I tried with karaf 4.3 it passed.
> I then tried with 4.2.7 and I experienced the same NPE. Apparently the 
> behavior when the errorHandler is set to null is different between 
> implementations of the XML libs supplied in these two versions of karaf.
> In your code setting the error handler to builder.setErrorHandler(new 
> org.xml.sax.helpers.DefaultHandler()); seems to do the trick.
> 
> I noticed your manifest is importing a bunch of packages not required for the 
> code in question. 
> 
> Regards
> João Assunção
> 
> Email: joao.assun...@exploitsys.com <mailto:joao.assun...@exploitsys.com>
> Mobile: +351 916968984
> Phone: +351 211933149
> Web: www.exploitsys.com <http://www.exploitsys.com/>
> 
> 
> 
> 
> On Tue, Mar 2, 2021 at 3:33 AM brock samson  <mailto:brock.sams...@hotmail.com>> wrote:
> hi, JB. did you get a chance to run my bundle?
> 
> From: brock samson  <mailto:brock.sams...@hotmail.com>>
> Sent: Wednesday, February 24, 2021, 11:18 PM
> To: user@karaf.apache.org <mailto:user@karaf.apache.org>
> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
> 
> hi, JB.
> 
> thank you for looking at this. The attached zip (rename its extension from 
> .txt to .zip) contains both the bundle (rename its extension from .txt to 
> .jar) and its feature file. the bundle should be placed in the /bundles dir, 
> and you know what to do with the feature file =)
> here are some points regarding the bundle:
> 1) the bundle executes automatically during Karaf startup to make it easier 
> for you.
> 2) The bundle contains both the schema and the xml, so you dont have to 
> really do anything to the bundle itself in order for it to just run
> 3) The bundle contains props.properties where you can specify external 
> locations to both schema and xml file if you choose to do so for any reason. 
> The provided files will be ignored in such case.
> 4) I have also provided the source .java alongside the binary just in case.
> 
> again, really appreciate you taking the time to look at it. thanks!!!
> 
> Brock Samson
> 
> From: Jean-Baptiste Onofre mailto:j...@nanthrax.net>>
> Sent: Tuesday, February 23, 2021 11:56 AM
> To: user@karaf.apache.org <mailto:user@karaf.apache.org> 
> mailto:user@karaf.apache.org>>
> Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing
>  
> Hi Brock,
> 
> Maybe you have xerces installed as bundle in your distribution ?
> 
> It sounds like a version mismatch.
> 
> Can you share the bundles installed ?
> 
> Thanks,
> Regards
> JB
> 
>> Le 23 févr. 2021 à 16:55, brock samson > <mailto:brock.sams...@hotmail.com>> a écrit :
>> 
>> Hello, 
>>  
>> I am using Karaf 4.2.10 and attempting to perform a rather simple xml 
>> parsing: 
>>  
>> Caused by: java.lang.NullPointerException 
>> at org.apache.xerces.util.ErrorHandlerProxy.error(Unknown 
>> Source) ~[!/:?] 
>> at 
>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:137)
>>  ~[?:1.8.0_102] 
>> at 
>> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
>>  ~[?:1.8.0_102] 

Re: Karaf 4.2.10 - NullPointerException during xml parsing

2021-03-02 Thread João Assunção
Hi Brock,

I tried your jar but it failed due to the layout of the jar (the MANIFEST
was not the first entry in the jar or something like that). I created a
bundle with our code and when I tried with karaf 4.3 it passed.
I then tried with 4.2.7 and I experienced the same NPE. Apparently the
behavior when the errorHandler is set to null is different between
implementations of the XML libs supplied in these two versions of karaf.
In your code setting the error handler to builder.setErrorHandler(new
org.xml.sax.helpers.DefaultHandler()); seems to do the trick.

I noticed your manifest is importing a bunch of packages not required for
the code in question.

Regards
João Assunção

Email: joao.assun...@exploitsys.com
Mobile: +351 916968984
Phone: +351 211933149
Web: www.exploitsys.com




On Tue, Mar 2, 2021 at 3:33 AM brock samson 
wrote:

> hi, JB. did you get a chance to run my bundle?
>
> --
> *From:* brock samson 
> *Sent:* Wednesday, February 24, 2021, 11:18 PM
> *To:* user@karaf.apache.org
> *Subject:* Re: Karaf 4.2.10 - NullPointerException during xml parsing
>
> hi, JB.
>
> thank you for looking at this. The attached zip (rename its extension from
> .txt to .zip) contains both the bundle (rename its extension from .txt to
> .jar) and its feature file. the bundle should be placed in the */bundles* dir,
> and you know what to do with the feature file =)
> here are some points regarding the bundle:
> 1) the bundle executes automatically during Karaf startup to make it
> easier for you.
> 2) The bundle contains both the schema and the xml, so you dont have to
> really do anything to the bundle itself in order for it to just run
> 3) The bundle contains *props.properties* where you can specify external
> locations to both schema and xml file if you choose to do so for any
> reason. The provided files will be ignored in such case.
> 4) I have also provided the source .java alongside the binary just in case.
>
> again, really appreciate you taking the time to look at it. thanks!!!
>
> Brock Samson
>
> --
> *From:* Jean-Baptiste Onofre 
> *Sent:* Tuesday, February 23, 2021 11:56 AM
> *To:* user@karaf.apache.org 
> *Subject:* Re: Karaf 4.2.10 - NullPointerException during xml parsing
>
> Hi Brock,
>
> Maybe you have xerces installed as bundle in your distribution ?
>
> It sounds like a version mismatch.
>
> Can you share the bundles installed ?
>
> Thanks,
> Regards
> JB
>
> Le 23 févr. 2021 à 16:55, brock samson  a
> écrit :
>
> Hello,
>
> I am using Karaf 4.2.10 and attempting to perform a rather simple xml
> parsing:
>
> *Caused by: java.lang.NullPointerException *
> *at org.apache.xerces.util.ErrorHandlerProxy.error(Unknown
> Source) ~[!/:?] *
> *at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:137)
> ~[?:1.8.0_102] *
> *at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
> ~[?:1.8.0_102] *
> *at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
> ~[?:1.8.0_102] *
> *at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
> ~[?:1.8.0_102] *
> *at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1900)
> ~[?:1.8.0_102] *
> *at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:740)
> ~[?:1.8.0_102] *
> *at
> com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:570)
> ~[?:1.8.0_102] *
> *at
> org.apache.xerces.jaxp.JAXPValidatorComponent$XNI2SAX.startElement(Unknown
> Source) ~[!/:?] *
> *at
> org.apache.xerces.jaxp.JAXPValidatorComponent.startElement(Unknown Source)
> ~[!/:?] *
> *at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> Source) ~[!/:?] *
> *at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
> Source) ~[!/:?] *
> *at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
> Source) ~[!/:?] *
> *at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source) ~[!/:?] *
> *at
> org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[!/:?] *
> *at
> org.apache.xerces.parsers.XML11Configuration.par

Re: Karaf 4.2.10 - NullPointerException during xml parsing

2021-03-01 Thread brock samson
hi, JB. did you get a chance to run my bundle?


From: brock samson 
Sent: Wednesday, February 24, 2021, 11:18 PM
To: user@karaf.apache.org
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

hi, JB.

thank you for looking at this. The attached zip (rename its extension from .txt 
to .zip) contains both the bundle (rename its extension from .txt to .jar) and 
its feature file. the bundle should be placed in the /bundles dir, and you know 
what to do with the feature file =)
here are some points regarding the bundle:
1) the bundle executes automatically during Karaf startup to make it easier for 
you.
2) The bundle contains both the schema and the xml, so you dont have to really 
do anything to the bundle itself in order for it to just run
3) The bundle contains props.properties where you can specify external 
locations to both schema and xml file if you choose to do so for any reason. 
The provided files will be ignored in such case.
4) I have also provided the source .java alongside the binary just in case.

again, really appreciate you taking the time to look at it. thanks!!!

Brock Samson


From: Jean-Baptiste Onofre 
Sent: Tuesday, February 23, 2021 11:56 AM
To: user@karaf.apache.org 
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

Maybe you have xerces installed as bundle in your distribution ?

It sounds like a version mismatch.

Can you share the bundles installed ?

Thanks,
Regards
JB

Le 23 févr. 2021 à 16:55, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

Hello,

I am using Karaf 4.2.10 and attempting to perform a rather simple xml parsing:

Caused by: java.lang.NullPointerException
at org.apache.xerces.util.ErrorHandlerProxy.error(Unknown 
Source) ~[!/:?]
at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:137)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1900)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:740)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:570)
 ~[?:1.8.0_102]
at 
org.apache.xerces.jaxp.JAXPValidatorComponent$XNI2SAX.startElement(Unknown 
Source) ~[!/:?]
at 
org.apache.xerces.jaxp.JAXPValidatorComponent.startElement(Unknown Source) 
~[!/:?]
at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown 
Source) ~[!/:?]
at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
 Source) ~[!/:?]
at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
 Source) ~[!/:?]
at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source) ~[!/:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown 
Source) ~[!/:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown 
Source) ~[!/:?]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) 
~[!/:?]
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) 
~[!/:?]
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown 
Source) ~[!/:?]
at 
javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) ~[?:1.8.0_102]

After snooping around, I noticed a 
/container/lib/endorsed/org.apache.karaf.specs.java.xml-4.2.10.jar lib 
containing parser-related libs. My code executed successfully once I ran Karaf 
without this particular file, though I don’t feel right just pulling it out of 
Karaf blindly, as its absence creates a distinct possibility of unforeseen 
issues down the road.

Here are the only imports my bundle references in its manifest:
Import-Package: 
javax.xml.transform,javax.xml.transform.stream,org.xml.sax,javax.xml.parsers,javax.xml.validation
There are no entries under Bundle-Classpath

Lastly, here is the java code that performs the xml parsing:

DocumentBuilderFactory factory = 
DocumentBuilderFactory.newInstance();
SchemaFactory sf = 
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(new StreamSource(new 
FileInput

Re: Karaf 4.2.10 - NullPointerException during xml parsing

2021-02-24 Thread brock samson
hi, JB.

thank you for looking at this. The attached zip (rename its extension from .txt 
to .zip) contains both the bundle (rename its extension from .txt to .jar) and 
its feature file. the bundle should be placed in the /bundles dir, and you know 
what to do with the feature file =)
here are some points regarding the bundle:
1) the bundle executes automatically during Karaf startup to make it easier for 
you.
2) The bundle contains both the schema and the xml, so you dont have to really 
do anything to the bundle itself in order for it to just run
3) The bundle contains props.properties where you can specify external 
locations to both schema and xml file if you choose to do so for any reason. 
The provided files will be ignored in such case.
4) I have also provided the source .java alongside the binary just in case.

again, really appreciate you taking the time to look at it. thanks!!!

Brock Samson


From: Jean-Baptiste Onofre 
Sent: Tuesday, February 23, 2021 11:56 AM
To: user@karaf.apache.org 
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

Maybe you have xerces installed as bundle in your distribution ?

It sounds like a version mismatch.

Can you share the bundles installed ?

Thanks,
Regards
JB

Le 23 févr. 2021 à 16:55, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

Hello,

I am using Karaf 4.2.10 and attempting to perform a rather simple xml parsing:

Caused by: java.lang.NullPointerException
at org.apache.xerces.util.ErrorHandlerProxy.error(Unknown 
Source) ~[!/:?]
at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:137)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1900)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:740)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:570)
 ~[?:1.8.0_102]
at 
org.apache.xerces.jaxp.JAXPValidatorComponent$XNI2SAX.startElement(Unknown 
Source) ~[!/:?]
at 
org.apache.xerces.jaxp.JAXPValidatorComponent.startElement(Unknown Source) 
~[!/:?]
at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown 
Source) ~[!/:?]
at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
 Source) ~[!/:?]
at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
 Source) ~[!/:?]
at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source) ~[!/:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown 
Source) ~[!/:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown 
Source) ~[!/:?]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) 
~[!/:?]
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) 
~[!/:?]
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown 
Source) ~[!/:?]
at 
javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) ~[?:1.8.0_102]

After snooping around, I noticed a 
/container/lib/endorsed/org.apache.karaf.specs.java.xml-4.2.10.jar lib 
containing parser-related libs. My code executed successfully once I ran Karaf 
without this particular file, though I don’t feel right just pulling it out of 
Karaf blindly, as its absence creates a distinct possibility of unforeseen 
issues down the road.

Here are the only imports my bundle references in its manifest:
Import-Package: 
javax.xml.transform,javax.xml.transform.stream,org.xml.sax,javax.xml.parsers,javax.xml.validation
There are no entries under Bundle-Classpath

Lastly, here is the java code that performs the xml parsing:

DocumentBuilderFactory factory = 
DocumentBuilderFactory.newInstance();
SchemaFactory sf = 
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(new StreamSource(new 
FileInputStream("")));
factory.setNamespaceAware(true);
factory.setSchema(schema);
factory.setExpandEntityReferences(false);
factory.setXIncludeAware(false);

factory.setFeature("http://xml.org/

Re: Karaf 4.2.10 - NullPointerException during xml parsing

2021-02-23 Thread brock samson
hi, JB.

thank you for looking at this. The attached zip contains both the bundle and 
its feature file. the bundle should be placed in the /bundles dir, and you know 
what to do with the feature file =)
here are some points regarding the bundle:
1) the bundle executes automatically during Karaf startup to make it easier for 
you.
2) The bundle contains both the schema and the xml, so you dont have to really 
do anything to the bundle itself in order for it to just run
3) The bundle contains props.properties where you can specify external 
locations to both schema and xml file if you choose to do so for any reason. 
The provided files will be ignored in such case.
4) I have also provided the source .java alongside the binary just in case.

again, really appreciate you taking the time to look at it. thanks!!!

Brock Samson


From: Jean-Baptiste Onofre 
Sent: Tuesday, February 23, 2021 11:56 AM
To: user@karaf.apache.org 
Subject: Re: Karaf 4.2.10 - NullPointerException during xml parsing

Hi Brock,

Maybe you have xerces installed as bundle in your distribution ?

It sounds like a version mismatch.

Can you share the bundles installed ?

Thanks,
Regards
JB

Le 23 févr. 2021 à 16:55, brock samson 
mailto:brock.sams...@hotmail.com>> a écrit :

Hello,

I am using Karaf 4.2.10 and attempting to perform a rather simple xml parsing:

Caused by: java.lang.NullPointerException
at org.apache.xerces.util.ErrorHandlerProxy.error(Unknown 
Source) ~[!/:?]
at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:137)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1900)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:740)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:570)
 ~[?:1.8.0_102]
at 
org.apache.xerces.jaxp.JAXPValidatorComponent$XNI2SAX.startElement(Unknown 
Source) ~[!/:?]
at 
org.apache.xerces.jaxp.JAXPValidatorComponent.startElement(Unknown Source) 
~[!/:?]
at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown 
Source) ~[!/:?]
at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
 Source) ~[!/:?]
at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
 Source) ~[!/:?]
at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source) ~[!/:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown 
Source) ~[!/:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown 
Source) ~[!/:?]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) 
~[!/:?]
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) 
~[!/:?]
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown 
Source) ~[!/:?]
at 
javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) ~[?:1.8.0_102]

After snooping around, I noticed a 
/container/lib/endorsed/org.apache.karaf.specs.java.xml-4.2.10.jar lib 
containing parser-related libs. My code executed successfully once I ran Karaf 
without this particular file, though I don’t feel right just pulling it out of 
Karaf blindly, as its absence creates a distinct possibility of unforeseen 
issues down the road.

Here are the only imports my bundle references in its manifest:
Import-Package: 
javax.xml.transform,javax.xml.transform.stream,org.xml.sax,javax.xml.parsers,javax.xml.validation
There are no entries under Bundle-Classpath

Lastly, here is the java code that performs the xml parsing:

DocumentBuilderFactory factory = 
DocumentBuilderFactory.newInstance();
SchemaFactory sf = 
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(new StreamSource(new 
FileInputStream("")));
factory.setNamespaceAware(true);
factory.setSchema(schema);
factory.setExpandEntityReferences(false);
factory.setXIncludeAware(false);

factory.setFeature("http://xml.org/sax/features/external-parameter-entities",false);

factory.setFeat

Re: Karaf 4.2.10 - NullPointerException during xml parsing

2021-02-23 Thread Jean-Baptiste Onofre
Hi Brock,

Maybe you have xerces installed as bundle in your distribution ?

It sounds like a version mismatch.

Can you share the bundles installed ?

Thanks,
Regards
JB

> Le 23 févr. 2021 à 16:55, brock samson  a écrit :
> 
> Hello, 
>  
> I am using Karaf 4.2.10 and attempting to perform a rather simple xml 
> parsing: 
>  
> Caused by: java.lang.NullPointerException 
> at org.apache.xerces.util.ErrorHandlerProxy.error(Unknown 
> Source) ~[!/:?] 
> at 
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:137)
>  ~[?:1.8.0_102] 
> at 
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
>  ~[?:1.8.0_102] 
> at 
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
>  ~[?:1.8.0_102] 
> at 
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
>  ~[?:1.8.0_102] 
> at 
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1900)
>  ~[?:1.8.0_102] 
> at 
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:740)
>  ~[?:1.8.0_102] 
> at 
> com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:570)
>  ~[?:1.8.0_102] 
> at 
> org.apache.xerces.jaxp.JAXPValidatorComponent$XNI2SAX.startElement(Unknown 
> Source) ~[!/:?] 
> at 
> org.apache.xerces.jaxp.JAXPValidatorComponent.startElement(Unknown Source) 
> ~[!/:?] 
> at 
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown 
> Source) ~[!/:?] 
> at 
> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
>  Source) ~[!/:?] 
> at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
>  Source) ~[!/:?] 
> at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
> Source) ~[!/:?] 
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown 
> Source) ~[!/:?] 
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown 
> Source) ~[!/:?] 
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) 
> ~[!/:?] 
> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) 
> ~[!/:?] 
> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown 
> Source) ~[!/:?] 
> at 
> javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) 
> ~[?:1.8.0_102] 
>  
> After snooping around, I noticed a 
> /container/lib/endorsed/org.apache.karaf.specs.java.xml-4.2.10.jar lib 
> containing parser-related libs. My code executed successfully once I ran 
> Karaf without this particular file, though I don’t feel right just pulling it 
> out of Karaf blindly, as its absence creates a distinct possibility of 
> unforeseen issues down the road. 
>  
> Here are the only imports my bundle references in its manifest: 
> Import-Package: 
> javax.xml.transform,javax.xml.transform.stream,org.xml.sax,javax.xml.parsers,javax.xml.validation
>  
> There are no entries under Bundle-Classpath 
>  
> Lastly, here is the java code that performs the xml parsing: 
>  
> DocumentBuilderFactory factory = 
> DocumentBuilderFactory.newInstance(); 
> SchemaFactory sf = 
> SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); 
> Schema schema = sf.newSchema(new StreamSource(new 
> FileInputStream(""))); 
> factory.setNamespaceAware(true); 
> factory.setSchema(schema); 
> factory.setExpandEntityReferences(false); 
> factory.setXIncludeAware(false); 
> 
> factory.setFeature("http://xml.org/sax/features/external-parameter-entities 
> ",false); 
> 
> factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd
>  ",false); 
> 
> factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl 
> ", true); 
> 
> factory.setFeature("http://xml.org/sax/features/external-general-entities 
> ",false); 
> DocumentBuilder builder = factory.newDocumentBuilder(); 
> builder.setErrorHandler(null); 
> byte[] fileContent = 
> Files.readAllBytes(Paths.get("")); 
> InputStream inStream = new ByteArrayInputStream(fileContent); 
> Document doc = builder.parse(inStream); 
>  
> 

Karaf 4.2.10 - NullPointerException during xml parsing

2021-02-23 Thread brock samson
Hello,

I am using Karaf 4.2.10 and attempting to perform a rather simple xml parsing:

Caused by: java.lang.NullPointerException
at org.apache.xerces.util.ErrorHandlerProxy.error(Unknown 
Source) ~[!/:?]
at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:137)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1900)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:740)
 ~[?:1.8.0_102]
at 
com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:570)
 ~[?:1.8.0_102]
at 
org.apache.xerces.jaxp.JAXPValidatorComponent$XNI2SAX.startElement(Unknown 
Source) ~[!/:?]
at 
org.apache.xerces.jaxp.JAXPValidatorComponent.startElement(Unknown Source) 
~[!/:?]
at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown 
Source) ~[!/:?]
at 
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
 Source) ~[!/:?]
at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
 Source) ~[!/:?]
at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source) ~[!/:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown 
Source) ~[!/:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown 
Source) ~[!/:?]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) 
~[!/:?]
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) 
~[!/:?]
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown 
Source) ~[!/:?]
at 
javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) ~[?:1.8.0_102]

After snooping around, I noticed a 
/container/lib/endorsed/org.apache.karaf.specs.java.xml-4.2.10.jar lib 
containing parser-related libs. My code executed successfully once I ran Karaf 
without this particular file, though I don’t feel right just pulling it out of 
Karaf blindly, as its absence creates a distinct possibility of unforeseen 
issues down the road.

Here are the only imports my bundle references in its manifest:
Import-Package: 
javax.xml.transform,javax.xml.transform.stream,org.xml.sax,javax.xml.parsers,javax.xml.validation
There are no entries under Bundle-Classpath

Lastly, here is the java code that performs the xml parsing:

DocumentBuilderFactory factory = 
DocumentBuilderFactory.newInstance();
SchemaFactory sf = 
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(new StreamSource(new 
FileInputStream("")));
factory.setNamespaceAware(true);
factory.setSchema(schema);
factory.setExpandEntityReferences(false);
factory.setXIncludeAware(false);

factory.setFeature("http://xml.org/sax/features/external-parameter-entities;, 
false);

factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd;,
 false);

factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl;, 
true);

factory.setFeature("http://xml.org/sax/features/external-general-entities;, 
false);
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setErrorHandler(null);
byte[] fileContent = 
Files.readAllBytes(Paths.get(""));
InputStream inStream = new ByteArrayInputStream(fileContent);
Document doc = builder.parse(inStream);

Please advise me as to what I am doing wrong, as well as a possible solution. 
Thank you for your time!

Sincerely,

Brock Samson