Rhino doesn't like a null ErrorReporter so we implement a dummy one.
This commit is contained in:
		
							parent
							
								
									1b08ced5c5
								
							
						
					
					
						commit
						df57e51235
					
				
					 1 changed files with 27 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -19,6 +19,8 @@ package helma.doc;
 | 
			
		|||
import java.awt.Point;
 | 
			
		||||
import java.io.*;
 | 
			
		||||
import java.util.Vector;
 | 
			
		||||
import org.mozilla.javascript.ErrorReporter;
 | 
			
		||||
import org.mozilla.javascript.EvaluatorException;
 | 
			
		||||
import org.mozilla.javascript.TokenStream;
 | 
			
		||||
import org.mozilla.javascript.Token;
 | 
			
		||||
import org.mozilla.javascript.Context;
 | 
			
		||||
| 
						 | 
				
			
			@ -159,7 +161,8 @@ public class DocFunction extends DocFileElement {
 | 
			
		|||
        String name = f.getName();
 | 
			
		||||
        int line = 0;
 | 
			
		||||
        CompilerEnvirons compilerEnv = new CompilerEnvirons();
 | 
			
		||||
        compilerEnv.initFromContext(Context.getCurrentContext(), null);
 | 
			
		||||
        compilerEnv.initFromContext(Context.getCurrentContext(), 
 | 
			
		||||
                                    new ErrorPrinter());
 | 
			
		||||
        return new TokenStream (compilerEnv, reader, null, name, line);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -180,4 +183,27 @@ public class DocFunction extends DocFileElement {
 | 
			
		|||
    public java.lang.String getPrototype() {
 | 
			
		||||
        return "docfunction";
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * A simple error reporter that reports errors on the console
 | 
			
		||||
     */
 | 
			
		||||
    static class ErrorPrinter implements ErrorReporter {
 | 
			
		||||
        public void warning(String message, String sourceName,
 | 
			
		||||
                            int line, String lineSource, int lineOffset) {
 | 
			
		||||
            System.err.println(new EvaluatorException(message, sourceName, line, 
 | 
			
		||||
                                                      lineSource, lineOffset));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void error(String message, String sourceName,
 | 
			
		||||
                            int line, String lineSource, int lineOffset) {
 | 
			
		||||
            System.err.println(new EvaluatorException(message, sourceName, line, 
 | 
			
		||||
                                                      lineSource, lineOffset));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public EvaluatorException runtimeError(String message, String sourceName,
 | 
			
		||||
                            int line, String lineSource, int lineOffset) {
 | 
			
		||||
            return new EvaluatorException(message, sourceName, line, 
 | 
			
		||||
                                          lineSource, lineOffset);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue