Jenkins build is back to normal : Jena ยป Jena Development Deploy #579

2024-05-03 Thread Apache Jenkins Server
See 




(jena) 01/02: GH-2444: jena-fuseki-core to depend only the Jakarta servlet API

2024-05-03 Thread andy
This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git

commit e26a2b3a8d02410d0e5a110b1bde7536799a3785
Author: Andy Seaborne 
AuthorDate: Thu May 2 11:30:51 2024 +0100

GH-2444: jena-fuseki-core to depend only the Jakarta servlet API
---
 jena-fuseki2/jena-fuseki-core/pom.xml | 23 +--
 jena-fuseki2/jena-fuseki-main/pom.xml | 15 +++
 pom.xml   | 10 ++
 3 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/jena-fuseki2/jena-fuseki-core/pom.xml 
b/jena-fuseki2/jena-fuseki-core/pom.xml
index 1602959e8c..525a37424e 100644
--- a/jena-fuseki2/jena-fuseki-core/pom.xml
+++ b/jena-fuseki2/jena-fuseki-core/pom.xml
@@ -76,20 +76,15 @@
   org.apache.commons
   commons-fileupload2-jakarta-servlet6
 
-
-
-  org.eclipse.jetty.ee10
-  jetty-ee10-servlet
-
-
-
-  org.eclipse.jetty.ee10
-  jetty-ee10-servlets
-
-
-
-  org.eclipse.jetty
-  jetty-security
+
+
+
+  jakarta.servlet
+  jakarta.servlet-api
 
 
 
diff --git a/jena-fuseki2/jena-fuseki-main/pom.xml 
b/jena-fuseki2/jena-fuseki-main/pom.xml
index 05cb5b05f1..b1852cffea 100644
--- a/jena-fuseki2/jena-fuseki-main/pom.xml
+++ b/jena-fuseki2/jena-fuseki-main/pom.xml
@@ -62,6 +62,21 @@
   5.1.0-SNAPSHOT
 
 
+
+  org.eclipse.jetty.ee10
+  jetty-ee10-servlet
+
+
+
+  org.eclipse.jetty.ee10
+  jetty-ee10-servlets
+
+
+
+  org.eclipse.jetty
+  jetty-security
+
+
 
 
   org.eclipse.jetty
diff --git a/pom.xml b/pom.xml
index 896d3e1c38..f96f85148c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,7 +65,10 @@
 1.4.0
 2.0.1
 
+
 12.0.8
+6.0.0
+
 2.0.0
 
 4.26.1
@@ -474,6 +477,13 @@
   
   
 
+  
+  
+jakarta.servlet
+jakarta.servlet-api
+${ver.jakarta-servlet}
+  
+
   
 org.eclipse.jetty
 jetty-bom



(jena) branch main updated (afc51dec52 -> b1eece1383)

2024-05-03 Thread andy
This is an automated email from the ASF dual-hosted git repository.

andy pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git


from afc51dec52 GH-2446: Lookup by proper name for javascript
 new e26a2b3a8d GH-2444: jena-fuseki-core to depend only the Jakarta 
servlet API
 new b1eece1383 GH-2443: Update CrossOriginFilter code

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 jena-fuseki2/jena-fuseki-core/pom.xml  |  23 +-
 .../jena/fuseki/servlets/CrossOriginFilter.java| 292 +++--
 jena-fuseki2/jena-fuseki-main/pom.xml  |  15 ++
 pom.xml|  10 +
 4 files changed, 309 insertions(+), 31 deletions(-)



(jena) 02/02: GH-2443: Update CrossOriginFilter code

2024-05-03 Thread andy
This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git

commit b1eece13838b9463f37e633afc184ad4c93779ea
Author: Andy Seaborne 
AuthorDate: Thu May 2 11:31:36 2024 +0100

GH-2443: Update CrossOriginFilter code
---
 .../jena/fuseki/servlets/CrossOriginFilter.java| 292 +++--
 1 file changed, 275 insertions(+), 17 deletions(-)

diff --git 
a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/CrossOriginFilter.java
 
