Skip to content

Commit

Permalink
[MINDEXER-164] Fix IOOBEx on GAV remote repositories (#225)
Browse files Browse the repository at this point in the history
The exception can still happen if the local repository contains _remote.repository or similar files. Apparently, with Maven 3.0.x, maven creates these file to record where the file was resolved from.
  • Loading branch information
fawind authored and cstamas committed Jul 1, 2022
1 parent 4c3f705 commit d07fc69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ protected boolean isIndexable( File file )

return !filename.equals( "maven-metadata.xml" )
&& !( filename.startsWith( "maven-metadata-" ) && filename.endsWith( ".xml" ) )
&& !( filename.startsWith( "_" ) && filename.endsWith( ".repositories" ) )
// || filename.endsWith( "-javadoc.jar" )
// || filename.endsWith( "-javadocs.jar" )
// || filename.endsWith( "-sources.jar" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ else if ( s.endsWith( ".sha1" ) )
}

if ( s.endsWith( "maven-metadata.xml" )
|| ( fileName.startsWith( "maven-metadata-" ) && fileName.contains( ".xml" ) ) )
|| ( fileName.startsWith( "maven-metadata-" ) && fileName.contains( ".xml" ) )
|| ( fileName.startsWith( "_" ) && fileName.endsWith( ".repositories" ) ) )
{
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,10 @@ public void testGav()
assertNull( gav );
gav = gavCalculator.pathToGav( "/dev/mbien/hintmod/maven-metadata-local.xml" );
assertNull( gav );
gav = gavCalculator.pathToGav( "/dev/mbien/hintmod/1.0-SNAPSHOT/_remote.repositories" ); // causes MINDEXER-164
assertNull( gav );
gav = gavCalculator.pathToGav( "/dev/mbien/hintmod/1.0-SNAPSHOT/_maven.repositories" );
assertNull( gav );
}

public void testNegGav()
Expand Down

0 comments on commit d07fc69

Please sign in to comment.