You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Sean Qiu (JIRA)" <ji...@apache.org> on 2008/05/20 09:39:55 UTC
[jira] Created: (HARMONY-5831) [classlib][beans] XMLDecoder will
throw exception for restrict method type check
[classlib][beans] XMLDecoder will throw exception for restrict method type check
--------------------------------------------------------------------------------
Key: HARMONY-5831
URL: https://issues.apache.org/jira/browse/HARMONY-5831
Project: Harmony
Issue Type: Bug
Components: Classlib
Affects Versions: 5.0M6
Reporter: Sean Qiu
Fix For: 5.0M6
The java.beans.XMLDecoder gets NoSuchMethodExceptions when method which take java.lang.Object as parameters are invoked with a java.lang.String against an "owner" object. In general, XMLDecoder throws a NoSuchMethodException unless the classes of the arguments match exactly with a method signature.
xml file:
<java version='1.6.0' class='java.beans.XMLDecoder'>
<void property='owner'>
<void method='get' id='v'>
<string>key</string>
</void>
</void>
<object idref='v'/>
</java>
testcase:
String expectedValue = "expected value";
HashMap map = new HashMap();
map.put("key", expectedValue);
XMLDecoder decoder = new XMLDecoder(this.getClass().getResourceAsStream(
"/xml/MockOwner.xml"), map);
String actualValue = (String) decoder.readObject();
assertEquals(expectedValue,actualValue);
stack trace:
java.lang.NoSuchMethodException: get(java.lang.String)
at java.lang.Class.findMatchingMethod(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at java.beans.XMLDecoder$SAXHandler.executeCommon(XMLDecoder.java:336)
at java.beans.XMLDecoder$SAXHandler.execute(XMLDecoder.java:285)
at java.beans.XMLDecoder$SAXHandler.endElement(XMLDecoder.java:250)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at java.beans.XMLDecoder.<init>(XMLDecoder.java:480)
at java.beans.XMLDecoder.<init>(XMLDecoder.java:456)
at DecoderTest.decode(DecoderTest.java:28)
at DecoderTest.main(DecoderTest.java:108)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (HARMONY-5831) [classlib][beans] XMLDecoder will
throw exception for restrict method type check
Posted by "Sean Qiu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-5831?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sean Qiu updated HARMONY-5831:
------------------------------
Attachment: Harmony-5831.diff
Could someone please try this patch?
> [classlib][beans] XMLDecoder will throw exception for restrict method type check
> --------------------------------------------------------------------------------
>
> Key: HARMONY-5831
> URL: https://issues.apache.org/jira/browse/HARMONY-5831
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M6
> Reporter: Sean Qiu
> Fix For: 5.0M6
>
> Attachments: Harmony-5831.diff
>
>
> The java.beans.XMLDecoder gets NoSuchMethodExceptions when method which take java.lang.Object as parameters are invoked with a java.lang.String against an "owner" object. In general, XMLDecoder throws a NoSuchMethodException unless the classes of the arguments match exactly with a method signature.
> xml file:
> <java version='1.6.0' class='java.beans.XMLDecoder'>
> <void property='owner'>
> <void method='get' id='v'>
> <string>key</string>
> </void>
> </void>
> <object idref='v'/>
> </java>
> testcase:
> String expectedValue = "expected value";
> HashMap map = new HashMap();
> map.put("key", expectedValue);
>
> XMLDecoder decoder = new XMLDecoder(this.getClass().getResourceAsStream(
> "/xml/MockOwner.xml"), map);
> String actualValue = (String) decoder.readObject();
> assertEquals(expectedValue,actualValue);
> stack trace:
> java.lang.NoSuchMethodException: get(java.lang.String)
> at java.lang.Class.findMatchingMethod(Unknown Source)
> at java.lang.Class.getMethod(Unknown Source)
> at java.beans.XMLDecoder$SAXHandler.executeCommon(XMLDecoder.java:336)
> at java.beans.XMLDecoder$SAXHandler.execute(XMLDecoder.java:285)
> at java.beans.XMLDecoder$SAXHandler.endElement(XMLDecoder.java:250)
> at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
> at javax.xml.parsers.SAXParser.parse(Unknown Source)
> at java.beans.XMLDecoder.<init>(XMLDecoder.java:480)
> at java.beans.XMLDecoder.<init>(XMLDecoder.java:456)
> at DecoderTest.decode(DecoderTest.java:28)
> at DecoderTest.main(DecoderTest.java:108)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (HARMONY-5831) [classlib][beans] XMLDecoder will
throw exception for restrict method type check
Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-5831?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tony Wu resolved HARMONY-5831.
------------------------------
Resolution: Fixed
patch applied at r659061, thanks for your contribution. please verify if it is fixed as you expected.
> [classlib][beans] XMLDecoder will throw exception for restrict method type check
> --------------------------------------------------------------------------------
>
> Key: HARMONY-5831
> URL: https://issues.apache.org/jira/browse/HARMONY-5831
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M6
> Reporter: Sean Qiu
> Assignee: Tony Wu
> Fix For: 5.0M6
>
> Attachments: Harmony-5831.diff
>
>
> The java.beans.XMLDecoder gets NoSuchMethodExceptions when method which take java.lang.Object as parameters are invoked with a java.lang.String against an "owner" object. In general, XMLDecoder throws a NoSuchMethodException unless the classes of the arguments match exactly with a method signature.
> xml file:
> <java version='1.6.0' class='java.beans.XMLDecoder'>
> <void property='owner'>
> <void method='get' id='v'>
> <string>key</string>
> </void>
> </void>
> <object idref='v'/>
> </java>
> testcase:
> String expectedValue = "expected value";
> HashMap map = new HashMap();
> map.put("key", expectedValue);
>
> XMLDecoder decoder = new XMLDecoder(this.getClass().getResourceAsStream(
> "/xml/MockOwner.xml"), map);
> String actualValue = (String) decoder.readObject();
> assertEquals(expectedValue,actualValue);
> stack trace:
> java.lang.NoSuchMethodException: get(java.lang.String)
> at java.lang.Class.findMatchingMethod(Unknown Source)
> at java.lang.Class.getMethod(Unknown Source)
> at java.beans.XMLDecoder$SAXHandler.executeCommon(XMLDecoder.java:336)
> at java.beans.XMLDecoder$SAXHandler.execute(XMLDecoder.java:285)
> at java.beans.XMLDecoder$SAXHandler.endElement(XMLDecoder.java:250)
> at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
> at javax.xml.parsers.SAXParser.parse(Unknown Source)
> at java.beans.XMLDecoder.<init>(XMLDecoder.java:480)
> at java.beans.XMLDecoder.<init>(XMLDecoder.java:456)
> at DecoderTest.decode(DecoderTest.java:28)
> at DecoderTest.main(DecoderTest.java:108)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HARMONY-5831) [classlib][beans] XMLDecoder will
throw exception for restrict method type check
Posted by "Sean Qiu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-5831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598214#action_12598214 ]
Sean Qiu commented on HARMONY-5831:
-----------------------------------
The root cause of this defect is XMLDecoder will invoke the desired method exactly according to the parameters from xml file. The right behavior is to find a most specific method when no exactly matching method exist. For example, when passing a String to get(Object), if no get(String) exist, the XMLDecoder should find get(Object) rather than throw the exception.The XMLDecoder has been updated to find the appropriate method that is most suit for the signature when no exact matching method exist.
> [classlib][beans] XMLDecoder will throw exception for restrict method type check
> --------------------------------------------------------------------------------
>
> Key: HARMONY-5831
> URL: https://issues.apache.org/jira/browse/HARMONY-5831
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M6
> Reporter: Sean Qiu
> Fix For: 5.0M6
>
> Attachments: Harmony-5831.diff
>
>
> The java.beans.XMLDecoder gets NoSuchMethodExceptions when method which take java.lang.Object as parameters are invoked with a java.lang.String against an "owner" object. In general, XMLDecoder throws a NoSuchMethodException unless the classes of the arguments match exactly with a method signature.
> xml file:
> <java version='1.6.0' class='java.beans.XMLDecoder'>
> <void property='owner'>
> <void method='get' id='v'>
> <string>key</string>
> </void>
> </void>
> <object idref='v'/>
> </java>
> testcase:
> String expectedValue = "expected value";
> HashMap map = new HashMap();
> map.put("key", expectedValue);
>
> XMLDecoder decoder = new XMLDecoder(this.getClass().getResourceAsStream(
> "/xml/MockOwner.xml"), map);
> String actualValue = (String) decoder.readObject();
> assertEquals(expectedValue,actualValue);
> stack trace:
> java.lang.NoSuchMethodException: get(java.lang.String)
> at java.lang.Class.findMatchingMethod(Unknown Source)
> at java.lang.Class.getMethod(Unknown Source)
> at java.beans.XMLDecoder$SAXHandler.executeCommon(XMLDecoder.java:336)
> at java.beans.XMLDecoder$SAXHandler.execute(XMLDecoder.java:285)
> at java.beans.XMLDecoder$SAXHandler.endElement(XMLDecoder.java:250)
> at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
> at javax.xml.parsers.SAXParser.parse(Unknown Source)
> at java.beans.XMLDecoder.<init>(XMLDecoder.java:480)
> at java.beans.XMLDecoder.<init>(XMLDecoder.java:456)
> at DecoderTest.decode(DecoderTest.java:28)
> at DecoderTest.main(DecoderTest.java:108)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (HARMONY-5831) [classlib][beans] XMLDecoder will
throw exception for restrict method type check
Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-5831?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tony Wu reassigned HARMONY-5831:
--------------------------------
Assignee: Tony Wu
> [classlib][beans] XMLDecoder will throw exception for restrict method type check
> --------------------------------------------------------------------------------
>
> Key: HARMONY-5831
> URL: https://issues.apache.org/jira/browse/HARMONY-5831
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M6
> Reporter: Sean Qiu
> Assignee: Tony Wu
> Fix For: 5.0M6
>
> Attachments: Harmony-5831.diff
>
>
> The java.beans.XMLDecoder gets NoSuchMethodExceptions when method which take java.lang.Object as parameters are invoked with a java.lang.String against an "owner" object. In general, XMLDecoder throws a NoSuchMethodException unless the classes of the arguments match exactly with a method signature.
> xml file:
> <java version='1.6.0' class='java.beans.XMLDecoder'>
> <void property='owner'>
> <void method='get' id='v'>
> <string>key</string>
> </void>
> </void>
> <object idref='v'/>
> </java>
> testcase:
> String expectedValue = "expected value";
> HashMap map = new HashMap();
> map.put("key", expectedValue);
>
> XMLDecoder decoder = new XMLDecoder(this.getClass().getResourceAsStream(
> "/xml/MockOwner.xml"), map);
> String actualValue = (String) decoder.readObject();
> assertEquals(expectedValue,actualValue);
> stack trace:
> java.lang.NoSuchMethodException: get(java.lang.String)
> at java.lang.Class.findMatchingMethod(Unknown Source)
> at java.lang.Class.getMethod(Unknown Source)
> at java.beans.XMLDecoder$SAXHandler.executeCommon(XMLDecoder.java:336)
> at java.beans.XMLDecoder$SAXHandler.execute(XMLDecoder.java:285)
> at java.beans.XMLDecoder$SAXHandler.endElement(XMLDecoder.java:250)
> at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
> at javax.xml.parsers.SAXParser.parse(Unknown Source)
> at java.beans.XMLDecoder.<init>(XMLDecoder.java:480)
> at java.beans.XMLDecoder.<init>(XMLDecoder.java:456)
> at DecoderTest.decode(DecoderTest.java:28)
> at DecoderTest.main(DecoderTest.java:108)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (HARMONY-5831) [classlib][beans] XMLDecoder will
throw exception for restrict method type check
Posted by "Sean Qiu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-5831?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sean Qiu closed HARMONY-5831.
-----------------------------
Verified by Sean at r659061.
Thanks, Tony.
> [classlib][beans] XMLDecoder will throw exception for restrict method type check
> --------------------------------------------------------------------------------
>
> Key: HARMONY-5831
> URL: https://issues.apache.org/jira/browse/HARMONY-5831
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M6
> Reporter: Sean Qiu
> Assignee: Tony Wu
> Fix For: 5.0M6
>
> Attachments: Harmony-5831.diff
>
>
> The java.beans.XMLDecoder gets NoSuchMethodExceptions when method which take java.lang.Object as parameters are invoked with a java.lang.String against an "owner" object. In general, XMLDecoder throws a NoSuchMethodException unless the classes of the arguments match exactly with a method signature.
> xml file:
> <java version='1.6.0' class='java.beans.XMLDecoder'>
> <void property='owner'>
> <void method='get' id='v'>
> <string>key</string>
> </void>
> </void>
> <object idref='v'/>
> </java>
> testcase:
> String expectedValue = "expected value";
> HashMap map = new HashMap();
> map.put("key", expectedValue);
>
> XMLDecoder decoder = new XMLDecoder(this.getClass().getResourceAsStream(
> "/xml/MockOwner.xml"), map);
> String actualValue = (String) decoder.readObject();
> assertEquals(expectedValue,actualValue);
> stack trace:
> java.lang.NoSuchMethodException: get(java.lang.String)
> at java.lang.Class.findMatchingMethod(Unknown Source)
> at java.lang.Class.getMethod(Unknown Source)
> at java.beans.XMLDecoder$SAXHandler.executeCommon(XMLDecoder.java:336)
> at java.beans.XMLDecoder$SAXHandler.execute(XMLDecoder.java:285)
> at java.beans.XMLDecoder$SAXHandler.endElement(XMLDecoder.java:250)
> at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
> at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
> at javax.xml.parsers.SAXParser.parse(Unknown Source)
> at java.beans.XMLDecoder.<init>(XMLDecoder.java:480)
> at java.beans.XMLDecoder.<init>(XMLDecoder.java:456)
> at DecoderTest.decode(DecoderTest.java:28)
> at DecoderTest.main(DecoderTest.java:108)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.