b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/CrossOriginFilter.java
index 9b7abd08e8..305134f969 100644
--- 
a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/CrossOriginFilter.java
+++ 
b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/CrossOriginFilter.java
@@ -16,17 +16,21 @@
  * limitations under the License.
  */
 
-package org.apache.jena.fuseki.servlets;
-
-// This is a copy of Jetty's CrossOriginFilter - Fuseki needs something
-// that works without Jetty on the classpath when running as a WAR file.
-// Copy from Jetty 11.0.15
-// 
https://github.com/eclipse/jetty.project/blob/jetty-11.0.x/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/CrossOriginFilter.java
-// We elect to use and distribute under The Apache License v2.0.
-
-//Changes:
+// This is a copy of Eclipse Jetty's CrossOriginFilter. Fuseki needs something
+// that works without Jetty on the classpath.
+// jena-fuseki-core is neutral to the servlet server implementation choice.
+//
+// This is a copy from Jetty 12.0.8 (where it is deprecated in favour of 
CrossOriginHandler)
+// The license above applies only to local modifications.
+// Changes:
 //  * Package declaration
-//  * Functions from org.eclipse.jetty.utilStringUtil to make this class 
portable
+//  * Remove deprecation of CrossOriginFilter
+//  * Extract of from org.eclipse.jetty.util.StringUtil with the functions to 
make this file portable
+//
+// 
https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-ee10/jetty-ee10-servlets/src/main/java/org/eclipse/jetty/ee10/servlets/CrossOriginFilter.java
+// 
https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/StringUtil.java
+//
+// We elect to use and distribute under the Apache License v2.0.
 
 //
 // 
@@ -41,7 +45,7 @@ package org.apache.jena.fuseki.servlets;
 // 
 //
 
-//package org.eclipse.jetty.ee10.servlets;
+package org.apache.jena.fuseki.servlets;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -61,10 +65,6 @@ import jakarta.servlet.ServletRequest;
 import jakarta.servlet.ServletResponse;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
-import org.eclipse.jetty.http.HttpField;
-import org.eclipse.jetty.http.HttpHeader;
-import org.eclipse.jetty.http.PreEncodedHttpField;
-import org.eclipse.jetty.util.StringUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -150,6 +150,10 @@ import org.slf4j.LoggerFactory;
  * /web-app
  * 
  */
+/*
+ * @deprecated Use {@link org.eclipse.jetty.server.handler.CrossOriginHandler} 
instead
+ */
+//@Deprecated
 public class CrossOriginFilter implements Filter
 {
 private static final Logger LOG = 
LoggerFactory.getLogger(CrossOriginFilter.class);
@@ -182,7 +186,6 @@ public class CrossOriginFilter implements Filter
 private static final List SIMPLE_HTTP_METHODS = 
Arrays.asList("GET", "POST", "HEAD");
 private static final List DEFAULT_ALLOWED_METHODS = 
Arrays.asList("GET", "POST", "HEAD");
 private static final List DEFAULT_ALLOWED_HEADERS = 
Arrays.asList("X-Requested-With", "Content-Type", "Accept", "Origin");
-private static final HttpField VARY_ORIGIN = new 
PreEncodedHttpField(HttpHeader.VARY, HttpHeader.ORIGIN.asString());
 
 private boolean anyOriginAllowed;
 private boolean anyTimingOriginAllowed;
@@ -303,7 +306,7 @@ public class CrossOriginFilter implements Filter
 
 private void handle(HttpServletRequest request, HttpServletResponse 
response, FilterChain chain) throws IOException, ServletException
 {
-response.addHeader(VARY_ORIGIN.getName(), VARY_ORIGIN.getValue());
+response.addHeader("Vary", ORIGIN_HEADER);
 String origin = request.getHeader(ORIGIN_HEADER);
 // Is it a cross origin request ?
 if (origin != null && isEnabled(request))
@@ -537,3 +540,258 @@ public class CrossOriginFilter implements Filter
 allowCredentials = false;
 }
 }
