[
https://issues.apache.org/jira/browse/AXIOM-364?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13047473#comment-13047473
]
Hudson commented on AXIOM-364:
------------------------------
Integrated in ws-axiom-trunk #407 (See
[https://builds.apache.org/job/ws-axiom-trunk/407/])
AXIOM-364: Removed an unnecessary (and in some rare cases incorrect) cast.
veithen :
Files :
*
/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
> Unnecessary cast to byte while scanning for first MIME boundary
> ---------------------------------------------------------------
>
> Key: AXIOM-364
> URL: https://issues.apache.org/jira/browse/AXIOM-364
> Project: Axiom
> Issue Type: Bug
> Components: API
> Affects Versions: 1.2.11
> Reporter: Ivan
> Assignee: Andreas Veithen
> Priority: Minor
> Fix For: 1.2.12
>
>
> In the class org.apache.axiom.attachments.Attachments line 237
> --->
> while (true) {
> int value;
> try {
> value = pushbackInStream.read();
> if ((byte) value == boundary[0]) {
> int boundaryIndex = 0;
> while ((boundaryIndex < boundary.length)
> && ((byte) value == boundary[boundaryIndex])) {
> value = pushbackInStream.read();
> if (value == -1) {
> throw new OMException(
> "Unexpected End of Stream while searching
> for first Mime Boundary");
> }
> boundaryIndex++;
> }
> if (boundaryIndex == boundary.length) { // boundary found
> pushbackInStream.read();
> break;
> }
> } else if ((byte) value == -1) { <--- this byte case is
> unnecessary, e.g. if the value is 255, after the cast from int to byte, then
> from byte to int, it will be finally equal to -1
> throw new OMException(
> "Mime parts not found. Stream ended while
> searching for the boundary");
> }
> } catch (IOException e1) {
> throw new OMException("Stream Error" + e1.toString(), e1);
> }
> }
> <---
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]