Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support commons-io 2.7 #168

Closed
Dichotomia opened this issue Jun 3, 2020 · 16 comments · Fixed by #169
Closed

Support commons-io 2.7 #168

Dichotomia opened this issue Jun 3, 2020 · 16 comments · Fixed by #169
Assignees
Milestone

Comments

@Dichotomia
Copy link

Released 28 May 2020: http://commons.apache.org/proper/commons-io/changes-report.html#a2.7

@uschindler
Copy link
Member

Thanks for the hint! I will check it for changes by API difference.

For now I would recommend to use signatures of version 2.6.

Uwe

@Dichotomia
Copy link
Author

I doesn't work with commons-io-unsafe-2.6

@uschindler
Copy link
Member

Why should it not work? There is no requirement to use the latest signatures file. Please give more details!

@Dichotomia
Copy link
Author

[ERROR] Failed to execute goal �[32mde.thetaphi:forbiddenapis:3.0:check�[m �[1m(check)�[m on project �[36mmac-bc360-custom�[m: �[1;31mParsing signatures failed: Method not found while parsing signature: org.apache.commons.io.output.ByteArrayOutputStream#toString()�[m -> �[1m[Help 1]�[m

@Dichotomia
Copy link
Author

I think that the method toString() has been deleted in commons-io 2.7

@Dichotomia
Copy link
Author

With the stack trace:
[ERROR] Failed to execute goal de.thetaphi:forbiddenapis:3.0:check (check) on project mac-bc360-custom: Parsing signatures failed: Method not found while parsing signature: org.apache.commons.io.output.ByteArrayOutputStream#toString() -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal de.thetaphi:forbiddenapis:3.0:check (check) on project mac-bc360-custom: Parsing signatures failed: Method not found while parsing signature: org.apache.commons.io.output.ByteArrayOutputStream#toString()
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Parsing signatures failed: Method not found while parsing signature: org.apache.commons.io.output.ByteArrayOutputStream#toString()
at de.thetaphi.forbiddenapis.maven.AbstractCheckMojo.execute (AbstractCheckMojo.java:432)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: de.thetaphi.forbiddenapis.ParseException: Method not found while parsing signature: org.apache.commons.io.output.ByteArrayOutputStream#toString()
at de.thetaphi.forbiddenapis.Signatures$UnresolvableReporting$1.parseFailed (Signatures.java:56)
at de.thetaphi.forbiddenapis.Signatures.addSignature (Signatures.java:202)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesFile (Signatures.java:302)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesStream (Signatures.java:268)
at de.thetaphi.forbiddenapis.Signatures.addBundledSignatures (Signatures.java:264)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesFile (Signatures.java:284)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesStream (Signatures.java:268)
at de.thetaphi.forbiddenapis.Signatures.addBundledSignatures (Signatures.java:264)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesFile (Signatures.java:284)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesStream (Signatures.java:268)
at de.thetaphi.forbiddenapis.Signatures.addBundledSignatures (Signatures.java:264)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesFile (Signatures.java:284)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesStream (Signatures.java:268)
at de.thetaphi.forbiddenapis.Signatures.addBundledSignatures (Signatures.java:264)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesFile (Signatures.java:284)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesStream (Signatures.java:268)
at de.thetaphi.forbiddenapis.Signatures.addBundledSignatures (Signatures.java:264)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesFile (Signatures.java:284)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesStream (Signatures.java:268)
at de.thetaphi.forbiddenapis.Signatures.addBundledSignatures (Signatures.java:264)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesFile (Signatures.java:284)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesStream (Signatures.java:268)
at de.thetaphi.forbiddenapis.Signatures.addBundledSignatures (Signatures.java:264)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesFile (Signatures.java:284)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesStream (Signatures.java:268)
at de.thetaphi.forbiddenapis.Signatures.addBundledSignatures (Signatures.java:264)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesFile (Signatures.java:284)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesStream (Signatures.java:268)
at de.thetaphi.forbiddenapis.Signatures.addBundledSignatures (Signatures.java:264)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesFile (Signatures.java:284)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesStream (Signatures.java:268)
at de.thetaphi.forbiddenapis.Signatures.addBundledSignatures (Signatures.java:264)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesFile (Signatures.java:284)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesStream (Signatures.java:268)
at de.thetaphi.forbiddenapis.Signatures.addBundledSignatures (Signatures.java:264)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesFile (Signatures.java:284)
at de.thetaphi.forbiddenapis.Signatures.parseSignaturesStream (Signatures.java:268)
at de.thetaphi.forbiddenapis.Signatures.addBundledSignatures (Signatures.java:264)
at de.thetaphi.forbiddenapis.Signatures.addBundledSignatures (Signatures.java:311)
at de.thetaphi.forbiddenapis.Checker.addBundledSignatures (Checker.java:317)
at de.thetaphi.forbiddenapis.maven.AbstractCheckMojo.execute (AbstractCheckMojo.java:393)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

@uschindler
Copy link
Member

Hi @Dichotomia thanks, this looks like the issue. What confuses me: I did not find any mentions about this in the release notes of 2.7. Was this metjod deprecated, otherwise it looks like a backwards-incompatible change in commons-io, breaking user updating. Of course they should have never used that method, as it does not use correct charset.

I'd suggest as a workaround to disable that it fails un unresolvable signatures.

@Dichotomia
Copy link
Author

Ok. I try to warn commons-io about it, because the version is marked as binary compatible.

Sorry, i didn't understand what the workaround is.

@uschindler
Copy link
Member

To get past the error in forbiddenapis, you can switch off this flag (set it to false): https://jenkins.thetaphi.de/job/Forbidden-APIs/javadoc/check-mojo.html#failOnUnresolvableSignatures

@Dichotomia
Copy link
Author

Ok thanks.

Issue in commons-io : https://issues.apache.org/jira/browse/IO-671

@uschindler
Copy link
Member

I found the issue: There is no binary incompatibility, the problem is that the method was moved to an abstract superclass in forbiddenapis. It's no longer directly inside ByteArrayOutputStream().

To fix this, I need to release a new signatures file for 2.7 (as proposed here), but on the other hand think about ways how to handle that in signatures files. Currently all signatures must resolve directly, there's no virtual method resolving introduced.

@uschindler uschindler self-assigned this Jun 3, 2020
@uschindler uschindler added this to the 3.1 milestone Jun 3, 2020
uschindler added a commit that referenced this issue Jun 3, 2020
…as there was an incompatible change; This also adds signatures for version 2.7.

TODO: Scan for other API differences (new methods) in 2.7 vs. 2.6
@uschindler
Copy link
Member

uschindler commented Jun 3, 2020

#169 is a quick fix for the issue, but I don't like it yet - as it has to enable ignoreUnresolvable for the very first commons-io-1.0 version signatures file.
Will sleep about it one more night.

@uschindler
Copy link
Member

I improved the situation a bit. It just adds @ignoreUnresolvable annotation to the ByteArrayOutputStream#toString() method. The new class AbstractByteArrayOutputStream is handled in signatures file for 2.7.

@uschindler uschindler modified the milestones: 3.1, 3.0.1 Jun 3, 2020
@uschindler
Copy link
Member

I scanned the API differences: https://commons.apache.org/proper/commons-io/japicmp.html

I found no other new methods taking default charsets, so PR #169 is the only change needed. My plan is to merge the PR tomorrow and target a bugfix 3.0.1 release, as this is an issue affecting all people who upgrade common-io, as not even older versions of signatures work.

For version 3.1, I will think about a better way to handle such issues. For deprecated signatures in the JDK it always uses @ignoreUnresolvable (but those are autogenerated, so there is no syntax checking needed), but I think at some point we will get commons-io 3.0 and there should be some way to be backwards compatible.

I tend to think about ignoring failures for all commons-io signatures at runtime only, but during "testing" of forbiddenapis, the check against the base version are "hard", so typos in signatures would fail forbiddenapis build and packaging.

@uschindler
Copy link
Member

uschindler commented Jun 3, 2020

Hi,
forbiddenapis 3.0.1 bugfix release was released on the Gradle Plugin Portal and Maven Central.
It supports commons-io 2.7.
Uwe

@Dichotomia
Copy link
Author

3.0.1 works.

Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants