It seems the second loop shown below may not be necessary, since checking if the last character to be '\\' might be sufficient. But the code is correct and since only used during build time, it should be ok.

Satheesh

            for (int lastNonWS = line.length() - 1;
                lastNonWS >= 0; lastNonWS--)
            {
                char ch = line.charAt(lastNonWS);
                if (!Character.isWhitespace(ch)) {
                // this is the last non-whitespace character; if it's
                // a backslash, then we continue building the query
                // by reading the next line.
                    if (ch == '\\') {
                    // then continue building the query.
                        done = false;
                    }
                    break;
                }

Satheesh Bandaram (JIRA) wrote:
    [ http://issues.apache.org/jira/browse/DERBY-675?page=comments#action_12356730 ] 

Satheesh Bandaram commented on DERBY-675:
-----------------------------------------

This patch is committed.

Sending        java\build\org\apache\derbyBuild\ODBCMetadataGenerator.java
Transmitting file data .
Committed revision 330672.


  
Build-time processing of "metadata.properties" file handles slashes incorrectly.
--------------------------------------------------------------------------------

         Key: DERBY-675
         URL: http://issues.apache.org/jira/browse/DERBY-675
     Project: Derby
        Type: Bug
  Components: Build tools
    Versions: 10.2.0.0, 10.1.1.1, 10.1.1.0
    Reporter: A B
    Assignee: A B
    Priority: Minor
     Fix For: 10.2.0.0
 Attachments: d675_v2.patch

As found and described by Mamta here:
http://www.nabble.com/-Derby-573-Optimizer-overrides-and-metadata.properties-files-t460642.html
During the ant build process, Derby's metadata.properties file is modified by the ODBCMetadataGenerator class and that class treats backslashes that occur in the metadata.properties file incorrectly.  More specifically, it treats every backslash as the end of a line and thus will translate things like
FROM --DERBY-PROPERTIES joinOrder=FIXED \\n \
into
FROM --DERBY-PROPERTIES joinOrder=FIXED \
\
n \
(in other words, escaped characters like "\n" are handled incorrectly)..
    

  

Reply via email to