Bug 37829 - Log says always that a error ocurred, but the cgi script is correct
Summary: Log says always that a error ocurred, but the cgi script is correct
Status: CLOSED WORKSFORME
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Servlets:CGI (show other bugs)
Version: 5.0.30
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords: ErrorMessage
Depends on:
Blocks:
 
Reported: 2005-12-08 00:05 UTC by Armindo Correia Junior
Modified: 2005-12-12 04:54 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Armindo Correia Junior 2005-12-08 00:05:41 UTC
Hi,

If I try to run, thru tomcat, a correct perl script, Tomcat writes always a 
line on log saying that an error ocurred. The file stderr.log is always empty, 
which is not in accordance with what the main log says.

Thanks 
Armindo Correia
Comment 1 Mark Thomas 2005-12-08 00:34:59 UTC
This works for me without an error message with the latest source.

The last change that might have any effect was over 12 months ago.

If you re-open this bug report, please provide the smallest possible test war
that demonstrates this issue. Also please include:
- JVM version
- CGI config and mapping from web.xml
Comment 2 Armindo Correia Junior 2005-12-12 13:44:57 UTC
Hi Mark,

I found what caused this problem in class "CGIServlet", method "sendToLog". 

Until the version 5.0.30, the variable linecount was wrongly incremented after 
the loop and not inside it. 

That means it has always the value 1, even though there was no errors or many 
lines of message

            try {
                while ((line = rdr.readLine()) != null) {
                    log("runCGI (stderr):" +  line) ;
                }
                lineCount++ ;
            } catch (IOException e) {


I checked now the source code in the beta version 5.5.12 and 14, and this 
problem was solved. As you tested with the last version, the bug was no more 
there:

            try {
                while ((line = rdr.readLine()) != null) {
                    log("runCGI (stderr):" +  line) ;
                    lineCount++ ;
                }
            } catch (IOException e) {


As I didn't find any bug relating this problem, I created this bug before 
testing with the latest version. 

Thank for the attention, sorry if it took your time ;P

Armindo Correia