Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java @ 556:046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
flys-client/trunk@2080 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 08 Jun 2011 12:43:38 +0000 |
parents | c5fc3fa02edb |
children | 460b8e0f0563 |
comparison
equal
deleted
inserted
replaced
555:33b86f5b1168 | 556:046f43e1d305 |
---|---|
76 Document info = XMLUtils.parseDocument(in); | 76 Document info = XMLUtils.parseDocument(in); |
77 | 77 |
78 return parseInfoDocument(info); | 78 return parseInfoDocument(info); |
79 } | 79 } |
80 catch (IOException ioe) { | 80 catch (IOException ioe) { |
81 // do nothing | 81 ioe.printStackTrace(); |
82 } | |
83 catch (Exception e) { | |
84 e.printStackTrace(); | |
82 } | 85 } |
83 | 86 |
84 System.err.println("Error while fetching chart info."); | 87 System.err.println("Error while fetching chart info."); |
85 | 88 |
86 throw new ServerException(EXCEPTION_STRING); | 89 throw new ServerException(EXCEPTION_STRING); |
149 | 152 |
150 try { | 153 try { |
151 int pos = Integer.parseInt(posStr); | 154 int pos = Integer.parseInt(posStr); |
152 double from = Double.parseDouble(fromStr); | 155 double from = Double.parseDouble(fromStr); |
153 double to = Double.parseDouble(toStr); | 156 double to = Double.parseDouble(toStr); |
157 | |
158 if (pos >= result.length) { | |
159 // this should never happen | |
160 System.err.println("The axis is out of valid range: " + pos); | |
161 continue; | |
162 } | |
154 | 163 |
155 result[pos] = new Axis(pos, from, to); | 164 result[pos] = new Axis(pos, from, to); |
156 } | 165 } |
157 catch (NumberFormatException nfe) { | 166 catch (NumberFormatException nfe) { |
158 nfe.printStackTrace(); | 167 nfe.printStackTrace(); |