On Thu, Oct 8, 2009 at 2:19 AM, <veit...@apache.org> wrote: > Author: veithen > Date: Wed Oct 7 20:49:51 2009 > New Revision: 822903 > > URL: http://svn.apache.org/viewvc?rev=822903&view=rev > Log: > Added a unit test providing evidence that the claim made in r822747 (that > XMLStreamReaderUtils#getDataHandlerFromElement doesn't support empty > elements) is incorrect. > > Added: > > > webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/XMLStreamReaderUtilsTest.java > (with props) > > Added: > webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/XMLStreamReaderUtilsTest.java > URL: > http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/XMLStreamReaderUtilsTest.java?rev=822903&view=auto > > ============================================================================== > --- > webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/XMLStreamReaderUtilsTest.java > (added) > +++ > webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/XMLStreamReaderUtilsTest.java > Wed Oct 7 20:49:51 2009 > @@ -0,0 +1,48 @@ > +/* > + * Licensed to the Apache Software Foundation (ASF) under one > + * or more contributor license agreements. See the NOTICE file > + * distributed with this work for additional information > + * regarding copyright ownership. The ASF licenses this file > + * to you under the Apache License, Version 2.0 (the > + * "License"); you may not use this file except in compliance > + * with the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, > + * software distributed under the License is distributed on an > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > + * KIND, either express or implied. See the License for the > + * specific language governing permissions and limitations > + * under the License. > + */ > +package org.apache.axiom.util.stax; > + > +import java.io.StringReader; > + > +import javax.activation.DataHandler; > +import javax.xml.stream.XMLStreamReader; > + > +import org.apache.axiom.om.util.StAXUtils; > + > +import junit.framework.TestCase; > + > +public class XMLStreamReaderUtilsTest extends TestCase { > + public void testGetDataHandlerFromElementWithZeroLength() throws > Exception { > + XMLStreamReader reader = StAXUtils.createXMLStreamReader(new > StringReader("<test/>")); > + try { > + reader.next(); >
please try to set this property here with a dataHandler reader and see. reader.setProperty(DataHandlerReader.PROPERTY, ); thanks, Amila. > + > + // Check precondition > + assertTrue(reader.isStartElement()); > + > + DataHandler dh = > XMLStreamReaderUtils.getDataHandlerFromElement(reader); > + > + // Check postcondition > + assertTrue(reader.isEndElement()); > + assertEquals(-1, dh.getInputStream().read()); > + } finally { > + reader.close(); > + } > + } > +} > > Propchange: > webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/java/org/apache/axiom/util/stax/XMLStreamReaderUtilsTest.java > > ------------------------------------------------------------------------------ > svn:eol-style = native > > > -- Amila Suriarachchi WSO2 Inc. blog: http://amilachinthaka.blogspot.com/