Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ed1f2d3
fix flaky test
Sep 26, 2023
2a77632
Bump github/codeql-action from 2.21.8 to 2.21.9 in /.github/workflows
dependabot[bot] Sep 28, 2023
2ae937b
Bump mikepenz/action-junit-report in /.github/workflows
dependabot[bot] Oct 2, 2023
d3dc578
Bump commons-io:commons-io from 2.13.0 to 2.14.0
dependabot[bot] Oct 2, 2023
0b5f8a0
Create codeql.yml
joycebrum Sep 25, 2023
5b57b51
set top level permission to codeql.yml
joycebrum Sep 25, 2023
44bcd20
Update codeql.yml
joycebrum Sep 26, 2023
e0563ee
Fix some easy to fix CodeQL issues
haraldk Oct 3, 2023
ea9d1c0
Bump github/codeql-action from 2.21.8 to 2.21.9 in /.github/workflows
dependabot[bot] Oct 4, 2023
e73b0a7
Update ci.yml
haraldk Sep 20, 2023
b61341c
Testing JDK 21-ea
haraldk Sep 20, 2023
c22ada0
Replace some usages of ImageTypeSpecifier.createFromRenderedImage.
haraldk Oct 5, 2023
a5ee535
Added OpenSSF Best Practices badge.
haraldk Oct 5, 2023
80229b8
Minor code clean-up.
haraldk Oct 5, 2023
be34854
Fix possibly flaky test.
haraldk Oct 5, 2023
8bd3f4f
Badge reorganization.
haraldk Oct 5, 2023
f2cc9fa
Add maven-bundle-plugin to build to give jar files OSGi manifest head…
steinarb Aug 2, 2023
e65f471
Provide Require-Capability and Add-Capability headers for osgi.servic…
steinarb Aug 13, 2023
690cb06
Ignore eclipse .metadata directory
steinarb Aug 14, 2023
f0a032a
Add Require-Capability header requiring osgi.serviceloader.registrar …
steinarb Sep 17, 2023
a7ebd66
Export all TwelveMonkeys imageio SPI plugins using the osgi.servicelo…
steinarb Oct 5, 2023
cf35cb9
Merge branch 'master' into fixflakytest
prathyushreddylpr Oct 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
java: [ 8, 11, 17, 20 ]
java: [ 8, 11, 17, 20, 21-ea ]
runs-on: ${{ matrix.os }}
permissions:
checks: write
Expand All @@ -32,7 +32,7 @@ jobs:
- name: Run Tests
run: mvn --batch-mode --no-transfer-progress test
- name: Publish Test Report
uses: mikepenz/action-junit-report@75b84e78b3f0aaea7ed7cf8d1d100d7f97f963ec # v4.0.0
uses: mikepenz/action-junit-report@0a8a5ba57593d67b2e45de2c543b438412382b7b # v4.0.1
if: ${{ !cancelled() }}
with:
report_paths: "**/target/surefire-reports/TEST*.xml"
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Run Tests
run: mvn --batch-mode --no-transfer-progress test
- name: Publish Test Report
uses: mikepenz/action-junit-report@75b84e78b3f0aaea7ed7cf8d1d100d7f97f963ec # v4.0.0
uses: mikepenz/action-junit-report@0a8a5ba57593d67b2e45de2c543b438412382b7b # v4.0.1
if: ${{ !cancelled() }}
with:
report_paths: "**/target/surefire-reports/TEST*.xml"
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '26 13 * * 6'

permissions: {}

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'java' ]

