You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Pradeep Kamath (JIRA)" <ji...@apache.org> on 2009/02/26 00:13:01 UTC

[jira] Resolved: (PIG-591) Error handling phase four

     [ https://issues.apache.org/jira/browse/PIG-591?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pradeep Kamath resolved PIG-591.
--------------------------------

      Resolution: Fixed
    Hadoop Flags: [Reviewed]

Santhosh, thanks for the feature contribution. Patch commited with the following changes in HExecution.java:
{code}
@@ -200,7 +200,7 @@
         }
         catch (IOException e) {
             int errCode = 6009; 
-            String msg = "Failed to create job client";
+            String msg = "Failed to create job client:" + e.getMessage();
             throw new ExecException(msg, errCode, PigException.BUG, e);
         }       
     }
@@ -549,11 +549,20 @@
             //this should return as soon as connection is shutdown
             int rc = p.waitFor();
             if (rc != 0) { 
-                String errMsg = new String();
+                StringBuilder errMsg = new StringBuilder();
                 try {   
-                    BufferedReader br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
-                    errMsg = br.readLine();
+                    BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
+                    String line = null;
+                    while((line = br.readLine()) != null) {
+                        errMsg.append(line);
+                    }
                     br.close();
+                    br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+                    line = null;
+                    while((line = br.readLine()) != null) {
+                        errMsg.append(line);
+                    }
+                    br.close();
                 } catch (IOException ioe) {} 
                 int errCode = 6011; 
                 StringBuilder msg = new StringBuilder("Failed to run command ");
@@ -563,7 +572,7 @@
                 msg.append("; return code: ");
                 msg.append(rc);
                 msg.append("; error: ");
-                msg.append(errMsg);
+                msg.append(errMsg.toString());
                 throw new ExecException(msg.toString(), errCode, PigException.REMOTE_ENVIRONMENT);
             }
         } catch (Exception e){

{code}

These extra changes are need so that the right error message is shown when there is an error while connecting to DFS. Since this is the last error handling related patch it seemed logical to add this with this patch. The above change has been taken from the patch submitted for http://issues.apache.org/jira/browse/PIG-682. So when http://issues.apache.org/jira/browse/PIG-682 is finally committed this portion can be omitted.

> Error handling phase four
> -------------------------
>
>                 Key: PIG-591
>                 URL: https://issues.apache.org/jira/browse/PIG-591
>             Project: Pig
>          Issue Type: Sub-task
>          Components: grunt, impl, tools
>    Affects Versions: types_branch
>            Reporter: Santhosh Srinivasan
>            Assignee: Santhosh Srinivasan
>             Fix For: types_branch
>
>         Attachments: Error_handling_phase4.patch, Error_handling_phase4_1.patch
>
>
> Phase four of the error handling feature will address the warning message cleanup and warning message aggregation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.