comparison src/java/de/intevation/mxd/reader/MarkerSymbolReader.java @ 115:fb93f20478cc

Improved exception handling for symbol reader.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 15 Jun 2011 16:48:42 +0200
parents 9ea64427ac7e
children f4eb506499f5
comparison
equal deleted inserted replaced
114:93699e8f2d1f 115:fb93f20478cc
49 logger.debug("contructor()"); 49 logger.debug("contructor()");
50 this.symbol = null; 50 this.symbol = null;
51 this.markerSymbol = null; 51 this.markerSymbol = null;
52 } 52 }
53 53
54 public Element read() 54 public Element read() {
55 throws Exception {
56 logger.debug("read()"); 55 logger.debug("read()");
57 ISymbolReader sreader = null; 56 ISymbolReader sreader = null;
58 57
59 if(symbol != null) { 58 if(symbol != null) {
60 if(symbol instanceof SimpleMarkerSymbol) { 59 try {
61 sreader = new SimpleMarkerSymbolReader(symbol); 60 if(symbol instanceof SimpleMarkerSymbol) {
61 sreader = new SimpleMarkerSymbolReader(symbol);
62 }
63 else if(symbol instanceof ArrowMarkerSymbol) {
64 sreader = new ArrowMarkerSymbolReader(symbol);
65 }
66 else if(symbol instanceof CharacterMarkerSymbol) {
67 sreader = new CharacterMarkerSymbolReader(symbol);
68 }
69 else if(symbol instanceof PictureMarkerSymbol) {
70 sreader = new PictureMarkerSymbolReader(symbol);
71 }
72 else if(symbol instanceof MultiLayerMarkerSymbol) {
73 sreader = new MultiLayerMarkerSymbolReader(symbol);
74 }
75 else {
76 logger.debug("The reader for type " + symbol.getClass().toString() +
77 " is not implemented!");
78 return parent;
79 }
62 } 80 }
63 else if(symbol instanceof ArrowMarkerSymbol) { 81 catch(Exception e) {
64 sreader = new ArrowMarkerSymbolReader(symbol); 82 logger.error(
65 } 83 "Could not read the symbol " +
66 else if(symbol instanceof CharacterMarkerSymbol) { 84 symbol.getClass().toString());
67 sreader = new CharacterMarkerSymbolReader(symbol);
68 }
69 else if(symbol instanceof PictureMarkerSymbol) {
70 sreader = new PictureMarkerSymbolReader(symbol);
71 }
72 else if(symbol instanceof MultiLayerMarkerSymbol) {
73 sreader = new MultiLayerMarkerSymbolReader(symbol);
74 }
75 else {
76 logger.debug("The reader for type " + symbol.getClass().toString() +
77 " is not implemented!");
78 return parent; 85 return parent;
86
79 } 87 }
80 } 88 }
81 else if(markerSymbol != null) { 89 else if(markerSymbol != null) {
82 if(markerSymbol instanceof SimpleMarkerSymbol) { 90 try {
83 sreader = new SimpleMarkerSymbolReader(markerSymbol); 91 if(markerSymbol instanceof SimpleMarkerSymbol) {
92 sreader = new SimpleMarkerSymbolReader(markerSymbol);
93 }
94 else if(markerSymbol instanceof ArrowMarkerSymbol) {
95 sreader = new ArrowMarkerSymbolReader(markerSymbol);
96 }
97 else if(markerSymbol instanceof CharacterMarkerSymbol) {
98 sreader = new CharacterMarkerSymbolReader(markerSymbol);
99 }
100 else if(markerSymbol instanceof PictureMarkerSymbol) {
101 sreader = new PictureMarkerSymbolReader(markerSymbol);
102 }
103 else if(markerSymbol instanceof MultiLayerMarkerSymbol) {
104 sreader = new MultiLayerMarkerSymbolReader(markerSymbol);
105 }
106 else {
107 logger.debug("The reader for type " + symbol.getClass().toString() +
108 " is not implemented!");
109 return parent;
110 }
84 } 111 }
85 else if(markerSymbol instanceof ArrowMarkerSymbol) { 112 catch(Exception e) {
86 sreader = new ArrowMarkerSymbolReader(markerSymbol); 113 logger.error(
87 } 114 "Could not read the symbol " +
88 else if(markerSymbol instanceof CharacterMarkerSymbol) { 115 symbol.getClass().toString());
89 sreader = new CharacterMarkerSymbolReader(markerSymbol);
90 }
91 else if(markerSymbol instanceof PictureMarkerSymbol) {
92 sreader = new PictureMarkerSymbolReader(markerSymbol);
93 }
94 else if(markerSymbol instanceof MultiLayerMarkerSymbol) {
95 sreader = new MultiLayerMarkerSymbolReader(markerSymbol);
96 }
97 else {
98 logger.debug("The reader for type " + symbol.getClass().toString() +
99 " is not implemented!");
100 return parent; 116 return parent;
117
101 } 118 }
102 } 119 }
103 if (sreader != null) { 120 if (sreader != null) {
104 sreader.setParent(parent); 121 sreader.setParent(parent);
105 sreader.setUtil(util); 122 sreader.setUtil(util);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)