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:12:10 UTC

[sling-org-apache-sling-scripting-sightly-testing-content] 09/17: SLING-4441 - The JavaUseProvider should return a failure for any exception encountered during Use object retrieval

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.scripting.sightly.testing-content-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-testing-content.git

commit 24f8e4252e395003ef6c828419b80a4fd153a0bc
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Thu Feb 19 21:57:19 2015 +0000

    SLING-4441 - The JavaUseProvider should return a failure for any exception encountered during Use object retrieval
    
    * return a failure outcome for any exception that's thrown during the Use-object load phase
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/sightly/testing-content@1661012 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apps/sightly/scripts/use/ErrorPojo.java        | 20 +++++++++++++++
 .../apps/sightly/scripts/use/javaerror.html        | 29 ++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/use/ErrorPojo.java b/src/main/resources/SLING-INF/apps/sightly/scripts/use/ErrorPojo.java
new file mode 100644
index 0000000..3eb58cd
--- /dev/null
+++ b/src/main/resources/SLING-INF/apps/sightly/scripts/use/ErrorPojo.java
@@ -0,0 +1,20 @@
+package apps.sightly.scripts.use;
+
+import javax.script.Bindings;
+
+import org.apache.sling.scripting.sightly.pojo.Use;
+
+public class ErrorPojo implements Use {
+
+    @Override
+    public void init(Bindings bindings) {
+        Object o = null;
+        // throw a silly NPE
+        o.toString();
+    }
+
+    public String sayHello() {
+        return "hello";
+    }
+
+}
\ No newline at end of file
diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/use/javaerror.html b/src/main/resources/SLING-INF/apps/sightly/scripts/use/javaerror.html
new file mode 100644
index 0000000..404ab6e
--- /dev/null
+++ b/src/main/resources/SLING-INF/apps/sightly/scripts/use/javaerror.html
@@ -0,0 +1,29 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<!doctype html>
+<html>
+    <head>
+        <title>Sightly Use-API - Sling implementation :: Java Use object errors</title>
+    </head>
+    <body>
+        <div data-sly-use.pojo="apps.sightly.scripts.use.ErrorPojo">
+            ${pojo.sayHello}
+        </div>
+    </body>
+</html>
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.