Committed by
Ray Milkey
Refactor: Simplify statements
Change-Id: I8f6f25e08bde450d8c1c56a21d0b03fed00e664f
Showing
1 changed file
with
3 additions
and
7 deletions
| ... | @@ -166,21 +166,17 @@ public class ConsistentLinkResourceStore extends | ... | @@ -166,21 +166,17 @@ public class ConsistentLinkResourceStore extends |
| 166 | 166 | ||
| 167 | // if Link annotation exist, use them | 167 | // if Link annotation exist, use them |
| 168 | // if all fails, use DEFAULT_BANDWIDTH | 168 | // if all fails, use DEFAULT_BANDWIDTH |
| 169 | - BandwidthResource bandwidth = null; | 169 | + BandwidthResource bandwidth = DEFAULT_BANDWIDTH; |
| 170 | String strBw = link.annotations().value(BANDWIDTH); | 170 | String strBw = link.annotations().value(BANDWIDTH); |
| 171 | if (strBw != null) { | 171 | if (strBw != null) { |
| 172 | try { | 172 | try { |
| 173 | bandwidth = new BandwidthResource(Bandwidth.mbps(Double.parseDouble(strBw))); | 173 | bandwidth = new BandwidthResource(Bandwidth.mbps(Double.parseDouble(strBw))); |
| 174 | } catch (NumberFormatException e) { | 174 | } catch (NumberFormatException e) { |
| 175 | - // do nothings | 175 | + // do nothings, use default bandwidth |
| 176 | - bandwidth = null; | 176 | + bandwidth = DEFAULT_BANDWIDTH; |
| 177 | } | 177 | } |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | - if (bandwidth == null) { | ||
| 181 | - // fall back, use fixed default | ||
| 182 | - bandwidth = DEFAULT_BANDWIDTH; | ||
| 183 | - } | ||
| 184 | return new BandwidthResourceAllocation(bandwidth); | 180 | return new BandwidthResourceAllocation(bandwidth); |
| 185 | } | 181 | } |
| 186 | 182 | ... | ... |
-
Please register or login to post a comment