Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
de69eeb
Changed to Junit5
michael-schnell Dec 23, 2023
39fae1a
Updated Maven Wrapper
michael-schnell Dec 23, 2023
680cc58
Code cleanup
michael-schnell Dec 23, 2023
fbeb560
Switched to Java 17 and added marshaller builder
michael-schnell Dec 26, 2023
be21ca2
Prepare next iteration
michael-schnell Dec 27, 2023
bc4e97a
Fixed Java version in doc
michael-schnell Dec 27, 2023
0dca9c3
Merge branch 'master' into develop
michael-schnell Jan 11, 2024
8c9033d
With Maven 3.9 `maven.config` requires each flag on a separate line
michael-schnell Jan 14, 2024
6ee8bea
Fixed missing https
michael-schnell Jan 14, 2024
d58b878
Added some more utility methods
michael-schnell Jan 21, 2024
e7ab6c3
Added new methods
michael-schnell Jan 21, 2024
c5039d0
Moved reader/writer methods into separate classes
michael-schnell Jan 21, 2024
0b8cc2b
Include Jandex index file into JAR
michael-schnell Jan 21, 2024
58bf72d
Updated build actions
michael-schnell Feb 10, 2024
268c554
Updated dependencies
michael-schnell Feb 10, 2024
a241a52
Added some classes from units4j to prepare archiving that project
michael-schnell Feb 11, 2024
b6787cd
Moved jandex dependent classes to separate package
michael-schnell Feb 11, 2024
5608c18
Added new locking methods
michael-schnell Mar 2, 2024
bb56b2a
Updated dependencies
michael-schnell Apr 1, 2025
fbf5e7d
Fixed Sonar issues
michael-schnell Apr 1, 2025
ea1cafa
Harmonized versions for Quarkus/SB3 integration
michael-schnell Apr 2, 2025
82c03fe
Added shared sonar config
michael-schnell Apr 4, 2025
d45ef33
Added release notes
michael-schnell Apr 17, 2025
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
10 changes: 5 additions & 5 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:

steps:
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
Expand All @@ -34,21 +34,21 @@ jobs:
run: java -version && ./mvnw -version && gpg --version