steps:
- name: Checkout repository
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@ddccb873888234080b77e9bc2d4764d5ccaaccf9 # v2.21.9
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@ddccb873888234080b77e9bc2d4764d5ccaaccf9 # v2.21.9

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@ddccb873888234080b77e9bc2d4764d5ccaaccf9 # v2.21.9
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2.21.8
uses: github/codeql-action/upload-sarif@ddccb873888234080b77e9bc2d4764d5ccaaccf9 # v2.21.9
with:
sarif_file: results.sarif
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ private
profiles.xml
Thumbs.db
.DS_Store
/.metadata/
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
[![CI](https://github.com/haraldk/TwelveMonkeys/actions/workflows/ci.yml/badge.svg)](https://github.com/haraldk/TwelveMonkeys/actions/workflows/ci.yml)
[![CodeQL](https://github.com/haraldk/TwelveMonkeys/actions/workflows/codeql.yml/badge.svg)](https://github.com/haraldk/TwelveMonkeys/actions/workflows/codeql.yml)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/haraldk/TwelveMonkeys/badge)](https://securityscorecards.dev/viewer/?uri=github.com/haraldk/TwelveMonkeys)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/7900/badge)](https://www.bestpractices.dev/projects/7900)

[![Maven Central](https://img.shields.io/maven-central/v/com.twelvemonkeys.imageio/imageio?color=slateblue)](https://search.maven.org/search?q=g:com.twelvemonkeys.imageio)
[![Maven Snapshot](https://img.shields.io/nexus/s/com.twelvemonkeys.imageio/imageio?label=development&server=https%3A%2F%2Foss.sonatype.org&color=slateblue)](https://oss.sonatype.org/content/repositories/snapshots/com/twelvemonkeys/)
[![StackOverflow](https://img.shields.io/badge/stack_overflow-twelvemonkeys-orange.svg)](https://stackoverflow.com/questions/tagged/twelvemonkeys)
[![Donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://paypal.me/haraldk76/100)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/haraldk/TwelveMonkeys/badge)](https://securityscorecards.dev/viewer/?uri=github.com/haraldk/TwelveMonkeys)

![Logo](logo.png)

Expand Down
9 changes: 9 additions & 0 deletions common/common-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,13 @@
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
8 changes: 8 additions & 0 deletions common/common-io/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public class CompoundReader extends Reader {

private int currentReader;
private int markedReader;
private int mark;
private int mNext;
private long mark;
private long next;

/**
* Create a new compound reader.
Expand All @@ -76,7 +76,7 @@ public CompoundReader(final Iterator<Reader> pReaders) {
finalLock = pReaders; // NOTE: It's ok to sync on pReaders, as the
// reference can't change, only it's elements

readers = new ArrayList<Reader>();
readers = new ArrayList<>();

boolean markSupported = true;
while (pReaders.hasNext()) {
Expand All @@ -101,7 +101,7 @@ protected final Reader nextReader() {
}

// NOTE: Reset mNext for every reader, and record marked reader in mark/reset methods!
mNext = 0;
next = 0;
return current;
}

Expand Down Expand Up @@ -135,7 +135,7 @@ public void mark(int pReadLimit) throws IOException {

synchronized (finalLock) {
ensureOpen();
mark = mNext;
mark = next;
markedReader = currentReader;

current.mark(pReadLimit);
Expand All @@ -158,7 +158,7 @@ public void reset() throws IOException {
}
current.reset();

mNext = mark;
next = mark;
}
}

Expand All @@ -177,13 +177,13 @@ public int read() throws IOException {
return read(); // In case of 0-length readers
}

mNext++;
next++;

return read;
}
}

public int read(char pBuffer[], int pOffset, int pLength) throws IOException {
public int read(char[] pBuffer, int pOffset, int pLength) throws IOException {
synchronized (finalLock) {
int read = current.read(pBuffer, pOffset, pLength);

Expand All @@ -192,7 +192,7 @@ public int read(char pBuffer[], int pOffset, int pLength) throws IOException {
return read(pBuffer, pOffset, pLength); // In case of 0-length readers
}

mNext += read;
next += read;

return read;
}
Expand All @@ -213,7 +213,7 @@ public long skip(long pChars) throws IOException {
return skip(pChars); // In case of 0-length readers
}

mNext += skipped;
next += skipped;

return skipped;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public class StringArrayReader extends StringReader {
protected final Object finalLock;
private int currentSting;
private int markedString;
private int mark;
private int next;
private long mark;
private long next;

/**
* Create a new string array reader.
Expand Down Expand Up @@ -151,7 +151,7 @@ public int read() throws IOException {
}
}

public int read(char pBuffer[], int pOffset, int pLength) throws IOException {
public int read(char[] pBuffer, int pOffset, int pLength) throws IOException {
synchronized (finalLock) {
int read = current.read(pBuffer, pOffset, pLength);

Expand Down
8 changes: 8 additions & 0 deletions common/common-lang/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@
<project.jpms.module.name>com.twelvemonkeys.common.lang</project.jpms.module.name>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
9 changes: 9 additions & 0 deletions contrib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,13 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
14 changes: 13 additions & 1 deletion imageio/imageio-batik/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Provide-Capability>
osgi.serviceloader;
osgi.serviceloader=javax.imageio.spi.ImageReaderSpi
</Provide-Capability>
</instructions>
</configuration>
</plugin>
</plugins>
</build>

Expand All @@ -51,7 +63,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.13.0</version>
<version>2.14.0</version>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.twelvemonkeys.image.ImageUtil;
import com.twelvemonkeys.imageio.ImageReaderBase;
import com.twelvemonkeys.imageio.util.IIOUtil;
import com.twelvemonkeys.imageio.util.ImageTypeSpecifiers;
import com.twelvemonkeys.lang.StringUtil;

import org.apache.batik.anim.dom.SVGDOMImplementation;
Expand Down Expand Up @@ -249,7 +250,7 @@ public int getHeight(int imageIndex) throws IOException {
}

public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex) {
return Collections.singleton(ImageTypeSpecifier.createFromRenderedImage(rasterizer.createImage(1, 1))).iterator();
return Collections.singleton(ImageTypeSpecifiers.createFromRenderedImage(rasterizer.createImage(1, 1))).iterator();
}

/**
Expand Down
18 changes: 18 additions & 0 deletions imageio/imageio-bmp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,22 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Provide-Capability>
osgi.serviceloader;
osgi.serviceloader=javax.imageio.spi.ImageReaderSpi;
osgi.serviceloader=javax.imageio.spi.ImageWriterSpi
</Provide-Capability>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
9 changes: 9 additions & 0 deletions imageio/imageio-clippath/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,13 @@
<artifactId>imageio-metadata</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import com.twelvemonkeys.imageio.metadata.tiff.TIFFReader;
import com.twelvemonkeys.imageio.stream.ByteArrayImageInputStream;
import com.twelvemonkeys.imageio.stream.SubImageInputStream;
import com.twelvemonkeys.imageio.util.ImageTypeSpecifiers;

import javax.imageio.*;
import javax.imageio.metadata.IIOMetadata;
Expand Down Expand Up @@ -307,7 +308,7 @@ public static boolean writeClipped(final RenderedImage image, Shape clipPath, fi
throw new IllegalArgumentException("output == null!");
}

ImageTypeSpecifier type = ImageTypeSpecifier.createFromRenderedImage(image);
ImageTypeSpecifier type = ImageTypeSpecifiers.createFromRenderedImage(image);
Iterator<ImageWriter> writers = ImageIO.getImageWriters(type, formatName);

if (writers.hasNext()) {
Expand Down
16 changes: 16 additions & 0 deletions imageio/imageio-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,20 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Provide-Capability>
osgi.serviceloader;
osgi.serviceloader=javax.imageio.spi.ImageInputStreamSpi
</Provide-Capability>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading