You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by "Benoit Tellier (Jira)" <mi...@james.apache.org> on 2022/05/19 08:16:00 UTC
[jira] [Closed] (MIME4J-310) TextInputStream NoSuchMethodError under JDK8 starting with 0.8.5
[ https://issues.apache.org/jira/browse/MIME4J-310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benoit Tellier closed MIME4J-310.
---------------------------------
Resolution: Fixed
Fix pull request is merged
> TextInputStream NoSuchMethodError under JDK8 starting with 0.8.5
> ----------------------------------------------------------------
>
> Key: MIME4J-310
> URL: https://issues.apache.org/jira/browse/MIME4J-310
> Project: James Mime4j
> Issue Type: Bug
> Affects Versions: 0.8.5, 0.8.6
> Reporter: Kevin C. Dorff
> Priority: Critical
> Time Spent: 6h 10m
> Remaining Estimate: 0h
>
> We've been using apache-mime4j 0.8.4 with our *JDK8* application for some time without issue.
> While attempting to upgrade to apache-mime4j version 0.8.6 (and have verified the issue exists with 0.8.5) our application now fails quite a few tests that appear to be related to how the apache-mime4j jars are created.
> The following groovy script can be run run from *groovyconsole* to quickly demonstrate the issue if you are using JDK8 (I am running Zulu OpenJDK 1.8.0_192), tested with groovy 2.5.9, but the critical piece is JDK8
> Under JDK8, I can successfully run
>
> {noformat}
> @Grab(group='org.apache.james', module='apache-mime4j-core', version='0.8.4')
> @Grab(group='org.apache.james', module='apache-mime4j-dom', version='0.8.4')
> import org.apache.james.mime4j.field.address.DefaultAddressParser
> def address = DefaultAddressParser.DEFAULT.parseAddress( "email@addresss.com" );
> {noformat}
> but if I change the *@Grab*'s to either version 0.8.5 or 0.8.6 *(NOTE* you will need to restart groovyconsole if you change a *@Grab* version) I instead get
>
> {noformat}
> Exception thrown
> java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
> at org.apache.james.mime4j.io.TextInputStream.<init>(TextInputStream.java:49)
> at org.apache.james.mime4j.io.InputStreams.create(InputStreams.java:77)
> at org.apache.james.mime4j.field.address.DefaultAddressParser.parseAddress(DefaultAddressParser.java:51)
> at org.apache.james.mime4j.field.address.DefaultAddressParser.parseAddress(DefaultAddressParser.java:56)
> at org.apache.james.mime4j.field.address.AddressParser$parseAddress.call(Unknown Source)
> at ConsoleScript0.run(ConsoleScript0:4)
> {noformat}
> If I change my JDK to Zulu OpenJDK 11.0.13, the script works fine under all of 0.8.4, 0.8.5, and 0.8.6.
> After doing a bit of searching [I found this discussion|https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip] which seems to be related.
> The top answer seems to describe the problem and possible solutions. I believe the change would need to be implemented within apache-mime4j to remain JDK8-compatible. This is likely also an issue with JDK9 and JDK10.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)