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 160073

Summary: IndexOutOfBoundsException: off < 0 || len < 0 || off+len > b.length || off+len < 0!
Product: utilities Reporter: Ivan Sidorkin <ivansidorkin>
Component: ImageAssignee: Alexey Butenko <alexeybutenko>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://statistics.netbeans.org/exceptions/detail.do?id=2492
Issue Type: DEFECT Exception Reporter: 2492
Attachments: stacktrace
Example of image which cause the exception

Description Ivan Sidorkin 2009-03-11 08:55:59 UTC
Build: NetBeans IDE Dev (Build 200903101401)
VM: Java HotSpot(TM) Client VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b02
OS: Windows XP, 5.1, x86

User Comments:
suchezi: fresh newest compilation

giorgio42: Double-clicked on a gif image. Note that I am using a self-compiled NetBeans build.

GUEST: i created a label inside a jframe, then i went into the jlabel property and click on the icon browse so that i can out an image on the label and the browse window didnt open 

hope this helps u

GUEST: Happend when try to choose icon in jbutton!

GUEST: property editor for label icon

ogretech: Selecting the poperty editor for a JButton's icon

GUEST: I created a label from the pallete

i clicked on its properties and choose to browse for icons 

the icon browser doesnt open 

so i have to code the icon manually hope this helps

GUEST: I have a problem with Icon ( JButton ).



Stacktrace: 
java.lang.IndexOutOfBoundsException: off < 0 || len < 0 || off+len > b.length || off+len < 0!
        at javax.imageio.stream.MemoryCacheImageInputStream.read(MemoryCacheImageInputStream.java:85)
        at com.sun.imageio.plugins.gif.GIFImageReader.getCode(GIFImageReader.java:306)
        at com.sun.imageio.plugins.gif.GIFImageReader.read(GIFImageReader.java:881)
        at javax.imageio.ImageIO.read(ImageIO.java:1422)
        at javax.imageio.ImageIO.read(ImageIO.java:1326)
        at org.netbeans.modules.image.ImageDataObject.getImage(ImageDataObject.java:174)
Comment 1 Ivan Sidorkin 2009-03-11 08:56:06 UTC
Created attachment 78020 [details]
stacktrace
Comment 2 Alexey Butenko 2009-03-11 12:51:39 UTC
changeset f71ca8bc6989
I've fixed the Exception but not the issue itself, because com.sun.imageio.plugins.gif.GIFImageReader class not able to
read some gif files, and it is not related to Netbeans. 

Here is the code which will give an Exception for some gif files
        String fileStr="columnIndex.gif";
        File file = new File(fileStr);
        Iterator<ImageReader> it = javax.imageio.ImageIO.getImageReadersByFormatName("GIF");
        ImageReader reader = it.next();
        FileImageInputStream input = new FileImageInputStream(file);
        reader.setInput(input);
        reader.read(0);

Comment 3 Alexey Butenko 2009-03-11 12:52:57 UTC
Created attachment 78041 [details]
Example of image which cause the exception
Comment 4 Alexey Butenko 2009-03-11 12:53:57 UTC
Fixed
Comment 5 Ivan Sidorkin 2009-03-11 14:17:02 UTC
java bug: http://bugs.sun.com/view_bug.do?bug_id=6532025