+
+// Extract of org.eclipse.jetty.util.StringUtil (12.0.8) in support of the 
CORS filter above.
+class StringUtil {
+
+/**
+ * Replace chars within string.
+ * 
+ * Fast replacement for 

(jena) branch main updated: GH-2446: Lookup by proper name for javascript

2024-05-03 Thread andy
This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git


The following commit(s) were added to refs/heads/main by this push:
 new afc51dec52 GH-2446: Lookup by proper name for javascript
afc51dec52 is described below

commit afc51dec52508dff3a2da84a781c69d6af93810e
Author: Andy Seaborne 
AuthorDate: Thu May 2 13:35:42 2024 +0100

GH-2446: Lookup by proper name for javascript
---
 .../sparql/function/scripting/ScriptFunction.java  |  4 +-
 .../scripting/TestSPARQLCustomFunctions.java   | 46 --
 jena-arq/testing/ARQ/Scripting/manifest.ttl|  2 +-
 3 files changed, 4 insertions(+), 48 deletions(-)

diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/function/scripting/ScriptFunction.java
 
b/jena-arq/src/main/java/org/apache/jena/sparql/function/scripting/ScriptFunction.java
index 062c35bd30..8fafddbec5 100644
--- 
a/jena-arq/src/main/java/org/apache/jena/sparql/function/scripting/ScriptFunction.java
+++ 
b/jena-arq/src/main/java/org/apache/jena/sparql/function/scripting/ScriptFunction.java
@@ -126,6 +126,7 @@ public class ScriptFunction extends FunctionBase {
 //this.denyList = Set.of("eval", "exec");
 //check(lang, name, allowList, denyList);
 //break;
+// No other names allowed, not even synonyms.
 default:
 throw new ScriptDenyException("Language '"+lang+"' not 
recognized");
 }
@@ -197,7 +198,8 @@ public class ScriptFunction extends FunctionBase {
 }
 
 private Invocable createEngine() {
-ScriptEngine engine = scriptEngineManager.getEngineByName(lang);
+String lookupLang =  "js".equals(lang) ? "javascript" : lang;
+ScriptEngine engine = scriptEngineManager.getEngineByName(lookupLang);
 if (engine == null)
 throw new ExprException("Unknown scripting language: " + lang);
 // Enforce Nashorn compatibility for Graal.js
diff --git 
a/jena-arq/src/test/java/org/apache/jena/sparql/function/scripting/TestSPARQLCustomFunctions.java
 
b/jena-arq/src/test/java/org/apache/jena/sparql/function/scripting/TestSPARQLCustomFunctions.java
deleted file mode 100644
index 1ec0314388..00
--- 
a/jena-arq/src/test/java/org/apache/jena/sparql/function/scripting/TestSPARQLCustomFunctions.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.jena.sparql.function.scripting;
-
-import static org.apache.jena.sparql.function.scripting.TestScriptFunction.DIR;
-
-import org.apache.jena.query.ARQ;
-import org.apache.jena.query.Query;
-import org.apache.jena.query.QueryFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class TestSPARQLCustomFunctions {
-
-@BeforeClass public static void enableScripting() {
-System.setProperty(ARQ.systemPropertyScripting, "true");
-}
-
-@AfterClass public static void disableScripting() {
-System.clearProperty(ARQ.systemPropertyScripting);
-}
-
-@Test public void script_sparql_bad_1() {
-Query query = QueryFactory.read(DIR+"/js-query-5.rq");
-}
-
-
-
-}
diff --git a/jena-arq/testing/ARQ/Scripting/manifest.ttl 
b/jena-arq/testing/ARQ/Scripting/manifest.ttl
index 359d0f1132..aea79e4e84 100644
--- a/jena-arq/testing/ARQ/Scripting/manifest.ttl
+++ b/jena-arq/testing/ARQ/Scripting/manifest.ttl
@@ -47,5 +47,5 @@
   qt:data] ;
  mf:result  
   ]
-  ## js-query-5 is a build time error.
+  ## js-query-5 is an error and run separately.
 ).