Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Rémy, how would you have done it ? Maybe there can be applied a fix to it. grisi - Original Message - From: Remy Maucherat [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, December 04, 2003 6:37 PM Subject: Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending Dirk Griesbach wrote: Rémy, I'm quite sure. With a summary of oreilly´s sources I see: class MultipartParser { ... private ServletInputStream in; private byte[] buf = new byte[8 * 1024]; ... ServletInputStream in = req.getInputStream(); ... do { String line = readLine(); if (line == null) { throw new IOException(Corrupt form data: premature ending); thrown when using TC5, but not on TC4 } ... private String readLine() throws IOException { int result; StringBuffer sbuf = new StringBuffer(); do { result = in.readLine(buf , 0, buf.length); ... sbuf.append(new String(buf, 0, result, encoding)); } ... return sbuf.toString(); } } looks quite normal, doesn't it ? If they're doing *that*, they might as well use the buffered reader readLine method ;-) Byte by byte input works (it's inefficent, obviously, but it works). I recommend adding some debug in their readLine method to see what is being returned. -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Dirk Griesbach wrote: Rémy, how would you have done it ? Maybe there can be applied a fix to it. You could add a sys.out in their readLine() method to see what is actually being read :) -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Hello Rémy, Dirk Griesbach wrote: Rémy, how would you have done it ? Maybe there can be applied a fix to it. You could add a sys.out in their readLine() method to see what is actually being read :) you hit my thoughts thinking on debugging (:-)), but we now know that this causes trouble somehow so it's worth thinking how to do it differently. Instead of using the 'ServletInputStream' and instead of using the 'readLine()' Method (which is the only one within this class) reading multipart stream byte-by-byte. Reading bytewise is essential, I think, beacuse mostly uploaded data is of binary content. So do you have a suggestion how to avoid the 'readLine()'-thing being more performant ? regards grisi -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Howdy, If I were you, Senor Griesbach, I would dump COS in favor of jakarta commons fileupload instead of spending significant time debugging intricate input stream problems... But that's just me, and I'm not a patient debugger ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Dirk Griesbach [mailto:[EMAIL PROTECTED] Sent: Friday, December 05, 2003 5:57 AM To: Tomcat Users List Subject: Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending Hello Rémy, Dirk Griesbach wrote: Rémy, how would you have done it ? Maybe there can be applied a fix to it. You could add a sys.out in their readLine() method to see what is actually being read :) you hit my thoughts thinking on debugging (:-)), but we now know that this causes trouble somehow so it's worth thinking how to do it differently. Instead of using the 'ServletInputStream' and instead of using the 'readLine()' Method (which is the only one within this class) reading multipart stream byte-by-byte. Reading bytewise is essential, I think, beacuse mostly uploaded data is of binary content. So do you have a suggestion how to avoid the 'readLine()'-thing being more performant ? regards grisi -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Yoav, Rémy, thanks for your suggestions. We will consider that; the reason why we hesitate is simply that we would have to apply modifications to the cos-lib we've done would have to be ported to commons fileupload also (with testing, adapting deployment etc). BTW, testing with TC5.0.16 was successful again. Obviously there are side effects of TC' implementation (inputStream-) details, but this only FYI. Again, thanks for your responses and see you soon on this list...(;-)) (I'm not a patient debugger, too...) grisi - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, December 05, 2003 3:11 PM Subject: RE: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending Howdy, If I were you, Senor Griesbach, I would dump COS in favor of jakarta commons fileupload instead of spending significant time debugging intricate input stream problems... But that's just me, and I'm not a patient debugger ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Dirk Griesbach [mailto:[EMAIL PROTECTED] Sent: Friday, December 05, 2003 5:57 AM To: Tomcat Users List Subject: Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending Hello Rémy, Dirk Griesbach wrote: Rémy, how would you have done it ? Maybe there can be applied a fix to it. You could add a sys.out in their readLine() method to see what is actually being read :) you hit my thoughts thinking on debugging (:-)), but we now know that this causes trouble somehow so it's worth thinking how to do it differently. Instead of using the 'ServletInputStream' and instead of using the 'readLine()' Method (which is the only one within this class) reading multipart stream byte-by-byte. Reading bytewise is essential, I think, beacuse mostly uploaded data is of binary content. So do you have a suggestion how to avoid the 'readLine()'-thing being more performant ? regards grisi -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Shapira, Yoav wrote: Howdy, If I were you, Senor Griesbach, I would dump COS in favor of jakarta commons fileupload instead of spending significant time debugging intricate input stream problems... But that's just me, and I'm not a patient debugger ;) What cos is doing is bad IMO (it should read in a byte buffer, IMO, and work in there, instead of using inefficient methods - which also generate Strings, so it's even more inefficient). I don't know what commons-fileupload is doing, but it works (he manager servlet uses it). But, I don't know, maybe there's an obscure bug with input. -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Another issue came up comparing TC4 and TC5: using the oreilly multipart lib on TC5 causes the error ...Corrupt form data: premature ending on POST uploads. As stated in the FAQ's at http://www.servlets.com/cos/faq.html this problem is merely due to the webcontainer and has been fixed with Tomcat 4. I tested and can state that this problem doesn't occur with TC4. But it is apparent with TC5 again. Will this be fixed ? grisi - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 3:53 PM Subject: RE: TC 4 -oreillyMultipart- TC5 Howdy, I don't have an immediate idea, which is worrisome (to me at least ;)). Let's try to not put this oreilly jar in commons/lib, but instead in WEB-INF/lib. Yoav Shapira Millennium ChemInformatics -Original Message- From: Dirk Griesbach [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 9:44 AM To: Tomcat Users List Subject: Re: TC 4 -oreillyMultipart- TC5 Hi Yoav, the 'full' error trace is: java.lang.IllegalAccessError: tried to access method com.oreilly.servlet.multipart.Part.init(Ljava/lang/String;)V from class com.oreilly.servlet.multipart.ParamPart at com.oreilly.servlet.multipart.ParamPart.init(ParamPart.java:42) at com.oreilly.servlet.multipart.MultipartParser.readNextPart(MultipartPar ser. j ava:341) ... the calling servlet method ... the source code mentioned reads: STARTSNIP of class ParamPart public class ParamPart extends Part { /** contents of the parameter */ private byte[] value; HashMap hashMap; private String encoding; /** * Constructs a parameter part; this is called by the parser. * ... */ ParamPart(HashMap hashMap, String name, ServletInputStream in, String boundary, String encoding) throws IOException { super(name); --- start of error-trace this.encoding = encoding; .. ENDSNIP class 'ParamPart' STARTSNIP of class 'Part' public abstract class Part { private String name; /** * Constructs an upload part with the given name. */ Part(String name) { -- this constructor being called causes the error I think this.name = name; } /** * Returns the name of the form element that this Part corresponds to. * * @return the name of the form element that this Part corresponds to. */ public String getName() { return name; } . ENDSNIP class 'ParamPart' I have used TC 5 'as is' after standard installation; no changes to server.xml. Same web.xml. Same with TC4. The multipartlibrary both times (TC4 and TC5) being in ../common/lib Same (web-)application, different results. Any ideas ? grisi - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 3:08 PM Subject: RE: TC 4 -oreillyMultipart- TC5 Howdy, Class ParamPart is public and its constructor is public as well? Strange. Are you running with different security settings? Did you put the library in a different place? Yoav Shapira Millennium ChemInformatics -Original Message- From: Dirk Griesbach [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 03, 2003 8:28 AM To: Tomcat Users List Subject: TC 4 -oreillyMultipart- TC5 Hi folks, I encountered a strange behaviour using 'oreilly's' multipartlibary (from Nov,2002): It works fine on TC 4.1.27 but exactly the same servlet and library with TC 5.0.12 and 5.0.14 (just copied them) the error log reads: java.lang.IllegalAccessError: tried to access method com.oreilly.servlet.multipart.Part.init(Ljava/lang/String;)V from class com.oreilly.servlet.multipart.ParamPart Class 'Part' IS public, so why this error on TC5 ? And no error on TC 4 ? Any suggestions ? greets grisi This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an)
RE: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Howdy, Another issue came up comparing TC4 and TC5: using the oreilly multipart lib on TC5 causes the error ...Corrupt form data: premature ending on POST uploads. As stated in the FAQ's at http://www.servlets.com/cos/faq.html this problem is merely due to the webcontainer and has been fixed with Tomcat 4. Umm, you misread that section of the FAQ. It states that there are many possible causes for this bug. A small subcase (IE, client hitting stop then starting again, leading to empty input stream) was isolated and fixed in a couple of containers (tomcat 4.0 and weblogic 6.1 according to the FAQ). I tested and can state that this problem doesn't occur with TC4. But it is apparent with TC5 again. Will this be fixed ? If you provide a concise description along with a test case or steps to reproduce your problems, there's a chance it might be fixed. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Shapira, Yoav wrote: Howdy, Another issue came up comparing TC4 and TC5: using the oreilly multipart lib on TC5 causes the error ...Corrupt form data: premature ending on POST uploads. As stated in the FAQ's at http://www.servlets.com/cos/faq.html this problem is merely due to the webcontainer and has been fixed with Tomcat 4. Umm, you misread that section of the FAQ. It states that there are many possible causes for this bug. A small subcase (IE, client hitting stop then starting again, leading to empty input stream) was isolated and fixed in a couple of containers (tomcat 4.0 and weblogic 6.1 according to the FAQ). I tested and can state that this problem doesn't occur with TC4. But it is apparent with TC5 again. Will this be fixed ? If you provide a concise description along with a test case or steps to reproduce your problems, there's a chance it might be fixed. There has been enough testing for uploading (with the standalone connector, at least, but there's no difference with JK for this), that I can confidently say that there's very little likelihood of a Tomcat bug in this area. Maybe if the thing uses readLine on the Tomcat provided reader (a rather annoying method to implement, so maybe there could be a bug), but in the unlikely case it does, I recommend dumping that library in favor of commons-fileupload (readLine is by definition awful performance wise). -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Rémy, I had a look into the sources. There it reads: class MultipartParser: do { String line = readLine(); if (line == null) { throw new IOException(Corrupt form data: premature ending); } (:-) By which method should 'readLine()' be replaced to achieve best performance ? grisi - Original Message - From: Remy Maucherat [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, December 04, 2003 3:23 PM Subject: Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending Shapira, Yoav wrote: Howdy, Another issue came up comparing TC4 and TC5: using the oreilly multipart lib on TC5 causes the error ...Corrupt form data: premature ending on POST uploads. As stated in the FAQ's at http://www.servlets.com/cos/faq.html this problem is merely due to the webcontainer and has been fixed with Tomcat 4. Umm, you misread that section of the FAQ. It states that there are many possible causes for this bug. A small subcase (IE, client hitting stop then starting again, leading to empty input stream) was isolated and fixed in a couple of containers (tomcat 4.0 and weblogic 6.1 according to the FAQ). I tested and can state that this problem doesn't occur with TC4. But it is apparent with TC5 again. Will this be fixed ? If you provide a concise description along with a test case or steps to reproduce your problems, there's a chance it might be fixed. There has been enough testing for uploading (with the standalone connector, at least, but there's no difference with JK for this), that I can confidently say that there's very little likelihood of a Tomcat bug in this area. Maybe if the thing uses readLine on the Tomcat provided reader (a rather annoying method to implement, so maybe there could be a bug), but in the unlikely case it does, I recommend dumping that library in favor of commons-fileupload (readLine is by definition awful performance wise). -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Dirk Griesbach wrote: Rémy, I had a look into the sources. There it reads: class MultipartParser: do { String line = readLine(); if (line == null) { throw new IOException(Corrupt form data: premature ending); } (:-) By which method should 'readLine()' be replaced to achieve best performance ? Yes, but what does this readLine method does and when is it called ? I was talking about request.getReader().readLine(). -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Rémy, this copy is of type javax.servlet.ServletInputStream.readLine() acquired by HttpServletRequest.getInputStream(); Would you agree that this is a good idea ? grisi - Original Message - From: Remy Maucherat [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, December 04, 2003 3:49 PM Subject: Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending Dirk Griesbach wrote: Rémy, I had a look into the sources. There it reads: class MultipartParser: do { String line = readLine(); if (line == null) { throw new IOException(Corrupt form data: premature ending); } (:-) By which method should 'readLine()' be replaced to achieve best performance ? Yes, but what does this readLine method does and when is it called ? I was talking about request.getReader().readLine(). -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Rémy, I'm quite sure. With a summary of oreilly´s sources I see: class MultipartParser { ... private ServletInputStream in; private byte[] buf = new byte[8 * 1024]; ... ServletInputStream in = req.getInputStream(); ... do { String line = readLine(); if (line == null) { throw new IOException(Corrupt form data: premature ending); thrown when using TC5, but not on TC4 } ... private String readLine() throws IOException { int result; StringBuffer sbuf = new StringBuffer(); do { result = in.readLine(buf , 0, buf.length); ... sbuf.append(new String(buf, 0, result, encoding)); } ... return sbuf.toString(); } } looks quite normal, doesn't it ? grisi - Original Message - From: Remy Maucherat [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Thursday, December 04, 2003 4:16 PM Subject: Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending Dirk Griesbach wrote: Rémy, this copy is of type javax.servlet.ServletInputStream.readLine() acquired by HttpServletRequest.getInputStream(); Would you agree that this is a good idea ? Are you sure ? There's a ServletIS.readLine(byte[] b, int off, int len) method, but no readLine returning a String (that's in the BufferedReader). SevletIS.readLine is not optimal already (I thought nobody would use it). Maybe it would be a good idea to attempt to reimplement it eventually. -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Dirk Griesbach wrote: Rémy, this copy is of type javax.servlet.ServletInputStream.readLine() acquired by HttpServletRequest.getInputStream(); Would you agree that this is a good idea ? Are you sure ? There's a ServletIS.readLine(byte[] b, int off, int len) method, but no readLine returning a String (that's in the BufferedReader). SevletIS.readLine is not optimal already (I thought nobody would use it). Maybe it would be a good idea to attempt to reimplement it eventually. -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TC 4 -oreillyMultipart- TC5: Corrupt form data: premature ending
Dirk Griesbach wrote: Rémy, I'm quite sure. With a summary of oreilly´s sources I see: class MultipartParser { ... private ServletInputStream in; private byte[] buf = new byte[8 * 1024]; ... ServletInputStream in = req.getInputStream(); ... do { String line = readLine(); if (line == null) { throw new IOException(Corrupt form data: premature ending); thrown when using TC5, but not on TC4 } ... private String readLine() throws IOException { int result; StringBuffer sbuf = new StringBuffer(); do { result = in.readLine(buf , 0, buf.length); ... sbuf.append(new String(buf, 0, result, encoding)); } ... return sbuf.toString(); } } looks quite normal, doesn't it ? If they're doing *that*, they might as well use the buffered reader readLine method ;-) Byte by byte input works (it's inefficent, obviously, but it works). I recommend adding some debug in their readLine method to see what is being returned. -- x Rémy Maucherat Senior Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]