Again: help with Java program - Page 2
Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Again: help with Java program

  1. #11
    Senior Member
    Join Date
    Jun 2003
    Posts
    772
    I have the latest stable VM (1.4.2_05) already as I thought that was the problem. Nothing is solved
    The above sentences are produced by the propaganda and indoctrination of people manipulating my mind since 1987, hence, I cannot be held responsible for this post\'s content - me

    www.elhalf.com

  2. #12
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,255
    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...
    How about a catch block that reads:
    Code:
    try {
      blahblah...;
    } catch (Exception e) {
      System.out.println("Exception Thrown: "+ e.getClass().getName() +");
      System.out.println("Message: "+ e.getMessage());
    }
    Should help you understand which exception is being thrown.
    Chris Shepherd
    The Nelson-Shepherd cutoff: The point at which you realise someone is an idiot while trying to help them.
    \"Well as far as the spelling, I speak fluently both your native languages. Do you even can try spell mine ?\" -- Failed Insult
    Is your whole family retarded, or did they just catch it from you?

  3. #13
    Senior Member
    Join Date
    Jun 2003
    Posts
    772
    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.
    The above sentences are produced by the propaganda and indoctrination of people manipulating my mind since 1987, hence, I cannot be held responsible for this post\'s content - me

    www.elhalf.com

  4. #14
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,255
    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.
    Chris Shepherd
    The Nelson-Shepherd cutoff: The point at which you realise someone is an idiot while trying to help them.
    \"Well as far as the spelling, I speak fluently both your native languages. Do you even can try spell mine ?\" -- Failed Insult
    Is your whole family retarded, or did they just catch it from you?

  5. #15
    Senior Member
    Join Date
    Jun 2003
    Posts
    772
    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 above sentences are produced by the propaganda and indoctrination of people manipulating my mind since 1987, hence, I cannot be held responsible for this post\'s content - me

    www.elhalf.com

  6. #16
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,255
    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());
    }
    Chris Shepherd
    The Nelson-Shepherd cutoff: The point at which you realise someone is an idiot while trying to help them.
    \"Well as far as the spelling, I speak fluently both your native languages. Do you even can try spell mine ?\" -- Failed Insult
    Is your whole family retarded, or did they just catch it from you?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides