You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2002/01/09 01:15:07 UTC

DO NOT REPLY [Bug 5756] New: - jspc.bat exits with wrong ERRORLEVEL

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5756>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5756

jspc.bat exits with wrong ERRORLEVEL

           Summary: jspc.bat exits with wrong ERRORLEVEL
           Product: Tomcat 3
           Version: 3.2.3 Final
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: alan@coldsmoke.com


I'm using jspc.bat from Tomcat 3.2.3 under Windows 2000.  I'm invoking it from 
ant and I'm always getting back a failure from the exec task.  The problem is 
actually with tomcat.bat when invoked as 

tomcat jspc ...

tomcat.bat is resetting the environment vars in the "cleanup" section.  Under 
cmd.exe, succesfully setting or unsetting a environmental var sets the 
ERRORLEVEL.  In my case, I didn't have a CP var, so I was always failing; when 
I changed it, then I was always suceeding, even when I had errors compiling my 
jsp pages.

My workaround is add a variable called "tomcatexit" (yes, this will pollute the 
environment, but whatever).  I first set it to 0 at about line 34:

set _CP=%CP%
set _TOMCAT_HOME=%TOMCAT_HOME%
set _CLASSPATH=%CLASSPATH%
set tomcatexit=0

Then I used it to trap the ERRORLEVEL at the cleanup tag (at about line 181):

:cleanup
set tomcatexit=%ERRORLEVEL%

and finally I exit with it:

:finish
if "%OS%"=="Windows_NT" exit /b %tomcatexit%

I do the OS check since I'm not sure that command.com supports the exit /b 
syntax.  This lets tomcat.bat, and hence jspc.bat, exit with whatever value the 
java code returns.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>