public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: java/4031: Socket code failing with null ptr exception
@ 2001-08-16 10:26 Tom Tromey
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2001-08-16 10:26 UTC (permalink / raw)
  To: tromey; +Cc: gcc-prs

The following reply was made to PR java/4031; it has been noted by GNATS.

From: Tom Tromey <tromey@redhat.com>
To: olson@mcs.anl.gov
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: java/4031: Socket code failing with null ptr exception
Date: 16 Aug 2001 11:47:58 -0600

 >>>>> "Robert" == olson  <olson@mcs.anl.gov> writes:
 
 >> Release:        gcj 2.96
 
 I tried `fo' using gcj 3.1.  It worked fine.
 I also tried using gcj 3.0, and that worked too.
 So I think whatever the bug was, it has since been fixed.
 
 Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: java/4031: Socket code failing with null ptr exception
@ 2001-08-16 10:36 Robert Olson
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Olson @ 2001-08-16 10:36 UTC (permalink / raw)
  To: tromey; +Cc: gcc-prs

The following reply was made to PR java/4031; it has been noted by GNATS.

From: Robert Olson <olson@mcs.anl.gov>
To: tromey@redhat.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: java/4031: Socket code failing with null ptr exception
Date: Thu, 16 Aug 2001 12:32:16 -0500

 Very cool. I'll have to give them a try.
 
 thanks,
 --bob
 
 At 11:47 AM 8/16/2001 -0600, Tom Tromey wrote:
 > >>>>> "Robert" == olson  <olson@mcs.anl.gov> writes:
 >
 > >> Release:        gcj 2.96
 >
 >I tried `fo' using gcj 3.1.  It worked fine.
 >I also tried using gcj 3.0, and that worked too.
 >So I think whatever the bug was, it has since been fixed.
 >
 >Tom
 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: java/4031: Socket code failing with null ptr exception
@ 2001-08-16 10:20 tromey
  0 siblings, 0 replies; 6+ messages in thread
From: tromey @ 2001-08-16 10:20 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, java-prs, nobody, olson, tromey

Synopsis: Socket code failing with null ptr exception

Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-By: tromey
Responsible-Changed-When: Thu Aug 16 10:20:35 2001
Responsible-Changed-Why:
    I've handled it.
State-Changed-From-To: open->closed
State-Changed-By: tromey
State-Changed-When: Thu Aug 16 10:20:35 2001
State-Changed-Why:
    I believe this is already fixed in gcc 3.0 and 3.1.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4031&database=gcc


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: java/4031: Socket code failing with null ptr exception
@ 2001-08-15 14:26 Tom Tromey
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2001-08-15 14:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR java/4031; it has been noted by GNATS.

From: Tom Tromey <tromey@redhat.com>
To: olson@mcs.anl.gov
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: java/4031: Socket code failing with null ptr exception
Date: 15 Aug 2001 15:49:12 -0600

 >>>>> ">" == olson  <olson@mcs.anl.gov> writes:
 
 >> gcj  -g -v -o fo --main=fo fo.java
 
 Could you send fo.java to me?  Please CC gcc-gnats, so that it is
 included in the PR.
 
 Thanks,
 Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: java/4031: Socket code failing with null ptr exception
@ 2001-08-15 14:26 Robert Olson
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Olson @ 2001-08-15 14:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR java/4031; it has been noted by GNATS.

