beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From echauc...@apache.org
Subject [beam] 21/37: Wrap exceptions in UserCoderExceptions
Date Thu, 24 Oct 2019 10:18:25 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 72c267cc91f75a446a949825a216d4101bbca37d
Author: Etienne Chauchot <echauchot@apache.org>
AuthorDate: Thu Sep 5 15:53:10 2019 +0200

    Wrap exceptions in UserCoderExceptions
---
 .../translation/helpers/EncoderHelpers.java                  | 12 ++++++------
 1 file changed, 6 insertions(+), 6 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 f990121..f4ea6fa 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
@@ -147,8 +147,8 @@ public class EncoderHelpers {
             $beamCoder.encode(${input.value}, baos);
             ${ev.value} =  baos.toByteArray();
         }
-        } catch (Exception e) {
-          throw new RuntimeException(org.apache.beam.sdk.util.UserCodeException.wrap(e));
+        } catch (java.io.IOException e) {
+          throw org.apache.beam.sdk.util.UserCodeException.wrap(e);
         }
       */
       List<String> parts = new ArrayList<>();
@@ -160,7 +160,7 @@ public class EncoderHelpers {
       parts.add(".encode(");
       parts.add(", baos); ");
       parts.add(
-          " = baos.toByteArray();}} catch (Exception e) {throw new RuntimeException(org.apache.beam.sdk.util.UserCodeException.wrap(e));}");
+          " = baos.toByteArray();}} catch (java.io.IOException e) {throw org.apache.beam.sdk.util.UserCodeException.wrap(e);}");
 
       StringContext sc =
           new StringContext(JavaConversions.collectionAsScalaIterable(parts).toSeq());
@@ -262,8 +262,8 @@ public class EncoderHelpers {
             ${input.isNull} ?
             ${CodeGenerator.defaultValue(dataType)} :
             ($javaType) $beamCoder.decode(new java.io.ByteArrayInputStream(${input.value}));
-           } catch (Exception e) {
-            throw new RuntimeException(org.apache.beam.sdk.util.UserCodeException.wrap(e));
+           } catch (java.io.IOException e) {
+            throw org.apache.beam.sdk.util.UserCodeException.wrap(e);
            }
       */
 
@@ -277,7 +277,7 @@ public class EncoderHelpers {
       parts.add(") ");
       parts.add(".decode(new java.io.ByteArrayInputStream(");
       parts.add(
-          "));  } catch (Exception e) {throw new RuntimeException(org.apache.beam.sdk.util.UserCodeException.wrap(e));}");
+          "));  } catch (java.io.IOException e) {throw org.apache.beam.sdk.util.UserCodeException.wrap(e);}");
 
       StringContext sc =
           new StringContext(JavaConversions.collectionAsScalaIterable(parts).toSeq());


Mime
View raw message