=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/DefaultAdxDataService.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/DefaultAdxDataService.java 2015-11-02 18:56:53 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/adx/DefaultAdxDataService.java 2015-11-02 19:01:59 +0000 @@ -28,8 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -47,7 +45,6 @@ import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import org.amplecode.staxwax.factory.XMLFactory; @@ -211,7 +208,7 @@ IdentifiableProperty dataElementIdScheme = importOptions.getDataElementIdScheme(); - Map groupAttributes = readAttributes( adxReader ); + Map groupAttributes = adxReader.readAttributes(); if ( !groupAttributes.containsKey( AdxDataService.PERIOD ) ) { @@ -278,7 +275,7 @@ private void parseADXDataValueToDxf( XMLReader adxReader, XMLStreamWriter dxfWriter, ImportOptions importOptions ) throws XMLStreamException, AdxException { - Map dvAttributes = readAttributes( adxReader ); + Map dvAttributes = adxReader.readAttributes(); log.debug( "Processing data value: " + dvAttributes ); @@ -353,8 +350,8 @@ if ( categoryCode == null || !XMLChar.isValidName( categoryCode ) ) { - throw new AdxException( "Category code for " + category.getName() + " is missing or invalid: " - + categoryCode ); + throw new AdxException( "Category code for " + category.getName() + + " is missing or invalid: " + categoryCode ); } categoryMap.put( category.getCode(), category ); @@ -377,7 +374,7 @@ } catch ( CategoryComboMapException ex ) { - log.info( "Failed to create catcomboMap from " + catcombo ); + log.info( "Failed to create category combo map from: " + catcombo ); throw new AdxException( ex.getMessage() ); } @@ -396,7 +393,7 @@ if ( catAttribute == null ) { - throw new AdxException( "Missing required attribute from catcombo: " + categoryCode ); + throw new AdxException( "Missing required attribute from category combo: " + categoryCode ); } compositeIdentifier += "\"" + catAttribute + "\""; @@ -446,25 +443,4 @@ log.debug( "DXF attributes: " + attributes ); } - - // TODO this should be part of staxwax library - protected Map readAttributes( XMLReader staxWaxReader ) - { - Map attributes = new HashMap<>(); - - XMLStreamReader reader = staxWaxReader.getXmlStreamReader(); - - if ( reader.getEventType() != START_ELEMENT ) - { - throw new IllegalArgumentException( "Trying to retrieve attributes from non START_ELEMENT node" ); - } - - // Read attributes - for ( int i = 0; i < reader.getAttributeCount(); i++ ) - { - attributes.put( reader.getAttributeLocalName( i ), reader.getAttributeValue( i ) ); - } - - return attributes; - } } === modified file 'dhis-2/pom.xml' --- dhis-2/pom.xml 2015-10-25 19:44:21 +0000 +++ dhis-2/pom.xml 2015-11-02 19:01:59 +0000 @@ -598,7 +598,7 @@ org.amplecode staxwax - 1.1.1 + 1.1.2 com.lowagie