[GitHub] flink pull request #3757: (refactor) some opportunities to use multi-catch
Github user rbonifacio closed the pull request at: https://github.com/apache/flink/pull/3757 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request #3757: (refactor) some opportunities to use multi-catch
Github user zentol commented on a diff in the pull request: https://github.com/apache/flink/pull/3757#discussion_r113290832 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/util/ClassLoaderUtil.java --- @@ -121,11 +120,7 @@ public static boolean validateClassLoadable(ClassNotFoundException cnfe, ClassLo String className = cnfe.getMessage(); Class.forName(className, false, cl); return true; - } - catch (ClassNotFoundException e) { - return false; - } - catch (Exception e) { + }catch(ClassNotFoundException | Exception e) /*multi-catch refactor*/ { --- End diff -- you can remove the `ClassNotFoundException` clause since it is included in the `Exception` clause anway. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request #3757: (refactor) some opportunities to use multi-catch
Github user zentol commented on a diff in the pull request: https://github.com/apache/flink/pull/3757#discussion_r113290672 --- Diff: flink-connectors/flink-avro/src/main/java/org/apache/flink/api/java/io/AvroOutputFormat.java --- @@ -125,9 +125,7 @@ public void open(int taskNumber, int numTasks) throws IOException { datumWriter = new SpecificDatumWriter(avroValueType); try { schema = ((org.apache.avro.specific.SpecificRecordBase)avroValueType.newInstance()).getSchema(); - } catch (InstantiationException e) { - throw new RuntimeException(e.getMessage()); - } catch (IllegalAccessException e) { + }catch(InstantiationException | IllegalAccessException e) /*multi-catch refactor*/ { --- End diff -- In this particular case it makes sense as it reduces clutter. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request #3757: (refactor) some opportunities to use multi-catch
Github user rbonifacio commented on a diff in the pull request: https://github.com/apache/flink/pull/3757#discussion_r113068939 --- Diff: flink-connectors/flink-avro/src/main/java/org/apache/flink/api/java/io/AvroOutputFormat.java --- @@ -125,9 +125,7 @@ public void open(int taskNumber, int numTasks) throws IOException { datumWriter = new SpecificDatumWriter(avroValueType); try { schema = ((org.apache.avro.specific.SpecificRecordBase)avroValueType.newInstance()).getSchema(); - } catch (InstantiationException e) { - throw new RuntimeException(e.getMessage()); - } catch (IllegalAccessException e) { + }catch(InstantiationException | IllegalAccessException e) /*multi-catch refactor*/ { --- End diff -- Yes... I will fix the problems related to white spaces. In our opinion, is this kind of transformation, which aims to use new programming language constructs, worth? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request #3757: (refactor) some opportunities to use multi-catch
Github user greghogan commented on a diff in the pull request: https://github.com/apache/flink/pull/3757#discussion_r112941684 --- Diff: flink-connectors/flink-avro/src/main/java/org/apache/flink/api/java/io/AvroOutputFormat.java --- @@ -125,9 +125,7 @@ public void open(int taskNumber, int numTasks) throws IOException { datumWriter = new SpecificDatumWriter(avroValueType); try { schema = ((org.apache.avro.specific.SpecificRecordBase)avroValueType.newInstance()).getSchema(); - } catch (InstantiationException e) { - throw new RuntimeException(e.getMessage()); - } catch (IllegalAccessException e) { + }catch(InstantiationException | IllegalAccessException e) /*multi-catch refactor*/ { --- End diff -- Why change the whitespace before 'catch' and why include the comment? There's an extra space after each `IllegalAccessException`. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] flink pull request #3757: (refactor) some opportunities to use multi-catch
GitHub user rbonifacio opened a pull request: https://github.com/apache/flink/pull/3757 (refactor) some opportunities to use multi-catch You can merge this pull request into a Git repository by running: $ git pull https://github.com/rbonifacio/flink refactor-multi-catch Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/3757.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3757 commit 18c58ea0a1cc35b19c51737f07f206b8c76c4752 Author: Rodrigo BonifacioDate: 2017-04-23T21:42:59Z (refactor) some opportunities to use multi-catch --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---