Re: [log4j] NUL in log event message

2018-02-09 Thread Remko Popma
Good stuff!

(Shameless plug) Every java main() method deserves http://picocli.info

> On Feb 10, 2018, at 2:47, Gary Gregory  wrote:
> 
> I fixed this in the one spot where we initialize Jansi and replace NULs
> with SPACEs when we log the exception's message. That's the simplest thing
> to do and leaves room for someone to investigate why JAnsi returns such a
> string since at least you can see it.
> 
> Gary
> 
>> On Thu, Feb 8, 2018 at 5:40 PM, Matt Sicker  wrote:
>> 
>> Could that be UTF-16 or something similar?
>> 
>>> On 8 February 2018 at 16:52, Remko Popma  wrote:
>>> 
>>> How about stripping nulls out of any error messages coming from Jansi?
>>> 
>>> (Shameless plug) Every java main() method deserves http://picocli.info
>>> 
 On Feb 9, 2018, at 5:03, Gary Gregory  wrote:
 
 It might be a bug in JAnsi's WindowsSupport.getLastErrorMessage()
 
 Gary
 
 On Thu, Feb 8, 2018 at 12:42 PM, Ralph Goers <
>> ralph.go...@dslextreme.com
 
 wrote:
 
> Maybe this is a silly question, but in what world is it rational to
>> have
> NULL chars in the middle of a String?
> 
> Ralph
> 
>> On Feb 8, 2018, at 10:24 AM, Gary Gregory 
> wrote:
>> 
>> In some cases I get:
>> 
>> 2018-02-08 10:14:49,488 main WARN Unable to instantiate
>> org.fusesource.jansi.WindowsAnsiOutputStream due to
>>> java.io.IOException:
>> Could not get the screen info: T
>> 
>> What you do not see above is that on the console there is more after
>>> the
>> "T". There is a NUL character and "h e   h a n d l e   i s   i n v a
>> l
>>> i
> d
>> ." which probably contains more NUL chars since I cannot cut and copy
> that
>> string.
>> 
>> If I cut and paste my Eclipse console, the only text I get is the
>>> above,
>> not the whole console, due to the NUL char.
>> 
>> I am thinking that I should create a configuration for that one
>> logger
>> " org.fusesource.jansi.WindowsAnsiOutputStream"
>> and strip out NULs. I am not sure how I can do that on a regular
>>> logger,
>> even less the status logger.
>> 
>> Do we want to take the hit to scan all status logger string messages
>>> for
>> NULs and replace them with SPACEs or skip them. I also am not crazy
>>> about
>> adding yet another option.
>> 
>> Thoughts?
>> 
>> This seems important (to me) since these kinds of messages come from
>>> the
> OS
>> and we do not have control over them.
>> 
>> Gary
> 
> 
> 
>>> 
>> 
>> 
>> 
>> --
>> Matt Sicker 
>> 


Re: [log4j] NUL in log event message

2018-02-09 Thread Gary Gregory
I fixed this in the one spot where we initialize Jansi and replace NULs
with SPACEs when we log the exception's message. That's the simplest thing
to do and leaves room for someone to investigate why JAnsi returns such a
string since at least you can see it.

Gary

On Thu, Feb 8, 2018 at 5:40 PM, Matt Sicker  wrote:

> Could that be UTF-16 or something similar?
>
> On 8 February 2018 at 16:52, Remko Popma  wrote:
>
> > How about stripping nulls out of any error messages coming from Jansi?
> >
> > (Shameless plug) Every java main() method deserves http://picocli.info
> >
> > > On Feb 9, 2018, at 5:03, Gary Gregory  wrote:
> > >
> > > It might be a bug in JAnsi's WindowsSupport.getLastErrorMessage()
> > >
> > > Gary
> > >
> > > On Thu, Feb 8, 2018 at 12:42 PM, Ralph Goers <
> ralph.go...@dslextreme.com
> > >
> > > wrote:
> > >
> > >> Maybe this is a silly question, but in what world is it rational to
> have
> > >> NULL chars in the middle of a String?
> > >>
> > >> Ralph
> > >>
> > >>> On Feb 8, 2018, at 10:24 AM, Gary Gregory 
> > >> wrote:
> > >>>
> > >>> In some cases I get:
> > >>>
> > >>> 2018-02-08 10:14:49,488 main WARN Unable to instantiate
> > >>> org.fusesource.jansi.WindowsAnsiOutputStream due to
> > java.io.IOException:
> > >>> Could not get the screen info: T
> > >>>
> > >>> What you do not see above is that on the console there is more after
> > the
> > >>> "T". There is a NUL character and "h e   h a n d l e   i s   i n v a
> l
> > i
> > >> d
> > >>> ." which probably contains more NUL chars since I cannot cut and copy
> > >> that
> > >>> string.
> > >>>
> > >>> If I cut and paste my Eclipse console, the only text I get is the
> > above,
> > >>> not the whole console, due to the NUL char.
> > >>>
> > >>> I am thinking that I should create a configuration for that one
> logger
> > >>> " org.fusesource.jansi.WindowsAnsiOutputStream"
> > >>> and strip out NULs. I am not sure how I can do that on a regular
> > logger,
> > >>> even less the status logger.
> > >>>
> > >>> Do we want to take the hit to scan all status logger string messages
> > for
> > >>> NULs and replace them with SPACEs or skip them. I also am not crazy
> > about
> > >>> adding yet another option.
> > >>>
> > >>> Thoughts?
> > >>>
> > >>> This seems important (to me) since these kinds of messages come from
> > the
> > >> OS
> > >>> and we do not have control over them.
> > >>>
> > >>> Gary
> > >>
> > >>
> > >>
> >
>
>
>
> --
> Matt Sicker 
>


