diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index f00fa12..d01e0f0 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,12 +1,24 @@
name: Java CI Combined
-on: [push, pull_request, workflow_dispatch]
+on:
+ push:
+ pull_request:
+ workflow_dispatch:
+ inputs:
+ lucee-versions:
+ description: 'JSON array of Lucee versions to test'
+ default: '["7.0/snapshot/light","7.0/stable/light","6.2/snapshot/light","6.2/stable/light"]'
+ dry-run:
+ description: 'Dry run - skip deploy to Maven'
+ type: boolean
+ default: false
jobs:
setup:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.VERSION }}
+ lucee-matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -31,6 +43,16 @@ jobs:
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
+ - name: Set Lucee test matrix
+ id: set-matrix
+ run: |
+ DEFAULT='["7.0/snapshot/light","7.0/stable/light","6.2/snapshot/light","6.2/stable/light"]'
+ MATRIX="${{ inputs.lucee-versions || '' }}"
+ if [ -z "$MATRIX" ]; then
+ MATRIX="$DEFAULT"
+ fi
+ echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
+
- name: Cache Lucee files
uses: actions/cache@v4
with:
@@ -43,23 +65,9 @@ jobs:
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- build-and-test:
+ build:
runs-on: ubuntu-latest
needs: setup
- env:
- testLabels: image
- testAdditional: ${{ github.workspace }}/tests
- LUCEE_TEST_VERSIONS_JAKARTA: ${{ vars.LUCEE_TEST_VERSIONS_JAKARTA }}
- strategy:
- fail-fast: false
- matrix:
- lucee: ${{ fromJSON(vars.LUCEE_TEST_VERSIONS_JAKARTA) }}
- java: [ 11, 21 ]
- services:
- minio:
- image: fclairamb/minio-github-actions
- ports:
- - 9000:9000
steps:
- uses: actions/checkout@v4
@@ -69,6 +77,14 @@ jobs:
java-version: '11'
distribution: 'adopt'
+ - name: Cache Maven packages
+ uses: actions/cache@v4
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+
- name: Build and Install with Maven
run: |
echo "------- Maven Install -------";
@@ -77,9 +93,31 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
- name: image-lex-${{ matrix.lucee.version }}-${{ matrix.java }}
+ name: image-lex
path: target/*.lex
+ test:
+ runs-on: ubuntu-latest
+ needs: [setup, build]
+ strategy:
+ fail-fast: false
+ matrix:
+ lucee: ${{ fromJSON(needs.setup.outputs.lucee-matrix) }}
+ java: [ 11, 21 ]
+ services:
+ minio:
+ image: fclairamb/minio-github-actions
+ ports:
+ - 9000:9000
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Download Artifact
+ uses: actions/download-artifact@v4
+ with:
+ name: image-lex
+ path: target
+
- name: Checkout Lucee
uses: actions/checkout@v4
with:
@@ -97,8 +135,7 @@ jobs:
with:
webroot: ${{ github.workspace }}/lucee/test
execute: /bootstrap-tests.cfm
- luceeVersion: ${{ matrix.lucee.version }}
- luceeVersionQuery: ${{ matrix.lucee.query }}
+ luceeVersion: ${{ matrix.lucee }}
extensionDir: ${{ github.workspace }}/target
env:
testLabels: image
@@ -108,8 +145,8 @@ jobs:
deploy:
runs-on: ubuntu-latest
- needs: [setup, build-and-test]
- if: always() && needs.build-and-test.result == 'success'
+ needs: [setup, test]
+ if: always() && needs.test.result == 'success' && github.ref == 'refs/heads/master' && !inputs.dry-run
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -146,4 +183,4 @@ jobs:
else
echo "------- Maven Deploy release on ${{ github.event_name }} -------";
mvn -B -e -f pom.xml clean deploy -DperformRelease=true --settings maven-settings.xml
- fi
\ No newline at end of file
+ fi
diff --git a/.gitignore b/.gitignore
index 7d46262..210a52a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,3 +28,4 @@ WEB-INF
*.iml
*.ipr
*.iws
+test-output/
diff --git a/source/java/src/org/lucee/extension/image/tag/jakarta/Image.java b/source/java/src/org/lucee/extension/image/tag/jakarta/Image.java
index 7c29dac..1c3c5e2 100644
--- a/source/java/src/org/lucee/extension/image/tag/jakarta/Image.java
+++ b/source/java/src/org/lucee/extension/image/tag/jakarta/Image.java
@@ -405,8 +405,11 @@ private String touchDestination() throws IOException, PageException {
destination = folder.getRealResource(name);
cleanOld(folder);
- // create path
- String cp = pageContext.getHttpServletRequest().getContextPath();
+ // create path (use reflection to avoid jakarta/javax bytecode binding)
+ Object req = eng.getClassUtil().callMethod(pageContext,
+ eng.getCastUtil().toKey("getHttpServletRequest"), new Object[] {});
+ String cp = (String) eng.getClassUtil().callMethod(req,
+ eng.getCastUtil().toKey("getContextPath"), new Object[] {});
if (eng.getStringUtil().isEmpty(cp))
cp = "";
return cp + "/lucee/graph.cfm?img=" + name + "&type="
diff --git a/source/java/src/org/lucee/extension/image/tag/javax/Image.java b/source/java/src/org/lucee/extension/image/tag/javax/Image.java
index ba896d2..094e4b1 100644
--- a/source/java/src/org/lucee/extension/image/tag/javax/Image.java
+++ b/source/java/src/org/lucee/extension/image/tag/javax/Image.java
@@ -365,8 +365,11 @@ private String touchDestination() throws IOException, PageException {
destination = folder.getRealResource(name);
cleanOld(folder);
- // create path
- String cp = pageContext.getHttpServletRequest().getContextPath();
+ // create path (use reflection to avoid jakarta/javax bytecode binding)
+ Object req = eng.getClassUtil().callMethod(pageContext,
+ eng.getCastUtil().toKey("getHttpServletRequest"), new Object[] {});
+ String cp = (String) eng.getClassUtil().callMethod(req,
+ eng.getCastUtil().toKey("getContextPath"), new Object[] {});
if (eng.getStringUtil().isEmpty(cp)) cp = "";
return cp + "/lucee/graph.cfm?img=" + name + "&type=" + (eng.getListUtil().last(ImageUtil.getMimeTypeFromFormat(format), "/", true).trim());
}
diff --git a/tests/LDEV6157.cfc b/tests/LDEV6157.cfc
new file mode 100644
index 0000000..56640ee
--- /dev/null
+++ b/tests/LDEV6157.cfc
@@ -0,0 +1,22 @@
+component extends="org.lucee.cfml.test.LuceeTestCase" labels="image" {
+
+ function run( testResults, testBox ) {
+ describe( "LDEV-6157 cfimage jakarta/javax compat", function() {
+
+ it( title="cfimage action=writeToBrowser should not throw jakarta error on Lucee 6", body=function() {
+ local.result = _internalRequest(
+ template: "#createURI( 'LDEV6157' )#/LDEV6157.cfm"
+ );
+ expect( result.filecontent.trim() ).toInclude( "
+