This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 231041 - IndexOutOfBoundsException at java.io.PipedOutputStream.write
Summary: IndexOutOfBoundsException at java.io.PipedOutputStream.write
Status: RESOLVED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: GlassFish (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: TomasKraus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-10 15:31 UTC by Exceptions Reporter
Modified: 2013-07-26 02:48 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 194463


Attachments
stacktrace (1.14 KB, text/plain)
2013-06-10 15:31 UTC, Exceptions Reporter
Details
stacktrace (1.15 KB, text/plain)
2013-07-08 19:32 UTC, sreder
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Exceptions Reporter 2013-06-10 15:31:45 UTC
Build: NetBeans IDE 7.3 (Build 201302132200)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.21-b01, Java(TM) SE Runtime Environment, 1.7.0_21-b11
OS: Windows 7

User Comments:
GUEST: un altre cop peta




Stacktrace: 
java.lang.IndexOutOfBoundsException
   at java.io.PipedOutputStream.write(PipedOutputStream.java:0)
   at org.glassfish.tools.ide.server.FetchLogLocal.call(FetchLogLocal.java:224)
   at org.glassfish.tools.ide.server.FetchLogLocal.call(FetchLogLocal.java:56)
   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:0)
   at java.util.concurrent.FutureTask.run(FutureTask.java:0)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:0)
Comment 1 Exceptions Reporter 2013-06-10 15:31:46 UTC
Created attachment 135596 [details]
stacktrace
Comment 2 sreder 2013-07-08 19:32:38 UTC
Created attachment 136837 [details]
stacktrace

Deploying a project to Glassfish
Comment 3 TomasKraus 2013-07-24 13:36:21 UTC
Looking into PipedOutputStream write method:

        } else if ((off < 0) || (off > b.length) || (len < 0) ||
                   ((off + len) > b.length) || ((off + len) < 0)) {
            throw new IndexOutOfBoundsException();

javadoc for read(byte b[]) says: The number of bytes read is,
        at most, equal to the length of <code>b</code>

our code:
   fIn.read(buff);
   out.write(buff, 0, count)

 - off is 0
 * len can be < 0
 - (off + len) > b.length shall not happen because of fIn.read(buff) javadoc
   and off = 0
 * (off + len) < 0) when len < 0

So adding one if:
                        if (count > 0) {
                            out.write(buff, 0, count);
                        }

should fix this issue.

Checked into Tooling Library:
-----------------------------
changeset:   629:71e8f5d887e8
summary:     Bug# 231041 - IndexOutOfBoundsException at 
             java.io.PipedOutputStream.write
Comment 4 TomasKraus 2013-07-24 14:48:46 UTC
Pushing changes into web-main.
Comment 5 Quality Engineering 2013-07-26 02:48:36 UTC
Integrated into 'main-silver', will be available in build *201307252300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e92f2671e63b
User: Tomas Kraus <TomasKraus@netbeans.org>
Log: #231041 - IndexOutOfBoundsException at java.io.PipedOutputStream.write