Matthias Bläsing created MINDEXER-157:
-----------------------------------------

             Summary: After import all groups and root groups are inverted in 
the IndexingContext
                 Key: MINDEXER-157
                 URL: https://issues.apache.org/jira/browse/MINDEXER-157
             Project: Maven Indexer
          Issue Type: Improvement
            Reporter: Matthias Bläsing


I investigated a regression introduced into the NetBeans codebase by the update 
of maven indexer to 6.2.0 ([https://github.com/apache/netbeans/issues/4102)] It 
turned out, that maven indexer after loading the index needs to explicitly 
rebuild the group lists as they are not stored with the index any longer. 
Rebuilding on demand is not an option for us, so a solution using a cached 
version was tried.

The idea is, that after the index is updated, the current group lists will be 
dumped into cache files and when the index is loaded from scratch, that cache 
is used to initialize all groups and root groups. This seemed to work ok, but 
the results were strange - only the root groups were returned. Debugging 
showed, that the all groups list was very short (~950 groups for maven central) 
while the root groups list was very long (~66.000 groups for maven central). 
The opposite ratio was expected.

The issue can be traced into _DefaultIndexUpdater#loadIndexDirectory_ where 
_IndexingContext#replace_ is called with the with the wrong order or 
parameters. The declared method:
{code:java}
public interface IndexingContext {
    void replace( Directory directory, Set<String> allGroups, Set<String> 
rootGroups ) throws IOException;
}{code}
is called as:
{code:java}
    private Date loadIndexDirectory( final IndexUpdateRequest updateRequest, 
final ResourceFetcher fetcher,
                                     final boolean merge, final String 
remoteIndexFile )
        throws IOException
    {
        // ...
                updateRequest.getIndexingContext().replace( directory, 
rootGroups, allGroups );
        // ...
    }
{code}
The last two parameters need to be reversed.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to