aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultMetadataDiscoverer.java3
-rw-r--r--maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/lucene/LuceneRepositoryArtifactIndex.java19
2 files changed, 15 insertions, 7 deletions
diff --git a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultMetadataDiscoverer.java b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultMetadataDiscoverer.java
index 7755016c6..6aad837df 100644
--- a/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultMetadataDiscoverer.java
+++ b/maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultMetadataDiscoverer.java
@@ -151,11 +151,12 @@ public class DefaultMetadataDiscoverer
}
/**
- * Builds a RepositoryMetadata object from a Metadata object and its path
+ * Builds a RepositoryMetadata object from a Metadata object and its path.
*
* @param m Metadata
* @param metadataPath path
* @return RepositoryMetadata if the parameters represent one; null if not
+ * @todo should we just be using the path information, and loading it later when it is needed? (for reporting, etc)
*/
private RepositoryMetadata buildMetadata( Metadata m, String metadataPath )
{
diff --git a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/lucene/LuceneRepositoryArtifactIndex.java b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/lucene/LuceneRepositoryArtifactIndex.java
index 6307636c2..45aebae62 100644
--- a/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/lucene/LuceneRepositoryArtifactIndex.java
+++ b/maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/lucene/LuceneRepositoryArtifactIndex.java
@@ -94,10 +94,14 @@ public class LuceneRepositoryArtifactIndex
{
RepositoryIndexRecord record = (RepositoryIndexRecord) i.next();
- Document document = converter.convert( record );
- document.add( new Field( FLD_PK, record.getPrimaryKey(), Field.Store.NO, Field.Index.UN_TOKENIZED ) );
+ if ( record != null )
+ {
+ Document document = converter.convert( record );
+ document.add(
+ new Field( FLD_PK, record.getPrimaryKey(), Field.Store.NO, Field.Index.UN_TOKENIZED ) );
- indexWriter.addDocument( document );
+ indexWriter.addDocument( document );
+ }
}
}
catch ( IOException e )
@@ -128,7 +132,7 @@ public class LuceneRepositoryArtifactIndex
private Analyzer getAnalyzer()
{
- // TODO: investigate why changed in original!
+ // TODO: investigate why changed in original! Probably for MD5 and number querying.
return new StandardAnalyzer();
}
@@ -146,9 +150,12 @@ public class LuceneRepositoryArtifactIndex
{
RepositoryIndexRecord record = (RepositoryIndexRecord) artifacts.next();
- Term term = new Term( FLD_PK, record.getPrimaryKey() );
+ if ( record != null )
+ {
+ Term term = new Term( FLD_PK, record.getPrimaryKey() );
- indexReader.deleteDocuments( term );
+ indexReader.deleteDocuments( term );
+ }
}
}
finally