W3C home > Mailing lists > Public > www-jigsaw@w3.org > January to February 2001

RE: java.io.IOException: Broken pipe

From: Dan Hansen <DLHansen@quark.com>
Date: Fri, 9 Feb 2001 10:14:11 -0500 (EST)
Message-ID: <3D62AB6FFC80D211A84700104B10CB2C0A22B7D0@denver.quark.com>
To: "'Yves Lafon'" <ylafon@w3.org>, Dan Hansen <DLHansen@quark.com>
Cc: "'www-jigsaw@w3.org'" <www-jigsaw@w3.org>
I think the problem is this - a stacktrace was put in for debugging but not
surrounded by the debug statement.  BTW, this debugging technique is only
efficient if the compiler (or jit) is smart enough to know what to do with
final static variables :)  Are they all?  I don't know.

So, I put in the debug "if" test - see the "HERE" statements below.  I think
that is it - will let you know if it was not.

BTW, what does the quotation mean?  I don't speak French.  Sorry.

Yours,
Dan


  /**
     * Run chunk encoding on the provided stream to emit reply's body.
     * @param is The reply's body that has to be chunk encoded.
     * @exception IOException If IO error occurs.
     */

    protected int chunkTransfer(InputStream is)
		  throws IOException
    {
		  byte   zeroChunk[] = { ((byte) 48), ((byte) 13), ((byte)
10) };//0\r\n
		  byte   crlf[]      = { ((byte) 13), ((byte) 10) } ; 
		  byte   bheader[]   = new byte[32] ;
		  int    blen        = 0 ;
		  int    written     = 0 ;
		  int    got         = 0 ;
		  int    sgot;
		  String header      = null ;
		  
		  try {
				// Emit the reply stream:
				while ((got = is.read(buffer)) >= 0) {
					 if (got == 0) {
						  continue;
					 }
					 // Emit a full chunk: header first,
followed by the body
					 // we dump the hexa size of the
header backward
					 sgot = got;
					 blen = 3;
					 bheader[30] = ((byte) 13); // \r
					 bheader[31] = ((byte) 10); // \n
					 while (sgot > 15) {
						  bheader[32-blen] =
hexaTable[sgot % 16];
						  sgot >>= 4;
						  blen++;
					 }
					 bheader[32-blen] = hexaTable[sgot];
					 output.write(bheader, 32-blen,
blen) ;
					 output.write(buffer, 0, got) ;
					 output.write(crlf, 0, 2) ;
					 output.flush() ;
					 written += (blen+got) ;
				}
		  } catch (IOException ex) {
				// To cope with Java's exec bug 
				// Anyway, if this really fails, the output
will fail below too
//HERE!!!
				if (debug) { //added this dlh
					 ex.printStackTrace();
				}            // added this dlh
//ENDHERE!!
		  }
		  // Emit the 0 chunk:
		  output.write(zeroChunk, 0, 3) ;
		  // FIXME trailers should be sent here
		  output.write(crlf, 0, 2) ;
		  output.flush() ;
		  return written + blen ;
    }

-----Original Message-----
From: Yves Lafon [mailto:ylafon@w3.org]
Sent: Friday, February 09, 2001 7:49 AM
To: Dan Hansen
Cc: 'www-jigsaw@w3.org'
Subject: Re: java.io.IOException: Broken pipe


On Fri, 9 Feb 2001, Dan Hansen wrote:

> A question to Yves -
>
> Why is this not being caught?  Should I put a catch someplace, and if not,
> why not?

It should be! Maybe there is a debug flag set to true somewhere, (usually
it's done with
    private static final boolean debug = false;
Maybe some "true" remains :/

>
> Thanks much!!!!
>
> java.io.IOException: Broken pipe
>         at java.net.SocketOutputStream.socketWrite(Native Method)
>         at java.net.SocketOutputStream.socketWrite(Compiled Code)
>         at java.net.SocketOutputStream.write(Compiled Code)
>         at org.w3c.jigsaw.http.socket.SocketOutputBuffer.write(Compiled
> Code)
>         at java.io.DataOutputStream.write(Compiled Code)
>         at org.w3c.jigsaw.http.Client.chunkTransfer(Compiled Code)
>         at org.w3c.jigsaw.http.Client.emitReply(Compiled Code)
>         at org.w3c.jigsaw.http.Client.startConnection(Compiled Code)
>         at org.w3c.jigsaw.http.socket.SocketClient.run(Compiled Code)
>         at org.w3c.util.CachedThread.run(Compiled Code)
>
> Dan Hansen
> Software Development Manager
> Quark, Inc.
> dlhansen@quark.com
> dhansen@dimensional.com
>
>
>
>

-- 
Yves Lafon - W3C
"Baroula que barouleras, au tiéu toujou t'entourneras."
Received on Friday, 9 February 2001 10:15:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:35 GMT