Re: [log4j] NUL in log event message

2018-02-08 Thread Matt Sicker
Could that be UTF-16 or something similar?

On 8 February 2018 at 16:52, Remko Popma  wrote:

> How about stripping nulls out of any error messages coming from Jansi?
>
> (Shameless plug) Every java main() method deserves http://picocli.info
>
> > On Feb 9, 2018, at 5:03, Gary Gregory  wrote:
> >
> > It might be a bug in JAnsi's WindowsSupport.getLastErrorMessage()
> >
> > Gary
> >
> > On Thu, Feb 8, 2018 at 12:42 PM, Ralph Goers  >
> > wrote:
> >
> >> Maybe this is a silly question, but in what world is it rational to have
> >> NULL chars in the middle of a String?
> >>
> >> Ralph
> >>
> >>> On Feb 8, 2018, at 10:24 AM, Gary Gregory 
> >> wrote:
> >>>
> >>> In some cases I get:
> >>>
> >>> 2018-02-08 10:14:49,488 main WARN Unable to instantiate
> >>> org.fusesource.jansi.WindowsAnsiOutputStream due to
> java.io.IOException:
> >>> Could not get the screen info: T
> >>>
> >>> What you do not see above is that on the console there is more after
> the
> >>> "T". There is a NUL character and "h e   h a n d l e   i s   i n v a l
> i
> >> d
> >>> ." which probably contains more NUL chars since I cannot cut and copy
> >> that
> >>> string.
> >>>
> >>> If I cut and paste my Eclipse console, the only text I get is the
> above,
> >>> not the whole console, due to the NUL char.
> >>>
> >>> I am thinking that I should create a configuration for that one logger
> >>> " org.fusesource.jansi.WindowsAnsiOutputStream"
> >>> and strip out NULs. I am not sure how I can do that on a regular
> logger,
> >>> even less the status logger.
> >>>
> >>> Do we want to take the hit to scan all status logger string messages
> for
> >>> NULs and replace them with SPACEs or skip them. I also am not crazy
> about
> >>> adding yet another option.
> >>>
> >>> Thoughts?
> >>>
> >>> This seems important (to me) since these kinds of messages come from
> the
> >> OS
> >>> and we do not have control over them.
> >>>
> >>> Gary
> >>
> >>
> >>
>



-- 
Matt Sicker 


Re: [log4j] NUL in log event message

2018-02-08 Thread Gary Gregory
It might be a bug in JAnsi's WindowsSupport.getLastErrorMessage()

Gary

On Thu, Feb 8, 2018 at 12:42 PM, Ralph Goers 
wrote:

> Maybe this is a silly question, but in what world is it rational to have
> NULL chars in the middle of a String?
>
> Ralph
>
> > On Feb 8, 2018, at 10:24 AM, Gary Gregory 
> wrote:
> >
> > In some cases I get:
> >
> > 2018-02-08 10:14:49,488 main WARN Unable to instantiate
> > org.fusesource.jansi.WindowsAnsiOutputStream due to java.io.IOException:
> > Could not get the screen info: T
> >
> > What you do not see above is that on the console there is more after the
> > "T". There is a NUL character and "h e   h a n d l e   i s   i n v a l i
> d
> > ." which probably contains more NUL chars since I cannot cut and copy
> that
> > string.
> >
> > If I cut and paste my Eclipse console, the only text I get is the above,
> > not the whole console, due to the NUL char.
> >
> > I am thinking that I should create a configuration for that one logger
> > " org.fusesource.jansi.WindowsAnsiOutputStream"
> > and strip out NULs. I am not sure how I can do that on a regular logger,
> > even less the status logger.
> >
> > Do we want to take the hit to scan all status logger string messages for
> > NULs and replace them with SPACEs or skip them. I also am not crazy about
> > adding yet another option.
> >
> > Thoughts?
> >
> > This seems important (to me) since these kinds of messages come from the
> OS
> > and we do not have control over them.
> >
> > Gary
>
>
>