Mercurial > mxd2map
changeset 120:11d63bf00326
Changed exception handling and logging in writer classes.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 16 Jun 2011 14:49:45 +0200 (2011-06-16) |
parents | 84f202b6aa65 |
children | 9f74f4d36822 |
files | ChangeLog conf/log4j.properties src/java/de/intevation/mxd/writer/FillStyleWriter.java src/java/de/intevation/mxd/writer/IWriter.java src/java/de/intevation/mxd/writer/LineStyleWriter.java src/java/de/intevation/mxd/writer/MapScriptWriter.java src/java/de/intevation/mxd/writer/MarkerStyleWriter.java src/java/de/intevation/mxd/writer/SymbolWriter.java |
diffstat | 8 files changed, 32 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Jun 16 14:13:39 2011 +0200 +++ b/ChangeLog Thu Jun 16 14:49:45 2011 +0200 @@ -1,3 +1,16 @@ +2011-06-16 Raimund Renkert <raimund.renkert@intevation.de> + + * conf/log4j.properties: Set console log level to INFO. + + * src/java/de/intevation/mxd/writer/FillStyleWriter.java, + src/java/de/intevation/mxd/writer/IWriter.java, + src/java/de/intevation/mxd/writer/LineStyleWriter.java, + src/java/de/intevation/mxd/writer/MapScriptWriter.java, + src/java/de/intevation/mxd/writer/MarkerStyleWriter.java, + src/java/de/intevation/mxd/writer/SymbolWriter.java: + Changed the exception handling. + + 2011-06-16 Raimund Renkert <raimund.renkert@intevation.de> * conf/log4j.properties: Added console appender to log4j config.
--- a/conf/log4j.properties Thu Jun 16 14:13:39 2011 +0200 +++ b/conf/log4j.properties Thu Jun 16 14:49:45 2011 +0200 @@ -10,7 +10,7 @@ #log4j.rootLogger=WARN, Console log4j.appender.Console=org.apache.log4j.ConsoleAppender -log4j.appender.Console.Threshold=WARN +log4j.appender.Console.Threshold=INFO log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
--- a/src/java/de/intevation/mxd/writer/FillStyleWriter.java Thu Jun 16 14:13:39 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/FillStyleWriter.java Thu Jun 16 14:49:45 2011 +0200 @@ -45,8 +45,7 @@ /** * Write the content. */ - public boolean write(Element symbolElement) - throws Exception { + public boolean write(Element symbolElement) { symbolSetObj symbolSet = map.getSymbolset(); if(symbolElement.hasChildNodes()) { @@ -116,8 +115,7 @@ /** * Write the outline for a polygon. */ - private void writeOutline(Element symbolElement) - throws Exception { + private void writeOutline(Element symbolElement) { logger.debug("writeOutline()"); //write transparent outline colorObj color = new colorObj(-1, -1, -1, -4); @@ -142,8 +140,7 @@ /** * Write marker attributes and a symbol for the polygon fill. */ - private void writeMarker(Element symbolElement, double gap) - throws Exception { + private void writeMarker(Element symbolElement, double gap) { logger.debug("writeMarker()"); String name = symbolElement.getAttribute("name"); String type = symbolElement.getAttribute("type");
--- a/src/java/de/intevation/mxd/writer/IWriter.java Thu Jun 16 14:13:39 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/IWriter.java Thu Jun 16 14:49:45 2011 +0200 @@ -11,6 +11,6 @@ /** * Write the content. */ - boolean write(Document doc) throws Exception; + boolean write(Document doc); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/src/java/de/intevation/mxd/writer/LineStyleWriter.java Thu Jun 16 14:13:39 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/LineStyleWriter.java Thu Jun 16 14:49:45 2011 +0200 @@ -39,8 +39,7 @@ /** * Write the content. */ - public boolean write(Element symbolElement) - throws Exception { + public boolean write(Element symbolElement) { logger.debug("write(Element)"); symbolSetObj symbolSet = map.getSymbolset(); if(symbolElement.hasAttribute("angle")) {
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java Thu Jun 16 14:13:39 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java Thu Jun 16 14:49:45 2011 +0200 @@ -56,8 +56,7 @@ * * @return Currently always true. */ - public boolean write(Document doc) - throws Exception { + public boolean write(Document doc) { logger.debug("write()"); this.root = doc; @@ -73,6 +72,7 @@ //Save the map. mapObj cloneMap = map.cloneMap(); cloneMap.save(mapFilename); + logger.info("Mapfile successfully created."); return true; } @@ -133,8 +133,7 @@ /** * Create layer objects and set the attributes. */ - private void writeLayer() - throws Exception { + private void writeLayer() { logger.debug("writeLayer()"); Element mapNode = (Element)XMLUtils.xpath( root, @@ -198,8 +197,7 @@ * @param layer Mapscript layer object. * @param layerElement Dom element containing the class attributes. */ - private void writeClass(layerObj layer, Element layerElement) - throws Exception { + private void writeClass(layerObj layer, Element layerElement) { logger.debug("writeClass(layerObj, Element)"); //Get all renderer elements (renderer in arcgis equals class in the //mapfile.)
--- a/src/java/de/intevation/mxd/writer/MarkerStyleWriter.java Thu Jun 16 14:13:39 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/MarkerStyleWriter.java Thu Jun 16 14:49:45 2011 +0200 @@ -38,8 +38,7 @@ /** * Write the content. */ - public boolean write(Element symbolElement) - throws Exception { + public boolean write(Element symbolElement) { logger.debug("write(Element)"); symbolSetObj symbolSet = map.getSymbolset();
--- a/src/java/de/intevation/mxd/writer/SymbolWriter.java Thu Jun 16 14:13:39 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/SymbolWriter.java Thu Jun 16 14:49:45 2011 +0200 @@ -39,8 +39,7 @@ /** * Write the content. */ - public boolean write(Element symbolElement) - throws Exception { + public boolean write(Element symbolElement) { logger.debug("write(Element)"); symbolSetObj symbolSet = map.getSymbolset(); @@ -65,7 +64,13 @@ return false; } - saveSymbolSet(symbolSet); + try { + saveSymbolSet(symbolSet); + } + catch(Exception e) { + logger.error("Error saving symbol set."); + return false; + } return true; }