harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-5707) [classlib][beans] dead loop in Encoder
Date Mon, 14 Apr 2008 09:23:05 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-5707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12588520#action_12588520
] 

Alexei Zakharov commented on HARMONY-5707:
------------------------------------------

It looks like my previous example is too complex to fix. RI hangs on it as well. So let's
soften it a little bit and let it look more like classes from our AWT implementation:

---
package test;

import java.beans.*;
import java.awt.*;

public class DeadLoopTest {
    int val;

    public DeadLoopTest() {
        val = 0;
    }

    public DeadLoopTest(int n) {
        val = n;
    }

    public DeadLoopTest getProp1() {
        return new DeadLoopTest(val);
    }

    public void setProp1(DeadLoopTest val) {}

    public boolean equals(Object obj) {
        if (obj instanceof DeadLoopTest) {
            return ((DeadLoopTest) obj).val == val;
        }

        return false;
    }

    public static void main(String argv[]) {
        XMLEncoder encoder = new XMLEncoder(System.out);
        DeadLoopTest bean1 = new DeadLoopTest(5);

        encoder.writeObject(bean1);
        encoder.close();
    }
}
---

> [classlib][beans] dead loop in Encoder
> --------------------------------------
>
>                 Key: HARMONY-5707
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5707
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: all
>            Reporter: Alexei Zakharov
>            Assignee: Alexei Zakharov
>
> The current implementation of Encoder/XMLEncoder/PersistentDelegate/DefaultPersistentDelegate
runs into a dead loop while trying to encode bean like this:
> DeadLoopTest.java
> ---
> package test;
> import java.beans.*;
> public class DeadLoopTest {
>     public DeadLoopTest getProp1() {
>         return new DeadLoopTest();
>     }
>     public void setProp1(DeadLoopTest val) {}
>     public static void main(String argv[]) {
>         XMLEncoder encoder = new XMLEncoder(System.out);
>         DeadLoopTest bean1 = new DeadLoopTest();
>         encoder.writeObject(bean1);
>         encoder.close();
>     }
> }
> ---
> Please note that several classes from Harmony's AWT implementation contain patterns that
are very close to this. For example Component.getLocation()/setLocation(), Component.getSize()/setSize().


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