Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Rhino JavaScript Java Library Source Code
Rhino JavaScript Java Library is an open-source implementation of JavaScript
written entirely in Java.
Rhino JavaScript Java Library Source Code files are provided in binary package (rhino-1.7.14.zip).
You can also browse the source code below:
✍: FYIcenter.com
⏎ org/mozilla/javascript/DefaultErrorReporter.java
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.javascript;
/**
* This is the default error reporter for JavaScript.
*
* @author Norris Boyd
*/
class DefaultErrorReporter implements ErrorReporter
{
static final DefaultErrorReporter instance = new DefaultErrorReporter();
private boolean forEval;
private ErrorReporter chainedReporter;
private DefaultErrorReporter() { }
static ErrorReporter forEval(ErrorReporter reporter)
{
DefaultErrorReporter r = new DefaultErrorReporter();
r.forEval = true;
r.chainedReporter = reporter;
return r;
}
@Override
public void warning(String message, String sourceURI, int line,
String lineText, int lineOffset)
{
if (chainedReporter != null) {
chainedReporter.warning(
message, sourceURI, line, lineText, lineOffset);
} else {
// Do nothing
}
}
@Override
public void error(String message, String sourceURI, int line,
String lineText, int lineOffset)
{
if (forEval) {
// Assume error message strings that start with "TypeError: "
// should become TypeError exceptions. A bit of a hack, but we
// don't want to change the ErrorReporter interface.
String error = "SyntaxError";
final String TYPE_ERROR_NAME = "TypeError";
final String DELIMETER = ": ";
final String prefix = TYPE_ERROR_NAME + DELIMETER;
if (message.startsWith(prefix)) {
error = TYPE_ERROR_NAME;
message = message.substring(prefix.length());
}
throw ScriptRuntime.constructError(error, message, sourceURI,
line, lineText, lineOffset);
}
if (chainedReporter != null) {
chainedReporter.error(
message, sourceURI, line, lineText, lineOffset);
} else {
throw runtimeError(
message, sourceURI, line, lineText, lineOffset);
}
}
@Override
public EvaluatorException runtimeError(String message, String sourceURI,
int line, String lineText,
int lineOffset)
{
if (chainedReporter != null) {
return chainedReporter.runtimeError(message, sourceURI, line, lineText, lineOffset);
}
return new EvaluatorException(message, sourceURI, line, lineText, lineOffset);
}
}
⏎ org/mozilla/javascript/DefaultErrorReporter.java
Or download all of them as a single archive file:
File name: rhino-1.7.14-sources.jar File size: 1029165 bytes Release date: 2022-01-06 Download
⇒ Example code to Test rhino-runtime-1.7.14.jar
⇐ Download Rhino JavaScript Binary Package
2022-05-03, ≈196🔥, 1💬
Popular Posts:
JavaMail Source Code Files are provided in the source package file, httpcomponents-client-5. 2-src.zi...
What Is javaws.jar in JRE (Java Runtime Environment) 8? javaws.jar in JRE (Java Runtime Environment)...
If you are a Java developer, it is very often that you need to use some 3rd party libraries to perfo...
commons-io-1.4.jar is the JAR file for Commons IO 1.4, which is a library of utilities to assist wit...
What Is XMLBeans xbean.jar 2.6.0? XMLBeans xbean.jar 2.6.0 is the JAR file for Apache XMLBeans 2.6.0...