fixed errors reported by Checkstyle
diff --git a/indexer-core/src/main/java/org/apache/maven/index/ArtifactAvailability.java b/indexer-core/src/main/java/org/apache/maven/index/ArtifactAvailability.java
index c0d2af2..60af75c 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/ArtifactAvailability.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/ArtifactAvailability.java
@@ -41,7 +41,7 @@
private final int n;
- private ArtifactAvailability( int n )
+ ArtifactAvailability( int n )
{
this.n = n;
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/ArtifactContext.java b/indexer-core/src/main/java/org/apache/maven/index/ArtifactContext.java
index 45c70ff..a720028 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/ArtifactContext.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/ArtifactContext.java
@@ -20,7 +20,6 @@
*/
import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
@@ -93,7 +92,7 @@
File pom = getPom();
if ( pom != null && pom.isFile() )
{
- try (InputStream inputStream = Files.newInputStream( pom.toPath() ))
+ try ( InputStream inputStream = Files.newInputStream( pom.toPath() ) )
{
return new MavenXpp3Reader().read( inputStream, false );
}
@@ -106,7 +105,7 @@
else if ( getArtifact() != null && getArtifact().isFile() )
{
File artifact = getArtifact();
- try(ZipHandle handle = ZipFacade.getZipHandle( artifact ))
+ try ( ZipHandle handle = ZipFacade.getZipHandle( artifact ) )
{
final String embeddedPomPath =
@@ -114,7 +113,7 @@
if ( handle.hasEntry( embeddedPomPath ) )
{
- try(InputStream inputStream = handle.getEntryContent( embeddedPomPath ))
+ try ( InputStream inputStream = handle.getEntryContent( embeddedPomPath ) )
{
return new MavenXpp3Reader().read( inputStream, false );
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java b/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java
index cadd0ad..7f75838 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfo.java
@@ -344,7 +344,8 @@
versionScheme = new GenericVersionScheme();
}
- public ArtifactInfo( String repository, String groupId, String artifactId, String version, String classifier, String extension )
+ public ArtifactInfo( String repository, String groupId, String artifactId, String version, String classifier,
+ String extension )
{
this();
this.repository = repository;
@@ -1062,43 +1063,53 @@
this.fields = fields;
}
- public String getBundleProvideCapability() {
+ public String getBundleProvideCapability()
+ {
return bundleProvideCapability;
}
- public void setBundleProvideCapability(String bundleProvideCapability) {
+ public void setBundleProvideCapability( String bundleProvideCapability )
+ {
this.bundleProvideCapability = bundleProvideCapability;
}
- public String getBundleRequireCapability() {
+ public String getBundleRequireCapability()
+ {
return bundleRequireCapability;
}
- public void setBundleRequireCapability(String bundleRequireCapability) {
+ public void setBundleRequireCapability( String bundleRequireCapability )
+ {
this.bundleRequireCapability = bundleRequireCapability;
}
- public String getSha256() {
+ public String getSha256()
+ {
return sha256;
}
- public void setSha256(String sha256) {
+ public void setSha256( String sha256 )
+ {
this.sha256 = sha256;
}
- public String getBundleFragmentHost() {
+ public String getBundleFragmentHost()
+ {
return bundleFragmentHost;
}
- public void setBundleFragmentHost(String bundleFragmentHost) {
+ public void setBundleFragmentHost( String bundleFragmentHost )
+ {
this.bundleFragmentHost = bundleFragmentHost;
}
- public String getBundleRequiredExecutionEnvironment() {
+ public String getBundleRequiredExecutionEnvironment()
+ {
return bundleRequiredExecutionEnvironment;
}
- public void setBundleRequiredExecutionEnvironment(String bundleRequiredExecutionEnvironment) {
+ public void setBundleRequiredExecutionEnvironment( String bundleRequiredExecutionEnvironment )
+ {
this.bundleRequiredExecutionEnvironment = bundleRequiredExecutionEnvironment;
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/DefaultArtifactContextProducer.java b/indexer-core/src/main/java/org/apache/maven/index/DefaultArtifactContextProducer.java
index 6e96222..79c55de 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/DefaultArtifactContextProducer.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/DefaultArtifactContextProducer.java
@@ -117,7 +117,8 @@
String classifier = gav.getClassifier();
- ArtifactInfo ai = new ArtifactInfo( context.getRepositoryId(), groupId, artifactId, version, classifier, gav.getExtension() );
+ ArtifactInfo ai =
+ new ArtifactInfo( context.getRepositoryId(), groupId, artifactId, version, classifier, gav.getExtension() );
// store extension if classifier is not empty
if ( !StringUtils.isEmpty( ai.getClassifier() ) )
diff --git a/indexer-core/src/main/java/org/apache/maven/index/DefaultIndexer.java b/indexer-core/src/main/java/org/apache/maven/index/DefaultIndexer.java
index d8b5500..36909b1 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/DefaultIndexer.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/DefaultIndexer.java
@@ -43,7 +43,6 @@
import org.apache.maven.index.expr.SearchTypedStringSearchExpression;
import org.apache.maven.index.expr.SourcedSearchExpression;
import org.apache.maven.index.util.IndexCreatorSorter;
-import org.codehaus.plexus.util.IOUtil;
/**
* A default {@link Indexer} implementation.
@@ -109,7 +108,7 @@
// Modifying
// ----------------------------------------------------------------------------
- public void addArtifactToIndex( ArtifactContext ac, IndexingContext context)
+ public void addArtifactToIndex( ArtifactContext ac, IndexingContext context )
throws IOException
{
if ( ac != null )
@@ -157,7 +156,7 @@
{
if ( request.getContexts().isEmpty() )
{
- return new FlatSearchResponse( request.getQuery(), 0, Collections.<ArtifactInfo> emptySet() );
+ return new FlatSearchResponse( request.getQuery(), 0, Collections.<ArtifactInfo>emptySet() );
}
else
{
@@ -183,7 +182,8 @@
{
if ( request.getContexts().isEmpty() )
{
- return new GroupedSearchResponse( request.getQuery(), 0, Collections.<String, ArtifactInfoGroup> emptyMap() );
+ return new GroupedSearchResponse( request.getQuery(), 0,
+ Collections.<String, ArtifactInfoGroup>emptyMap() );
}
else
{
@@ -199,7 +199,7 @@
public Collection<ArtifactInfo> identify( final File artifact, final Collection<IndexingContext> contexts )
throws IOException
{
- try (FileInputStream is = new FileInputStream( artifact ))
+ try ( FileInputStream is = new FileInputStream( artifact ) )
{
final MessageDigest sha1 = MessageDigest.getInstance( "SHA-1" );
final byte[] buff = new byte[4096];
@@ -259,7 +259,7 @@
public Query constructQuery( Field field, String expression, SearchType searchType )
throws IllegalArgumentException
{
- return constructQuery( field, new SearchTypedStringSearchExpression( expression, searchType ));
+ return constructQuery( field, new SearchTypedStringSearchExpression( expression, searchType ) );
}
// ==
diff --git a/indexer-core/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java b/indexer-core/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java
index 9b3249f..ba234eb 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java
@@ -140,7 +140,7 @@
for ( Object o : d.getFields() )
{
IndexableField f = (IndexableField) o;
- if ( f.fieldType().stored())
+ if ( f.fieldType().stored() )
{
result.put( f.name(), f.stringValue() );
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/DefaultIteratorResultSet.java b/indexer-core/src/main/java/org/apache/maven/index/DefaultIteratorResultSet.java
index c6a4e58..cb30ef3 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/DefaultIteratorResultSet.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/DefaultIteratorResultSet.java
@@ -96,7 +96,8 @@
this.starts = new int[contexts.size() + 1]; // build starts array
// this is good to do as we have NexusIndexMultiSearcher passed in contructor, so it is already open, hence
// #acquire() already invoked on underlying NexusIndexMultiReader
- final List<IndexSearcher> acquiredSearchers = indexSearcher.getNexusIndexMultiReader().getAcquiredSearchers();
+ final List<IndexSearcher> acquiredSearchers =
+ indexSearcher.getNexusIndexMultiReader().getAcquiredSearchers();
for ( int i = 0; i < contexts.size(); i++ )
{
starts[i] = maxDoc;
@@ -115,7 +116,8 @@
for ( MatchHighlightRequest hr : request.getMatchHighlightRequests() )
{
Query rewrittenQuery = hr.getQuery().rewrite( indexSearcher.getIndexReader() );
- matchHighlightRequests.add( new MatchHighlightRequest( hr.getField(), rewrittenQuery, hr.getHighlightMode() ) );
+ matchHighlightRequests.add( new MatchHighlightRequest( hr.getField(), rewrittenQuery,
+ hr.getHighlightMode() ) );
}
this.hits = hits;
@@ -369,7 +371,7 @@
Analyzer analyzer = context.getAnalyzer();
TokenStream baseTokenStream = analyzer.tokenStream( field.getKey(), new StringReader( text ) );
- CachingTokenFilter tokenStream = new CachingTokenFilter(baseTokenStream);
+ CachingTokenFilter tokenStream = new CachingTokenFilter( baseTokenStream );
Formatter formatter = null;
diff --git a/indexer-core/src/main/java/org/apache/maven/index/DefaultQueryCreator.java b/indexer-core/src/main/java/org/apache/maven/index/DefaultQueryCreator.java
index 4900bac..63a2196 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/DefaultQueryCreator.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/DefaultQueryCreator.java
@@ -34,7 +34,6 @@
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.WildcardQuery;
-import org.apache.lucene.util.Version;
import org.apache.maven.index.context.NexusAnalyzer;
import org.apache.maven.index.creator.JarFileContentsIndexCreator;
import org.apache.maven.index.creator.MinimalArtifactInfoIndexCreator;
@@ -150,8 +149,8 @@
{
if ( query.contains( "*" ) && query.matches( ".*(\\.|-|_).*" ) )
{
- query =
- query.toLowerCase().replaceAll( "\\*", "X" ).replaceAll( "\\.|-|_", " " ).replaceAll( "X", "*" );
+ query = query.toLowerCase().replaceAll( "\\*", "X" ).replaceAll( "\\.|-|_", " " ).replaceAll( "X",
+ "*" );
}
}
@@ -184,10 +183,8 @@
{
if ( indexerField == null )
{
- getLogger().warn(
- "Querying for field \""
- + field.toString()
- + "\" without any indexer field was tried. Please review your code, and consider adding this field to index!" );
+ getLogger().warn( "Querying for field \"" + field.toString() + "\" without any indexer field was tried. "
+ + "Please review your code, and consider adding this field to index!" );
return null;
}
@@ -243,7 +240,8 @@
type.toString()
+ " type of querying for non-keyword (but stored) field "
+ indexerField.getOntology().toString()
- + " was tried. Please review your code, or indexCreator involved, since this type of querying of this field is currently unsupported." );
+ + " was tried. Please review your code, or indexCreator involved, "
+ + "since this type of querying of this field is currently unsupported." );
// will never succeed (unless we supply him "filter" too, but that would kill performance)
// and is possible with stored fields only
@@ -256,7 +254,8 @@
type.toString()
+ " type of querying for non-keyword (and not stored) field "
+ indexerField.getOntology().toString()
- + " was tried. Please review your code, or indexCreator involved, since this type of querying of this field is impossible." );
+ + " was tried. Please review your code, or indexCreator involved, "
+ + "since this type of querying of this field is impossible." );
// not a keyword indexerField, nor stored. No hope at all. Impossible even with "filtering"
return null;
@@ -463,7 +462,7 @@
{
try
{
- TokenStream ts = nexusAnalyzer.tokenStream(indexerField.getKey(), new StringReader(query));
+ TokenStream ts = nexusAnalyzer.tokenStream( indexerField.getKey(), new StringReader( query ) );
ts.reset();
int result = 0;
diff --git a/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java b/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java
index 8767dbf..a9ca2c7 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/DefaultScannerListener.java
@@ -212,11 +212,11 @@
try
{
final IndexReader r = indexSearcher.getIndexReader();
- Bits liveDocs = MultiFields.getLiveDocs(r);
+ Bits liveDocs = MultiFields.getLiveDocs( r );
for ( int i = 0; i < r.maxDoc(); i++ )
{
- if (liveDocs == null || liveDocs.get(i) )
+ if ( liveDocs == null || liveDocs.get( i ) )
{
Document d = r.document( i );
diff --git a/indexer-core/src/main/java/org/apache/maven/index/DefaultSearchEngine.java b/indexer-core/src/main/java/org/apache/maven/index/DefaultSearchEngine.java
index 4bef62b..b74302f 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/DefaultSearchEngine.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/DefaultSearchEngine.java
@@ -355,9 +355,9 @@
// warn the user and leave trace just before OOM might happen
// the hits.getTotalHits() might be HUUGE
getLogger().debug(
- "Executing unbounded search, and fitting topHitCounts to "
- + topHitCount
- + ", an OOMEx might follow. To avoid OOM use narrower queries or limit your expectancy with request.setCount() method where appropriate. See MINDEXER-14 for details." );
+ "Executing unbounded search, and fitting topHitCounts to " + topHitCount
+ + ", an OOMEx might follow. To avoid OOM use narrower queries or limit your expectancy with "
+ + "request.setCount() method where appropriate. See MINDEXER-14 for details." );
}
// redo all, but this time with correct numbers
diff --git a/indexer-core/src/main/java/org/apache/maven/index/Indexer.java b/indexer-core/src/main/java/org/apache/maven/index/Indexer.java
index db56179..64ccda1 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/Indexer.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/Indexer.java
@@ -1,19 +1,5 @@
package org.apache.maven.index;
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.lucene.search.Query;
-import org.apache.maven.index.context.ContextMemberProvider;
-import org.apache.maven.index.context.ExistingLuceneIndexMismatchException;
-import org.apache.maven.index.context.IndexCreator;
-import org.apache.maven.index.context.IndexingContext;
-import org.apache.maven.index.expr.SearchExpression;
-import org.apache.maven.index.expr.SourcedSearchExpression;
-import org.apache.maven.index.expr.UserInputSearchExpression;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -33,6 +19,20 @@
* under the License.
*/
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.lucene.search.Query;
+import org.apache.maven.index.context.ContextMemberProvider;
+import org.apache.maven.index.context.ExistingLuceneIndexMismatchException;
+import org.apache.maven.index.context.IndexCreator;
+import org.apache.maven.index.context.IndexingContext;
+import org.apache.maven.index.expr.SearchExpression;
+import org.apache.maven.index.expr.SourcedSearchExpression;
+import org.apache.maven.index.expr.UserInputSearchExpression;
+
/**
* Indexer component. It is the main component of Maven Indexer, offering {@link IndexingContext} creation and close
* methods, context maintenance (scan, add, remove) and search methods. Supersedes the {@link NexusIndexer} component,
@@ -231,5 +231,6 @@
* @return
* @throws IllegalArgumentException
*/
- Query constructQuery( Field field, String expression, SearchType searchType) throws IllegalArgumentException;
+ Query constructQuery( Field field, String expression, SearchType searchType )
+ throws IllegalArgumentException;
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/IteratorSearchResponse.java b/indexer-core/src/main/java/org/apache/maven/index/IteratorSearchResponse.java
index 83e3fd7..cbd55a1 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/IteratorSearchResponse.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/IteratorSearchResponse.java
@@ -122,7 +122,9 @@
/**
* Too many search response.
*
- * @deprecated Left here for backward compatibility, but since version 4.1.0 (see MINDEXER-14) there is NO notion of "hit limit" anymore.
+ * @deprecated Left here for backward compatibility, but since version 4.1.0 (see MINDEXER-14) there is NO notion of
+ * "hit limit" anymore.
*/
- public static final IteratorSearchResponse TOO_MANY_HITS_ITERATOR_SEARCH_RESPONSE = new IteratorSearchResponse( null, -1, EMPTY_ITERATOR_RESULT_SET );
+ public static final IteratorSearchResponse TOO_MANY_HITS_ITERATOR_SEARCH_RESPONSE =
+ new IteratorSearchResponse( null, -1, EMPTY_ITERATOR_RESULT_SET );
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/OSGI.java b/indexer-core/src/main/java/org/apache/maven/index/OSGI.java
index 9e145d5..9dc681c 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/OSGI.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/OSGI.java
@@ -61,12 +61,14 @@
Field REQUIRE_BUNDLE = new Field( null, OSGI_NAMESPACE, "requireBundle", "Require-Bundle" );
/**
- * used by OSGI resolvers to determine which bundles / artifacts / environments, etc. can satisfy a given requirement.
- * It replaces headers like Export-Service and Required Execution Environment, and uses the default OSGI header format
+ * used by OSGI resolvers to determine which bundles / artifacts / environments, etc. can satisfy a given
+ * requirement. It replaces headers like Export-Service and Required Execution Environment, and uses the default
+ * OSGI header format
*
* @since 5.1.2
*/
- final Field PROVIDE_CAPABILITY = new Field(null, OSGI_NAMESPACE, "provideCapability", "Bundle Provide-Capability");
+ Field PROVIDE_CAPABILITY =
+ new Field( null, OSGI_NAMESPACE, "provideCapability", "Bundle Provide-Capability" );
/**
* used by OSGI resolvers to indicate which services, features, etc are required by a given .
@@ -74,28 +76,29 @@
*
* @since 5.1.2
*/
- final Field REQUIRE_CAPABILITY = new Field(null, OSGI_NAMESPACE, "requireCapability", "Bundle Require-Capability");
+ Field REQUIRE_CAPABILITY =
+ new Field( null, OSGI_NAMESPACE, "requireCapability", "Bundle Require-Capability" );
/**
* used to hold the SHA256 checksum required as identifier for OSGI Content resources.
*
* @since 5.1.2
*/
- final Field SHA256 = new Field(null, OSGI_NAMESPACE, "sha256", "SHA-256 checksum");
+ Field SHA256 = new Field( null, OSGI_NAMESPACE, "sha256", "SHA-256 checksum" );
/**
* used to hold the Fragment Host header for an OSGI Fragment bundle.
*
* @since 5.1.2
*/
- final Field FRAGMENT_HOST = new Field(null, OSGI_NAMESPACE, "fragmentHost", "Bundle Fragment-Host");
+ Field FRAGMENT_HOST = new Field( null, OSGI_NAMESPACE, "fragmentHost", "Bundle Fragment-Host" );
/**
* used to hold the Fragment Host header for an OSGI Fragment bundle.
*
* @since 5.1.2
*/
- final Field BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT = new Field(null, OSGI_NAMESPACE, "bree",
- "Bundle Required Execution Environment");
+ Field BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT =
+ new Field( null, OSGI_NAMESPACE, "bree", "Bundle Required Execution Environment" );
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/archetype/AbstractArchetypeDataSource.java b/indexer-core/src/main/java/org/apache/maven/index/archetype/AbstractArchetypeDataSource.java
index d71f446..3ecb0c9 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/archetype/AbstractArchetypeDataSource.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/archetype/AbstractArchetypeDataSource.java
@@ -68,7 +68,8 @@
try
{
final Map<String, String> repositories = getRepositoryMap();
- final Query pq = indexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression( "maven-archetype" ) );
+ final Query pq =
+ indexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression( "maven-archetype" ) );
final FlatSearchRequest searchRequest = new FlatSearchRequest( pq );
searchRequest.setContexts( getIndexingContexts() );
final FlatSearchResponse searchResponse = indexer.searchFlat( searchRequest );
diff --git a/indexer-core/src/main/java/org/apache/maven/index/artifact/DefaultArtifactPackagingMapper.java b/indexer-core/src/main/java/org/apache/maven/index/artifact/DefaultArtifactPackagingMapper.java
index dd02e25..79201d3 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/artifact/DefaultArtifactPackagingMapper.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/artifact/DefaultArtifactPackagingMapper.java
@@ -28,7 +28,6 @@
import java.util.Map;
import java.util.Properties;
-import org.codehaus.plexus.util.IOUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,25 +57,25 @@
private volatile Map<String, String> packaging2extensionMapping;
- private final static Map<String, String> defaults;
+ private static final Map<String, String> DEFAULTS;
static
{
- defaults = new HashMap<String, String>();
- defaults.put( "ejb-client", "jar" );
- defaults.put( "ejb", "jar" );
- defaults.put( "rar", "jar" );
- defaults.put( "par", "jar" );
- defaults.put( "maven-plugin", "jar" );
- defaults.put( "maven-archetype", "jar" );
- defaults.put( "plexus-application", "jar" );
- defaults.put( "eclipse-plugin", "jar" );
- defaults.put( "eclipse-feature", "jar" );
- defaults.put( "eclipse-application", "zip" );
- defaults.put( "nexus-plugin", "jar" );
- defaults.put( "java-source", "jar" );
- defaults.put( "javadoc", "jar" );
- defaults.put( "test-jar", "jar" );
+ DEFAULTS = new HashMap<String, String>();
+ DEFAULTS.put( "ejb-client", "jar" );
+ DEFAULTS.put( "ejb", "jar" );
+ DEFAULTS.put( "rar", "jar" );
+ DEFAULTS.put( "par", "jar" );
+ DEFAULTS.put( "maven-plugin", "jar" );
+ DEFAULTS.put( "maven-archetype", "jar" );
+ DEFAULTS.put( "plexus-application", "jar" );
+ DEFAULTS.put( "eclipse-plugin", "jar" );
+ DEFAULTS.put( "eclipse-feature", "jar" );
+ DEFAULTS.put( "eclipse-application", "zip" );
+ DEFAULTS.put( "nexus-plugin", "jar" );
+ DEFAULTS.put( "java-source", "jar" );
+ DEFAULTS.put( "javadoc", "jar" );
+ DEFAULTS.put( "test-jar", "jar" );
}
public void setPropertiesFile( File propertiesFile )
@@ -96,7 +95,7 @@
packaging2extensionMapping = new HashMap<String, String>();
// merge defaults
- packaging2extensionMapping.putAll( defaults );
+ packaging2extensionMapping.putAll( DEFAULTS );
if ( propertiesFile != null && propertiesFile.exists() )
{
@@ -104,7 +103,7 @@
Properties userMappings = new Properties();
- try (FileInputStream fis= new FileInputStream( propertiesFile ))
+ try ( FileInputStream fis = new FileInputStream( propertiesFile ) )
{
userMappings.load( fis );
@@ -149,7 +148,7 @@
public Map<String, String> getDefaults()
{
- return defaults;
+ return DEFAULTS;
}
public String getExtensionForPackaging( String packaging )
diff --git a/indexer-core/src/main/java/org/apache/maven/index/artifact/M1GavCalculator.java b/indexer-core/src/main/java/org/apache/maven/index/artifact/M1GavCalculator.java
index c871b90..faf564a 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/artifact/M1GavCalculator.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/artifact/M1GavCalculator.java
@@ -31,14 +31,15 @@
* @author Tamas Cservenak
*/
@Singleton
-@Named ("maven1")
+@Named( "maven1" )
public class M1GavCalculator
implements GavCalculator
{
- private static final Pattern pat1 = Pattern.compile( "^([^0-9]+)-([0-9].+)\\.([^0-9]+)(\\.md5|\\.sha1){0,1}$" );
+ private static final Pattern PAT1 = Pattern.compile( "^([^0-9]+)-([0-9].+)\\.([^0-9]+)(\\.md5|\\.sha1){0,1}$" );
- private static final Pattern pat2 = Pattern.compile( "^([a-z0-9-_]+)-([0-9-].+)\\.([^0-9]+)(\\.md5|\\.sha1){0,1}$" );
+ private static final Pattern PAT2 =
+ Pattern.compile( "^([a-z0-9-_]+)-([0-9-].+)\\.([^0-9]+)(\\.md5|\\.sha1){0,1}$" );
public Gav pathToGav( String str )
{
@@ -101,7 +102,7 @@
String ext = s.substring( s.lastIndexOf( '.' ) + 1 );
- Matcher m = pat1.matcher( n );
+ Matcher m = PAT1.matcher( n );
if ( m.matches() )
{
String a = m.group( 1 );
@@ -116,7 +117,7 @@
}
else
{
- m = pat2.matcher( n );
+ m = PAT2.matcher( n );
if ( m.matches() )
{
String a = m.group( 1 );
diff --git a/indexer-core/src/main/java/org/apache/maven/index/artifact/M2GavCalculator.java b/indexer-core/src/main/java/org/apache/maven/index/artifact/M2GavCalculator.java
index dd8defe..7356d19 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/artifact/M2GavCalculator.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/artifact/M2GavCalculator.java
@@ -31,7 +31,7 @@
* @author Tamas Cservenak
*/
@Singleton
-@Named ("maven2")
+@Named( "maven2" )
public class M2GavCalculator
implements GavCalculator
{
diff --git a/indexer-core/src/main/java/org/apache/maven/index/artifact/VersionUtils.java b/indexer-core/src/main/java/org/apache/maven/index/artifact/VersionUtils.java
index 8ae6b02..6637be3 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/artifact/VersionUtils.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/artifact/VersionUtils.java
@@ -27,7 +27,7 @@
public class VersionUtils
{
- private static String SNAPSHOT_VERSION = "SNAPSHOT";
+ private static final String SNAPSHOT_VERSION = "SNAPSHOT";
private static final Pattern VERSION_FILE_PATTERN =
Pattern.compile(
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/DefaultIndexingContext.java b/indexer-core/src/main/java/org/apache/maven/index/context/DefaultIndexingContext.java
index 9a01d4c..6a092c1 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/DefaultIndexingContext.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/DefaultIndexingContext.java
@@ -180,8 +180,8 @@
List<? extends IndexCreator> indexCreators, boolean reclaimIndex )
throws IOException, ExistingLuceneIndexMismatchException
{
- this( id, repositoryId, repository, indexDirectoryFile, new TrackingLockFactory( FSLockFactory.getDefault() ),
- repositoryUrl, indexUpdateUrl, indexCreators, reclaimIndex );
+ this( id, repositoryId, repository, indexDirectoryFile, new TrackingLockFactory( FSLockFactory.getDefault() ),
+ repositoryUrl, indexUpdateUrl, indexCreators, reclaimIndex );
}
@Deprecated
@@ -190,11 +190,12 @@
List<? extends IndexCreator> indexCreators, boolean reclaimIndex )
throws IOException, ExistingLuceneIndexMismatchException
{
- this( id, repositoryId, repository, repositoryUrl, indexUpdateUrl, indexCreators, indexDirectory, null, reclaimIndex ); //Lock factory already installed - pass null
+ this( id, repositoryId, repository, repositoryUrl, indexUpdateUrl, indexCreators, indexDirectory, null,
+ reclaimIndex ); // Lock factory already installed - pass null
if ( indexDirectory instanceof FSDirectory )
{
- setIndexDirectoryFile(( (FSDirectory) indexDirectory ).getDirectory().toFile() );
+ setIndexDirectoryFile( ( (FSDirectory) indexDirectory ).getDirectory().toFile() );
}
}
@@ -207,7 +208,8 @@
* Sets index location. As usually index is persistent (is on disk), this will point to that value, but in
* some circumstances (ie, using RAMDisk for index), this will point to an existing tmp directory.
*/
- protected void setIndexDirectoryFile(File dir) throws IOException
+ protected void setIndexDirectoryFile( File dir )
+ throws IOException
{
if ( dir == null )
{
@@ -363,7 +365,8 @@
hdr.add( new Field( FLD_DESCRIPTOR, FLD_DESCRIPTOR_CONTENTS, Field.Store.YES, Field.Index.NOT_ANALYZED ) );
- hdr.add( new Field( FLD_IDXINFO, VERSION + ArtifactInfo.FS + getRepositoryId(), Field.Store.YES, Field.Index.NO ) );
+ hdr.add( new Field( FLD_IDXINFO, VERSION + ArtifactInfo.FS + getRepositoryId(), Field.Store.YES,
+ Field.Index.NO ) );
IndexWriter w = getIndexWriter();
@@ -382,11 +385,12 @@
if ( names != null )
{
- for (String name : names)
+ for ( String name : names )
{
- if (! (name.equals(INDEX_PACKER_PROPERTIES_FILE) || name.equals(INDEX_UPDATER_PROPERTIES_FILE) ))
+ if ( !( name.equals( INDEX_PACKER_PROPERTIES_FILE )
+ || name.equals( INDEX_UPDATER_PROPERTIES_FILE ) ) )
{
- indexDirectory.deleteFile(name);
+ indexDirectory.deleteFile( name );
}
}
}
@@ -669,10 +673,10 @@
{
int numDocs = directoryReader.maxDoc();
- Bits liveDocs = MultiFields.getLiveDocs(directoryReader);
+ Bits liveDocs = MultiFields.getLiveDocs( directoryReader );
for ( int i = 0; i < numDocs; i++ )
{
- if (liveDocs != null && ! liveDocs.get(i) )
+ if ( liveDocs != null && !liveDocs.get( i ) )
{
continue;
}
@@ -774,11 +778,11 @@
Set<String> allGroups = new LinkedHashSet<String>();
int numDocs = r.maxDoc();
- Bits liveDocs = MultiFields.getLiveDocs(r);
+ Bits liveDocs = MultiFields.getLiveDocs( r );
for ( int i = 0; i < numDocs; i++ )
{
- if (liveDocs != null && !liveDocs.get(i) )
+ if ( liveDocs != null && !liveDocs.get( i ) )
{
continue;
}
@@ -885,41 +889,54 @@
return id + " : " + timestamp;
}
- private static void unlockForcibly( final TrackingLockFactory lockFactory, final Directory dir ) throws IOException
+ private static void unlockForcibly( final TrackingLockFactory lockFactory, final Directory dir )
+ throws IOException
{
//Warning: Not doable in lucene >= 5.3 consider to remove it as IndexWriter.unlock
//was always strongly non recommended by Lucene.
//For now try to do the best to simulate the IndexWriter.unlock at least on FSDirectory
//using FSLockFactory, the RAMDirectory uses SingleInstanceLockFactory.
//custom lock factory?
- if (lockFactory != null) {
- final Set<? extends Lock> emittedLocks = lockFactory.getEmittedLocks(IndexWriter.WRITE_LOCK_NAME);
- for (Lock emittedLock : emittedLocks) {
+ if ( lockFactory != null )
+ {
+ final Set<? extends Lock> emittedLocks = lockFactory.getEmittedLocks( IndexWriter.WRITE_LOCK_NAME );
+ for ( Lock emittedLock : emittedLocks )
+ {
emittedLock.close();
}
}
- if (dir instanceof FSDirectory) {
+ if ( dir instanceof FSDirectory )
+ {
final FSDirectory fsdir = (FSDirectory) dir;
final Path dirPath = fsdir.getDirectory();
- if (Files.isDirectory(dirPath)) {
- Path lockPath = dirPath.resolve(IndexWriter.WRITE_LOCK_NAME);
- try {
+ if ( Files.isDirectory( dirPath ) )
+ {
+ Path lockPath = dirPath.resolve( IndexWriter.WRITE_LOCK_NAME );
+ try
+ {
lockPath = lockPath.toRealPath();
- } catch (IOException ioe) {
- //Not locked
+ }
+ catch ( IOException ioe )
+ {
+ // Not locked
return;
}
- try (final FileChannel fc = FileChannel.open(lockPath, StandardOpenOption.CREATE, StandardOpenOption.WRITE)) {
+ try ( final FileChannel fc =
+ FileChannel.open( lockPath, StandardOpenOption.CREATE, StandardOpenOption.WRITE ) )
+ {
final FileLock lck = fc.tryLock();
- if (lck == null) {
- //Still active
- throw new LockObtainFailedException("Lock held by another process: " + lockPath);
- } else {
- //Not held fine to release
+ if ( lck == null )
+ {
+ // Still active
+ throw new LockObtainFailedException( "Lock held by another process: " + lockPath );
+ }
+ else
+ {
+ // Not held fine to release
lck.close();
}
}
- Files.delete(lockPath);
+ Files.delete( lockPath );
}
}
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/ExistingLuceneIndexMismatchException.java b/indexer-core/src/main/java/org/apache/maven/index/context/ExistingLuceneIndexMismatchException.java
index a1822bf..973a566 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/ExistingLuceneIndexMismatchException.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/ExistingLuceneIndexMismatchException.java
@@ -1,7 +1,5 @@
package org.apache.maven.index.context;
-import java.io.IOException;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -21,6 +19,8 @@
* under the License.
*/
+import java.io.IOException;
+
/**
* Thrown when a user tries to create a NexusInder IndexingContext over and existing Lucene index, and there is a
* mismatch. The reason for mismatch may be multiple: non-NexusIndexer Lucene index (basically missing the descriptor
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/IndexUtils.java b/indexer-core/src/main/java/org/apache/maven/index/context/IndexUtils.java
index 7e68e1f..cd676ff 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/IndexUtils.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/IndexUtils.java
@@ -75,9 +75,9 @@
{
try
{
- source.fileLength( srcName ); // instead of fileExists
+ source.fileLength( srcName ); // instead of fileExists
}
- catch (FileNotFoundException | NoSuchFileException e)
+ catch ( FileNotFoundException | NoSuchFileException e )
{
return false;
}
@@ -102,7 +102,7 @@
// Add minimal information to the artifact info linking it to the context it belongs to.
try
{
- artifactInfo.setRepository(context.getRepositoryId());
+ artifactInfo.setRepository( context.getRepositoryId() );
}
catch ( UnsupportedOperationException e )
{
@@ -110,7 +110,7 @@
}
try
{
- artifactInfo.setContext(context.getId());
+ artifactInfo.setContext( context.getId() );
}
catch ( Exception e )
{
@@ -132,12 +132,14 @@
public static Document updateDocument( Document doc, IndexingContext context, boolean updateLastModified )
{
- return updateDocument(doc, context, updateLastModified, null);
+ return updateDocument( doc, context, updateLastModified, null );
}
- public static Document updateDocument( Document doc, IndexingContext context, boolean updateLastModified, ArtifactInfo ai )
+ public static Document updateDocument( Document doc, IndexingContext context, boolean updateLastModified,
+ ArtifactInfo ai )
{
- if( ai == null ) {
+ if ( ai == null )
+ {
ai = constructArtifactInfo( doc, context );
if ( ai == null )
{
@@ -174,7 +176,7 @@
{
directory.deleteFile( TIMESTAMP_FILE );
}
- catch (FileNotFoundException | NoSuchFileException e)
+ catch ( FileNotFoundException | NoSuchFileException e )
{
//Does not exist
}
@@ -191,7 +193,7 @@
{
deleteTimestamp( directory );
- IndexOutput io = directory.createOutput( TIMESTAMP_FILE, IOContext.DEFAULT);
+ IndexOutput io = directory.createOutput( TIMESTAMP_FILE, IOContext.DEFAULT );
try
{
@@ -210,13 +212,17 @@
synchronized ( directory )
{
Date result = null;
- try (IndexInput ii = directory.openInput( TIMESTAMP_FILE, IOContext.DEFAULT)) {
- result = new Date( ii.readLong() );
- } catch (FileNotFoundException | NoSuchFileException e) {
- //Does not exist
- } catch ( IOException ex )
+ try ( IndexInput ii = directory.openInput( TIMESTAMP_FILE, IOContext.DEFAULT ) )
{
- //IO failure
+ result = new Date( ii.readLong() );
+ }
+ catch ( FileNotFoundException | NoSuchFileException e )
+ {
+ // Does not exist
+ }
+ catch ( IOException ex )
+ {
+ // IO failure
}
return result;
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/MergedIndexingContext.java b/indexer-core/src/main/java/org/apache/maven/index/context/MergedIndexingContext.java
index 82cb3ab..f842959 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/MergedIndexingContext.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/MergedIndexingContext.java
@@ -79,7 +79,8 @@
boolean searchable, ContextMemberProvider membersProvider )
throws IOException
{
- this( membersProvider, id, repositoryId, repository, FSDirectory.open( indexDirectoryFile.toPath() ), searchable );
+ this( membersProvider, id, repositoryId, repository, FSDirectory.open( indexDirectoryFile.toPath() ),
+ searchable );
setIndexDirectoryFile( indexDirectoryFile );
}
@@ -302,7 +303,8 @@
* Sets index location. As usually index is persistent (is on disk), this will point to that value, but in
* some circumstances (ie, using RAMDisk for index), this will point to an existing tmp directory.
*/
- protected void setIndexDirectoryFile(File dir) throws IOException
+ protected void setIndexDirectoryFile( File dir )
+ throws IOException
{
if ( dir == null )
{
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/NexusAnalyzer.java b/indexer-core/src/main/java/org/apache/maven/index/context/NexusAnalyzer.java
index 45be8b7..b5f49b1 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/NexusAnalyzer.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/NexusAnalyzer.java
@@ -19,12 +19,9 @@
* under the License.
*/
-import java.io.Reader;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.AnalyzerWrapper;
-import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.util.CharTokenizer;
-import org.apache.lucene.util.Version;
import org.apache.maven.index.creator.JarFileContentsIndexCreator;
/**
@@ -39,29 +36,30 @@
extends AnalyzerWrapper
{
private static final Analyzer CLASS_NAMES_ANALYZER = new Analyzer()
- {
+ {
@Override
- protected TokenStreamComponents createComponents(String fieldName)
+ protected TokenStreamComponents createComponents( String fieldName )
{
- return new TokenStreamComponents(new DeprecatedClassnamesTokenizer());
+ return new TokenStreamComponents( new DeprecatedClassnamesTokenizer() );
}
};
+
private static final Analyzer LETTER_OR_DIGIT_ANALYZER = new Analyzer()
{
@Override
- protected TokenStreamComponents createComponents(String filedName)
+ protected TokenStreamComponents createComponents( String filedName )
{
- return new TokenStreamComponents(new LetterOrDigitTokenizer());
+ return new TokenStreamComponents( new LetterOrDigitTokenizer() );
}
};
public NexusAnalyzer()
{
- super(PER_FIELD_REUSE_STRATEGY);
+ super( PER_FIELD_REUSE_STRATEGY );
}
@Override
- protected Analyzer getWrappedAnalyzer(String fieldName)
+ protected Analyzer getWrappedAnalyzer( String fieldName )
{
if ( JarFileContentsIndexCreator.FLD_CLASSNAMES_KW.getKey().equals( fieldName ) )
{
@@ -85,7 +83,7 @@
}
@Override
- protected boolean isTokenChar(int i)
+ protected boolean isTokenChar( int i )
{
return true;
}
@@ -101,15 +99,15 @@
}
@Override
- protected boolean isTokenChar(int i)
+ protected boolean isTokenChar( int i )
{
return i != '\n';
}
@Override
- protected int normalize(int c)
+ protected int normalize( int c )
{
- return Character.toLowerCase(c);
+ return Character.toLowerCase( c );
}
}
@@ -122,15 +120,15 @@
}
@Override
- protected boolean isTokenChar(int c)
+ protected boolean isTokenChar( int c )
{
return Character.isLetterOrDigit( c );
}
@Override
- protected int normalize(int c)
+ protected int normalize( int c )
{
- return Character.toLowerCase(c);
+ return Character.toLowerCase( c );
}
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/NexusIndexMultiReader.java b/indexer-core/src/main/java/org/apache/maven/index/context/NexusIndexMultiReader.java
index e8e6b38..44bc696 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/NexusIndexMultiReader.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/NexusIndexMultiReader.java
@@ -75,7 +75,8 @@
if ( ic.hasNext() || is.hasNext() )
{
- throw new IllegalStateException( "Context and IndexSearcher mismatch: " + contexts + " vs " + searchers );
+ throw new IllegalStateException( "Context and IndexSearcher mismatch: " + contexts + " vs "
+ + searchers );
}
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/NexusIndexWriter.java b/indexer-core/src/main/java/org/apache/maven/index/context/NexusIndexWriter.java
index 90c975f..eb2246b 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/NexusIndexWriter.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/NexusIndexWriter.java
@@ -25,7 +25,6 @@
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.index.SerialMergeScheduler;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.LockObtainFailedException;
@@ -38,15 +37,16 @@
public class NexusIndexWriter
extends IndexWriter
{
- public interface IndexWriterConfigFactory {
- IndexWriterConfig create(Analyzer analyzer);
+ public interface IndexWriterConfigFactory
+ {
+ IndexWriterConfig create( Analyzer analyzer );
}
@Deprecated
public NexusIndexWriter( final Directory directory, final Analyzer analyzer, boolean create )
throws CorruptIndexException, LockObtainFailedException, IOException
{
- this(directory, new IndexWriterConfig(analyzer));
+ this( directory, new IndexWriterConfig( analyzer ) );
}
public NexusIndexWriter( final Directory directory, final IndexWriterConfig config )
@@ -63,7 +63,7 @@
// default open mode is CreateOrAppend which suits us
config.setRAMBufferSizeMB( 2.0 ); // old default
config.setMergeScheduler( new SerialMergeScheduler() ); // merging serially
- config.setWriteLockTimeout(IndexWriterConfig.WRITE_LOCK_TIMEOUT);
+ config.setWriteLockTimeout( IndexWriterConfig.WRITE_LOCK_TIMEOUT );
return config;
}
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/NexusLegacyAnalyzer.java b/indexer-core/src/main/java/org/apache/maven/index/context/NexusLegacyAnalyzer.java
index 305baa1..4cb15ce 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/NexusLegacyAnalyzer.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/NexusLegacyAnalyzer.java
@@ -19,7 +19,6 @@
* under the License.
*/
-
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.AnalyzerWrapper;
import org.apache.lucene.analysis.util.CharTokenizer;
@@ -37,39 +36,42 @@
extends AnalyzerWrapper
{
private static final Analyzer DEFAULT_ANALYZER = new StandardAnalyzer();
- private static final Analyzer LETTER_OR_DIGIT_ANALYZER = new Analyzer() {
+
+ private static final Analyzer LETTER_OR_DIGIT_ANALYZER = new Analyzer()
+ {
@Override
- protected TokenStreamComponents createComponents(final String fieldName)
+ protected TokenStreamComponents createComponents( final String fieldName )
{
- return new TokenStreamComponents(new CharTokenizer()
+ return new TokenStreamComponents( new CharTokenizer()
{
@Override
- protected boolean isTokenChar(int c )
+ protected boolean isTokenChar( int c )
{
return Character.isLetterOrDigit( c );
}
@Override
- protected int normalize(int c )
+ protected int normalize( int c )
{
return Character.toLowerCase( c );
}
- });
+ } );
}
};
public NexusLegacyAnalyzer()
{
- super(PER_FIELD_REUSE_STRATEGY);
+ super( PER_FIELD_REUSE_STRATEGY );
}
@Override
- protected Analyzer getWrappedAnalyzer(String fieldName)
+ protected Analyzer getWrappedAnalyzer( String fieldName )
{
- if (!isTextField( fieldName ))
+ if ( !isTextField( fieldName ) )
{
return LETTER_OR_DIGIT_ANALYZER;
- } else
+ }
+ else
{
return DEFAULT_ANALYZER;
}
@@ -79,6 +81,5 @@
{
return ArtifactInfo.NAME.equals( field ) || ArtifactInfo.DESCRIPTION.equals( field )
|| ArtifactInfo.NAMES.equals( field );
-
}
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/TrackingLockFactory.java b/indexer-core/src/main/java/org/apache/maven/index/context/TrackingLockFactory.java
index ead848b..9bc6a02 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/TrackingLockFactory.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/TrackingLockFactory.java
@@ -1,3 +1,5 @@
+package org.apache.maven.index.context;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -16,7 +18,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.maven.index.context;
import java.io.IOException;
import java.util.Collections;
@@ -32,62 +33,78 @@
*
* @author Tomas Zezula
*/
-final class TrackingLockFactory extends LockFactory {
+final class TrackingLockFactory
+ extends LockFactory
+{
private final LockFactory delegate;
+
private final Set<TrackingLock> emittedLocks;
- TrackingLockFactory(final LockFactory delegate) {
- this.delegate = checkNotNull(delegate);
- this.emittedLocks = Collections.newSetFromMap(new ConcurrentHashMap<TrackingLock,Boolean>());
+ TrackingLockFactory( final LockFactory delegate )
+ {
+ this.delegate = checkNotNull( delegate );
+ this.emittedLocks = Collections.newSetFromMap( new ConcurrentHashMap<TrackingLock, Boolean>() );
}
- Set<? extends Lock> getEmittedLocks(String name) {
+ Set<? extends Lock> getEmittedLocks( String name )
+ {
final Set<Lock> result = new HashSet<>();
- for (TrackingLock lock : emittedLocks) {
- if (name == null || name.equals(lock.getName())) {
- result.add(lock);
+ for ( TrackingLock lock : emittedLocks )
+ {
+ if ( name == null || name.equals( lock.getName() ) )
+ {
+ result.add( lock );
}
}
return result;
}
@Override
- public Lock obtainLock(Directory dir, String lockName) throws IOException {
- final TrackingLock lck = new TrackingLock(
- delegate.obtainLock(dir, lockName),
- lockName);
- emittedLocks.add(lck);
+ public Lock obtainLock( Directory dir, String lockName )
+ throws IOException
+ {
+ final TrackingLock lck = new TrackingLock( delegate.obtainLock( dir, lockName ), lockName );
+ emittedLocks.add( lck );
return lck;
}
-
- private final class TrackingLock extends Lock {
+ private final class TrackingLock
+ extends Lock
+ {
private final Lock delegate;
+
private final String name;
- TrackingLock(
- final Lock delegate,
- final String name) {
- this.delegate = checkNotNull(delegate);
- this.name = checkNotNull(name);
+ TrackingLock( final Lock delegate, final String name )
+ {
+ this.delegate = checkNotNull( delegate );
+ this.name = checkNotNull( name );
}
- String getName() {
+ String getName()
+ {
return name;
}
@Override
- public void close() throws IOException {
- try {
+ public void close()
+ throws IOException
+ {
+ try
+ {
delegate.close();
- } finally {
- emittedLocks.remove(this);
+ }
+ finally
+ {
+ emittedLocks.remove( this );
}
}
@Override
- public void ensureValid() throws IOException {
+ public void ensureValid()
+ throws IOException
+ {
delegate.ensureValid();
}
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/context/UnsupportedExistingLuceneIndexException.java b/indexer-core/src/main/java/org/apache/maven/index/context/UnsupportedExistingLuceneIndexException.java
index 9bbef8a..bfbaaf1 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/context/UnsupportedExistingLuceneIndexException.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/context/UnsupportedExistingLuceneIndexException.java
@@ -1,8 +1,5 @@
package org.apache.maven.index.context;
-import org.apache.maven.index.Indexer;
-import org.apache.maven.index.NexusIndexer;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -22,6 +19,9 @@
* under the License.
*/
+import org.apache.maven.index.Indexer;
+import org.apache.maven.index.NexusIndexer;
+
/**
* Thrown when a user tries to create a NexusInder IndexingContext over and existing Lucene index. The reason for
* throwing this exception may be multiple: non-NexusIndexer Lucene index, index version is wrong, repositoryId does not
diff --git a/indexer-core/src/main/java/org/apache/maven/index/creator/JarFileContentsIndexCreator.java b/indexer-core/src/main/java/org/apache/maven/index/creator/JarFileContentsIndexCreator.java
index c30b93a..9318fbb 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/creator/JarFileContentsIndexCreator.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/creator/JarFileContentsIndexCreator.java
@@ -44,7 +44,7 @@
* collect all the class names from it.
*/
@Singleton
-@Named (JarFileContentsIndexCreator.ID)
+@Named( JarFileContentsIndexCreator.ID )
public class JarFileContentsIndexCreator
extends AbstractIndexCreator
implements LegacyDocumentUpdater
@@ -189,7 +189,8 @@
// class name without ".class"
sb.append( name.substring( 0, name.length() - 6 ) ).append( '\n' );
}
- else if ( name.startsWith( strippedPrefix ) && (name.length() > ( strippedPrefix.length() + 6 )) )
+ else if ( name.startsWith( strippedPrefix )
+ && ( name.length() > ( strippedPrefix.length() + 6 ) ) )
{
// class name without ".class" and stripped prefix
sb.append( name.substring( strippedPrefix.length(), name.length() - 6 ) ).append( '\n' );
diff --git a/indexer-core/src/main/java/org/apache/maven/index/creator/MavenArchetypeArtifactInfoIndexCreator.java b/indexer-core/src/main/java/org/apache/maven/index/creator/MavenArchetypeArtifactInfoIndexCreator.java
index c9d3b7a..bd6c759 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/creator/MavenArchetypeArtifactInfoIndexCreator.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/creator/MavenArchetypeArtifactInfoIndexCreator.java
@@ -43,7 +43,7 @@
* @author cstamas
*/
@Singleton
-@Named (MavenArchetypeArtifactInfoIndexCreator.ID)
+@Named( MavenArchetypeArtifactInfoIndexCreator.ID )
public class MavenArchetypeArtifactInfoIndexCreator
extends AbstractIndexCreator
{
@@ -51,8 +51,8 @@
private static final String MAVEN_ARCHETYPE_PACKAGING = "maven-archetype";
- private static final String[] ARCHETYPE_XML_LOCATIONS = { "META-INF/maven/archetype.xml", "META-INF/archetype.xml",
- "META-INF/maven/archetype-metadata.xml" };
+ private static final String[] ARCHETYPE_XML_LOCATIONS =
+ { "META-INF/maven/archetype.xml", "META-INF/archetype.xml", "META-INF/maven/archetype-metadata.xml" };
public MavenArchetypeArtifactInfoIndexCreator()
{
diff --git a/indexer-core/src/main/java/org/apache/maven/index/creator/MavenPluginArtifactInfoIndexCreator.java b/indexer-core/src/main/java/org/apache/maven/index/creator/MavenPluginArtifactInfoIndexCreator.java
index ceb48a6..71e18d9 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/creator/MavenPluginArtifactInfoIndexCreator.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/creator/MavenPluginArtifactInfoIndexCreator.java
@@ -52,7 +52,7 @@
* @author cstamas
*/
@Singleton
-@Named (MavenPluginArtifactInfoIndexCreator.ID)
+@Named( MavenPluginArtifactInfoIndexCreator.ID )
public class MavenPluginArtifactInfoIndexCreator
extends AbstractIndexCreator
{
@@ -78,7 +78,8 @@
ArtifactInfo ai = ac.getArtifactInfo();
// we need the file to perform these checks, and those may be only JARs
- if ( artifact != null && MAVEN_PLUGIN_PACKAGING.equals( ai.getPackaging() ) && artifact.getName().endsWith( ".jar" ) )
+ if ( artifact != null && MAVEN_PLUGIN_PACKAGING.equals( ai.getPackaging() )
+ && artifact.getName().endsWith( ".jar" ) )
{
// TODO: recheck, is the following true? "Maven plugins and Maven Archetypes can be only JARs?"
diff --git a/indexer-core/src/main/java/org/apache/maven/index/creator/MinimalArtifactInfoIndexCreator.java b/indexer-core/src/main/java/org/apache/maven/index/creator/MinimalArtifactInfoIndexCreator.java
index d491733..feea2d2 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/creator/MinimalArtifactInfoIndexCreator.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/creator/MinimalArtifactInfoIndexCreator.java
@@ -30,17 +30,20 @@
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Field.Index;
import org.apache.lucene.document.Field.Store;
-import org.apache.maven.index.*;
import org.apache.maven.index.ArtifactAvailability;
+import org.apache.maven.index.ArtifactContext;
+import org.apache.maven.index.ArtifactInfo;
+import org.apache.maven.index.IndexerField;
+import org.apache.maven.index.IndexerFieldVersion;
+import org.apache.maven.index.MAVEN;
+import org.apache.maven.index.NEXUS;
import org.apache.maven.index.artifact.Gav;
-import org.apache.maven.index.context.IndexCreator;
import org.apache.maven.index.locator.JavadocLocator;
import org.apache.maven.index.locator.Locator;
import org.apache.maven.index.locator.Sha1Locator;
import org.apache.maven.index.locator.SignatureLocator;
import org.apache.maven.index.locator.SourcesLocator;
import org.apache.maven.model.Model;
-import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
@@ -53,7 +56,7 @@
* @author cstamas
*/
@Singleton
-@Named (MinimalArtifactInfoIndexCreator.ID)
+@Named( MinimalArtifactInfoIndexCreator.ID )
public class MinimalArtifactInfoIndexCreator
extends AbstractIndexCreator
implements LegacyDocumentUpdater
@@ -202,7 +205,8 @@
{
File signature = sigl.locate( artifact );
- ai.setSignatureExists( signature.exists() ? ArtifactAvailability.PRESENT : ArtifactAvailability.NOT_PRESENT );
+ ai.setSignatureExists( signature.exists() ? ArtifactAvailability.PRESENT
+ : ArtifactAvailability.NOT_PRESENT );
File sha1 = sha1l.locate( artifact );
@@ -253,11 +257,13 @@
public void updateDocument( ArtifactInfo ai, Document doc )
{
String info =
- new StringBuilder().append( ArtifactInfo.nvl( ai.getPackaging() )).append( ArtifactInfo.FS ).append(
- Long.toString( ai.getLastModified() ) ).append( ArtifactInfo.FS ).append( Long.toString( ai.getSize() ) ).append(
- ArtifactInfo.FS ).append( ai.getSourcesExists().toString() ).append( ArtifactInfo.FS ).append(
- ai.getJavadocExists().toString() ).append( ArtifactInfo.FS ).append( ai.getSignatureExists().toString() ).append(
- ArtifactInfo.FS ).append( ai.getFileExtension() ).toString();
+ new StringBuilder().append( ArtifactInfo.nvl( ai.getPackaging() ) )
+ .append( ArtifactInfo.FS ).append( Long.toString( ai.getLastModified() ) )
+ .append( ArtifactInfo.FS ).append( Long.toString( ai.getSize() ) )
+ .append( ArtifactInfo.FS ).append( ai.getSourcesExists().toString() )
+ .append( ArtifactInfo.FS ).append( ai.getJavadocExists().toString() )
+ .append( ArtifactInfo.FS ).append( ai.getSignatureExists().toString() )
+ .append( ArtifactInfo.FS ).append( ai.getFileExtension() ).toString();
doc.add( FLD_INFO.toField( info ) );
@@ -304,7 +310,8 @@
// legacy!
if ( ai.getPrefix() != null )
{
- doc.add( new Field( ArtifactInfo.PLUGIN_PREFIX, ai.getPrefix(), Field.Store.YES, Field.Index.NOT_ANALYZED ) );
+ doc.add( new Field( ArtifactInfo.PLUGIN_PREFIX, ai.getPrefix(), Field.Store.YES,
+ Field.Index.NOT_ANALYZED ) );
}
if ( ai.getGoals() != null )
@@ -349,7 +356,7 @@
{
String[] r = ArtifactInfo.FS_PATTERN.split( info );
- ai.setPackaging( ArtifactInfo.renvl( r[0] ));
+ ai.setPackaging( ArtifactInfo.renvl( r[0] ) );
ai.setLastModified( Long.parseLong( r[1] ) );
diff --git a/indexer-core/src/main/java/org/apache/maven/index/creator/OsgiArtifactIndexCreator.java b/indexer-core/src/main/java/org/apache/maven/index/creator/OsgiArtifactIndexCreator.java
index dcda9dd..ed06d0b 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/creator/OsgiArtifactIndexCreator.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/creator/OsgiArtifactIndexCreator.java
@@ -64,33 +64,34 @@
* @since 4.1.2
*/
@Singleton
-@Named (OsgiArtifactIndexCreator.ID)
+@Named( OsgiArtifactIndexCreator.ID )
public class OsgiArtifactIndexCreator
extends AbstractIndexCreator
{
public static final String ID = "osgi-metadatas";
+
public static final IndexerField FLD_SHA256 =
- new IndexerField(OSGI.SHA256, IndexerFieldVersion.V4, "sha256", "SHA-256 (not analyzed, stored)",
- Field.Store.YES, Field.Index.NOT_ANALYZED);
+ new IndexerField( OSGI.SHA256, IndexerFieldVersion.V4, "sha256", "SHA-256 (not analyzed, stored)",
+ Field.Store.YES, Field.Index.NOT_ANALYZED );
+
private static final String BSN = "Bundle-SymbolicName";
public static final IndexerField FLD_BUNDLE_SYMBOLIC_NAME =
new IndexerField( OSGI.SYMBOLIC_NAME, IndexerFieldVersion.V4, BSN, "Bundle-SymbolicName (indexed, stored)",
Field.Store.YES, Field.Index.ANALYZED );
-
private static final String BV = "Bundle-Version";
public static final IndexerField FLD_BUNDLE_VERSION =
new IndexerField( OSGI.VERSION, IndexerFieldVersion.V4, BV, "Bundle-Version (indexed, stored)", Field.Store.YES,
Field.Index.ANALYZED );
-
private static final String BEP = "Export-Package";
public static final IndexerField FLD_BUNDLE_EXPORT_PACKAGE =
new IndexerField( OSGI.EXPORT_PACKAGE, IndexerFieldVersion.V4, BEP, "Export-Package (indexed, stored)",
Field.Store.YES, Field.Index.ANALYZED );
+
@Deprecated
private static final String BES = "Export-Service";
@Deprecated
@@ -98,7 +99,6 @@
new IndexerField( OSGI.EXPORT_SERVICE, IndexerFieldVersion.V4, BES, "Export-Service (indexed, stored)",
Field.Store.YES, Field.Index.ANALYZED );
-
private static final String BD = "Bundle-Description";
public static final IndexerField FLD_BUNDLE_DESCRIPTION =
@@ -135,35 +135,41 @@
public static final IndexerField FLD_BUNDLE_REQUIRE_BUNDLE =
new IndexerField( OSGI.REQUIRE_BUNDLE, IndexerFieldVersion.V4, BRB, "Require-Bundle (indexed, stored)",
Field.Store.YES, Field.Index.ANALYZED );
+
private static final String PROVIDE_CAPABILITY = "Provide-Capability";
+
public static final IndexerField FLD_BUNDLE_PROVIDE_CAPABILITY =
- new IndexerField(OSGI.PROVIDE_CAPABILITY, IndexerFieldVersion.V4, PROVIDE_CAPABILITY, "Provide-Capability (indexed, stored)",
- Field.Store.YES, Field.Index.ANALYZED);
+ new IndexerField( OSGI.PROVIDE_CAPABILITY, IndexerFieldVersion.V4, PROVIDE_CAPABILITY,
+ "Provide-Capability (indexed, stored)", Field.Store.YES, Field.Index.ANALYZED );
+
private static final String REQUIRE_CAPABILITY = "Require-Capability";
+
public static final IndexerField FLD_BUNDLE_REQUIRE_CAPABILITY =
- new IndexerField(OSGI.REQUIRE_CAPABILITY, IndexerFieldVersion.V4, REQUIRE_CAPABILITY, "Require-Capability (indexed, stored)",
- Field.Store.YES, Field.Index.ANALYZED);
+ new IndexerField( OSGI.REQUIRE_CAPABILITY, IndexerFieldVersion.V4, REQUIRE_CAPABILITY,
+ "Require-Capability (indexed, stored)", Field.Store.YES, Field.Index.ANALYZED );
+
private static final String FRAGMENT_HOST = "Fragment-Host";
+
public static final IndexerField FLD_BUNDLE_FRAGMENT_HOST =
- new IndexerField(OSGI.FRAGMENT_HOST, IndexerFieldVersion.V4, FRAGMENT_HOST, "Fragment-Host (indexed, stored)",
- Field.Store.YES, Field.Index.ANALYZED);
+ new IndexerField( OSGI.FRAGMENT_HOST, IndexerFieldVersion.V4, FRAGMENT_HOST, "Fragment-Host (indexed, stored)",
+ Field.Store.YES, Field.Index.ANALYZED );
private static final String BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT = "Bundle-RequiredExecutionEnvironment";
+
public static final IndexerField FLD_BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT =
- new IndexerField(OSGI.BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT, IndexerFieldVersion.V4, BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT,
- "Bundle-RequiredExecutionEnvironment (indexed, stored)",
- Field.Store.YES, Field.Index.ANALYZED);
-
-
+ new IndexerField( OSGI.BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT, IndexerFieldVersion.V4,
+ BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT,
+ "Bundle-RequiredExecutionEnvironment (indexed, stored)", Field.Store.YES,
+ Field.Index.ANALYZED );
public Collection<IndexerField> getIndexerFields()
{
- return Arrays.asList(FLD_BUNDLE_SYMBOLIC_NAME, FLD_BUNDLE_VERSION, FLD_BUNDLE_EXPORT_PACKAGE,
- FLD_BUNDLE_EXPORT_SERVIVE, FLD_BUNDLE_DESCRIPTION, FLD_BUNDLE_NAME, FLD_BUNDLE_LICENSE,
- FLD_BUNDLE_DOCURL, FLD_BUNDLE_IMPORT_PACKAGE, FLD_BUNDLE_REQUIRE_BUNDLE,
- FLD_BUNDLE_PROVIDE_CAPABILITY, FLD_BUNDLE_REQUIRE_CAPABILITY, FLD_BUNDLE_FRAGMENT_HOST,
- FLD_BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT, FLD_SHA256);
+ return Arrays.asList( FLD_BUNDLE_SYMBOLIC_NAME, FLD_BUNDLE_VERSION, FLD_BUNDLE_EXPORT_PACKAGE,
+ FLD_BUNDLE_EXPORT_SERVIVE, FLD_BUNDLE_DESCRIPTION, FLD_BUNDLE_NAME, FLD_BUNDLE_LICENSE,
+ FLD_BUNDLE_DOCURL, FLD_BUNDLE_IMPORT_PACKAGE, FLD_BUNDLE_REQUIRE_BUNDLE,
+ FLD_BUNDLE_PROVIDE_CAPABILITY, FLD_BUNDLE_REQUIRE_CAPABILITY, FLD_BUNDLE_FRAGMENT_HOST,
+ FLD_BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT, FLD_SHA256 );
}
public OsgiArtifactIndexCreator()
@@ -239,25 +245,30 @@
document.add( FLD_BUNDLE_REQUIRE_BUNDLE.toField( artifactInfo.getBundleRequireBundle() ) );
}
- if (artifactInfo.getBundleProvideCapability() != null) {
- document.add(FLD_BUNDLE_PROVIDE_CAPABILITY.toField(artifactInfo.getBundleProvideCapability()));
+ if ( artifactInfo.getBundleProvideCapability() != null )
+ {
+ document.add( FLD_BUNDLE_PROVIDE_CAPABILITY.toField( artifactInfo.getBundleProvideCapability() ) );
}
- if (artifactInfo.getBundleRequireCapability() != null) {
- document.add(FLD_BUNDLE_REQUIRE_CAPABILITY.toField(artifactInfo.getBundleRequireCapability()));
+ if ( artifactInfo.getBundleRequireCapability() != null )
+ {
+ document.add( FLD_BUNDLE_REQUIRE_CAPABILITY.toField( artifactInfo.getBundleRequireCapability() ) );
}
- if (artifactInfo.getBundleFragmentHost() != null) {
- document.add(FLD_BUNDLE_FRAGMENT_HOST.toField(artifactInfo.getBundleFragmentHost()));
+ if ( artifactInfo.getBundleFragmentHost() != null )
+ {
+ document.add( FLD_BUNDLE_FRAGMENT_HOST.toField( artifactInfo.getBundleFragmentHost() ) );
}
String bree = artifactInfo.getBundleRequiredExecutionEnvironment();
- if (bree != null) {
- document.add(FLD_BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT.toField(bree));
+ if ( bree != null )
+ {
+ document.add( FLD_BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT.toField( bree ) );
}
- if (artifactInfo.getSha256() != null) {
- document.add(FLD_SHA256.toField(artifactInfo.getSha256()));
+ if ( artifactInfo.getSha256() != null )
+ {
+ document.add( FLD_SHA256.toField( artifactInfo.getSha256() ) );
}
}
@@ -291,7 +302,6 @@
artifactInfo.setBundleExportPackage( bundleExportPackage );
updated = true;
-
}
String bundleExportService = document.get( FLD_BUNDLE_EXPORT_SERVIVE.getKey() );
@@ -301,7 +311,6 @@
artifactInfo.setBundleExportService( bundleExportService );
updated = true;
-
}
String bundleDescription = document.get( FLD_BUNDLE_DESCRIPTION.getKey() );
@@ -311,7 +320,6 @@
artifactInfo.setBundleDescription( bundleDescription );
updated = true;
-
}
@@ -322,7 +330,6 @@
artifactInfo.setBundleName( bundleName );
updated = true;
-
}
@@ -333,7 +340,6 @@
artifactInfo.setBundleLicense( bundleLicense );
updated = true;
-
}
String bundleDocUrl = document.get( FLD_BUNDLE_DOCURL.getKey() );
@@ -343,7 +349,6 @@
artifactInfo.setBundleDocUrl( bundleDocUrl );
updated = true;
-
}
String bundleImportPackage = document.get( FLD_BUNDLE_IMPORT_PACKAGE.getKey() );
@@ -353,7 +358,6 @@
artifactInfo.setBundleImportPackage( bundleImportPackage );
updated = true;
-
}
String bundleRequireBundle = document.get( FLD_BUNDLE_REQUIRE_BUNDLE.getKey() );
@@ -363,46 +367,50 @@
artifactInfo.setBundleRequireBundle( bundleRequireBundle );
updated = true;
-
}
- String bundleProvideCapability = document.get(FLD_BUNDLE_PROVIDE_CAPABILITY.getKey());
- if (bundleProvideCapability != null) {
- artifactInfo.setBundleProvideCapability(bundleProvideCapability);
+ String bundleProvideCapability = document.get( FLD_BUNDLE_PROVIDE_CAPABILITY.getKey() );
+
+ if ( bundleProvideCapability != null )
+ {
+ artifactInfo.setBundleProvideCapability( bundleProvideCapability );
updated = true;
-
}
- String bundleRequireCapability = document.get(FLD_BUNDLE_REQUIRE_CAPABILITY.getKey());
- if (bundleRequireCapability != null) {
- artifactInfo.setBundleRequireCapability(bundleRequireCapability);
+ String bundleRequireCapability = document.get( FLD_BUNDLE_REQUIRE_CAPABILITY.getKey() );
+
+ if ( bundleRequireCapability != null )
+ {
+ artifactInfo.setBundleRequireCapability( bundleRequireCapability );
updated = true;
-
}
- String bundleFragmentHost = document.get(FLD_BUNDLE_FRAGMENT_HOST.getKey());
- if (bundleFragmentHost != null) {
- artifactInfo.setBundleFragmentHost(bundleFragmentHost);
+ String bundleFragmentHost = document.get( FLD_BUNDLE_FRAGMENT_HOST.getKey() );
+
+ if ( bundleFragmentHost != null )
+ {
+ artifactInfo.setBundleFragmentHost( bundleFragmentHost );
updated = true;
-
}
- String bundleRequiredExecutionEnvironment = document.get(FLD_BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT.getKey());
+ String bundleRequiredExecutionEnvironment = document.get( FLD_BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT.getKey() );
- if (bundleRequiredExecutionEnvironment != null) {
- artifactInfo.setBundleRequiredExecutionEnvironment(bundleRequiredExecutionEnvironment);
+ if ( bundleRequiredExecutionEnvironment != null )
+ {
+ artifactInfo.setBundleRequiredExecutionEnvironment( bundleRequiredExecutionEnvironment );
updated = true;
-
}
- String sha256 = document.get(FLD_SHA256.getKey());
+ String sha256 = document.get( FLD_SHA256.getKey() );
- if (sha256 != null) {
- artifactInfo.setSha256(sha256);
+ if ( sha256 != null )
+ {
+ artifactInfo.setSha256( sha256 );
+
updated = true;
}
@@ -543,38 +551,49 @@
ai.setBundleRequireBundle( null );
}
- attValue = mainAttributes.getValue(PROVIDE_CAPABILITY);
- if (StringUtils.isNotBlank(attValue)) {
- ai.setBundleProvideCapability(attValue);
+ attValue = mainAttributes.getValue( PROVIDE_CAPABILITY );
+ if ( StringUtils.isNotBlank( attValue ) )
+ {
+ ai.setBundleProvideCapability( attValue );
updated = true;
- } else {
- ai.setBundleProvideCapability(null);
+ }
+ else
+ {
+ ai.setBundleProvideCapability( null );
}
- attValue = mainAttributes.getValue(REQUIRE_CAPABILITY);
- if (StringUtils.isNotBlank(attValue)) {
- ai.setBundleRequireCapability(attValue);
+ attValue = mainAttributes.getValue( REQUIRE_CAPABILITY );
+ if ( StringUtils.isNotBlank( attValue ) )
+ {
+ ai.setBundleRequireCapability( attValue );
updated = true;
- } else {
- ai.setBundleRequireCapability(null);
+ }
+ else
+ {
+ ai.setBundleRequireCapability( null );
}
- attValue = mainAttributes.getValue(FRAGMENT_HOST);
- if (StringUtils.isNotBlank(attValue)) {
- ai.setBundleFragmentHost(attValue);
+ attValue = mainAttributes.getValue( FRAGMENT_HOST );
+ if ( StringUtils.isNotBlank( attValue ) )
+ {
+ ai.setBundleFragmentHost( attValue );
updated = true;
- } else {
- ai.setBundleFragmentHost(null);
+ }
+ else
+ {
+ ai.setBundleFragmentHost( null );
}
- attValue = mainAttributes.getValue(BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT);
- if (StringUtils.isNotBlank(attValue)) {
- ai.setBundleRequiredExecutionEnvironment(attValue);
+ attValue = mainAttributes.getValue( BUNDLE_REQUIRED_EXECUTION_ENVIRONMENT );
+ if ( StringUtils.isNotBlank( attValue ) )
+ {
+ ai.setBundleRequiredExecutionEnvironment( attValue );
updated = true;
- } else {
- ai.setBundleRequiredExecutionEnvironment(null);
}
-
+ else
+ {
+ ai.setBundleRequiredExecutionEnvironment( null );
+ }
}
}
}
@@ -593,40 +612,56 @@
}
// only calculate sha256 digest for if we are indexing a bundle.
- if (ai.getBundleSymbolicName() != null) {
- String sha256 = computeSha256(f);
- if (sha256 != null) {
- ai.setSha256(sha256);
+ if ( ai.getBundleSymbolicName() != null )
+ {
+ String sha256 = computeSha256( f );
+ if ( sha256 != null )
+ {
+ ai.setSha256( sha256 );
updated = true;
- } else {
- ai.setSha256(null);
+ }
+ else
+ {
+ ai.setSha256( null );
}
}
return updated;
}
- private String computeSha256(File f) throws IOException {
+ private String computeSha256( File f )
+ throws IOException
+ {
String sha256 = null;
- try {
- MessageDigest digest = MessageDigest.getInstance("SHA-256");
- DigestInputStream in = new DigestInputStream(new FileInputStream(f), digest);
+ try
+ {
+ MessageDigest digest = MessageDigest.getInstance( "SHA-256" );
+ DigestInputStream in = new DigestInputStream( new FileInputStream( f ), digest );
- try {
+ try
+ {
byte buf[] = new byte[8192];
- while (in.read(buf) >= 0) ;
+ while ( in.read( buf ) >= 0 )
+ {
+ // nop
+ }
byte digestBytes[] = digest.digest();
- StringBuilder builder = new StringBuilder(64);
- for (int b : digestBytes) {
+ StringBuilder builder = new StringBuilder( 64 );
+ for ( int b : digestBytes )
+ {
b &= 0xff;
- builder.append(String.format("%02x", b));
+ builder.append( String.format( "%02x", b ) );
sha256 = builder.toString();
}
- } finally {
+ }
+ finally
+ {
in.close();
}
- } catch (NoSuchAlgorithmException e) {
+ }
+ catch ( NoSuchAlgorithmException e )
+ {
}
return sha256;
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/locator/ArtifactLocator.java b/indexer-core/src/main/java/org/apache/maven/index/locator/ArtifactLocator.java
index d83b3a4..7ea9a54 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/locator/ArtifactLocator.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/locator/ArtifactLocator.java
@@ -20,7 +20,6 @@
*/
import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
@@ -64,7 +63,7 @@
return null;
}
- try (InputStream inputStream = Files.newInputStream( source.toPath() ))
+ try ( InputStream inputStream = Files.newInputStream( source.toPath() ) )
{
// need to read the pom model to get packaging
final Model model = new MavenXpp3Reader().read( inputStream, false );
diff --git a/indexer-core/src/main/java/org/apache/maven/index/packer/DefaultIndexPacker.java b/indexer-core/src/main/java/org/apache/maven/index/packer/DefaultIndexPacker.java
index 933dd1b..48233dc 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/packer/DefaultIndexPacker.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/packer/DefaultIndexPacker.java
@@ -38,7 +38,6 @@
import org.apache.maven.index.incremental.IncrementalHandler;
import org.apache.maven.index.updater.IndexDataWriter;
import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -221,7 +220,7 @@
targetArchive.delete();
}
- try( OutputStream os = new FileOutputStream( targetArchive ) )
+ try ( OutputStream os = new FileOutputStream( targetArchive ) )
{
IndexDataWriter dw = new IndexDataWriter( os );
dw.write( request.getContext(), request.getIndexReader(), docIndexes );
@@ -239,12 +238,12 @@
info.setProperty( IndexingContext.INDEX_ID, request.getContext().getId() );
- try (OutputStream os = new FileOutputStream( propertyFile ))
+ try ( OutputStream os = new FileOutputStream( propertyFile ) )
{
info.store( os, null );
}
- try (OutputStream os = new FileOutputStream( targetPropertyFile ))
+ try ( OutputStream os = new FileOutputStream( targetPropertyFile ) )
{
info.store( os, null );
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/packer/DigesterUtils.java b/indexer-core/src/main/java/org/apache/maven/index/packer/DigesterUtils.java
index be98346..5adffad 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/packer/DigesterUtils.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/packer/DigesterUtils.java
@@ -29,8 +29,6 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
-import org.codehaus.plexus.util.IOUtil;
-
/**
* A util class to calculate various digests on Strings. Useful for some simple password management.
*
@@ -144,7 +142,7 @@
public static String getSha1Digest( File file )
throws IOException
{
- try (FileInputStream fis = new FileInputStream( file ))
+ try ( FileInputStream fis = new FileInputStream( file ) )
{
return getDigest( "SHA1", fis );
}
@@ -217,7 +215,7 @@
throws IOException
{
- try (InputStream fis = new FileInputStream( file ))
+ try ( InputStream fis = new FileInputStream( file ) )
{
return getDigest( "MD5", fis );
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/packer/IndexPackingRequest.java b/indexer-core/src/main/java/org/apache/maven/index/packer/IndexPackingRequest.java
index 0b74ea3..850d9d8 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/packer/IndexPackingRequest.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/packer/IndexPackingRequest.java
@@ -24,7 +24,6 @@
import java.util.Collection;
import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.search.IndexSearcher;
import org.apache.maven.index.context.IndexingContext;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -54,7 +53,7 @@
public IndexPackingRequest( final IndexingContext context, final IndexReader indexReader, final File targetDir )
{
- this.context = checkNotNull(context);
+ this.context = checkNotNull( context );
this.indexReader = checkNotNull( indexReader );
@@ -76,7 +75,10 @@
return context;
}
- public IndexReader getIndexReader() { return indexReader; }
+ public IndexReader getIndexReader()
+ {
+ return indexReader;
+ }
/**
* Sets index formats to be created
@@ -142,7 +144,7 @@
/**
* Index format enumeration.
*/
- public static enum IndexFormat
+ public enum IndexFormat
{
FORMAT_V1;
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/treeview/AbstractTreeNode.java b/indexer-core/src/main/java/org/apache/maven/index/treeview/AbstractTreeNode.java
index 75a509f..90e9038 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/treeview/AbstractTreeNode.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/treeview/AbstractTreeNode.java
@@ -74,9 +74,9 @@
*/
private String repositoryId;
- final private transient IndexTreeView treeView;
+ private final transient IndexTreeView treeView;
- final private transient TreeViewRequest request;
+ private final transient TreeViewRequest request;
/**
* Constructor that takes an IndexTreeView implementation and a TreeNodeFactory implementation;
diff --git a/indexer-core/src/main/java/org/apache/maven/index/treeview/DefaultIndexTreeView.java b/indexer-core/src/main/java/org/apache/maven/index/treeview/DefaultIndexTreeView.java
index ee1fc77..61f450c 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/treeview/DefaultIndexTreeView.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/treeview/DefaultIndexTreeView.java
@@ -189,7 +189,8 @@
// it needs to be created only if not found (is null) and is _below_ groupParentResource
if ( groupResource == null
- && groupParentResource.getPath().length() < getPathForAi( ai, MAVEN.GROUP_ID ).length() )
+ && groupParentResource.getPath().length() < getPathForAi( ai,
+ MAVEN.GROUP_ID ).length() )
{
String gNodeName =
partialGroupId.lastIndexOf( '.' ) > -1 ? partialGroupId.substring(
@@ -218,8 +219,8 @@
}
}
- artifactResource =
- request.getFactory().createANode( this, request, ai, getPathForAi( ai, MAVEN.ARTIFACT_ID ) );
+ artifactResource = request.getFactory().createANode( this, request, ai,
+ getPathForAi( ai, MAVEN.ARTIFACT_ID ) );
groupParentResource.getChildren().add( artifactResource );
diff --git a/indexer-core/src/main/java/org/apache/maven/index/treeview/TreeNode.java b/indexer-core/src/main/java/org/apache/maven/index/treeview/TreeNode.java
index 58d1c12..f444cdf 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/treeview/TreeNode.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/treeview/TreeNode.java
@@ -24,7 +24,7 @@
public interface TreeNode
{
- public enum Type
+ enum Type
{
G, A, V, artifact
};
diff --git a/indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java b/indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java
index 06b2834..38c8d0d 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java
@@ -90,7 +90,8 @@
@Inject
- public DefaultIndexUpdater( final IncrementalHandler incrementalHandler, final List<IndexUpdateSideEffect> sideEffects )
+ public DefaultIndexUpdater( final IncrementalHandler incrementalHandler,
+ final List<IndexUpdateSideEffect> sideEffects )
{
this.incrementalHandler = incrementalHandler;
this.sideEffects = sideEffects;
@@ -134,7 +135,7 @@
try
{
- if( fetchAndUpdateIndex( updateRequest, fetcher, cache ).isSuccessful() )
+ if ( fetchAndUpdateIndex( updateRequest, fetcher, cache ).isSuccessful() )
{
cache.commit();
}
@@ -159,7 +160,7 @@
LuceneIndexAdaptor target = new LuceneIndexAdaptor( updateRequest );
result = fetchAndUpdateIndex( updateRequest, fetcher, target );
- if(result.isSuccessful())
+ if ( result.isSuccessful() )
{
target.commit();
}
@@ -189,8 +190,8 @@
indexDir.delete();
indexDir.mkdirs();
- try(BufferedInputStream is = new BufferedInputStream( fetcher.retrieve( remoteIndexFile ) ); //
- Directory directory = updateRequest.getFSDirectoryFactory().open( indexDir ))
+ try ( BufferedInputStream is = new BufferedInputStream( fetcher.retrieve( remoteIndexFile ) ); //
+ Directory directory = updateRequest.getFSDirectoryFactory().open( indexDir ) )
{
Date timestamp = null;
@@ -206,7 +207,8 @@
else
{
// legacy transfer format
- throw new IllegalArgumentException("The legacy format is no longer supported by this version of maven-indexer.");
+ throw new IllegalArgumentException( "The legacy format is no longer supported "
+ + "by this version of maven-indexer." );
}
if ( updateRequest.getDocumentFilter() != null )
@@ -256,13 +258,13 @@
r = DirectoryReader.open( directory );
w = new NexusIndexWriter( directory, new NexusAnalyzer(), false );
- Bits liveDocs = MultiFields.getLiveDocs(r);
+ Bits liveDocs = MultiFields.getLiveDocs( r );
int numDocs = r.maxDoc();
for ( int i = 0; i < numDocs; i++ )
{
- if (liveDocs != null && ! liveDocs.get(i) )
+ if ( liveDocs != null && !liveDocs.get( i ) )
{
continue;
}
@@ -271,8 +273,8 @@
if ( !filter.accept( d ) )
{
- boolean success = w.tryDeleteDocument(r, i);
- //FIXME handle deletion failure
+ boolean success = w.tryDeleteDocument( r, i );
+ // FIXME handle deletion failure
}
}
w.commit();
@@ -301,7 +303,7 @@
{
File indexProperties = new File( indexDirectoryFile, remoteIndexPropertiesName );
- try ( FileInputStream fis = new FileInputStream( indexProperties ))
+ try ( FileInputStream fis = new FileInputStream( indexProperties ) )
{
Properties properties = new Properties();
@@ -323,7 +325,7 @@
if ( properties != null )
{
- try (OutputStream os = new BufferedOutputStream( new FileOutputStream( file ) ))
+ try ( OutputStream os = new BufferedOutputStream( new FileOutputStream( file ) ) )
{
properties.store( os, null );
}
@@ -337,7 +339,7 @@
private Properties downloadIndexProperties( final ResourceFetcher fetcher )
throws IOException
{
- try (InputStream fis = fetcher.retrieve( IndexingContext.INDEX_REMOTE_PROPERTIES_FILE ))
+ try ( InputStream fis = fetcher.retrieve( IndexingContext.INDEX_REMOTE_PROPERTIES_FILE ) )
{
Properties properties = new Properties();
@@ -373,7 +375,8 @@
* @param w a writer to save index data
* @param ics a collection of index creators for updating unpacked documents.
*/
- public static IndexDataReadResult unpackIndexData( final InputStream is, final Directory d, final IndexingContext context )
+ public static IndexDataReadResult unpackIndexData( final InputStream is, final Directory d,
+ final IndexingContext context )
throws IOException
{
NexusIndexWriter w = new NexusIndexWriter( d, new NexusAnalyzer(), true );
@@ -477,7 +480,7 @@
{
private final IndexUpdateRequest updateRequest;
- public LuceneIndexAdaptor( IndexUpdateRequest updateRequest )
+ LuceneIndexAdaptor( IndexUpdateRequest updateRequest )
{
super( updateRequest.getIndexingContext().getIndexDirectoryFile() );
this.updateRequest = updateRequest;
@@ -536,7 +539,7 @@
private final ArrayList<String> newChunks = new ArrayList<String>();
- public LocalCacheIndexAdaptor( File dir, IndexUpdateResult result )
+ LocalCacheIndexAdaptor( File dir, IndexUpdateResult result )
{
super( dir );
this.result = result;
@@ -601,8 +604,8 @@
throws IOException
{
File chunksFile = new File( dir, CHUNKS_FILENAME );
- try (BufferedOutputStream os = new BufferedOutputStream( new FileOutputStream( chunksFile, true ) ); //
- Writer w = new OutputStreamWriter( os, CHUNKS_FILE_ENCODING ))
+ try ( BufferedOutputStream os = new BufferedOutputStream( new FileOutputStream( chunksFile, true ) ); //
+ Writer w = new OutputStreamWriter( os, CHUNKS_FILE_ENCODING ) )
{
for ( String filename : newChunks )
{
@@ -619,8 +622,8 @@
ArrayList<String> chunks = new ArrayList<String>();
File chunksFile = new File( dir, CHUNKS_FILENAME );
- try (BufferedReader r =
- new BufferedReader( new InputStreamReader( new FileInputStream( chunksFile ), CHUNKS_FILE_ENCODING ) ))
+ try ( BufferedReader r =
+ new BufferedReader( new InputStreamReader( new FileInputStream( chunksFile ), CHUNKS_FILE_ENCODING ) ) )
{
String str;
while ( ( str = r.readLine() ) != null )
@@ -648,7 +651,7 @@
abstract static class LocalIndexCacheFetcher
extends FileFetcher
{
- public LocalIndexCacheFetcher( File basedir )
+ LocalIndexCacheFetcher( File basedir )
{
super( basedir );
}
@@ -693,8 +696,8 @@
target.addIndexChunk( source, filename );
}
- result.setTimestamp(updateTimestamp);
- result.setSuccessful(true);
+ result.setTimestamp( updateTimestamp );
+ result.setSuccessful( true );
return result;
}
}
@@ -714,7 +717,7 @@
if ( updateTimestamp != null && localTimestamp != null && !updateTimestamp.after( localTimestamp ) )
{
//Index is up to date
- result.setSuccessful(true);
+ result.setSuccessful( true );
return result;
}
}
@@ -725,7 +728,7 @@
target.setProperties( source );
}
- if( !updateRequest.isIncrementalOnly() )
+ if ( !updateRequest.isIncrementalOnly() )
{
Date timestamp = null;
try
@@ -756,9 +759,9 @@
}
}
- result.setTimestamp(timestamp);
- result.setSuccessful(true);
- result.setFullUpdate(true);
+ result.setTimestamp( timestamp );
+ result.setSuccessful( true );
+ result.setFullUpdate( true );
}
return result;
diff --git a/indexer-core/src/main/java/org/apache/maven/index/updater/FSDirectoryFactory.java b/indexer-core/src/main/java/org/apache/maven/index/updater/FSDirectoryFactory.java
index 9866bbf..92342cc 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/updater/FSDirectoryFactory.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/updater/FSDirectoryFactory.java
@@ -35,7 +35,7 @@
/**
* Default implementation that lets Lucene choose FSDirectory implementation.
*/
- public static final FSDirectoryFactory DEFAULT = new FSDirectoryFactory()
+ FSDirectoryFactory DEFAULT = new FSDirectoryFactory()
{
public FSDirectory open( File indexDir )
throws IOException
@@ -44,6 +44,6 @@
}
};
- public FSDirectory open( File indexDir )
+ FSDirectory open( File indexDir )
throws IOException;
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataReader.java b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataReader.java
index 792943d..716fda6 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataReader.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataReader.java
@@ -61,7 +61,7 @@
if ( is.read() == 0x1f && is.read() == 0x8b ) // GZIPInputStream.GZIP_MAGIC
{
is.reset();
- data = new BufferedInputStream(new GZIPInputStream( is, 1024 * 8 ), 1024 * 8 );
+ data = new BufferedInputStream( new GZIPInputStream( is, 1024 * 8 ), 1024 * 8 );
}
else
{
@@ -96,13 +96,16 @@
while ( ( doc = readDocument() ) != null )
{
ArtifactInfo ai = IndexUtils.constructArtifactInfo( doc, context );
- if(ai != null) {
+ if ( ai != null )
+ {
w.addDocument( IndexUtils.updateDocument( doc, context, false, ai ) );
rootGroups.add( ai.getRootGroup() );
allGroups.add( ai.getGroupId() );
- } else {
+ }
+ else
+ {
w.addDocument( doc );
}
n++;
@@ -156,13 +159,15 @@
// Fix up UINFO field wrt MINDEXER-41
final Field uinfoField = (Field) doc.getField( ArtifactInfo.UINFO );
final String info = doc.get( ArtifactInfo.INFO );
- if (uinfoField!= null && !Strings.isNullOrEmpty(info)) {
+ if ( uinfoField != null && !Strings.isNullOrEmpty( info ) )
+ {
final String[] splitInfo = ArtifactInfo.FS_PATTERN.split( info );
if ( splitInfo.length > 6 )
{
final String extension = splitInfo[6];
final String uinfoString = uinfoField.stringValue();
- if (uinfoString.endsWith( ArtifactInfo.FS + ArtifactInfo.NA )) {
+ if ( uinfoString.endsWith( ArtifactInfo.FS + ArtifactInfo.NA ) )
+ {
uinfoField.setStringValue( uinfoString + ArtifactInfo.FS + ArtifactInfo.nvl( extension ) );
}
}
@@ -211,8 +216,8 @@
catch ( OutOfMemoryError e )
{
final IOException ex =
- new IOException(
- "Index data content is inappropriate (is junk?), leads to OutOfMemoryError! See MINDEXER-28 for more information!" );
+ new IOException( "Index data content is inappropriate (is junk?), leads to OutOfMemoryError!"
+ + " See MINDEXER-28 for more information!" );
ex.initCause( e );
throw ex;
}
@@ -328,7 +333,7 @@
return timestamp;
}
- public void setRootGroups(Set<String> rootGroups)
+ public void setRootGroups( Set<String> rootGroups )
{
this.rootGroups = rootGroups;
}
@@ -338,7 +343,7 @@
return rootGroups;
}
- public void setAllGroups(Set<String> allGroups)
+ public void setAllGroups( Set<String> allGroups )
{
this.allGroups = allGroups;
}
@@ -392,7 +397,7 @@
/**
* Visitor of indexed Lucene documents.
*/
- public static interface IndexDataReadVisitor
+ public interface IndexDataReadVisitor
{
/**
diff --git a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataWriter.java b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataWriter.java
index 5d9e338..979474d 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataWriter.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexDataWriter.java
@@ -31,14 +31,12 @@
import java.util.Set;
import java.util.zip.GZIPOutputStream;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.MultiFields;
-import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.util.Bits;
import org.apache.maven.index.ArtifactInfo;
import org.apache.maven.index.context.DefaultIndexingContext;
@@ -124,15 +122,18 @@
{
{
List<IndexableField> allGroupsFields = new ArrayList<>( 2 );
- allGroupsFields.add( new StringField( ArtifactInfo.ALL_GROUPS, ArtifactInfo.ALL_GROUPS_VALUE, Store.YES));
- allGroupsFields.add( new StringField( ArtifactInfo.ALL_GROUPS_LIST, ArtifactInfo.lst2str( allGroups ), Store.YES) );
+ allGroupsFields.add( new StringField( ArtifactInfo.ALL_GROUPS, ArtifactInfo.ALL_GROUPS_VALUE, Store.YES ) );
+ allGroupsFields.add( new StringField( ArtifactInfo.ALL_GROUPS_LIST, ArtifactInfo.lst2str( allGroups ),
+ Store.YES ) );
writeDocumentFields( allGroupsFields );
}
{
List<IndexableField> rootGroupsFields = new ArrayList<>( 2 );
- rootGroupsFields.add( new StringField( ArtifactInfo.ROOT_GROUPS, ArtifactInfo.ROOT_GROUPS_VALUE, Store.YES) );
- rootGroupsFields.add( new StringField( ArtifactInfo.ROOT_GROUPS_LIST, ArtifactInfo.lst2str( rootGroups ), Store.YES ));
+ rootGroupsFields.add( new StringField( ArtifactInfo.ROOT_GROUPS, ArtifactInfo.ROOT_GROUPS_VALUE,
+ Store.YES ) );
+ rootGroupsFields.add( new StringField( ArtifactInfo.ROOT_GROUPS_LIST, ArtifactInfo.lst2str( rootGroups ),
+ Store.YES ) );
writeDocumentFields( rootGroupsFields );
}
}
@@ -141,13 +142,13 @@
throws IOException
{
int n = 0;
- Bits liveDocs = MultiFields.getLiveDocs(r);
+ Bits liveDocs = MultiFields.getLiveDocs( r );
if ( docIndexes == null )
{
for ( int i = 0; i < r.maxDoc(); i++ )
{
- if (liveDocs == null || liveDocs.get(i) )
+ if ( liveDocs == null || liveDocs.get( i ) )
{
if ( writeDocument( r.document( i ) ) )
{
@@ -160,7 +161,7 @@
{
for ( int i : docIndexes )
{
- if ( liveDocs == null || liveDocs.get(i) )
+ if ( liveDocs == null || liveDocs.get( i ) )
{
if ( writeDocument( r.document( i ) ) )
{
@@ -180,7 +181,7 @@
List<IndexableField> storedFields = new ArrayList<>( fields.size() );
- for (IndexableField field : fields )
+ for ( IndexableField field : fields )
{
if ( DefaultIndexingContext.FLD_DESCRIPTOR.equals( field.name() ) )
{
@@ -218,7 +219,7 @@
return false;
}
- if ( field.fieldType().stored())
+ if ( field.fieldType().stored() )
{
storedFields.add( field );
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdateRequest.java b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdateRequest.java
index ed35565..9b4e7e3 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdateRequest.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdateRequest.java
@@ -99,7 +99,7 @@
return incrementalOnly;
}
- public void setIncrementalOnly(boolean incrementalOnly)
+ public void setIncrementalOnly( boolean incrementalOnly )
{
this.incrementalOnly = incrementalOnly;
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdateResult.java b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdateResult.java
index 906bbd0..bd51b36 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdateResult.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdateResult.java
@@ -61,7 +61,7 @@
return successful;
}
- public void setSuccessful(boolean successful)
+ public void setSuccessful( boolean successful )
{
this.successful = successful;
}
diff --git a/indexer-examples/indexer-examples-basic/src/main/java/org/apache/maven/indexer/examples/BasicUsageExample.java b/indexer-examples/indexer-examples-basic/src/main/java/org/apache/maven/indexer/examples/BasicUsageExample.java
index ba463f4..fc23bc2 100644
--- a/indexer-examples/indexer-examples-basic/src/main/java/org/apache/maven/indexer/examples/BasicUsageExample.java
+++ b/indexer-examples/indexer-examples-basic/src/main/java/org/apache/maven/indexer/examples/BasicUsageExample.java
@@ -293,9 +293,9 @@
searchAndDump( indexer, "main artifacts under GA org.apache.maven.indexer:indexer-artifact", bq );
// doing sha1 search
- searchAndDump( indexer, "SHA1 7ab67e6b20e5332a7fb4fdf2f019aec4275846c2", indexer.constructQuery( MAVEN.SHA1,
- new SourcedSearchExpression(
- "7ab67e6b20e5332a7fb4fdf2f019aec4275846c2" ) ) );
+ searchAndDump( indexer, "SHA1 7ab67e6b20e5332a7fb4fdf2f019aec4275846c2",
+ indexer.constructQuery( MAVEN.SHA1,
+ new SourcedSearchExpression( "7ab67e6b20e5332a7fb4fdf2f019aec4275846c2" ) ) );
searchAndDump( indexer, "SHA1 7ab67e6b20 (partial hash)",
indexer.constructQuery( MAVEN.SHA1, new UserInputSearchExpression( "7ab67e6b20" ) ) );