You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by HuangWHWHW <gi...@git.apache.org> on 2015/09/11 10:35:12 UTC

[GitHub] flink pull request: [hotfix][streaming]Improve throwing exception ...

GitHub user HuangWHWHW opened a pull request:

    https://github.com/apache/flink/pull/1119

    [hotfix][streaming]Improve throwing exception for WriteSinkFunction.java

    When call the `cleanFile()` method in WriteSinkFunction, it will only print "File not found" when error occurred.
    And the FileNotFoundException is not only the "File not found" but also others(.e.g "Permission denied").
    So I changed the print path to print exception.
    
    For example, when a "Permission denied" happened, here is the exception information following before change:
    `java.lang.RuntimeException: File not found /result.txt
    	at java.io.FileOutputStream.open0(Native Method)
    	at java.io.FileOutputStream.open(FileOutputStream.java:270)
    	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    	at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
    	at java.io.PrintWriter.<init>(PrintWriter.java:184)
    	at org.apache.flink.streaming.api.functions.sink.WriteSinkFunction.cleanFile(WriteSinkFunction.java:55)
    	at org.apache.flink.streaming.api.functions.sink.WriteSinkFunction.<init>(WriteSinkFunction.java:43)
    	at org.apache.flink.streaming.api.functions.sink.WriteSinkFunctionTest$2.<init>(WriteSinkFunctionTest.java:22)
    	at org.apache.flink.streaming.api.functions.sink.WriteSinkFunctionTest.testFileNotFound(WriteSinkFunctionTest.java:22)`
    
    And here is the info after change:
    `java.lang.RuntimeException: An error occured while cleaning the file:java.io.FileNotFoundException: /result.txt (Permission denied)
    	at java.io.FileOutputStream.open0(Native Method)
    	at java.io.FileOutputStream.open(FileOutputStream.java:270)
    	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    	at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
    	at java.io.PrintWriter.<init>(PrintWriter.java:184)
    	at org.apache.flink.streaming.api.functions.sink.WriteSinkFunction.cleanFile(WriteSinkFunction.java:55)
    	at org.apache.flink.streaming.api.functions.sink.WriteSinkFunction.<init>(WriteSinkFunction.java:43)
    	at org.apache.flink.streaming.api.functions.sink.WriteSinkFunctionTest$2.<init>(WriteSinkFunctionTest.java:22)
    	at org.apache.flink.streaming.api.functions.sink.WriteSinkFunctionTest.testFileNotFound(WriteSinkFunctionTest.java:22)`

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/HuangWHWHW/flink FLINK-2480-9-11-new

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/1119.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 #1119
    
----
commit 22a1b10ad6bf04a3c25056a1aec8930373927704
Author: HuangWHWHW <40...@qq.com>
Date:   2015-09-11T08:28:48Z

    [hotfix][streaming]Improve throwing exception for WriteSinkFunction.java

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [hotfix][streaming]Improve throwing exception ...

Posted by mbalassi <gi...@git.apache.org>.
Github user mbalassi commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1119#discussion_r39389124
  
    --- Diff: flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteSinkFunction.java ---
    @@ -56,7 +56,7 @@ protected void cleanFile(String path) {
     			writer.print("");
     			writer.close();
     		} catch (FileNotFoundException e) {
    -			throw new RuntimeException("File not found " + path, e);
    +			throw new RuntimeException("An error occurred while cleaning the file:" + e, e);
    --- End diff --
    
    Makes sense, will change it while merging.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [hotfix][streaming]Improve throwing exception ...

Posted by HuangWHWHW <gi...@git.apache.org>.
Github user HuangWHWHW commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1119#discussion_r39392417
  
    --- Diff: flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteSinkFunction.java ---
    @@ -56,7 +56,7 @@ protected void cleanFile(String path) {
     			writer.print("");
     			writer.close();
     		} catch (FileNotFoundException e) {
    -			throw new RuntimeException("File not found " + path, e);
    +			throw new RuntimeException("An error occurred while cleaning the file:" + e, e);
    --- End diff --
    
    Many thanks!
    Just in another PR, you told me change the `LOG("value=" + value.toString())` to `LOG("value=" + value)`.
    So maybe I had some misunderstanding before.
    :-D


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [hotfix][streaming]Improve throwing exception ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/flink/pull/1119


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [hotfix][streaming]Improve throwing exception ...

Posted by mbalassi <gi...@git.apache.org>.
Github user mbalassi commented on the pull request:

    https://github.com/apache/flink/pull/1119#issuecomment-140056107
  
    Makes sense, will merge it.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] flink pull request: [hotfix][streaming]Improve throwing exception ...

Posted by StephanEwen <gi...@git.apache.org>.
Github user StephanEwen commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1119#discussion_r39388903
  
    --- Diff: flink-staging/flink-streaming/flink-streaming-core/src/main/java/org/apache/flink/streaming/api/functions/sink/WriteSinkFunction.java ---
    @@ -56,7 +56,7 @@ protected void cleanFile(String path) {
     			writer.print("");
     			writer.close();
     		} catch (FileNotFoundException e) {
    -			throw new RuntimeException("File not found " + path, e);
    +			throw new RuntimeException("An error occurred while cleaning the file:" + e, e);
    --- End diff --
    
    Shouldn't this rather be `... file: " + e.getMessage(), e);`?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---