Skip to content

Commit

Permalink
Merge branch 'master' into LDEV-4396-ArrayIndexOutOfBoundsException
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner authored Dec 18, 2023
2 parents d7d4df2 + 23e0dd3 commit ce99e90
Show file tree
Hide file tree
Showing 27 changed files with 137 additions and 20 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/main-5.4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# This workflow will build a Java project with Ant
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant

name: Java CI - Lucee 5.4

on: [push, pull_request, workflow_dispatch]

jobs:
build:

runs-on: ubuntu-latest
services:
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
env:
luceeVersion: light-5.4.3.2

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: lucee-script-runner-maven-cache
- name: Cache Lucee files
uses: actions/cache@v3
with:
path: _actions/lucee/script-runner/main/lucee-download-cache
key: lucee-downloads-${{ env.luceeVersion }}
restore-keys: |
lucee-downloads
- name: Build with Ant
run: ant -noinput -verbose -buildfile build.xml
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: redis-lex
path: dist/*.lex
- name: Checkout Lucee
uses: actions/checkout@v3
with:
repository: lucee/lucee
path: lucee
- name: Run Lucee Test Suite, labels="redis"
uses: lucee/script-runner@main
with:
webroot: ${{ github.workspace }}/lucee/test
execute: /bootstrap-tests.cfm
luceeVersion: ${{ env.luceeVersion }}
extensionDir: ${{ github.workspace }}/dist
extensions:
env:
testLabels: redis
testAdditional: ${{ github.workspace }}/tests
REDIS_PORT: 6379
REDIS_SERVER: localhost
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Ant
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant

name: Java CI
name: Java CI - Lucee 6

on: [push, pull_request, workflow_dispatch]

Expand All @@ -23,7 +23,7 @@ jobs:
# Maps port 6379 on service container to the host
- 6379:6379
env:
luceeVersion: light-6.0.0.300-SNAPSHOT
luceeVersion: light-6.0.0.451-BETA

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions build.number
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Fri Dec 16 09:13:01 CET 2022
build.number=49
#Fri Dec 15 16:39:37 CET 2023
build.number=57
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

bundlename: redis.extension
bundleversion: 3.0.0.
bundleversion_appendix:
bundleversion_appendix: -SNAPSHOT
codename: redis
camelname: Redis
author: Michael Offner
Expand Down
Binary file added source/java/lib/bouncycastle.mail-1.38.0.jar
Binary file not shown.
Binary file added source/java/lib/bouncycastle.prov-1.38.0.jar
Binary file not shown.
Binary file added source/java/lib/bouncycastle.tsp-1.38.0.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added source/java/lib/joda-convert-1.2.0.jar
Binary file not shown.
Binary file removed source/java/lib/joda-time-2.2.jar
Binary file not shown.
Binary file added source/java/lib/joda-time-2.8.1.jar
Binary file not shown.
Binary file removed source/java/lib/org.lucee.aws-core-1.12.348.jar
Binary file not shown.
Binary file not shown.
Binary file removed source/java/lib/org.lucee.aws-jmespath-1.12.348.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
15 changes: 11 additions & 4 deletions source/java/src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ Export-Package: lucee.extension.io.cache.redis,
lucee.extension.io.cache.redis.simple,
lucee.extension.io.cache.redis.udf
Bundle-ManifestVersion: 2
Require-Bundle: org.mongodb.bson;bundle-version=4.2.3,
org.apache.commons.commons-pool2;bundle-version=2.8.1,
org.lucee.aws-secretsmanager;bundle-version=1.12.348,
org.lucee.aws-core;bundle-version=1.12.348
Require-Bundle: org.lucee.aws-java-sdk-secretsmanager-all;bundle-version="[1.12.456,2)",
org.mongodb.bson;bundle-version="[4.2.3,5)",
org.apache.commons.commons-pool2;bundle-version="[2.8.1,3)",
com.fasterxml.jackson.core.jackson-annotations;bundle-version="[2.15.0,3)",
com.fasterxml.jackson.core.jackson-core;bundle-version="[2.15.0,3)",
com.fasterxml.jackson.core.jackson-databind;bundle-version="[2.15.0,3)",
com.fasterxml.jackson.dataformat.jackson-dataformat-cbor;bundle-version="[2.15.0,3)",
bouncycastle.prov;bundle-version="[1.38.0,2)",
bouncycastle.tsp;bundle-version="[1.38.0,2)",
bouncycastle.mail;bundle-version="[1.38.0,2)",
software.amazon.ion.java;bundle-version="[1.0.2,2)"
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ public RedisCache() {
}
}

public static void init(Config config, String[] cacheName, Struct[] arguments) {
// Not used at the moment
}

@Override
public void init(Config config, String cacheName, Struct arguments) throws IOException {
init(config, arguments);
Expand Down
16 changes: 14 additions & 2 deletions source/java/src/lucee/extension/io/cache/util/BSON.java
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,20 @@ private static Object evaluate(ClassLoader cl, byte[] data) throws IOException {
ois = new ObjectInputStreamImpl(cl, bais);
return ois.readObject();
}
catch (ClassNotFoundException e) {
throw CFMLEngineFactory.getInstance().getExceptionUtil().toIOException(e);
catch (ClassNotFoundException cnfe) {
String className = cnfe.getMessage();
if (!Util.isEmpty(className, true)) {
Class<?> clazz = CFMLEngineFactory.getInstance().getClassUtil().loadClass(className.trim());
bais = new ByteArrayInputStream(data);
ois = new ObjectInputStreamImpl(clazz.getClassLoader(), bais);
try {
return ois.readObject();
}
catch (ClassNotFoundException e) {
throw CFMLEngineFactory.getInstance().getExceptionUtil().toIOException(e);
}
}
throw CFMLEngineFactory.getInstance().getExceptionUtil().toIOException(cnfe);
}
finally {
Util.closeEL(ois);
Expand Down
41 changes: 36 additions & 5 deletions source/java/src/lucee/extension/io/cache/util/Coder.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,26 @@ public static Object evaluate(ClassLoader cl, byte[] data) throws IOException {
ois = new ObjectInputStreamImpl(cl, bais);
return ois.readObject();
}
catch (ClassNotFoundException cnfe) {
String className = cnfe.getMessage();
if (!Util.isEmpty(className, true)) {
Class<?> clazz = CFMLEngineFactory.getInstance().getClassUtil().loadClass(className.trim());
bais = new ByteArrayInputStream(data);
ois = new ObjectInputStreamImpl(clazz.getClassLoader(), bais);
try {
return ois.readObject();
}
catch (ClassNotFoundException e) {
throw CFMLEngineFactory.getInstance().getExceptionUtil().toIOException(e);
}
}
try {
return toString(data);
}
catch (Exception ee) {
throw CFMLEngineFactory.getInstance().getExceptionUtil().toIOException(cnfe);
}
}
// happens when the object is not ObjectOutputstream serialized
catch (Exception e) {
try {
Expand Down Expand Up @@ -144,15 +164,26 @@ public static Object decompress(ClassLoader cl, byte[] bytes) throws IOException
objectIn.close();
return val;
}
catch (ClassNotFoundException e) {
throw CFMLEngineFactory.getInstance().getExceptionUtil().toIOException(e);
catch (ClassNotFoundException cnfe) {
String className = cnfe.getMessage();
if (!Util.isEmpty(className, true)) {
Class<?> clazz = CFMLEngineFactory.getInstance().getClassUtil().loadClass(className.trim());
bais = new ByteArrayInputStream(bytes);
objectIn = new ObjectInputStreamImpl(clazz.getClassLoader(), bais);
try {
return objectIn.readObject();
}
catch (ClassNotFoundException e) {
throw CFMLEngineFactory.getInstance().getExceptionUtil().toIOException(e);
}
}

throw CFMLEngineFactory.getInstance().getExceptionUtil().toIOException(cnfe);
}
}

public static boolean isGzip(byte[] barr) throws IOException {
return barr.length > 2 && barr[0] == GZIP0 && barr[1] == GZIP1;

//
return barr != null && barr.length > 1 && barr[0] == GZIP0 && barr[1] == GZIP1;
}

}

0 comments on commit ce99e90

Please sign in to comment.