Cleanup NetconfDevice 75/60475/2
authorTomas Cere <tcere@cisco.com>
Mon, 17 Jul 2017 11:07:34 +0000 (13:07 +0200)
committerTomas Cere <tcere@cisco.com>
Wed, 19 Jul 2017 11:04:14 +0000 (13:04 +0200)
Change-Id: I0a0441e662ca78e8d6d6841cc48279b293422d1b
Signed-off-by: Tomas Cere <tcere@cisco.com>
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDevice.java

index 6452cfae415b093dbbf8ffac59e7549cbfae42da..b78011460e4e81f4544c79863184e7f7089ea429 100644 (file)
@@ -500,32 +500,26 @@ public class NetconfDevice
 
                     capabilities.addNonModuleBasedCapabilities(remoteSessionCapabilities
                             .getNonModuleCaps().stream().map(entry -> new AvailableCapabilityBuilder()
-                            .setCapability(entry).setCapabilityOrigin(
+                                    .setCapability(entry).setCapabilityOrigin(
                                             remoteSessionCapabilities.getNonModuleBasedCapsOrigin().get(entry)).build())
                             .collect(Collectors.toList()));
 
                     handleSalInitializationSuccess(result, remoteSessionCapabilities, getDeviceSpecificRpc(result));
                     return;
-                } catch (final Throwable t) {
-                    if (t instanceof MissingSchemaSourceException) {
-                        requiredSources =
-                                handleMissingSchemaSourceException(requiredSources, (MissingSchemaSourceException) t);
-                    } else if (t instanceof SchemaResolutionException) {
-                        // schemaBuilderFuture.checkedGet() throws only SchemaResolutionException
-                        // that might be wrapping a MissingSchemaSourceException so we need to look
-                        // at the cause of the exception to make sure we don't misinterpret it.
-                        if (t.getCause() instanceof MissingSchemaSourceException) {
-                            requiredSources = handleMissingSchemaSourceException(
-                                    requiredSources, (MissingSchemaSourceException) t.getCause());
-                            continue;
-                        }
-                        requiredSources =
-                                handleSchemaResolutionException(requiredSources, (SchemaResolutionException) t);
-                    } else {
-                        // unknown error, fail
-                        handleSalInitializationFailure(t, listener);
-                        return;
+                } catch (final SchemaResolutionException e) {
+                    // schemaBuilderFuture.checkedGet() throws only SchemaResolutionException
+                    // that might be wrapping a MissingSchemaSourceException so we need to look
+                    // at the cause of the exception to make sure we don't misinterpret it.
+                    if (e.getCause() instanceof MissingSchemaSourceException) {
+                        requiredSources = handleMissingSchemaSourceException(
+                                requiredSources, (MissingSchemaSourceException) e.getCause());
+                        continue;
                     }
+                    requiredSources = handleSchemaResolutionException(requiredSources, e);
+                } catch (final Exception e) {
+                    // unknown error, fail
+                    handleSalInitializationFailure(e, listener);
+                    return;
                 }
             }
             // No more sources, fail