comparison src/java/de/intevation/mxd/reader/LineSymbolReader.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 2cbe423b1fda
children f4eb506499f5
comparison
equal deleted inserted replaced
114:93699e8f2d1f 115:fb93f20478cc
48 logger.debug("contructor(ILineSymbol)"); 48 logger.debug("contructor(ILineSymbol)");
49 this.lineSymbol = symbol; 49 this.lineSymbol = symbol;
50 this.symbol= null; 50 this.symbol= null;
51 } 51 }
52 52
53 public Element read() throws Exception { 53 public Element read() {
54 ISymbolReader sreader = null; 54 ISymbolReader sreader = null;
55 if(symbol != null) { 55 if(symbol != null) {
56 if(symbol instanceof SimpleLineSymbol) { 56 try {
57 sreader = new SimpleLineSymbolReader(symbol); 57 if(symbol instanceof SimpleLineSymbol) {
58 sreader = new SimpleLineSymbolReader(symbol);
59 }
60 else if(symbol instanceof MarkerLineSymbol) {
61 sreader = new MarkerLineSymbolReader(symbol);
62 }
63 else if(symbol instanceof PictureLineSymbol) {
64 sreader = new PictureLineSymbolReader(symbol);
65 }
66 else if(symbol instanceof MultiLayerLineSymbol) {
67 sreader = new MultiLayerLineSymbolReader(symbol);
68 }
69 else if(symbol instanceof CartographicLineSymbol) {
70 sreader = new CartoLineSymbolReader(symbol);
71 }
72 else if(symbol instanceof HashLineSymbol) {
73 sreader = new HashLineSymbolReader(symbol);
74 }
75 else {
76 logger.debug("The reader for type " + symbol.getClass().toString() +
77 " is not implemented!");
78 return parent;
79 }
58 } 80 }
59 else if(symbol instanceof MarkerLineSymbol) { 81 catch(Exception e) {
60 sreader = new MarkerLineSymbolReader(symbol); 82 logger.error(
61 } 83 "Could not read the symbol " +
62 else if(symbol instanceof PictureLineSymbol) { 84 symbol.getClass().toString());
63 sreader = new PictureLineSymbolReader(symbol);
64 }
65 else if(symbol instanceof MultiLayerLineSymbol) {
66 sreader = new MultiLayerLineSymbolReader(symbol);
67 }
68 else if(symbol instanceof CartographicLineSymbol) {
69 sreader = new CartoLineSymbolReader(symbol);
70 }
71 else if(symbol instanceof HashLineSymbol) {
72 sreader = new HashLineSymbolReader(symbol);
73 }
74 else {
75 logger.debug("The reader for type " + symbol.getClass().toString() +
76 " is not implemented!");
77 return parent; 85 return parent;
78 } 86 }
79 } 87 }
80 else if(lineSymbol != null) { 88 else if(lineSymbol != null) {
81 if(lineSymbol instanceof SimpleLineSymbol) { 89 try {
82 sreader = new SimpleLineSymbolReader(lineSymbol); 90 if(lineSymbol instanceof SimpleLineSymbol) {
91 sreader = new SimpleLineSymbolReader(lineSymbol);
92 }
93 else if(lineSymbol instanceof MarkerLineSymbol) {
94 sreader = new MarkerLineSymbolReader(lineSymbol);
95 }
96 else if(lineSymbol instanceof PictureLineSymbol) {
97 sreader = new PictureLineSymbolReader(lineSymbol);
98 }
99 else if(lineSymbol instanceof MultiLayerLineSymbol) {
100 sreader = new MultiLayerLineSymbolReader(lineSymbol);
101 }
102 else if(lineSymbol instanceof CartographicLineSymbol) {
103 sreader = new CartoLineSymbolReader(lineSymbol);
104 }
105 else if(lineSymbol instanceof HashLineSymbol) {
106 sreader = new HashLineSymbolReader(lineSymbol);
107 }
108 else {
109 logger.debug("The reader for type " +
110 lineSymbol.getClass().toString() +
111 " is not implemented!");
112 return parent;
113 }
83 } 114 }
84 else if(lineSymbol instanceof MarkerLineSymbol) { 115 catch(Exception e) {
85 sreader = new MarkerLineSymbolReader(lineSymbol); 116 logger.error(
86 } 117 "Could not read the symbol " +
87 else if(lineSymbol instanceof PictureLineSymbol) { 118 symbol.getClass().toString());
88 sreader = new PictureLineSymbolReader(lineSymbol);
89 }
90 else if(lineSymbol instanceof MultiLayerLineSymbol) {
91 sreader = new MultiLayerLineSymbolReader(lineSymbol);
92 }
93 else if(lineSymbol instanceof CartographicLineSymbol) {
94 sreader = new CartoLineSymbolReader(lineSymbol);
95 }
96 else if(lineSymbol instanceof HashLineSymbol) {
97 sreader = new HashLineSymbolReader(lineSymbol);
98 }
99 else {
100 logger.debug("The reader for type " +
101 lineSymbol.getClass().toString() +
102 " is not implemented!");
103 return parent; 119 return parent;
104 } 120 }
105 } 121 }
106 else { 122 else {
107 return parent; 123 return parent;
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)