harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ladislav Jahoda (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-6380) [classlib][logging] testInvalidParams results inconsistent
Date Sun, 22 Nov 2009 15:59:39 GMT
[classlib][logging]  testInvalidParams results inconsistent

                 Key: HARMONY-6380
                 URL: https://issues.apache.org/jira/browse/HARMONY-6380
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
    Affects Versions: 5.0M11
         Environment: Linux
            Reporter: Ladislav Jahoda
            Priority: Minor
             Fix For: 5.0M12

As noted in HARMONY-6358 this test under root user produces:
failure: should throw null exception

Under non root user it throws exception, which is desired behavior (test succeeds).

In HARMONY-6358 the issue was dismissed, because Sun Java didn't produce consistent results
either and Harmony behavior was considered more sensible.

In my opinion this behavior is rather confusing than sensible. Please note that if you repeat
the test in a following way:

java.util.logging.FileHandler h = new java.util.logging.FileHandler("%t/%h"); 
System.out.println("Exception not thrown"); 
h = new java.util.logging.FileHandler("%t/%h"); 
System.out.println("Exception not thrown"); 

you will get (as root) a different behavior on the first attempt (Exception not thrown) than
on the second attempt (Exception thrown).

All this confusion with root/non-root and first/second pass is caused by Harmony's interpretation
of %t/%h pattern.

Under root account %t/%h is resolved to e.g. /tmp/ + / + /root/ = /tmp///root/ which is then
forwarded to java.io.File where fixSlashes procedure removes the trailing slash. As a result
the root directory name is misunderstood as your intended log file name and you get a log
file called root in your tmp directory. No exception is thrown (test fails).

If you try it once more, then log file name gets appended with .1, so it won't be empty any
more. Slash after root won't be a trailing slash, it won't be removed and /tmp/root/.1 will
not get created, because you most likely don't have root dir under your tmp dir. So the test

Under non-root account %t/%h is resolved to e.g. /tmp/ + / + /home/myself = /tmp///home/myself/
 FixSlashes again removes the trailing slash, but unlike the above case with root account
it doesn't mean that the home directory name now can be misunderstood as file name. Home directory
name still contains a slash inside (home/myself), so /tmp/home/myself won't be created, unless
you have under your tmp dir a home dir.

Note that none of these problems occur on Windows, because Windows directories are prefixed
with drive letter and colon, so composing %t/%h can never produce a valid file location, like
it is happening here in case of /tmp + /root which produces a log file called root in your
tmp directory.

I suggest that this test result inconsitency is either fixed (%t/%h throws exception always,
as the test case expects) or that the test case with %t/%h is excluded, so that people who
need to see all harmony tests passed don't keep reinventing a wheel (like I did, before I
noticed HARMONY-6358)

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message