You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:04:37 UTC
[sling-org-apache-sling-scripting-java] 04/43: Improve error
reporting.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.java-2.0.10
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-java.git
commit 7255b9e117c80a7b9f0a3d4e6cc96c13e86882d5
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Jan 24 14:07:37 2011 +0000
Improve error reporting.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/java@1062781 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/scripting/java/impl/ServletWrapper.java | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/sling/scripting/java/impl/ServletWrapper.java b/src/main/java/org/apache/sling/scripting/java/impl/ServletWrapper.java
index ba38f94..71a7a8d 100644
--- a/src/main/java/org/apache/sling/scripting/java/impl/ServletWrapper.java
+++ b/src/main/java/org/apache/sling/scripting/java/impl/ServletWrapper.java
@@ -173,7 +173,7 @@ public class ServletWrapper {
final List<CompilerMessage> errors = result.getErrors();
if ( errors != null && errors.size() > 0 ) {
- throw CompilerException.create(errors);
+ throw CompilerException.create(errors, this.sourcePath);
}
if ( result.didCompile() || this.theServlet == null ) {
destroy();
@@ -189,12 +189,16 @@ public class ServletWrapper {
protected final static class CompilerException extends ServletException {
- public static CompilerException create(List<CompilerMessage> errors) {
+ private static final long serialVersionUID = 7353686069328527452L;
+
+ public static CompilerException create(final List<CompilerMessage> errors,
+ final String fileName) {
final StringBuilder buffer = new StringBuilder();
- buffer.append("Compilation errors:\n");
+ buffer.append("Compilation errors in ");
+ buffer.append(fileName);
+ buffer.append(":\n");
for(final CompilerMessage e : errors) {
- buffer.append(e.getFile());
- buffer.append(", line ");
+ buffer.append("Line ");
buffer.append(e.getLine());
buffer.append(", column ");
buffer.append(e.getColumn());
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.