[ 
https://issues.apache.org/jira/browse/BEAM-5638?focusedWorklogId=151735&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-151735
 ]

ASF GitHub Bot logged work on BEAM-5638:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Oct/18 17:19
            Start Date: 05/Oct/18 17:19
    Worklog Time Spent: 10m 
      Work Description: jklukas commented on a change in pull request #6586: 
[BEAM-5638] Exception handling for Java single message transforms
URL: https://github.com/apache/beam/pull/6586#discussion_r223080900
 
 

 ##########
 File path: 
sdks/java/extensions/jackson/src/main/java/org/apache/beam/sdk/extensions/jackson/AsJsons.java
 ##########
 @@ -64,13 +77,75 @@ private AsJsons(Class<? extends InputT> outputClass) {
               @Override
               public String apply(InputT input) {
                 try {
-                  ObjectMapper mapper = 
Optional.fromNullable(customMapper).or(DEFAULT_MAPPER);
-                  return mapper.writeValueAsString(input);
+                  return writeValue(input);
                 } catch (IOException e) {
-                  throw new RuntimeException(
+                  throw new UncheckedIOException(
 
 Review comment:
   We could pass a `Contextful` here, in which case we'd be able to let the 
`IOException` bubble up rather than catching and rethrowing as unchecked (which 
we do for the new `WithFailures` code below). But that could potentially break 
existing user code if users catch `PipelineExecutionException` and check the 
cause. That seems unlikely, so perhaps switching to a `Contextful` to avoid 
rethrowing is an option.
   
   In lieu of that, I've changed this to the more specific 
`UncheckedIOException`, which inherits from `RuntimeException` so is a safer 
change.
   
   This all applies to `ParseJsons` too.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 151735)
            Time Spent: 40m  (was: 0.5h)
    Remaining Estimate: 167h 20m  (was: 167.5h)

> Add exception handling to single message transforms in Java SDK
> ---------------------------------------------------------------
>
>                 Key: BEAM-5638
>                 URL: https://issues.apache.org/jira/browse/BEAM-5638
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-core
>            Reporter: Jeff Klukas
>            Assignee: Jeff Klukas
>            Priority: Minor
>   Original Estimate: 168h
>          Time Spent: 40m
>  Remaining Estimate: 167h 20m
>
> Add methods to MapElements, FlatMapElements, and Filter that allow users to 
> specify expected exceptions and tuple tags to associate with the with 
> collections of the successfully and unsuccessfully processed elements.
> See discussion on dev list:
> https://lists.apache.org/thread.html/936ed2a5f2c01be066fd903abf70130625e0b8cf4028c11b89b8b23f@%3Cdev.beam.apache.org%3E



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to