Array index error when duplicating a BufferedImage
So I'm trying to keep two copies of a set of images cached in my program. I've got an object that holds both references in it and a loop that loads the images and passes them to a new instance of that particular class. However, on about the 25th iteration, I get an Array Index Out of Bounds Exception when the class makes the copy. I've deduced that its trying to either copy to a non-existent pixel in the second copy or it's going beyond the bounds of the first copy.

Here's the parts of the code that matter:

The Loop:

    Hashtable<String, Sheet> tempHashTable = new Hashtable<String, Sheet>();
    for(int ii = 0; ii < sheetNames.size(); ii++) {
       try {
          File tempSheetFile = new File(Constants.TEMP_DIR, sheetNames.get(ii));
          BufferedImage tempSheet = ImageIO.read(tempSheetFile);
          System.out.println(sheetNames.get(ii));
          tempHashTable.put(sheetNames.get(ii), new Sheet(tempSheet));
       } catch (IOException ex) {
       }
    }
Sheet Init:

    private BufferedImage defaultSheet;
    private BufferedImage currentSheet;
    
    public Sheet(BufferedImage defaultSheet) {
        this.defaultSheet = defaultSheet;
        currentSheet = new BufferedImage(defaultSheet.getWidth(), defaultSheet.getHeight(), BufferedImage.TYPE_INT_ARGB);
        currentSheet.setData(defaultSheet.getData()); //Error line
    }
Error:

    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 64

The weirdest part about it is that the second BufferedImage is created with the size of the first, so why would we ever get an array index exception?
Array index error when duplicating a BufferedImage
===

So I'm trying to keep two copies of a set of images cached in my program. I've got an object that holds both references in it and a loop that loads the images and passes them to a new instance of that particular class. However, on about the 25th iteration, I get an Array Index Out of Bounds Exception when the class makes the copy. I've deduced that its trying to either copy to a non-existent pixel in the second copy or it's going beyond the bounds of the first copy.

Here's the parts of the code that matter:

The Loop:

    Hashtable<String, Sheet> tempHashTable = new Hashtable<String, Sheet>();
    for(int ii = 0; ii < sheetNames.size(); ii++) {
       try {
          File tempSheetFile = new File(Constants.TEMP_DIR, sheetNames.get(ii));
          BufferedImage tempSheet = ImageIO.read(tempSheetFile);
          System.out.println(sheetNames.get(ii));
          tempHashTable.put(sheetNames.get(ii), new Sheet(tempSheet));
       } catch (IOException ex) {
       }
    }
Sheet Init:

    private BufferedImage defaultSheet;
    private BufferedImage currentSheet;
    
    public Sheet(BufferedImage defaultSheet) {
        this.defaultSheet = defaultSheet;
        currentSheet = new BufferedImage(defaultSheet.getWidth(), defaultSheet.getHeight(), BufferedImage.TYPE_INT_ARGB);
        currentSheet.setData(defaultSheet.getData()); //Error line
    }
Error:

    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 64

The weirdest part about it is that the second BufferedImage is created with the size of the first, so why would we ever get an array index exception?