From: Robert Olson <olson@mcs.anl.gov>
To: tromey@redhat.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: java/4031: Socket code failing with null ptr exception
Date: Wed, 15 Aug 2001 16:21:47 -0500

 --=====================_65630141==_.ALT
 Content-Type: text/plain; charset="us-ascii"; format=flowed
 
 At 03:49 PM 8/15/2001 -0600, Tom Tromey wrote:
 > >>>>> ">" == olson  <olson@mcs.anl.gov> writes:
 >
 > >> gcj  -g -v -o fo --main=fo fo.java
 >
 >Could you send fo.java to me?  Please CC gcc-gnats, so that it is
 >included in the PR.
 
 Here it is -- I'd put it there on the file upload on the bugs page, guess 
 it didn't upload.
 
 --bob
 
 /**
   * WebView.java
   *
   * Response to query from web browsers
   *
   * @version 0.6 04/03/2000
   * @author Kai Chen, NLANR
   */
 
 import java.net.*;
 import java.io.*;
 import java.util.*;
 
 public class fo
 {
      private boolean verboseMode = true;
      private ServerSocket listenSock = null;
 
      private StringBuffer sbuf = null;   // for storing web reply
 
 public static void main (String args[])
 {
 fo w = new fo();
 w.run();
 }
 
      fo()
      {
          System.out.println("start webiew");
 
          try {
              listenSock = new ServerSocket(9999, 20); // set backlog
          } catch (BindException ex) {
              System.out.println("WebView: error creating listening socket - "
                                 + ex.getMessage());
          } catch (IOException ex) {
              System.out.println("WebView: error creating listening socket - "
                                 + ex.getMessage());
          }
      }
 
      public void run()
      {
          Socket sock = null;
 
          // loop to listen for incoming connections
          while (true) {
              // accept a connection
              try {
                  sock = listenSock.accept();
              } catch (IOException ex) {
                  if (verboseMode) System.out.println("WebView: error 
 accepting connection - "
                                                      + ex.getMessage());
                  sock = null;
                  continue; // ignore this request
              }
 
              try {
                  processRequest(sock); // reply to the request
              } catch (Exception ex) {
                  if (verboseMode) System.out.println("WebView processreq 
 threw " + ex + ": " + ex.getMessage());
 ex.printStackTrace();
                  // ignore this request
              }
 
              try {
                  sock.close();
              } catch (IOException ex) {
                  if (verboseMode)
                      System.out.println("WebView: close socket error - " + 
 ex.getMessage());
              }
 
              sock = null; // for garbage collection
 
          } // end of while
 
      }
 
 
      /*
       * cleanup
       */
      protected void finalize() {
          try {
              listenSock.close();
          } catch (IOException ex) {}
      }
 
 
      /*
       * read the request and send a reply via TCP as a html page
       */
 
      private void processRequest(Socket sock) throws Exception
      {
          // reads the web request
          BufferedReader sockInput = new BufferedReader
              (new InputStreamReader(sock.getInputStream()));
          String displayOption = "loss"; // default
 
          while (true) {
              String line = sockInput.readLine();
              System.out.println("webview got " + line);
              if (line.startsWith("GET")) {
                  int first = line.indexOf(' ');
                  int second = line.indexOf(' ', first + 1);
 System.out.println("have " + first + " " + second);
 if (second< 0)
                  displayOption = line.substring(first + 2).toLowerCase();
 else
                  displayOption = line.substring(first + 2, 
 second).toLowerCase();
                  //while (sockInput.ready())
                  //    sockInput.readLine(); // discard the rest of the request
                  break;
              }
          }
          System.out.println("start me up");
 
 
          BufferedWriter sockOutput = new BufferedWriter
              (new OutputStreamWriter(sock.getOutputStream()));
 //      PrintWriter pwriter = new PrintWriter(sockOutput);
          BufferedWriter pwriter = sockOutput;
 
 pwriter.write("Content-type: text/plain\n\n");
 pwriter.write("Got " + displayOption);
 
          System.out.println("closedown");
          try {
              //   pwriter.close();
              sockOutput.flush();
              sockOutput.close();
              sockInput.close();
          } catch (IOException ex) {
              if (verboseMode)
                  System.out.println("WebView: stream close error - " + 
 ex.getMessage());
          }
 
          return;
      }
 }
 
 --=====================_65630141==_.ALT
 Content-Type: text/html; charset="us-ascii"
 
 <html>
 At 03:49 PM 8/15/2001 -0600, Tom Tromey wrote:<br>
 <blockquote type=cite cite>&gt;&gt;&gt;&gt;&gt; &quot;&gt;&quot; ==
 olson&nbsp; &lt;olson@mcs.anl.gov&gt; writes:<br>
 <br>
 &gt;&gt; gcj&nbsp; -g -v -o fo --main=fo fo.java<br>
 <br>
 Could you send fo.java to me?&nbsp; Please CC gcc-gnats, so that it
 is<br>
 included in the PR.</blockquote><br>
 Here it is -- I'd put it there on the file upload on the bugs page, guess
 it didn't upload.<br>
 <br>
 --bob<br>
 <br>
 /**<br>
 &nbsp;* WebView.java <br>
 &nbsp;*<br>
 &nbsp;* Response to query from web browsers<br>
 &nbsp;* <br>
 &nbsp;* @version 0.6 04/03/2000<br>
 &nbsp;* @author Kai Chen, NLANR<br>
 &nbsp;*/<br>
 <br>
 import java.net.*;<br>
 import java.io.*;<br>
 import java.util.*;<br>
 <br>
 public class fo<br>
 {<br>
 &nbsp;&nbsp;&nbsp; private boolean verboseMode = true;<br>
 &nbsp;&nbsp;&nbsp; private ServerSocket listenSock = null;<br>
 <br>
 &nbsp;&nbsp;&nbsp; private StringBuffer sbuf = null;&nbsp;&nbsp; // for
 storing web reply<br>
 <br>
 public static void main (String args[])<br>
 {<br>
 fo w = new fo();<br>
 w.run();<br>
 }<br>
 <br>
 &nbsp;&nbsp;&nbsp; fo()<br>
 &nbsp;&nbsp;&nbsp; {<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>System.out.println(&quot;start
 webiew&quot;);<br>
 <br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 listenSock = new ServerSocket(9999, 20); // set backlog <br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (BindException ex)
 {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 System.out.println(&quot;WebView: error creating listening socket -
 &quot;<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 + ex.getMessage());<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (IOException ex)
 {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 System.out.println(&quot;WebView: error creating listening socket -
 &quot;<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 + ex.getMessage());<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
 &nbsp;&nbsp;&nbsp; }<br>
 <br>
 &nbsp;&nbsp;&nbsp; public void run()<br>
 &nbsp;&nbsp;&nbsp; {<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Socket
 sock = null;<br>
 <br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // loop to listen for incoming
 connections<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (true) {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //
 accept a connection<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try
 {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 sock = listenSock.accept();<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
 catch (IOException ex) {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 if (verboseMode) System.out.println(&quot;WebView: error accepting
 connection - &quot;<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 + ex.getMessage());<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 sock = null;<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 continue; // ignore this request<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
 }<br>
 <br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try
 {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 processRequest(sock); // reply to the request<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
 catch (Exception ex) {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 if (verboseMode) System.out.println(&quot;WebView processreq threw &quot;
 + ex + &quot;: &quot; + ex.getMessage());<br>
 ex.printStackTrace();<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 // ignore this request<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
 }<br>
 <br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try
 {<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>sock.close();<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
 catch (IOException ex) {<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>if
 (verboseMode) <br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 System.out.println(&quot;WebView: close socket error - &quot; +
 ex.getMessage());<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 }<br>
 <br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sock =
 null; // for garbage collection<br>
 <br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } // end of while<br>
 <br>
 &nbsp;&nbsp;&nbsp; }<br>
 <br>
 <br>
 &nbsp;&nbsp;&nbsp; /*<br>
 &nbsp;&nbsp;&nbsp;&nbsp; * cleanup<br>
 &nbsp;&nbsp;&nbsp;&nbsp; */<br>
 &nbsp;&nbsp;&nbsp; protected void finalize() {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 listenSock.close();<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (IOException ex)
 {}<br>
 &nbsp;&nbsp;&nbsp; }<br>
 <br>
 <br>
 &nbsp;&nbsp;&nbsp; /*<br>
 &nbsp;&nbsp;&nbsp;&nbsp; * read the request and send a reply via TCP as a
 html page<br>
 &nbsp;&nbsp;&nbsp;&nbsp; */<br>
 <br>
 &nbsp;&nbsp;&nbsp; private void processRequest(Socket sock) throws
 Exception<br>
 &nbsp;&nbsp;&nbsp; {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // reads the web request<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>BufferedReader
 sockInput = new BufferedReader<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 (new InputStreamReader(sock.getInputStream()));<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>String
 displayOption = &quot;loss&quot;; // default<br>
 <br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>while
 (true) {<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 String line = sockInput.readLine();<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 System.out.println(&quot;webview got &quot; + line);<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 if (line.startsWith(&quot;GET&quot;)) {<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>int
 first = line.indexOf(' ');<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>int
 second = line.indexOf(' ', first + 1);<br>
 System.out.println(&quot;have &quot; + first + &quot; &quot; +
 second);<br>
 if (second&lt; 0)<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>displayOption
 = line.substring(first + 2).toLowerCase();<br>
 else<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>displayOption
 = line.substring(first + 2, second).toLowerCase();<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>//while
 (sockInput.ready()) <br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>//&nbsp;&nbsp;&nbsp;
 sockInput.readLine(); // discard the rest of the request<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>break;<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 }<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>}<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>System.out.println(&quot;start
 me up&quot;);<br>
 <br>
 <br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>BufferedWriter
 sockOutput = new BufferedWriter<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 (new OutputStreamWriter(sock.getOutputStream()));<br>
 //<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>PrintWriter pwriter
 = new PrintWriter(sockOutput);<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>BufferedWriter
 pwriter = sockOutput;<br>
 <br>
 pwriter.write(&quot;Content-type: text/plain\n\n&quot;);<br>
 pwriter.write(&quot;Got &quot; + displayOption);<br>
 <br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>System.out.println(&quot;closedown&quot;);<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>try 
 {<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 //&nbsp;&nbsp; pwriter.close();<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 sockOutput.flush();<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 sockOutput.close();<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 sockInput.close();<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>} catch
 (IOException ex) {<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
 if (verboseMode)<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>System.out.println(&quot;WebView:
 stream close error - &quot; + ex.getMessage());<br>
 <x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>}<br>
 <br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>
 &nbsp;&nbsp;&nbsp; }<br>
 }<br>
 </html>
 
 --=====================_65630141==_.ALT--
 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* java/4031: Socket code failing with null ptr exception
@ 2001-08-15  5:46 olson
  0 siblings, 0 replies; 6+ messages in thread
From: olson @ 2001-08-15  5:46 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4031
>Category:       java
>Synopsis:       Socket code failing with null ptr exception
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 15 05:46:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Robert Olson
>Release:        gcj 2.96
>Organization:
>Environment:
RedHat Linux 7.1 on i386
>Description:
A simple socket code to read a web browser request crashes with an exception. The code works fine under Sun JDK1.2.2.

gcj  -g -v -o fo --main=fo fo.java
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/libgcj.spec
rename spec lib to liborig
rename spec startfile to startfileorig
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/jc1 fo.java -fno-use-divide-subroutine -fasynchronous-exceptions -quiet -dumpbase fo.java -g -version -o /tmp/ccwYvix0.s
GNU Java version 2.96 20000731 (Red Hat Linux 7.1 2.96-81) (i386-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-81).
 as -V -Qy -o /tmp/ccBr5Wr6.o /tmp/ccwYvix0.s
GNU assembler version 2.10.91 (i386-redhat-linux) using BFD version 2.10.91.0.2
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/jvgenmain fo /tmp/ccOqLhWimain.i
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1 /tmp/ccOqLhWimain.i -quiet -dumpbase fo.c -g -version -o /tmp/ccfNRl1umain.s
GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-81) (i386-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.1 2.96-81).
 as -V -Qy -o /tmp/ccaZyNRJmain%O /tmp/ccfNRl1umain.s
GNU assembler version 2.10.91 (i386-redhat-linux) using BFD version 2.10.91.0.2
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o fo /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crti.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/crtbegin.o -u __rethrow -u __frame_state_for -lgcc -L/usr/lib/gcc-lib/i386-redhat-linux/2.96 -L/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../.. /tmp/ccBr5Wr6.o /tmp/ccaZyNRJmain%O -lgcc -lgcj -lm -lgcjgc -lpthread -lzgcj -ldl -lc -lgcc /usr/lib/gcc-lib/i386-redhat-linux/2.96/crtend.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crtn.o

$ ./fo
start webiew
webview got GET /asdf HTTP/1.0
have 3 9
start me up
closedown
WebView processreq threw java.lang.NullPointerException: null
java.lang.NullPointerException
   at 0x4010b779: _Jv_ThrowSignal (/usr/lib/libgcj.so.1)
   at 0x4010b7b2: _Jv_ThrowSignal (/usr/lib/libgcj.so.1)
   at 0x40173f5a: java::lang::StringBuffer::ensureCapacity_unsynchronized(int) (/usr/lib/libgcj.so.1)
   at 0x40173953: java::lang::StringBuffer::append(java::lang::String *) (/usr/lib/libgcj.so.1)
   at 0x0804cbe1: __frame_state_for (./fo)
   at 0x0804c2c9: __frame_state_for (./fo)
   at 0x0804c271: __frame_state_for (./fo)
   at 0x401ce21d: gnu::gcj::runtime::FirstThread::run(void) (/usr/lib/libgcj.so.1)
   at 0x401d7d36: java::lang::Thread::run_(java::lang::Object *) (/usr/lib/libgcj.so.1)
   at 0x401e814d: _Jv_ThreadSetPriority(_Jv_Thread_t *, int) (/usr/lib/libgcj.so.1)
   at 0x403094a0: GC_start_routine (/usr/lib/libgcjgc.so.1)
   at 0x40322bfd: pthread_detach (/lib/i686/libpthread.so.0)
   at 0x4042977a: __clone (/lib/i686/libc.so.6)
WebView: close socket error - Bad file descriptor
>How-To-Repeat:
Compile and run, then either point a web browser to port 9999 on that host or telnet to it and type the request of the form "GET /asdf HTTP/1.0":

% telnet host 9999
Trying hostip...
Connected to host.
Escape character is '^]'.
GET /asdf HTTP/1.0
Content-type: text/plain

Got asdfConnection closed by foreign host.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-08-16 10:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-16 10:26 java/4031: Socket code failing with null ptr exception Tom Tromey
  -- strict thread matches above, loose matches on Subject: below --
2001-08-16 10:36 Robert Olson
2001-08-16 10:20 tromey
2001-08-15 14:26 Robert Olson
2001-08-15 14:26 Tom Tromey
2001-08-15  5:46 olson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).