Den fre 15 juli 2022 kl 10:46 skrev Thomas Singer <thomas.sin...@syntevo.com
>:

> Hi SVN developers,
>

Hi Thomas,

Thanks for the detailed report!


> First, there are 2 classes of NativeException, one in
> org.tigris.subversion.javahl package, the other in
> org.apache.subversion.javahl package. They only slightly differ in a
> constructor parameter. I recommend to use one class with 2 constructors
> instead.
>

I'm not experienced enough in the Java world to fully grasp this but I
assume the org.tigtis package is older and that it has been kept for
historical reasons (not to break an API used by older applications).

If you have a suggestion on how to consolidate this without breaking the
old API, feel free to send to the list!


>
> Second, the getMessage() method might throw a NullPointerException in
> the StringBuffer constructor if the NativeException was created with a
> null message (happened for a user's bug report).
>

Alright. I've been working on making a test case for this and I believe
I've managed to reproduce your issue. I would like to sleep on it and
verify once more tomorrow.


> Third, the usage of StringBuffer is discouraged in favor of StringBuilder.
>

Sounds good.


> I recommend to change the code for NativeException from
>
> >    public String getMessage()
> >     {
> >         StringBuffer msg = new StringBuffer(super.getMessage());
>
> to
>
> >    public String getMessage()
> >     {
> >         StringBuilder msg = new StringBuilder();
> >         String message = super.getMessage();
> >         if (message != null) {
> >           msg.append(message);
> >         }
>

I've implemented the above and I believe this also resolves the failure.

Kind regards,
Daniel Sahlberg

Reply via email to