[
https://issues.apache.org/jira/browse/VFS-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
binchen updated VFS-658:
------------------------
Description:
Invoke CombinedResource.getKeys() could lead to a dead cycle. source code :
@Override
public Enumeration<String> getKeys() {
if (!inited)
{ init(); }
*return new Enumeration<String>() {*
*@Override*
*public boolean hasMoreElements() {*
*return properties.keys().hasMoreElements();*
*}*
*@Override*
*public String nextElement() {*
*// We know that our properties will only ever contain Strings*
*return (String) properties.keys().nextElement();*
*}*
*}*;
}
The bold code above has bugs, the right code may be like below:
_return new Enumeration<String>() {_
_Enumeration<Object> proEnums = CombinedResources.this.properties.keys();_
_@Override_
_public boolean hasMoreElements() {_
_return this.proEnums.hasMoreElements();_
_}_
_@Override_
_public String nextElement() {_
_// We know that our properties will only ever contain Strings_
_return (String) this.proEnums.nextElement();_
_}_
_};_
was:
Invoke CombinedResource.getKeys() could lead to a dead cycle. source code :
@Override
public Enumeration<String> getKeys() {
if (!inited) {
init();
}
*return new Enumeration<String>() {*
*@Override*
*public boolean hasMoreElements() {*
*return properties.keys().hasMoreElements();*
*}*
*@Override*
*public String nextElement() {*
*// We know that our properties will only ever contain Strings*
*return (String) properties.keys().nextElement();*
*}*
*}*;
}
The bold code above has bugs, the right code may be like below:
_return new Enumeration<String>() {_
_Enumeration<Object> proEnums = CombinedResources.this.properties.keys();_
_@Override_
_public boolean hasMoreElements() {_
_return this.proEnums.hasMoreElements();_
_}_
_@Override_
_public String nextElement() {_
_// We know that our properties will only ever contain Strings_
_return (String) this.proEnums.nextElement();_
_}_
_};_
> org.apache.commons.vfs2.util.CombinedResources.getKeys() fail
> -------------------------------------------------------------
>
> Key: VFS-658
> URL: https://issues.apache.org/jira/browse/VFS-658
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.2
> Reporter: binchen
> Priority: Major
>
> Invoke CombinedResource.getKeys() could lead to a dead cycle. source code :
> @Override
> public Enumeration<String> getKeys() {
> if (!inited)
> { init(); }
> *return new Enumeration<String>() {*
> *@Override*
> *public boolean hasMoreElements() {*
> *return properties.keys().hasMoreElements();*
> *}*
> *@Override*
> *public String nextElement() {*
> *// We know that our properties will only ever contain Strings*
> *return (String) properties.keys().nextElement();*
> *}*
> *}*;
> }
> The bold code above has bugs, the right code may be like below:
> _return new Enumeration<String>() {_
> _Enumeration<Object> proEnums = CombinedResources.this.properties.keys();_
> _@Override_
> _public boolean hasMoreElements() {_
> _return this.proEnums.hasMoreElements();_
> _}_
> _@Override_
> _public String nextElement() {_
> _// We know that our properties will only ever contain Strings_
> _return (String) this.proEnums.nextElement();_
> _}_
> _};_
>
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)