Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java @ 2081:aa9cc91c8193
#444 Take care on NullPointerExceptions in getWQMode. Take 'false' as default value if no 'wq_free' item is existing.
flys-artifacts/trunk@3597 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 05 Jan 2012 14:15:07 +0000 |
parents | 0cf60d64895c |
children | bf67eb014443 |
comparison
equal
deleted
inserted
replaced
2080:0553e31d25e7 | 2081:aa9cc91c8193 |
---|---|
155 * @param flys The FLYSArtifact that stores wq mode relevant parameters. | 155 * @param flys The FLYSArtifact that stores wq mode relevant parameters. |
156 * | 156 * |
157 * @return an enum WQ_MODE. | 157 * @return an enum WQ_MODE. |
158 */ | 158 */ |
159 public static WQ_MODE getWQMode(FLYSArtifact flys) { | 159 public static WQ_MODE getWQMode(FLYSArtifact flys) { |
160 if (flys == null) { | |
161 return WQ_MODE.NONE; | |
162 } | |
163 | |
160 String mode = flys.getDataAsString("wq_mode"); | 164 String mode = flys.getDataAsString("wq_mode"); |
161 boolean free = flys.getDataAsBoolean("wq_free"); | 165 Boolean free = flys.getDataAsBoolean("wq_free"); |
166 | |
167 free = free != null ? free : false; | |
162 | 168 |
163 if (mode != null && mode.equals("Q")) { | 169 if (mode != null && mode.equals("Q")) { |
164 return free ? WQ_MODE.QFREE : WQ_MODE.QGAUGE; | 170 return free ? WQ_MODE.QFREE : WQ_MODE.QGAUGE; |
165 } | 171 } |
166 else if (mode != null && mode.equals("W")) { | 172 else if (mode != null && mode.equals("W")) { |