summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2018-10-12 12:16:36 +0200
committerTobrun <tobrun@mapbox.com>2018-10-15 18:56:55 +0200
commit787bbdfa51831fee5a9f6032c32e191677a802bd (patch)
tree114da18a06a416961e08ac892ba51dc72b92880c
parentecb59bf1f802319b4febb908b51de09f66767ae3 (diff)
downloadqtlocation-mapboxgl-787bbdfa51831fee5a9f6032c32e191677a802bd.tar.gz
[android] - remove obsolete catch block in getLayerAs
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java13
1 files changed, 3 insertions, 10 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
index ba6339f2fb..3214874b4e 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
@@ -312,7 +312,7 @@ public final class MapboxMap {
}
/**
- * Tries to cast the Layer to T, returns null if it's another type.
+ * Tries to cast the Layer to T, throws ClassCastException if it's another type.
*
* @param layerId the layer id used to look up a layer
* @param <T> the generic attribute of a Layer
@@ -320,15 +320,8 @@ public final class MapboxMap {
*/
@Nullable
public <T extends Layer> T getLayerAs(@NonNull String layerId) {
- try {
- // noinspection unchecked
- return (T) nativeMapView.getLayer(layerId);
- } catch (ClassCastException exception) {
- String message = String.format("Layer: %s is a different type: ", layerId);
- Logger.e(TAG, message, exception);
- MapStrictMode.strictModeViolation(message, exception);
- return null;
- }
+ // noinspection unchecked
+ return (T) nativeMapView.getLayer(layerId);
}
/**