Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 61051 invoked from network); 20 Nov 2007 16:43:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Nov 2007 16:43:06 -0000 Received: (qmail 34042 invoked by uid 500); 20 Nov 2007 16:42:51 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 34028 invoked by uid 500); 20 Nov 2007 16:42:51 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 34010 invoked by uid 99); 20 Nov 2007 16:42:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Nov 2007 08:42:51 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Nov 2007 16:42:49 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 0BFBD71420B for ; Tue, 20 Nov 2007 08:42:43 -0800 (PST) Message-ID: <24753214.1195576963044.JavaMail.jira@brutus> Date: Tue, 20 Nov 2007 08:42:43 -0800 (PST) From: "Vasily Zakharov (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-5086) [drlvm][geronimo] AnnotatedElement.getDeclaredAnnotations() throws exception if annotation is not available In-Reply-To: <1408907.1194477170675.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-5086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543941 ] Vasily Zakharov commented on HARMONY-5086: ------------------------------------------ Vladimir, Alexey, thanks a lot for the fix! It actually fixes the standalone test, but unfortunately doesn't fix the original issue in Geronimo. I'm now trying to localize the problem and provide another standalone test. > [drlvm][geronimo] AnnotatedElement.getDeclaredAnnotations() throws exception if annotation is not available > ----------------------------------------------------------------------------------------------------------- > > Key: HARMONY-5086 > URL: https://issues.apache.org/jira/browse/HARMONY-5086 > Project: Harmony > Issue Type: Bug > Components: App-Oriented Bug Reports, DRLVM > Reporter: Vasily Zakharov > Assignee: Alexey Varlamov > Priority: Critical > Attachments: H5086.patch, H5086fix.diff, H5086test.diff > > > When AccessibleObject.getDeclaredAnnotations() is called and the annotation class to be returned cannot be loaded, RI just skips that annotation, and Harmony throws exception. > To reproduce, use the following code: > import java.lang.annotation.*; > import java.lang.reflect.*; > import java.net.*; > public class Test { > public static void main(String[] args) { > try { > Class cls = Foo.class; > Field field = cls.getDeclaredFields()[0]; > Constructor constructor = cls.getDeclaredConstructors()[0]; > Method method = cls.getDeclaredMethods()[0]; > int can = cls.getDeclaredAnnotations().length; > int fan = field.getDeclaredAnnotations().length; > int nan = constructor.getDeclaredAnnotations().length; > int man = method.getDeclaredAnnotations().length; > System.out.println("SUCCESS: " + can + " " + fan + " " + nan + " " + man); > } catch (Exception e) { > e.printStackTrace(System.out); > } > } > } > @Retention(RetentionPolicy.RUNTIME) > @interface Ann {} > @Ann class Foo { > @Ann int field; > @Ann Foo() {} > @Ann void method() {} > } > If the test is run normally, both RI and Harmony produce the same result, but if Ann.class file is REMOVED, the output becomes different. > Output on RI and Harmony with Ann.class present: > SUCCESS: 1 1 1 > Output on RI with Ann.class removed: > SUCCESS: 0 0 0 > Output on Harmony with Ann.class removed: > java.lang.TypeNotPresentException: Type Ann not present > at org.apache.harmony.vm.VMGenericsAndAnnotations.getDeclaredAnnotations(VMGenericsAndAnnotations.java) > at java.lang.reflect.Field$FieldData.getAnnotations(Field.java:457) > at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:42) > at Test.main(Test.java:11) > Caused by: java.lang.NoClassDefFoundError: Ann > at org.apache.harmony.vm.VMGenericsAndAnnotations.getDeclaredAnnotations(VMGenericsAndAnnotations.java) > ... 3 more > Caused by: java.lang.ClassNotFoundException: Ann > at java.net.URLClassLoader.findClass(URLClassLoader.java:894) > at java.lang.ClassLoader.loadClass(ClassLoader.java:575) > at java.lang.ClassLoader$SystemClassLoader.loadClass(ClassLoader.java:963) > at java.lang.ClassLoader.loadClass(ClassLoader.java:319) > at org.apache.harmony.vm.VMGenericsAndAnnotations.getDeclaredAnnotations(VMGenericsAndAnnotations.java) > ... 3 more > This issue prevents Apache Geronimo 2.0 from starting on Harmony. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.