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

Report artifact info #75

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ private String isBadArtifact( Artifact a )
jarFile = new JarFile( f );
getLog().debug( f.getName() + " => " + f.getPath() );
byte[] magicAndClassFileVersion = new byte[8];
String artifactInfo = "(" + a.getGroupId() + ":" + a.getArtifactId() + ") ";
JAR: for ( Enumeration<JarEntry> e = jarFile.entries(); e.hasMoreElements(); )
{
JarEntry entry = e.nextElement();
Expand Down Expand Up @@ -349,7 +350,13 @@ private String isBadArtifact( Artifact a )

Matcher matcher = MULTIRELEASE.matcher( entry.getName() );

if ( matcher.matches() )
if ( MODULE_INFO_CLASS.equals( entry.getName() ) ) {
if ( major > maxJavaMajorVersionNumber ) {
getLog().warn( artifactInfo + "Invalid bytecodeVersion for " + MODULE_INFO_CLASS + ": expected "
+ maxJavaMajorVersionNumber + ", but was " + major);
}
}
else if ( matcher.matches() )
{
Integer expectedMajor = JDK_TO_MAJOR_VERSION_NUMBER_MAPPING.get( matcher.group( 1 ) );

Expand All @@ -359,8 +366,8 @@ private String isBadArtifact( Artifact a )
}
else if ( major != expectedMajor )
{
getLog().warn( "Invalid bytecodeVersion for " + a + " : "
+ entry.getName() + ": expected " + expectedMajor + ", but was " + major );
getLog().warn( artifactInfo + "Invalid bytecodeVersion for " + entry.getName() + ": expected "
+ expectedMajor + ", but was " + major );
}
}
else
Expand Down