Mercurial > mxd2map
diff src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java @ 74:7eba97e8201b
Catch all exceptions in the MXDReader.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 26 May 2011 18:11:29 +0200 |
parents | acbe36fb45e0 |
children | 59e06c405a9a |
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java Thu May 26 17:29:09 2011 +0200 +++ b/src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java Thu May 26 18:11:29 2011 +0200 @@ -69,59 +69,52 @@ * @return The parent XML node. */ public Element read() - throws IOException { + throws Exception { logger.debug("read()"); for(int i = 0; i < renderer.getClassCount() - 1; i++) { - Element rendererElement; - try { - rendererElement = util.addRenderer(layer); - - String value = renderer.getValue(i); - rendererElement.setAttribute("name", renderer.esri_getClass(i)); - rendererElement.setAttribute("description", - renderer.getDescription(value)); - rendererElement.setAttribute("value", value); - rendererElement.setAttribute("label", renderer.getLabel(value)); - rendererElement.setAttribute( - "field_count", - String.valueOf(renderer.getFieldCount())); - for(int j = 0; j < renderer.getFieldCount(); j++) { - rendererElement.setAttribute( - "expression_field_" + j, - renderer.getField(j)); - } - rendererElement.setAttribute("expression_operator", "="); + Element rendererElement = util.addRenderer(layer); - ISymbol sym = renderer.getSymbol(value); - MarkerSymbolReader markerReader = new MarkerSymbolReader(); - LineSymbolReader lineReader = new LineSymbolReader(); - FillSymbolReader fillReader = new FillSymbolReader(); - if(markerReader.canRead(sym)) { - markerReader.setSymbol(sym); - markerReader.setUtil(util); - markerReader.setParent(rendererElement); - markerReader.read(); - } - else if(lineReader.canRead(sym)) { - lineReader.setSymbol(sym); - lineReader.setUtil(util); - lineReader.setParent(rendererElement); - lineReader.read(); - } - else if(fillReader.canRead(sym)) { - fillReader.setSymbol(sym); - fillReader.setUtil(util); - fillReader.setParent(rendererElement); - fillReader.read(); - } - else { - logger.debug("Not a known symbol type: " + - sym.getClass().toString()); - } + String value = renderer.getValue(i); + rendererElement.setAttribute("name", renderer.esri_getClass(i)); + rendererElement.setAttribute("description", + renderer.getDescription(value)); + rendererElement.setAttribute("value", value); + rendererElement.setAttribute("label", renderer.getLabel(value)); + rendererElement.setAttribute( + "field_count", + String.valueOf(renderer.getFieldCount())); + for(int j = 0; j < renderer.getFieldCount(); j++) { + rendererElement.setAttribute( + "expression_field_" + j, + renderer.getField(j)); } - catch(Exception e) { - e.printStackTrace(); - return null; + rendererElement.setAttribute("expression_operator", "="); + + ISymbol sym = renderer.getSymbol(value); + MarkerSymbolReader markerReader = new MarkerSymbolReader(); + LineSymbolReader lineReader = new LineSymbolReader(); + FillSymbolReader fillReader = new FillSymbolReader(); + if(markerReader.canRead(sym)) { + markerReader.setSymbol(sym); + markerReader.setUtil(util); + markerReader.setParent(rendererElement); + markerReader.read(); + } + else if(lineReader.canRead(sym)) { + lineReader.setSymbol(sym); + lineReader.setUtil(util); + lineReader.setParent(rendererElement); + lineReader.read(); + } + else if(fillReader.canRead(sym)) { + fillReader.setSymbol(sym); + fillReader.setUtil(util); + fillReader.setParent(rendererElement); + fillReader.read(); + } + else { + logger.debug("Not a known symbol type: " + + sym.getClass().toString()); } } return layer;