harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Dmitriev (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-3518) java.util.Properties.getProperty(): get() instead of super.get()
Date Wed, 28 Mar 2007 14:48:25 GMT
java.util.Properties.getProperty(): get() instead of super.get()
----------------------------------------------------------------

                 Key: HARMONY-3518
                 URL: https://issues.apache.org/jira/browse/HARMONY-3518
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Sergey Dmitriev


Methods
java.util.Properties.getProperty(String) and
java.util.Properties.getProperty(String, String) call method get(Object) inherited from Hashtable
instead of super.get(Object).

In some circumstances this can cause issues if some subclass of Properties will override get(Object)
a certain way. I.e. if subclass.get(Object) calls getProperty(String) jvm fails with StackOverflow
which is not reproducible on JRockit. See demo.

--- props.java ---
import java.util.Properties;

public class props {
    public static void main(String[] args) {
        MyProperties props = new MyProperties();
        System.out.println(props.getProperty("key", "defaultValue"));
    }

    static class MyProperties extends Properties {
        public synchronized Object get(Object key) {
            return getProperty((String)key);
        }
    }
}

--- console ---
] ~
] jdk150/bin/java -showversion props                                               
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-linux-ia32, R25.0.0-75, GC: System
optimized over throughput (initial strategy singleparpar))
 
defaultValue

] ~
] java -showversion props
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 = r522516, (Mar 27 2007), Linux/ia32/icc 900, debug build
http://incubator.apache.org/harmony
Uncaught exception in main:
java.lang.StackOverflowError
        at java.util.Properties.getProperty(Properties.java:150)
        at props$MyProperties.get(props.java:11)
        at java.util.Properties.getProperty(Properties.java:150)
        at props$MyProperties.get(props.java:11)
        at java.util.Properties.getProperty(Properties.java:150)
        at props$MyProperties.get(props.java:11)
...



Note: sometimes Harmony fails just with "Segmentation fault" (without stacktrace).


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