Bug 361 : loadImageIO bimage is null
Last modified: 2006-05-22 13:53

DUPLICATE of bug 359


Assigned To:

Attachment Type Created Size Actions

Description:   Opened: 2006-05-22 11:51
I'm not sure of the details, but I've tracked it to at least this symptom:

bimage is causing a NullPointerException on the line "Integer hi =
(Integer) getHeightMethod.invoke(bimage, (Object[]) null);" in
loadImageIO(String filename) of the file PApplet.java

the circumstances:
* it only causes a problem when the applet is hosted remotely.
* the applet is signed.
* the image is aquired via drag and drop code similar to what is in
Editor.java as suggested <a
* I can read the file using a BufferedReader, I just can't display the image

specifically, i invoke the loadImage in this section of code - called in
the handling of a drop event of DropTarget:

public void dropImageFile(File file) {
final File file2 = file;
final PApplet thisApp = this;
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
PImage p = thisApp.loadImage(file2.getAbsolutePath());
if( p == null) { System.out.println("here"); return null; }
FloatingImage fi = new FloatingImage(thisApp, p);
return p;
Additional Comment #1 From tony 2006-05-22 11:53
This is a duplicate.. I accidently hit refresh and resubmit the page.
Additional Comment #2 From fry 2006-05-22 12:16

*** This bug has been marked as a duplicate of 359 ***
Additional Comment #3 From tony 2006-05-22 13:52
So... switching out loadimage in favor of loadStrings(filename) produces an
"... is missing or inaccessible, make sure it's been added to you
sketch..." error ....

However, loadStrings(File) seems to work fine, as does loadBytes

I can InputStream istr = openStream(file); System.out.println(istr); with
no problems at that point as well.

The problem is in openstream(String filename) when the signed applet is
hosted on a remote machine. I hacked together a workaround (a
loadImage(File f)) that I can use in the meanwhile.

I don't think i've seen thise work, I have been working on this off and on
for a long while, and never had any success on the remotely hosted version,
though it worked on the locally hosted end.