harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vera Petrashkova (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-4457) [classlib][x-management] QueryExp.apply method throws unexpected NullPointerException if MBean server was not set
Date Fri, 13 Jul 2007 07:26:05 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-4457?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Vera Petrashkova updated HARMONY-4457:
--------------------------------------

    Attachment: x_manag.zip

> [classlib][x-management] QueryExp.apply method throws unexpected NullPointerException
if MBean server was not set
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4457
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4457
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: x_manag.zip
>
>
> According to J2SE API specification of javax.management.QueryExp interface:
> boolean apply(ObjectName name)
>               throws BadStringOperationException,
>                      BadBinaryOpValueExpException,
>                      BadAttributeValueExpException,
>                      InvalidApplicationException
> Applies the QueryExp on an MBean. 
> The specification does not say that it is necessary to invoke  QueryExp,setMBeanServer(MBeanServer
s)
> before  appaly.
> The following test which uses Hello class from Functional test suite (use attached class
files)
> demonstrates that apple throws unexpected NullPointerException if
> MBean server was not set before its invocation.
> -------------test.java-------------
> import javax.management.*;
> import org.apache.harmony.test.func.api.javax.management.share.Hello;
> public class test {
>     public static void main(String[] args) {        
>         try {    
>             MBeanServer mbs = MBeanServerFactory.createMBeanServer();
>             new QueryEval() {
>                 private static final long serialVersionUID = 3832902139541599280L;
>             }.setMBeanServer(mbs);
>             Hello[] instances = new Hello[1];
>             ObjectName[] names = new ObjectName[instances.length];
>             instances[0] = new Hello();
>             names[0] = new ObjectName(
>                     "org.apache.harmony.test.func.api.javax.management:type=Hello");
>             mbs.registerMBean(instances[0], names[0]);
>             QueryExp exp1 = Query.eq(Query.attr("Attribute1"), Query
>                 .value("attribute1"));
>             QueryExp exp2 = Query.eq(Query.attr("Attribute2"), Query
>                 .value("attribute2"));
>             
>             QueryExp expAND = Query.and(exp1, exp2);
>             if (args.length > 0) {
>                 expAND.setMBeanServer(mbs);
>             }
>             System.err.println("Test passed: "+expAND.apply(names[0]));
>         } catch (Throwable e){
>             System.out.println("Test failed. Unexpected error was thrown");
>             e.printStackTrace();
>         }
>     }
> } 
> --------------
> Run test without parameter (without MBean server setting)
> java -cp .;x-manag.zip    test
> 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
> Created MBeanServer with ID: UID[2078d588:113be6a3705:-8000]:nswvpetrash:1
> Test failed. Unexpected error was thrown
> java.lang.NullPointerException
>         at javax.management.AttributeValueExp.getAttribute(AttributeValueExp.java:97)
>         at javax.management.AttributeValueExp.apply(AttributeValueExp.java:59)
>         at javax.management.BinaryRelQueryExp.apply(BinaryRelQueryExp.java:55)
>         at javax.management.AndQueryExp.apply(AndQueryExp.java:45)
>         at test.main(test.java:33)
> Run test without parameter (with MBean server setting)
> java -cp .;x-manag.zip    test 1
> 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
> Created MBeanServer with ID: UID[2078d588:113be6a4cfe:-8000]:nswvpetrash:1
> Test passed: true
> This test passes on RI in both cases:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or
its l
> icensors, 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
> Created MBeanServer with ID: UID[2078d588:113be6a4cfe:-8000]:nswvpetrash:1
> Test passed: true
> C:\tasks\ClassLoader\Harmony\NewBugs>.5.0_06\bin\java -cp .;x_manag.zip -showversion
test
> java version "1.5.0_06"
> 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: true
> This issue causes the failure of the following test from Functional suite:
>     functional/org/apache/harmony/test/func/api/javax/management/QueryTest.xml

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


Mime
View raw message