[jira] [Resolved] (AXIOM-508) Calling OMElement.cloneOMElement after OMElement.toString causes exception
[ https://issues.apache.org/jira/browse/AXIOM-508?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andreas Veithen resolved AXIOM-508. --- Fix Version/s: 1.3.1 Resolution: Fixed > Calling OMElement.cloneOMElement after OMElement.toString causes exception > -- > > Key: AXIOM-508 > URL: https://issues.apache.org/jira/browse/AXIOM-508 > Project: Axiom > Issue Type: Bug > Components: Core Model >Affects Versions: 1.3.0 >Reporter: Kyla Miller >Assignee: Andreas Veithen >Priority: Minor > Fix For: 1.3.1 > > Attachments: ComplexPITest.xml > > > If there is a descendant processing instruction within an element and the > processing has any "psuedo" attributes then calling OMElement.cloneOMElement > after OMElement.toString will cause an UnsupportedOperationException > exeption. Example code: > > String inputFile = "test-resources\\XMLStaxUtils\\ComplexPITest.xml"; > OMDocument inputDoc = XMLStaxUtils.readDocument(inputFile); > OMElement rootElement = inputDoc.getOMDocumentElement(); > > // This is the call that causes PIs to get trashed and will cause an > UnsupportedOperationException to be thrown when cloning. > rootElement.toString(); > > try > { > rootElement.cloneOMElement(); > fail("UnsupportedOperationException should have been thrown. If > it was not then axiom has been fixed so update this test and > XMLStaxUtils.cloneOMElement."); > } > catch (UnsupportedOperationException ex) > { > } > We got around it by creating a helper method that resets the text: > > List piNodes = getNodesWithDescendantPI(srcElement); > for (OMNode piNode : piNodes) > { > OMProcessingInstruction pi = (OMProcessingInstruction) piNode; > String piValue = pi.getValue(); > pi.setValue(piValue); > } > return srcElement.cloneOMElement(); > -- This message was sent by Atlassian Jira (v8.20.1#820001) - To unsubscribe, e-mail: dev-unsubscr...@ws.apache.org For additional commands, e-mail: dev-h...@ws.apache.org
[jira] [Updated] (AXIOM-508) Calling OMElement.cloneOMElement after OMElement.toString causes exception
[ https://issues.apache.org/jira/browse/AXIOM-508?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andreas Veithen updated AXIOM-508: -- Component/s: Core Model (was: LLOM) > Calling OMElement.cloneOMElement after OMElement.toString causes exception > -- > > Key: AXIOM-508 > URL: https://issues.apache.org/jira/browse/AXIOM-508 > Project: Axiom > Issue Type: Bug > Components: Core Model >Affects Versions: 1.3.0 >Reporter: Kyla Miller >Assignee: Andreas Veithen >Priority: Minor > Attachments: ComplexPITest.xml > > > If there is a descendant processing instruction within an element and the > processing has any "psuedo" attributes then calling OMElement.cloneOMElement > after OMElement.toString will cause an UnsupportedOperationException > exeption. Example code: > > String inputFile = "test-resources\\XMLStaxUtils\\ComplexPITest.xml"; > OMDocument inputDoc = XMLStaxUtils.readDocument(inputFile); > OMElement rootElement = inputDoc.getOMDocumentElement(); > > // This is the call that causes PIs to get trashed and will cause an > UnsupportedOperationException to be thrown when cloning. > rootElement.toString(); > > try > { > rootElement.cloneOMElement(); > fail("UnsupportedOperationException should have been thrown. If > it was not then axiom has been fixed so update this test and > XMLStaxUtils.cloneOMElement."); > } > catch (UnsupportedOperationException ex) > { > } > We got around it by creating a helper method that resets the text: > > List piNodes = getNodesWithDescendantPI(srcElement); > for (OMNode piNode : piNodes) > { > OMProcessingInstruction pi = (OMProcessingInstruction) piNode; > String piValue = pi.getValue(); > pi.setValue(piValue); > } > return srcElement.cloneOMElement(); > -- This message was sent by Atlassian Jira (v8.20.1#820001) - To unsubscribe, e-mail: dev-unsubscr...@ws.apache.org For additional commands, e-mail: dev-h...@ws.apache.org
[jira] [Work started] (AXIOM-508) Calling OMElement.cloneOMElement after OMElement.toString causes exception
[ https://issues.apache.org/jira/browse/AXIOM-508?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Work on AXIOM-508 started by Andreas Veithen. - > Calling OMElement.cloneOMElement after OMElement.toString causes exception > -- > > Key: AXIOM-508 > URL: https://issues.apache.org/jira/browse/AXIOM-508 > Project: Axiom > Issue Type: Bug > Components: LLOM >Affects Versions: 1.3.0 >Reporter: Kyla Miller >Assignee: Andreas Veithen >Priority: Minor > Attachments: ComplexPITest.xml > > > If there is a descendant processing instruction within an element and the > processing has any "psuedo" attributes then calling OMElement.cloneOMElement > after OMElement.toString will cause an UnsupportedOperationException > exeption. Example code: > > String inputFile = "test-resources\\XMLStaxUtils\\ComplexPITest.xml"; > OMDocument inputDoc = XMLStaxUtils.readDocument(inputFile); > OMElement rootElement = inputDoc.getOMDocumentElement(); > > // This is the call that causes PIs to get trashed and will cause an > UnsupportedOperationException to be thrown when cloning. > rootElement.toString(); > > try > { > rootElement.cloneOMElement(); > fail("UnsupportedOperationException should have been thrown. If > it was not then axiom has been fixed so update this test and > XMLStaxUtils.cloneOMElement."); > } > catch (UnsupportedOperationException ex) > { > } > We got around it by creating a helper method that resets the text: > > List piNodes = getNodesWithDescendantPI(srcElement); > for (OMNode piNode : piNodes) > { > OMProcessingInstruction pi = (OMProcessingInstruction) piNode; > String piValue = pi.getValue(); > pi.setValue(piValue); > } > return srcElement.cloneOMElement(); > -- This message was sent by Atlassian Jira (v8.20.1#820001) - To unsubscribe, e-mail: dev-unsubscr...@ws.apache.org For additional commands, e-mail: dev-h...@ws.apache.org
[jira] [Assigned] (AXIOM-508) Calling OMElement.cloneOMElement after OMElement.toString causes exception
[ https://issues.apache.org/jira/browse/AXIOM-508?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andreas Veithen reassigned AXIOM-508: - Assignee: Andreas Veithen > Calling OMElement.cloneOMElement after OMElement.toString causes exception > -- > > Key: AXIOM-508 > URL: https://issues.apache.org/jira/browse/AXIOM-508 > Project: Axiom > Issue Type: Bug > Components: LLOM >Affects Versions: 1.3.0 >Reporter: Kyla Miller >Assignee: Andreas Veithen >Priority: Minor > Attachments: ComplexPITest.xml > > > If there is a descendant processing instruction within an element and the > processing has any "psuedo" attributes then calling OMElement.cloneOMElement > after OMElement.toString will cause an UnsupportedOperationException > exeption. Example code: > > String inputFile = "test-resources\\XMLStaxUtils\\ComplexPITest.xml"; > OMDocument inputDoc = XMLStaxUtils.readDocument(inputFile); > OMElement rootElement = inputDoc.getOMDocumentElement(); > > // This is the call that causes PIs to get trashed and will cause an > UnsupportedOperationException to be thrown when cloning. > rootElement.toString(); > > try > { > rootElement.cloneOMElement(); > fail("UnsupportedOperationException should have been thrown. If > it was not then axiom has been fixed so update this test and > XMLStaxUtils.cloneOMElement."); > } > catch (UnsupportedOperationException ex) > { > } > We got around it by creating a helper method that resets the text: > > List piNodes = getNodesWithDescendantPI(srcElement); > for (OMNode piNode : piNodes) > { > OMProcessingInstruction pi = (OMProcessingInstruction) piNode; > String piValue = pi.getValue(); > pi.setValue(piValue); > } > return srcElement.cloneOMElement(); > -- This message was sent by Atlassian Jira (v8.20.1#820001) - To unsubscribe, e-mail: dev-unsubscr...@ws.apache.org For additional commands, e-mail: dev-h...@ws.apache.org