apache / apache/maven-surefire

[SUREFIRE-1496] Dump file error for java.lang.module.ResolutionException

Open
#2,589 6 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Stephen Colebourne](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=scolebourne@joda.org)** opened **[SUREFIRE-1496](https://issues.apache.org/jira/browse/SUREFIRE-1496?redirect=false)** and commented

Scenario:
* two JPMS modules `org.foo.a` and `org.foo.b`, both with module-info
* `org.foo.a` requires `org.foo.b`
* `org.foo.b` exports package `org.foo.b.c`
* `org.foo.a` contains a text file: src/main/resources/org/foo/b/c/Foo.txt
* when surefire is run on module `org.foo.a` a dump file error occurs:

 

```
Corrupted STDOUT by directly writing to native stream in forked JVM 1. Stream 'Error occurred during initialization of boot layer'.
java.lang.IllegalArgumentException: Stream stdin corrupted. Expected comma after third character in command 'Error occurred during initialization of boot layer'.
at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$OperationalData.(ForkClient.java:511)
at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.processLine(ForkClient.java:209)
at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.consumeLine(ForkClient.java:176)
at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.run(ThreadedStreamConsumer.java:88)
at java.base/java.lang.Thread.run(Thread.java:844)
Created on 2018-03-07T11:32:36.053
Corrupted STDOUT by directly writing to native stream in forked JVM 1. Stream 'java.lang.module.ResolutionException: Module org.foo.a contains package org.foo.b.c, module org.foo.b exports package org.foo.b.c to org.foo.a'. 
```

 

While the scenario is one that JPMS rejects, surefire should handle it better. The compiler compiles the code just fine because it doesn't see the resources as a package. Surefire is thus the first part of Maven that sees it as a "package" that clashes with the module org.foo.b.

Clearly, some part of surefire needs to be taught to about java.lang.module.ResolutionException, as the error is tricky to find/see because it is a dump file.

 

---

**Affects:** 2.21.0

3 votes, 6 watchers

Contributor guide

Open the contributing guide

Research direction

Reproduce the JPMS scenario with modules org.foo.a and org.foo.b, then inspect org.apache.maven.plugin.surefire.booterclient.output.ForkClient around lines 209 and 511, where the reported stream corruption is handled. Done means the ResolutionException is surfaced clearly instead of being misreported as a corrupted dump-file stream.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.