Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java @ 6051:e56f0d618f96
Add instanceof guard around boundary handling
Otherwise there could be a class cast exception when the class
was an annotation object
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 21 May 2013 10:12:25 +0200 |
parents | af13ceeba52a |
children | 036b02fc0c81 |
comparison
equal
deleted
inserted
replaced
6050:06450ef553cc | 6051:e56f0d618f96 |
---|---|
88 | 88 |
89 if (facet == null) { | 89 if (facet == null) { |
90 return; | 90 return; |
91 } | 91 } |
92 | 92 |
93 if (getXBounds(0) != null && getDomainAxisRange() != null) { | 93 if (bundle.getData(context) instanceof BedDifferencesResult) { |
94 Bounds bounds = | 94 if (getXBounds(0) != null && getDomainAxisRange() != null) { |
95 calculateZoom(getXBounds(0), getDomainAxisRange()); | 95 Bounds bounds = |
96 context.putContextValue("startkm", bounds.getLower()); | 96 calculateZoom(getXBounds(0), getDomainAxisRange()); |
97 context.putContextValue("endkm", bounds.getUpper()); | 97 context.putContextValue("startkm", bounds.getLower()); |
98 } | 98 context.putContextValue("endkm", bounds.getUpper()); |
99 else if (getXBounds(0) != null && getDomainAxisRange() == null) { | 99 } |
100 context.putContextValue("startkm", getXBounds(0).getLower()); | 100 else if (getXBounds(0) != null && getDomainAxisRange() == null) { |
101 context.putContextValue("endkm", getXBounds(0).getUpper()); | 101 context.putContextValue("startkm", getXBounds(0).getLower()); |
102 } | 102 context.putContextValue("endkm", getXBounds(0).getUpper()); |
103 else if (getXBounds(0) == null && getDomainAxisRange() == null) { | 103 } |
104 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); | 104 else if (getXBounds(0) == null && getDomainAxisRange() == null) { |
105 context.putContextValue("startkm", data.getKms().min()); | 105 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); |
106 context.putContextValue("endkm", data.getKms().max()); | 106 context.putContextValue("startkm", data.getKms().min()); |
107 } | 107 context.putContextValue("endkm", data.getKms().max()); |
108 else if (getXBounds(0) == null && getDomainAxisRange() != null){ | 108 } |
109 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); | 109 else if (getXBounds(0) == null && getDomainAxisRange() != null){ |
110 Bounds b = new DoubleBounds(data.getKms().min(), data.getKms().max()); | 110 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); |
111 Bounds bounds = | 111 Bounds b = new DoubleBounds(data.getKms().min(), data.getKms().max()); |
112 calculateZoom(b, getDomainAxisRange()); | 112 Bounds bounds = |
113 context.putContextValue("startkm", bounds.getLower()); | 113 calculateZoom(b, getDomainAxisRange()); |
114 context.putContextValue("endkm", bounds.getUpper()); | 114 context.putContextValue("startkm", bounds.getLower()); |
115 context.putContextValue("endkm", bounds.getUpper()); | |
116 } | |
115 } | 117 } |
116 Processor processor = new KMIndexProcessor(); | 118 Processor processor = new KMIndexProcessor(); |
117 if (name.equals(BED_DIFFERENCE_HEIGHT_YEAR)) { | 119 if (name.equals(BED_DIFFERENCE_HEIGHT_YEAR)) { |
118 doBedDifferenceYearOut( | 120 doBedDifferenceYearOut( |
119 (BedDiffYearResult) bundle.getData(context), | 121 (BedDiffYearResult) bundle.getData(context), |