harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Petrenko (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-3373) [classlib][luni]java.io.ByteArrayOutputStream: avoid to use exception mechanism as logic in write(int)
Date Thu, 22 Mar 2007 10:41:32 GMT

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

Alexey Petrenko resolved HARMONY-3373.
--------------------------------------

    Resolution: Fixed

Leo, thanks for the explanation.

The patch has been applied.
Please verify.

> [classlib][luni]java.io.ByteArrayOutputStream: avoid to use exception mechanism as logic
in write(int)
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3373
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3373
>             Project: Harmony
>          Issue Type: Improvement
>          Components: Classlib
>            Reporter: Leo Li
>         Assigned To: Alexey Petrenko
>         Attachments: patch-3373.diff
>
>
> In  ByteArrayOutputStream.write(int):
>      public synchronized void write(int oneByte) {
>         try {
>             buf[count] = (byte) oneByte;
>             count++;
>         } catch (IndexOutOfBoundsException e) {
>             // Expand when necessary
>             expand(1);
>             buf[count++] = (byte) oneByte;
>         } catch (NullPointerException e) {
>         }
>     }
>  Exception mechanism is adopted as a logic to judge whether current position is out of
the boundary of the backing array. So, I recommend to use explicit condtion to judge it. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message