You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by pr...@apache.org on 2009/02/26 00:08:08 UTC
svn commit: r747954 [2/2] - in /hadoop/pig/trunk: ./ src/org/apache/pig/
src/org/apache/pig/backend/hadoop/executionengine/
src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/
src/org/apache/pig/backend/hadoop/executionengine/physicalLaye...
Modified: hadoop/pig/trunk/src/org/apache/pig/tools/grunt/Grunt.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/tools/grunt/Grunt.java?rev=747954&r1=747953&r2=747954&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/tools/grunt/Grunt.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/tools/grunt/Grunt.java Wed Feb 25 23:08:07 2009
@@ -62,99 +62,28 @@
parser.setConsoleReader(c);
}
public void run() {
- //parser.parseContOnError();
- String trueString = "true";
- boolean verbose = trueString.equalsIgnoreCase(pig.getPigContext().getProperties().getProperty("verbose"));
- boolean append = false;
+ boolean verbose = "true".equalsIgnoreCase(pig.getPigContext().getProperties().getProperty("verbose"));
while(true) {
try {
parser.setInteractive(true);
parser.parseStopOnError();
break;
} catch(Throwable t) {
- //writeLog(t, verbose, append);
Utils.writeLog(t, pig.getPigContext().getProperties().getProperty("pig.logfile"), log, verbose);
- append = true;
parser.ReInit(in);
}
}
}
public void exec() throws Throwable {
- String trueString = "true";
- boolean verbose = trueString.equalsIgnoreCase(pig.getPigContext().getProperties().getProperty("verbose"));
+ boolean verbose = "true".equalsIgnoreCase(pig.getPigContext().getProperties().getProperty("verbose"));
try {
parser.setInteractive(false);
parser.parseStopOnError();
} catch (Throwable t) {
- //writeLog(t, verbose, false);
Utils.writeLog(t, pig.getPigContext().getProperties().getProperty("pig.logfile"), log, verbose);
throw (t);
}
}
-
-/* private void writeLog(Throwable t, boolean verbose, boolean append) {
-
- String message = null;
-
- if(t instanceof Exception) {
- Exception pe = Utils.getPermissionException((Exception)t);
- if (pe != null) {
- log.error("You don't have permission to perform the operation. Error from the server: " + pe.getMessage());
- }
- }
-
- PigException pigException = Utils.getPigException(t);
-
- if(pigException != null) {
- message = "ERROR " + pigException.getErrorCode() + ": " + pigException.getMessage();
- } else {
- if((t instanceof ParseException
- || t instanceof org.apache.pig.tools.pigscript.parser.TokenMgrError
- || t instanceof org.apache.pig.impl.logicalLayer.parser.TokenMgrError)) {
- message = "ERROR 1000: Error during parsing. " + t.getMessage();
- } else if (t instanceof RuntimeException) {
- message = "ERROR 2999: Unexpected internal error. " + t.getMessage();
- } else {
- message = "ERROR 2998: Unhandled internal error. " + t.getMessage();
- }
- }
-
- FileOutputStream fos = null;
- ByteArrayOutputStream bs = new ByteArrayOutputStream();
- t.printStackTrace(new PrintStream(bs));
-
- log.error(message);
-
- if(verbose) {
- log.error(bs.toString());
- }
-
- String logFileName = pig.getPigContext().getProperties().getProperty("pig.logfile");
-
- if(logFileName == null) {
- //if exec is invoked programmatically then logFileName will be null
- log.warn("There is no log file to write to");
- log.error(bs.toString());
- return;
- }
-
-
- File logFile = new File(logFileName);
- try {
- fos = new FileOutputStream(logFile, append);
- fos.write((message + "\n").getBytes("UTF-8"));
- fos.write(bs.toString().getBytes("UTF-8"));
- fos.close();
- if(verbose) {
- System.err.println("Details also at logfile: " + logFileName);
- } else {
- System.err.println("Details at logfile: " + logFileName);
- }
- } catch (IOException ioe) {
- log.warn("Could not write to log file: " + logFileName + " :" + ioe.getMessage());
- log.error(bs.toString());
- }
- }*/
}
Modified: hadoop/pig/trunk/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj?rev=747954&r1=747953&r2=747954&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj (original)
+++ hadoop/pig/trunk/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj Wed Feb 25 23:08:07 2009
@@ -608,15 +608,5 @@
JAVACODE
void handle_invalid_command(int kind)
{
- ParseException e = generateParseException(); // generate the exception object.
-
- if (mInteractive) {
- System.out.println(e.toString()); // print the error message
- Token t = getNextToken();
-
- while (t.kind != kind)
- t = getNextToken();
- } else {
- throw e;
- }
+ throw generateParseException(); // throw the exception object.
}