]> source.dussan.org Git - vaadin-framework.git/commitdiff
Replace with multi-catch
authorPer-Åke Minborg <minborg@speedment.com>
Fri, 28 Oct 2016 06:27:16 +0000 (23:27 -0700)
committerHenri Sara <hesara@vaadin.com>
Wed, 2 Nov 2016 14:41:54 +0000 (14:41 +0000)
Change-Id: I80b73b653e97904605dc62484a7448f3bfbf7216

server/src/main/java/com/vaadin/navigator/Navigator.java
server/src/main/java/com/vaadin/server/GAEVaadinServlet.java
server/src/main/java/com/vaadin/server/ServletPortletHelper.java
server/src/main/java/com/vaadin/ui/Grid.java
server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java

index 4fb3906e9e3690d65262c2fb50a151ac5fe837bf..07d7c5c085b32c2b89799b5aa38ed05f94a8e324 100644 (file)
@@ -340,13 +340,12 @@ public class Navigator implements Serializable {
                 try {
                     View view = viewClass.newInstance();
                     return view;
-                } catch (InstantiationException e) {
-                    // TODO error handling
-                    throw new RuntimeException(e);
-                } catch (IllegalAccessException e) {
+                } catch (InstantiationException | IllegalAccessException e) {
                     // TODO error handling
                     throw new RuntimeException(e);
                 }
+                // TODO error handling
+                
             }
             return null;
         }
index 93a43829b33f2f1ce1930bbdec3d688fa6a2ce2b..bfa2925dcbe07f30fe13cf213d8a57947d93733d 100644 (file)
@@ -341,13 +341,7 @@ public class GAEVaadinServlet extends VaadinServlet {
                 VaadinSession vaadinSession = (VaadinSession) ois.readObject();
                 getService().storeSession(vaadinSession,
                         new WrappedHttpSession(session));
-            } catch (IOException e) {
-                getLogger().log(Level.WARNING,
-                        "Could not de-serialize ApplicationContext for "
-                                + session.getId()
-                                + " A new one will be created. ",
-                        e);
-            } catch (ClassNotFoundException e) {
+            } catch (IOException | ClassNotFoundException e) {
                 getLogger().log(Level.WARNING,
                         "Could not de-serialize ApplicationContext for "
                                 + session.getId()
index 5bd4c01427bc2b07646ea0e6c4a534b53098e147..bf7b1c8452a5307bc4b553a724b8e9474b488c30 100644 (file)
@@ -183,11 +183,7 @@ public class ServletPortletHelper implements Serializable {
         } catch (ClassCastException e) {
             throw new ServiceException("UIProvider class " + uiProviderProperty
                     + " does not extend UIProvider", e);
-        } catch (InstantiationException e) {
-            throw new ServiceException(
-                    "Could not instantiate UIProvider " + uiProviderProperty,
-                    e);
-        } catch (IllegalAccessException e) {
+        } catch (InstantiationException | IllegalAccessException e) {
             throw new ServiceException(
                     "Could not instantiate UIProvider " + uiProviderProperty,
                     e);
index 6d2b2518b034cffcd7cddaca7aa59108204d00bc..bf50d6a53d8818722c94a98139d931f290736ca7 100644 (file)
@@ -601,9 +601,7 @@ public class Grid<T> extends AbstractSingleSelect<T> implements HasComponents {
                 try {
                     type = (getState(false).getClass()
                             .getDeclaredField(diffStateKey).getGenericType());
-                } catch (NoSuchFieldException e) {
-                    e.printStackTrace();
-                } catch (SecurityException e) {
+                } catch (NoSuchFieldException | SecurityException e) {
                     e.printStackTrace();
                 }
                 EncodeResult encodeResult = JsonCodec.encode(
index 3d7dcc20d97e7e94c9523f30b8dbcc9be03153b7..29c4c5491d1f238d348a17171c7777ff6af79dc7 100644 (file)
@@ -86,9 +86,7 @@ public class FieldBinder implements Serializable {
                 if (value == null) {
                     unboundFields.add(f.getName());
                 }
-            } catch (IllegalArgumentException e) {
-                throw new FieldBindingException("Could not get field value", e);
-            } catch (IllegalAccessException e) {
+            } catch (IllegalArgumentException | IllegalAccessException e) {
                 throw new FieldBindingException("Could not get field value", e);
             }
         }
@@ -197,10 +195,7 @@ public class FieldBinder implements Serializable {
                 field.set(bindTarget, instance);
             }
             return true;
-        } catch (IllegalAccessException e) {
-            throw new FieldBindingException(
-                    "Field binding failed for " + identifier, e);
-        } catch (IllegalArgumentException e) {
+        } catch (IllegalAccessException | IllegalArgumentException e) {
             throw new FieldBindingException(
                     "Field binding failed for " + identifier, e);
         }