- name: Cache SonarCloud packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Maven packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.OSS_SONATYPE_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.OSS_SONATYPE_GPG_PASSPHRASE }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
!.gitkeep
!.mvn
!.github
!.sonarlint
!.devcontainer
target
META-INF
*.log
*.iml
pom.xml.versionsBackup
3 changes: 2 additions & 1 deletion .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
-s settings.xml
-s
settings.xml
5 changes: 5 additions & 0 deletions .sonarlint/connectedMode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sonarCloudOrganization": "fuinorg",
"projectKey": "org.fuin:utils4j",
"region": "EU"
}
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ A small Java library that contains several helpful utility classes.
[![Java Development Kit 17](https://img.shields.io/badge/JDK-17-green.svg)](https://openjdk.java.net/projects/jdk/17/)

## Versions
- 0.14.0 = See [release-notes](release-notes.md)
- 0.13.x (or later) = **Java 17**
- 0.12.0 = **Java 11** with new **jakarta** namespace
- 0.11.x = **Java 11** before namespace change from 'javax' to 'jakarta'
Expand Down Expand Up @@ -42,7 +43,7 @@ Directly create a URL using a utility method:
```Java
URL url = Utils4J.url("classpath:org/fuin/utils4j/test.properties");
```
A full example can be found here: [ClasspathURLExample.java](https://github.com/fuinorg/utils4j/blob/master/src/test/java/org/fuin/utils4j/examples/ClasspathURLExample.java)
A full example can be found here: [ClasspathURLExample.java](src/test/java/org/fuin/utils4j/examples/ClasspathURLExample.java)

If you register the URL stream handler, all URLs (no matter how they were constructed) will work:
```Java
Expand All @@ -63,7 +64,7 @@ a=1
b=1/2
c=1/2/3
```
A full example can be found here: [VariableResolverExample.java](https://github.com/fuinorg/utils4j/blob/master/src/test/java/org/fuin/utils4j/examples/VariableResolverExample.java)
A full example can be found here: [VariableResolverExample.java](src/test/java/org/fuin/utils4j/examples/VariableResolverExample.java)


### ZIP and UNZIP
Expand All @@ -74,7 +75,7 @@ final File zipFile = new File(Utils4J.getTempDir(), "myfile1.zip");
Utils4J.zipDir(zipDir, "abc/def", zipFile);
Utils4J.unzip(zipFile, Utils4J.getTempDir());
```
A full example can be found here: [ZipDirExample.java](https://github.com/fuinorg/utils4j/blob/master/src/test/java/org/fuin/utils4j/examples/ZipDirExample.java)
A full example can be found here: [ZipDirExample.java](src/test/java/org/fuin/utils4j/examples/ZipDirExample.java)


### Tracking changes of a list / map
Expand All @@ -87,8 +88,8 @@ System.out.println(trackingList.getDeleted());
System.out.println(trackingList.getAdded());
trackingList.revert();
```
A list example can be found here: [ChangeTrackingUniqueListExample.java](https://github.com/fuinorg/utils4j/blob/master/src/test/java/org/fuin/utils4j/examples/ChangeTrackingUniqueListExample.java)
A map example can be found here: [ChangeTrackingMapExample.java](https://github.com/fuinorg/utils4j/blob/master/src/test/java/org/fuin/utils4j/examples/ChangeTrackingMapExample.java)
A list example can be found here: [ChangeTrackingUniqueListExample.java](src/test/java/org/fuin/utils4j/examples/ChangeTrackingUniqueListExample.java)
A map example can be found here: [ChangeTrackingMapExample.java](src/test/java/org/fuin/utils4j/examples/ChangeTrackingMapExample.java)


### Easy file locking
Expand All @@ -101,7 +102,7 @@ try {
lock.release();
}
```
A full example can be found here: [LockFileExample.java](https://github.com/fuinorg/utils4j/blob/master/src/test/java/org/fuin/utils4j/examples/LockFileExample.java)
A full example can be found here: [LockFileExample.java](src/test/java/org/fuin/utils4j/examples/LockFileExample.java)


### Properties file preferences
Expand All @@ -110,7 +111,7 @@ Shows the use of a directory and properties file based [Preferences API](http://
System.setProperty("java.util.prefs.PreferencesFactory", PropertiesFilePreferencesFactory.class.getName());
Preferences userPrefs = Preferences.userRoot();
```
A full example can be found here: [PropertiesFilePreferencesFactoryExample.java](https://github.com/fuinorg/utils4j/blob/master/src/test/java/org/fuin/utils4j/examples/PropertiesFilePreferencesFactoryExample.java)
A full example can be found here: [PropertiesFilePreferencesFactoryExample.java](src/test/java/org/fuin/utils4j/examples/PropertiesFilePreferencesFactoryExample.java)


### JAXB CDATA Stream Writer
Expand Down Expand Up @@ -163,7 +164,7 @@ System.out.println(copy.getContent());
// <whatever this="is"/>
```

A full example can be found here: [CDataJaxbExample.java](https://github.com/fuinorg/utils4j/blob/master/src/test/java/org/fuin/utils4j/examples/CDataJaxbExample.java)
A full example can be found here: [CDataJaxbExample.java](src/test/java/org/fuin/utils4j/examples/CDataJaxbExample.java)

**Caution** - You must explicitly add the xml.bind-api dependency to your POM if you want to use this feature, because it's defined as optional here.

Expand All @@ -180,7 +181,7 @@ A full example can be found here: [CDataJaxbExample.java](https://github.com/fui

> :warning: Deprecated in favour of [Awaitility](https://github.com/awaitility/awaitility)

The [WaitHelper](https://github.com/fuinorg/utils4j/blob/master/src/main/java/org/fuin/utils4j/WaitHelper.java) class supports waiting for some condition.
The [WaitHelper](src/main/java/org/fuin/utils4j/WaitHelper.java) class supports waiting for some condition.

Example of waiting for a function to finish without an exception:
```Java
Expand Down Expand Up @@ -208,7 +209,7 @@ waitHelper.waitUntilResult(() -> {
}, Arrays.asList("Peter Parker, Inc"));
```

A full example can be found here: [WaitHelperExample.java](https://github.com/fuinorg/utils4j/blob/master/src/test/java/org/fuin/utils4j/examples/WaitHelperExample.java)
A full example can be found here: [WaitHelperExample.java](src/test/java/org/fuin/utils4j/examples/WaitHelperExample.java)


### Find all JARs and classes in the classpath
Expand All @@ -234,7 +235,7 @@ for (final File file : Utils4J.pathsFiles(System.getProperty("sun.boot.class.pat
System.out.println(file);
}
```
A full example can be found here: [FindJarsAndClassesInClasspath.java](https://github.com/fuinorg/utils4j/blob/master/src/test/java/org/fuin/utils4j/examples/FindJarsAndClassesInClasspath.java)
A full example can be found here: [FindJarsAndClassesInClasspath.java](src/test/java/org/fuin/utils4j/examples/FindJarsAndClassesInClasspath.java)

### Analyze classes in the classpath with Jandex
Easily find matching types from all classes or JAR files in the classpath using [Jandex](https://github.com/wildfly/jandex)
Expand All @@ -255,7 +256,7 @@ for (File file : knownFiles) {
System.out.println(file);
}
```
A test that shows the usage can be found here: [JandexUtilsTest](https://github.com/fuinorg/utils4j/blob/master/src/test/java/org/fuin/utils4j/JandexUtilsTest.java)
A test that shows the usage can be found here: [JandexUtilsTest](src/test/java/org/fuin/utils4j/jandex/JandexUtilsTest.java)

**Caution** - You must explicitly add the Jandex dependency to your POM if you want to use this feature, because it's defined as optional here.

Expand Down
40 changes: 31 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<artifactId>utils4j</artifactId>
<packaging>bundle</packaging>
<version>0.13.0</version>
<version>0.14.0-SNAPSHOT</version>
<description>A small Java library that contains several helpful utility classes.</description>
<url>http://www.fuin.org/utils4j/</url>

Expand Down Expand Up @@ -40,14 +40,14 @@
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>jandex</artifactId>
<version>3.1.6</version>
<version>3.2.7</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.1</version>
<version>4.0.2</version>
<optional>true</optional>
</dependency>

Expand All @@ -56,42 +56,42 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.1</version>
<version>5.10.5</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.24.2</version>
<version>3.26.3</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>3.15.4</version>
<version>3.19.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<version>2.8.2</version>
<version>2.10.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.15.1</version>
<version>2.18.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>4.0.4</version>
<version>4.0.5</version>
<scope>test</scope>
</dependency>

Expand All @@ -111,6 +111,14 @@
<artifactId>maven-source-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${argLine} -Duser.language=en -Duser.region=US</argLine>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand Down Expand Up @@ -141,6 +149,20 @@
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>io.smallrye</groupId>
<artifactId>jandex-maven-plugin</artifactId>
<version>3.0.6</version>
<executions>
<execution>
<id>make-index</id>
<goals>
<goal>jandex</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>

</build>
Expand Down
17 changes: 17 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Release Notes

## 0.14.0

### General
- Dependency updates
- New [MultipleCommands](src/main/java/org/fuin/utils4j/MultipleCommands.java) class
- New [TestCommand](src/main/java/org/fuin/utils4j/TestCommand.java) class
- New [TestOmitted](src/main/java/org/fuin/utils4j/TestOmitted.java) annotation

### Jandex
- [JandexUtils](src/main/java/org/fuin/utils4j/jandex/JandexUtils.java) moved to "jandex" subdirectory
- New [JandexIndexFileReader](src/main/java/org/fuin/utils4j/jandex/JandexIndexFileReader.java) and [JandexIndexFileWriter](src/main/java/org/fuin/utils4j/jandex/JandexIndexWriter.java)

### JAX-B
- [MarshallerBuilder](src/main/java/org/fuin/utils4j/jaxb/MarshallerBuilder.java)
- Several static methods in [JaxbUtils](src/main/java/org/fuin/utils4j/jaxb/JaxbUtils.java) are now deprecated in favour of [MarshallerBuilder](src/main/java/org/fuin/utils4j/jaxb/MarshallerBuilder.java) and [UnmarshallerBuilder](src/main/java/org/fuin/utils4j/jaxb/UnmarshallerBuilder.java)
2 changes: 1 addition & 1 deletion settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<pluginRepository>
<id>sonatype.oss.snapshots</id>
<name>Sonatype OSS Snapshot Repository</name>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/fuin/utils4j/ChangeTrackingMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public ChangeTrackingMap(final Map<K, V> map) {
* @return If elements have been added or deleted <code>true</code> else <code>false</code>.
*/
public final boolean isChanged() {
return (added.size() > 0) || (changed.size() > 0) || (removed.size() > 0);
return (!added.isEmpty()) || (changed.size() > 0) || (removed.size() > 0);
}

/**
Expand Down
Loading