You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey Petrenko (JIRA)" <ji...@apache.org> on 2007/04/02 09:04:36 UTC

[jira] Closed: (HARMONY-3518) java.util.Properties.getProperty(): get() instead of super.get()

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

Alexey Petrenko closed HARMONY-3518.
------------------------------------


> 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
>         Assigned To: Alexey Petrenko
>         Attachments: 3518.patch, 3518_test.patch
>
>
> 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.