You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Andrew Zhang (JIRA)" <ji...@apache.org> on 2006/08/25 10:11:23 UTC

[jira] Commented: (HARMONY-1279) [classlib][logging] java.util.logging.StreamHandler.publish(LogRecord)'s condition check sequence is different from spec's.

    [ http://issues.apache.org/jira/browse/HARMONY-1279?page=comments#action_12430433 ] 
            
Andrew Zhang commented on HARMONY-1279:
---------------------------------------

Hi Mark,

The fix looks good. Many thanks!

Best regards,
Andrew

> [classlib][logging] java.util.logging.StreamHandler.publish(LogRecord)'s condition check sequence is different from spec's.
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1279
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1279
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Andrew Zhang
>         Assigned To: Mark Hindess
>         Attachments: Harmony-1279.diff
>
>
> StreamHandler.publish spec says "The StreamHandler first checks if there is an OutputStream and if the given LogRecord has at least the required log level. If not it silently returns. If so, it calls any associated Filter to check if the record should be published." But Harmony checks filter before OutputStream. 
> Following test reproduces the bug:
> 	public void testHandler() throws Exception {
> 		StreamHandler handler = new StreamHandler();
> 		MockFilter filter = new MockFilter();
> 		handler.setLevel(Level.FINER);
> 		handler.setFilter(filter);
> 		LogRecord record = new LogRecord(Level.FINE, "abc");
> 		handler.publish(record);
> 		assertFalse(filter.isLoggableCalled);
> 	}
> 	static class MockFilter implements Filter {
> 		private boolean isLoggableCalled = false;
> 		public boolean isLoggable(LogRecord arg0) {
> 			isLoggableCalled = true;
> 			return false;
> 		}
> 	}
> The test passes against RI while fails against Harmony. 
> I'll upload a patch to fix this problem soon.
> Best regards,
> Andrew

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira