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

From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc:  Subject: Re: mod_jserv/2962: initArgs are not parsed correctly
Date: Mon, 07 Sep 1998 14:40:35 +0200

 Here is a better fix for the problem than the previous hack
 I submitted. The attached patch should be applied to the current
 Configurations.java file (I labeled it as Configurations.java.orig) to
 give a correct Configurations.java.
 
 It will handle correctly even cases where the line ends with a "\" but
 is not really an "escaped" line, e.g. with:
 
 xxxx.initArgs=mydir=C:\\
 
 Note that the lines of the patch have been wrapped by my mail user
 agent.
 
 *** Configurations.java.orig   Mon Sep  7 13:06:26 1998
 --- Configurations.java        Mon Sep  7 13:24:44 1998
 ***************
 *** 160,178 ****
        */
       public void load(InputStream input) throws IOException {
           BufferedReader reader = new BufferedReader(new
 InputStreamReader(input));
 !         String line, escline;
   
           while ((line = reader.readLine()) != null) {
               line.trim();
               if (!line.startsWith("#")) {
 !            while(line.endsWith("\\")){
 !              if((escline = reader.readLine()) != null) {
 !                line = line.substring(0,line.length()-1) + escline;
 !              } else {
 !                break;
 !              }
 !            }
 ! 
                int equalSign = line.indexOf('=');
                   if (equalSign > 0) {
                       String key = line.substring(0, equalSign);
 --- 160,192 ----
        */
       public void load(InputStream input) throws IOException {
           BufferedReader reader = new BufferedReader(new
 InputStreamReader(input));
 !         String line;
   
           while ((line = reader.readLine()) != null) {
               line.trim();
               if (!line.startsWith("#")) {
 !              // Concatenate lines when ending with escape character '\\'
 !              do {
 !                  // Check if end of line is a _real_ escape,
 !                  //  avoiding cases where the line really ends with
 !                  //  a legitimate '\\', for example "dir=C:\\"
 !                  int endindex = line.length() - 1;
 !                  if( endindex < 0 )
 !                      break;
 !                  int i;
 !                  for(i=endindex; i<=0 || line.charAt(i)=='\\'; i--) ;
 !                  if( ((endindex-i) & 1) == 0 ){
 !                      break;
 !                  }
 !                  String lastline;
 !                  if((lastline = reader.readLine()) == null){
 !                      // Found EOF after an escaped line. Throw exception
 !                      throw new IOException();
 !                  }
 !                  lastline.trim();
 !                  line = line.substring(0,endindex).concat(lastline);
 !              } while(true);
 !              
                int equalSign = line.indexOf('=');
                   if (equalSign > 0) {
                       String key = line.substring(0, equalSign);

Reply via email to