Problem with FrameworkSet.java

From: Colin Clark (colinclar..ac.com)
Date: Wed Oct 02 2002 - 13:08:33 EDT

  • Next message: Christian Edward Gruber: "RE: Problems with wolips."

    Hi everyone,

    I've been having some annoying problems with the WOApplication task
    recently, and I've finally figured out what was wrong.

    Problem: On Windows, frameworks weren't being included in the classpath
    properly. Given an absolute path to a framework, the WOApplication task
    was failing with an error "Unrecognized root..." On Windows, we define
    absolute paths with backslashes (eg. C:\Path\To\Frameworks) for
    consistency. Although Ant will happily convert between path separators,
    it makes sense to us to use backslashes on Windows.

    Solution: The isAbsoluteRoot() method in FrameworkSet.java assumes that
    all absolute paths will use forward slashes. It chokes on backslashes.
    Here's the code from revision 1.10 in CVS:

    public boolean isAbsoluteRoot() {
            return root.charAt(0) == '/'
              || (root.length() >= 3 && root.substring(1, 3).equals(":/"));
    }

    Obviously, the current implementation will fail if the path has been
    set with backslashes. The following code should fix the problem. I
    haven't tested this code, and it was typed in straight to email, but it
    should convey my point:

    public boolean isAbsoluteRoot() {
            if (root.charAt(0) == '/)
                    return true;
            else if (root.length() >= 3 && root.substring(1, 3).equals(":/"))
                    return true;
            else if (root.length() >= 3 && root.substring(1, 3).equals(":\"))
                    return true;
            else
                    return false;
    }

    Workaround: In the meantime, I've just set my paths in the build script
    for Windows to use forward slashes. It's not a big issue bit it had us
    quite stumped for awhile. My suggested fix quite trivial to implement.

    Thanks,

    Colin

    ---
    Colin Clark
    Dynamic Web/Database Developer
    Resource Centre for Academic Technology,
    University of Toronto
    (416) 946-7592 / colin.clar..toronto.ca
    



    This archive was generated by hypermail 2.0.0 : Wed Oct 02 2002 - 13:08:48 EDT