You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vera Petrashkova (JIRA)" <ji...@apache.org> on 2007/07/12 16:41:05 UTC

[jira] Created: (HARMONY-4444) [classlib][x-management] StringMonitor.setObservedAttribute does not throw IllegalArgumentException

[classlib][x-management] StringMonitor.setObservedAttribute does not throw IllegalArgumentException
---------------------------------------------------------------------------------------------------

                 Key: HARMONY-4444
                 URL: https://issues.apache.org/jira/browse/HARMONY-4444
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Vera Petrashkova
            Priority: Minor


According to J2SE API specifications of javax.management.monitor.StringMonitor class:

setObservedAttribute method is inherited from abstract class javax.management.monitor.Monitor
and 
public void setObservedAttribute(String attribute)
                          throws IllegalArgumentException
Throws: 
IllegalArgumentException - The specified attribute is null.

But the following test demonstrates that IllegalArgumentException is not thrown when
method setObservedAttribute is invoked with null parameter.
--------------test.java--------------

import javax.management.monitor.StringMonitor;
public class test {
    public static void main(String[] args) {        
        try {      
            StringMonitor sm = new StringMonitor();
            sm.setObservedAttribute(null);
            System.out.println("Test failed: IllegalArgumentException exception was not thrown");
        } catch (IllegalArgumentException e ){
            System.out.println("Test passed - "+e);
            e.printStackTrace();
        } catch (Throwable e){
            System.out.println("Test failed. Unexpected error was thrown");
            e.printStackTrace();
        }
    }
}
----------------------

See output:
==========
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r551077, (Jun 27 2007), Windows/ia32/msvc 1310, release build
http://harmony.apache.org
Test failed: IllegalArgumentException exception was not thrown


On RI this test passes:
=============
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

Test passed - java.lang.IllegalArgumentException: Null observed attribute
java.lang.IllegalArgumentException: Null observed attribute
        at javax.management.monitor.Monitor.setObservedAttribute(Monitor.java:473)
        at test.main(test.java:6)


This issue causes the failure of the following functional test
    functional/org/apache/harmony/test/func/api/javax/management/monitor/stringmonitor/GetterSetterTest.xml



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