Failing OpenmrsUtilTest in Tag 2.7.1 when running mvn clean package

I am trying to build openmrs-core at tag 2.7.1 (sha 78bb5ab6b8895dabc0aa67bf522decc81adfbcd3) but I am getting this test error

Update: 2.7.0 have the same issue.

File: /Users/wisam/Projects/openmrs/openmrs-core/api/target/surefire-reports/org.openmrs.util.OpenmrsUtilTest.txt

-------------------------------------------------------------------------------
Test set: org.openmrs.util.OpenmrsUtilTest
-------------------------------------------------------------------------------
Tests run: 61, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.247 s <<< FAILURE! -- in org.openmrs.util.OpenmrsUtilTest
org.openmrs.util.OpenmrsUtilTest.copyFile_shouldCopyInputstreamToOutputstreamAndCloseTheOutputstream -- Time elapsed: 0.042 s <<< ERROR!
java.lang.NullPointerException: Cannot read the array length because "this.buf" is null
	at java.base/java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:97)
	at java.base/java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:132)
	at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1486)
	at org.apache.commons.io.IOUtils.copy(IOUtils.java:1110)
	at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1458)
	at org.apache.commons.io.IOUtils.copy(IOUtils.java:1088)
	at org.openmrs.util.OpenmrsUtil.copyFile(OpenmrsUtil.java:285)
	at org.openmrs.util.OpenmrsUtilTest.copyFile_shouldCopyInputstreamToOutputstreamAndCloseTheOutputstream(OpenmrsUtilTest.java:765)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)

$ git status

HEAD detached at 2.7.1
nothing to commit, working tree clean

command: mvn clean package

[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   OpenmrsUtilTest.copyFile_shouldCopyInputstreamToOutputstreamAndCloseTheOutputstream:765 » NullPointer Cannot read the array length because "this.buf" is null
[INFO] 
[ERROR] Tests run: 4734, Failures: 0, Errors: 1, Skipped: 55
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for OpenMRS 2.7.1:
[INFO] 
[INFO] OpenMRS ............................................ SUCCESS [  0.661 s]
[INFO] openmrs-tools ...................................... SUCCESS [  0.394 s]
[INFO] openmrs-test ....................................... SUCCESS [  0.110 s]
[INFO] openmrs-api ........................................ FAILURE [04:42 min]
[INFO] openmrs-web ........................................ SKIPPED
[INFO] openmrs-webapp ..................................... SKIPPED
[INFO] openmrs-liquibase .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  04:44 min
[INFO] Finished at: 2025-01-21T05:58:15+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.2:test (default-test) on project openmrs-api: 
[ERROR] 
[ERROR] See /Users/wisam/Projects/openmrs/openmrs-core/api/target/surefire-reports for the individual test results.
[ERROR] See dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR] 

mvn --version

mvn --version
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: /opt/homebrew/Cellar/maven/3.9.9/libexec
Java version: 23.0.1, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk/23.0.1/libexec/openjdk.jdk/Contents/Home
Default locale: en_IQ, platform encoding: UTF-8
OS name: "mac os x", version: "15.2", arch: "aarch64", family: "mac"

Switch to Java 17

1 Like