I have the latest stable VM (1.4.2_05) already as I thought that was the problem. Nothing is solved :(
Printable View
I have the latest stable VM (1.4.2_05) already as I thought that was the problem. Nothing is solved :(
How about a catch block that reads:Quote:
Originally posted here by el-half
I have commented out the code that may cause trouble.
[...]
But it's strange, while there is no exception anymore when I remove actionPerformed's content the exception thrown has nothing to do with IO...
Should help you understand which exception is being thrown.Code:try {
blahblah...;
} catch (Exception e) {
System.out.println("Exception Thrown: "+ e.getClass().getName() +");
System.out.println("Message: "+ e.getMessage());
}
Thanks, I now found out a NullPointer exception is thrown, so something is wrong with the IO stuff after all. I think.
/me is unable to fix it.
NullPointerException is probably being thrown by that DataConnect class. I'd help, but DataConnect isn't a part of the Java API. I'd assume reading the third party docs for it might help you a bit.
DataConnect is a class I wrote:
Code:class DataConnect { //class for transfer of image
Socket socket = null;
BufferedInputStream buffer = null;
DataInputStream data_reader = null;
String address = "192.168.1.3";
int PORTNUM;
public DataConnect(int port) {
PORTNUM = port;
}
void establishConnection() {
try {
socket = new Socket(address, PORTNUM);
buffer = new BufferedInputStream(socket.getInputStream());
data_reader = new DataInputStream(buffer);
} catch (IOException e) {
System.err.println("Exception: " + e.getMessage());
System.exit(1);
}
}
}
The exception should give you line numbers, so you should be able to figure out what line in which file is generating the exception. You might also try something like:
Code:try {
i=0;
while ((image[i++] = dataconn.data_reader.readByte()) != -1) {
// Read data in while it's not EOS
}
} catch (Exception e) {
System.out.println("Exception Thrown: "+ e.getClass().getName() +");
System.err.println("Exception: " + e.getMessage());
}