You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Oleg Khaschansky (JIRA)" <ji...@apache.org> on 2006/10/06 18:47:19 UTC

[jira] Created: (HARMONY-1763) [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException

[classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException
-----------------------------------------------------------------------------------------------

                 Key: HARMONY-1763
                 URL: http://issues.apache.org/jira/browse/HARMONY-1763
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Oleg Khaschansky
            Priority: Minor


The test below throws ClassCastException on Harmony but passes on RI.
I will provide a patch for this issue and a unit test.
----------------------------------------------------------------
import java.beans.*;
import java.lang.reflect.*;

public class Test {
        public static void main(String[] args) {       
                PropertyDescriptor toRet = null;
                try {
                        toRet = new PropertyDescriptor("p", Bean.class );
                        toRet.setBound( true );
                } catch (IntrospectionException e) {
                        e.printStackTrace();
                }
                Method m = null;
                try {
                        m = HelpClass.class.getDeclaredMethod("f_static",
(Class[])null);
                } catch (NoSuchMethodException e) {
                        e.printStackTrace();
                }

                toRet.equals(m);
                System.out.println("PASSED"); 

        }
}

class Bean {
    public void setP(int i) {}
    public int getP() {return 0;}
}

class HelpClass {
        public HelpClass () {}
        public static void f_static () {}               
}
----------------------------------------------------------------


-- 
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

        

Re: [jira] Updated: (HARMONY-1763) [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException

Posted by Oleg Khaschansky <ol...@gmail.com>.
Alexei,

Thank you for paying your attention to this. The patch is already
applied, sorry. Anyway, the suggested code is not significantly
different, IMO. Actually, I tend to make minimal modifications to the
original code when possible.


On 10/6/06, Alexei Zakharov <al...@gmail.com> wrote:
> Oleg,
>
> Can we write the same logic a little bit nicer?
> Something like:
>
>    public boolean equals(Object object) {
> -        boolean result = (object != null  && object instanceof
> PropertyDescriptor);
> -        if (result) {
> +        boolean result = false;
> +
> +        if (object != null && object instanceof PropertyDescriptor) {
>             PropertyDescriptor pd = (PropertyDescriptor) object;
>
> Anyway +1 for the patch in general, thank you for finding this!
>
> Regards,
>
> 2006/10/6, Oleg Khaschansky <ol...@gmail.com>:
> > According to the "good issue resolution guideline" I am forwarding
> > this to the dev. list.
> >
> > ---------- Forwarded message ----------
> > From: Oleg Khaschansky (JIRA) <ji...@apache.org>
> > Date: Oct 6, 2006 8:58 PM
> > Subject: [jira] Updated: (HARMONY-1763) [classlib][beans] method
> > java.beans.PropertyDescriptor.equals(Object) throws ClassCastException
> > To: harmony-commits@incubator.apache.org
> >
> >
> >     [ http://issues.apache.org/jira/browse/HARMONY-1763?page=all ]
> >
> > Oleg Khaschansky updated HARMONY-1763:
> > --------------------------------------
> >
> >    Attachment: harmony-1763.patch
> >
> > Patch for this issue rev. 453254.
> >
> > > [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException
> > > -----------------------------------------------------------------------------------------------
> > >
> > >                 Key: HARMONY-1763
> > >                 URL: http://issues.apache.org/jira/browse/HARMONY-1763
> > >             Project: Harmony
> > >          Issue Type: Bug
> > >          Components: Classlib
> > >            Reporter: Oleg Khaschansky
> > >            Priority: Minor
> > >         Attachments: harmony-1763-test.patch, harmony-1763.patch
> > >
> > >
> > > The test below throws ClassCastException on Harmony but passes on RI.
> > > I will provide a patch for this issue and a unit test.
> > > ----------------------------------------------------------------
> > > import java.beans.*;
> > > import java.lang.reflect.*;
> > > public class Test {
> > >         public static void main(String[] args) {
> > >                 PropertyDescriptor toRet = null;
> > >                 try {
> > >                         toRet = new PropertyDescriptor("p", Bean.class );
> > >                         toRet.setBound( true );
> > >                 } catch (IntrospectionException e) {
> > >                         e.printStackTrace();
> > >                 }
> > >                 Method m = null;
> > >                 try {
> > >                         m = HelpClass.class.getDeclaredMethod("f_static",
> > > (Class[])null);
> > >                 } catch (NoSuchMethodException e) {
> > >                         e.printStackTrace();
> > >                 }
> > >                 toRet.equals(m);
> > >                 System.out.println("PASSED");
> > >         }
> > > }
> > > class Bean {
> > >     public void setP(int i) {}
> > >     public int getP() {return 0;}
> > > }
> > > class HelpClass {
> > >         public HelpClass () {}
> > >         public static void f_static () {}
> > > }
> > > ----------------------------------------------------------------
>
>
> --
> Alexei Zakharov,
> Intel Middleware Product Division
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [jira] Updated: (HARMONY-1763) [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException

Posted by Alexei Zakharov <al...@gmail.com>.
Oleg,

Can we write the same logic a little bit nicer?
Something like:

   public boolean equals(Object object) {
-        boolean result = (object != null  && object instanceof
PropertyDescriptor);
-        if (result) {
+        boolean result = false;
+
+        if (object != null && object instanceof PropertyDescriptor) {
            PropertyDescriptor pd = (PropertyDescriptor) object;

Anyway +1 for the patch in general, thank you for finding this!

Regards,

2006/10/6, Oleg Khaschansky <ol...@gmail.com>:
> According to the "good issue resolution guideline" I am forwarding
> this to the dev. list.
>
> ---------- Forwarded message ----------
> From: Oleg Khaschansky (JIRA) <ji...@apache.org>
> Date: Oct 6, 2006 8:58 PM
> Subject: [jira] Updated: (HARMONY-1763) [classlib][beans] method
> java.beans.PropertyDescriptor.equals(Object) throws ClassCastException
> To: harmony-commits@incubator.apache.org
>
>
>     [ http://issues.apache.org/jira/browse/HARMONY-1763?page=all ]
>
> Oleg Khaschansky updated HARMONY-1763:
> --------------------------------------
>
>    Attachment: harmony-1763.patch
>
> Patch for this issue rev. 453254.
>
> > [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException
> > -----------------------------------------------------------------------------------------------
> >
> >                 Key: HARMONY-1763
> >                 URL: http://issues.apache.org/jira/browse/HARMONY-1763
> >             Project: Harmony
> >          Issue Type: Bug
> >          Components: Classlib
> >            Reporter: Oleg Khaschansky
> >            Priority: Minor
> >         Attachments: harmony-1763-test.patch, harmony-1763.patch
> >
> >
> > The test below throws ClassCastException on Harmony but passes on RI.
> > I will provide a patch for this issue and a unit test.
> > ----------------------------------------------------------------
> > import java.beans.*;
> > import java.lang.reflect.*;
> > public class Test {
> >         public static void main(String[] args) {
> >                 PropertyDescriptor toRet = null;
> >                 try {
> >                         toRet = new PropertyDescriptor("p", Bean.class );
> >                         toRet.setBound( true );
> >                 } catch (IntrospectionException e) {
> >                         e.printStackTrace();
> >                 }
> >                 Method m = null;
> >                 try {
> >                         m = HelpClass.class.getDeclaredMethod("f_static",
> > (Class[])null);
> >                 } catch (NoSuchMethodException e) {
> >                         e.printStackTrace();
> >                 }
> >                 toRet.equals(m);
> >                 System.out.println("PASSED");
> >         }
> > }
> > class Bean {
> >     public void setP(int i) {}
> >     public int getP() {return 0;}
> > }
> > class HelpClass {
> >         public HelpClass () {}
> >         public static void f_static () {}
> > }
> > ----------------------------------------------------------------


-- 
Alexei Zakharov,
Intel Middleware Product Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


[jira] Updated: (HARMONY-1763) [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException

Posted by Oleg Khaschansky <ol...@gmail.com>.
According to the "good issue resolution guideline" I am forwarding
this to the dev. list.

---------- Forwarded message ----------
From: Oleg Khaschansky (JIRA) <ji...@apache.org>
Date: Oct 6, 2006 8:58 PM
Subject: [jira] Updated: (HARMONY-1763) [classlib][beans] method
java.beans.PropertyDescriptor.equals(Object) throws ClassCastException
To: harmony-commits@incubator.apache.org


     [ http://issues.apache.org/jira/browse/HARMONY-1763?page=all ]

Oleg Khaschansky updated HARMONY-1763:
--------------------------------------

    Attachment: harmony-1763.patch

Patch for this issue rev. 453254.

> [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException
> -----------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1763
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1763
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Oleg Khaschansky
>            Priority: Minor
>         Attachments: harmony-1763-test.patch, harmony-1763.patch
>
>
> The test below throws ClassCastException on Harmony but passes on RI.
> I will provide a patch for this issue and a unit test.
> ----------------------------------------------------------------
> import java.beans.*;
> import java.lang.reflect.*;
> public class Test {
>         public static void main(String[] args) {
>                 PropertyDescriptor toRet = null;
>                 try {
>                         toRet = new PropertyDescriptor("p", Bean.class );
>                         toRet.setBound( true );
>                 } catch (IntrospectionException e) {
>                         e.printStackTrace();
>                 }
>                 Method m = null;
>                 try {
>                         m = HelpClass.class.getDeclaredMethod("f_static",
> (Class[])null);
>                 } catch (NoSuchMethodException e) {
>                         e.printStackTrace();
>                 }
>                 toRet.equals(m);
>                 System.out.println("PASSED");
>         }
> }
> class Bean {
>     public void setP(int i) {}
>     public int getP() {return 0;}
> }
> class HelpClass {
>         public HelpClass () {}
>         public static void f_static () {}
> }
> ----------------------------------------------------------------

--
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

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


[jira] Commented: (HARMONY-1763) [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException

Posted by "Oleg Khaschansky (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1763?page=comments#action_12440837 ] 
            
Oleg Khaschansky commented on HARMONY-1763:
-------------------------------------------

Verified, thanks, Nathan.

> [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException
> -----------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1763
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1763
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Oleg Khaschansky
>         Assigned To: Nathan Beyer
>            Priority: Minor
>         Attachments: harmony-1763-test.patch, harmony-1763.patch
>
>
> The test below throws ClassCastException on Harmony but passes on RI.
> I will provide a patch for this issue and a unit test.
> ----------------------------------------------------------------
> import java.beans.*;
> import java.lang.reflect.*;
> public class Test {
>         public static void main(String[] args) {       
>                 PropertyDescriptor toRet = null;
>                 try {
>                         toRet = new PropertyDescriptor("p", Bean.class );
>                         toRet.setBound( true );
>                 } catch (IntrospectionException e) {
>                         e.printStackTrace();
>                 }
>                 Method m = null;
>                 try {
>                         m = HelpClass.class.getDeclaredMethod("f_static",
> (Class[])null);
>                 } catch (NoSuchMethodException e) {
>                         e.printStackTrace();
>                 }
>                 toRet.equals(m);
>                 System.out.println("PASSED"); 
>         }
> }
> class Bean {
>     public void setP(int i) {}
>     public int getP() {return 0;}
> }
> class HelpClass {
>         public HelpClass () {}
>         public static void f_static () {}               
> }
> ----------------------------------------------------------------

-- 
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

        

[jira] Assigned: (HARMONY-1763) [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException

Posted by "Nathan Beyer (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1763?page=all ]

Nathan Beyer reassigned HARMONY-1763:
-------------------------------------

    Assignee: Nathan Beyer

> [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException
> -----------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1763
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1763
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Oleg Khaschansky
>         Assigned To: Nathan Beyer
>            Priority: Minor
>         Attachments: harmony-1763-test.patch, harmony-1763.patch
>
>
> The test below throws ClassCastException on Harmony but passes on RI.
> I will provide a patch for this issue and a unit test.
> ----------------------------------------------------------------
> import java.beans.*;
> import java.lang.reflect.*;
> public class Test {
>         public static void main(String[] args) {       
>                 PropertyDescriptor toRet = null;
>                 try {
>                         toRet = new PropertyDescriptor("p", Bean.class );
>                         toRet.setBound( true );
>                 } catch (IntrospectionException e) {
>                         e.printStackTrace();
>                 }
>                 Method m = null;
>                 try {
>                         m = HelpClass.class.getDeclaredMethod("f_static",
> (Class[])null);
>                 } catch (NoSuchMethodException e) {
>                         e.printStackTrace();
>                 }
>                 toRet.equals(m);
>                 System.out.println("PASSED"); 
>         }
> }
> class Bean {
>     public void setP(int i) {}
>     public int getP() {return 0;}
> }
> class HelpClass {
>         public HelpClass () {}
>         public static void f_static () {}               
> }
> ----------------------------------------------------------------

-- 
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

        

[jira] Resolved: (HARMONY-1763) [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException

Posted by "Nathan Beyer (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1763?page=all ]

Nathan Beyer resolved HARMONY-1763.
-----------------------------------

    Resolution: Fixed

Patch applied. Please verify that it was applied as expected. Thanks.

> [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException
> -----------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1763
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1763
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Oleg Khaschansky
>         Assigned To: Nathan Beyer
>            Priority: Minor
>         Attachments: harmony-1763-test.patch, harmony-1763.patch
>
>
> The test below throws ClassCastException on Harmony but passes on RI.
> I will provide a patch for this issue and a unit test.
> ----------------------------------------------------------------
> import java.beans.*;
> import java.lang.reflect.*;
> public class Test {
>         public static void main(String[] args) {       
>                 PropertyDescriptor toRet = null;
>                 try {
>                         toRet = new PropertyDescriptor("p", Bean.class );
>                         toRet.setBound( true );
>                 } catch (IntrospectionException e) {
>                         e.printStackTrace();
>                 }
>                 Method m = null;
>                 try {
>                         m = HelpClass.class.getDeclaredMethod("f_static",
> (Class[])null);
>                 } catch (NoSuchMethodException e) {
>                         e.printStackTrace();
>                 }
>                 toRet.equals(m);
>                 System.out.println("PASSED"); 
>         }
> }
> class Bean {
>     public void setP(int i) {}
>     public int getP() {return 0;}
> }
> class HelpClass {
>         public HelpClass () {}
>         public static void f_static () {}               
> }
> ----------------------------------------------------------------

-- 
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

        

[jira] Updated: (HARMONY-1763) [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException

Posted by "Oleg Khaschansky (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1763?page=all ]

Oleg Khaschansky updated HARMONY-1763:
--------------------------------------

    Attachment: harmony-1763.patch

Patch for this issue rev. 453254.

> [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException
> -----------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1763
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1763
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Oleg Khaschansky
>            Priority: Minor
>         Attachments: harmony-1763-test.patch, harmony-1763.patch
>
>
> The test below throws ClassCastException on Harmony but passes on RI.
> I will provide a patch for this issue and a unit test.
> ----------------------------------------------------------------
> import java.beans.*;
> import java.lang.reflect.*;
> public class Test {
>         public static void main(String[] args) {       
>                 PropertyDescriptor toRet = null;
>                 try {
>                         toRet = new PropertyDescriptor("p", Bean.class );
>                         toRet.setBound( true );
>                 } catch (IntrospectionException e) {
>                         e.printStackTrace();
>                 }
>                 Method m = null;
>                 try {
>                         m = HelpClass.class.getDeclaredMethod("f_static",
> (Class[])null);
>                 } catch (NoSuchMethodException e) {
>                         e.printStackTrace();
>                 }
>                 toRet.equals(m);
>                 System.out.println("PASSED"); 
>         }
> }
> class Bean {
>     public void setP(int i) {}
>     public int getP() {return 0;}
> }
> class HelpClass {
>         public HelpClass () {}
>         public static void f_static () {}               
> }
> ----------------------------------------------------------------

-- 
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

        

[jira] Updated: (HARMONY-1763) [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException

Posted by "Oleg Khaschansky (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1763?page=all ]

Oleg Khaschansky updated HARMONY-1763:
--------------------------------------

    Attachment: harmony-1763-test.patch

Patch for the unit test rev. 453254.

> [classlib][beans] method java.beans.PropertyDescriptor.equals(Object) throws ClassCastException
> -----------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1763
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1763
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Oleg Khaschansky
>            Priority: Minor
>         Attachments: harmony-1763-test.patch, harmony-1763.patch
>
>
> The test below throws ClassCastException on Harmony but passes on RI.
> I will provide a patch for this issue and a unit test.
> ----------------------------------------------------------------
> import java.beans.*;
> import java.lang.reflect.*;
> public class Test {
>         public static void main(String[] args) {       
>                 PropertyDescriptor toRet = null;
>                 try {
>                         toRet = new PropertyDescriptor("p", Bean.class );
>                         toRet.setBound( true );
>                 } catch (IntrospectionException e) {
>                         e.printStackTrace();
>                 }
>                 Method m = null;
>                 try {
>                         m = HelpClass.class.getDeclaredMethod("f_static",
> (Class[])null);
>                 } catch (NoSuchMethodException e) {
>                         e.printStackTrace();
>                 }
>                 toRet.equals(m);
>                 System.out.println("PASSED"); 
>         }
> }
> class Bean {
>     public void setP(int i) {}
>     public int getP() {return 0;}
> }
> class HelpClass {
>         public HelpClass () {}
>         public static void f_static () {}               
> }
> ----------------------------------------------------------------

-- 
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