beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From echauc...@apache.org
Subject [beam] 23/37: Catch Exception instead of IOException because some coders to not throw Exceptions at all (e.g.VoidCoder)
Date Thu, 24 Oct 2019 10:11:43 GMT
This is an automated email from the ASF dual-hosted git repository.

echauchot pushed a commit to branch spark-runner_structured-streaming
in repository https://gitbox.apache.org/repos/asf/beam.git

commit c33fddadcc3f38474e0aeb440c0d3fac718ee5a6
Author: Etienne Chauchot <echauchot@apache.org>
AuthorDate: Fri Sep 6 10:42:00 2019 +0200

    Catch Exception instead of IOException because some coders to not throw Exceptions at
all (e.g.VoidCoder)
---
 .../structuredstreaming/translation/helpers/EncoderHelpers.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/helpers/EncoderHelpers.java
b/runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/helpers/EncoderHelpers.java
index e7c5bb7..218dc0a 100644
--- a/runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/helpers/EncoderHelpers.java
+++ b/runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/helpers/EncoderHelpers.java
@@ -149,7 +149,7 @@ public class EncoderHelpers {
             $beamCoder.encode(${input.value}, baos);
             ${ev.value} =  baos.toByteArray();
         }
-        } catch (java.io.IOException e) {
+        } catch (Exception e) {
           throw org.apache.beam.sdk.util.UserCodeException.wrap(e);
         }
       */
@@ -162,7 +162,7 @@ public class EncoderHelpers {
       parts.add(".encode(");
       parts.add(", baos); ");
       parts.add(
-          " = baos.toByteArray();}} catch (java.io.IOException e) {throw org.apache.beam.sdk.util.UserCodeException.wrap(e);}");
+          " = baos.toByteArray();}} catch (Exception e) {throw org.apache.beam.sdk.util.UserCodeException.wrap(e);}");
 
       StringContext sc =
           new StringContext(JavaConversions.collectionAsScalaIterable(parts).toSeq());
@@ -265,7 +265,7 @@ public class EncoderHelpers {
             ${input.isNull} ?
             ${CodeGenerator.defaultValue(dataType)} :
             ($javaType) $beamCoder.decode(new java.io.ByteArrayInputStream(${input.value}));
-           } catch (java.io.IOException e) {
+           } catch (Exception e) {
             throw org.apache.beam.sdk.util.UserCodeException.wrap(e);
            }
       */
@@ -280,7 +280,7 @@ public class EncoderHelpers {
       parts.add(") ");
       parts.add(".decode(new java.io.ByteArrayInputStream(");
       parts.add(
-          "));  } catch (java.io.IOException e) {throw org.apache.beam.sdk.util.UserCodeException.wrap(e);}");
+          "));  } catch (Exception e) {throw org.apache.beam.sdk.util.UserCodeException.wrap(e);}");
 
       StringContext sc =
           new StringContext(JavaConversions.collectionAsScalaIterable(parts).toSeq());


Mime
View raw message