Checkstyle error fixes.
diff --git a/indexer-cli/src/main/java/org/apache/maven/index/cli/NexusIndexerCli.java b/indexer-cli/src/main/java/org/apache/maven/index/cli/NexusIndexerCli.java
index e57a2a7..d64f039 100644
--- a/indexer-cli/src/main/java/org/apache/maven/index/cli/NexusIndexerCli.java
+++ b/indexer-cli/src/main/java/org/apache/maven/index/cli/NexusIndexerCli.java
@@ -19,15 +19,6 @@
* under the License.
*/
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.lang.reflect.Proxy;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.OptionBuilder;
@@ -56,7 +47,16 @@
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.logging.LoggerManager;
import org.codehaus.plexus.tools.cli.AbstractCli;
-import org.codehaus.plexus.util.IOUtil;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
/**
* A command line tool that can be used to index local Maven repository.
@@ -64,7 +64,8 @@
* The following command line options are supported:
* <ul>
* <li>-repository <path> : required path to repository to be indexed</li>
- * <li>-index <path> : required index folder used to store created index or where previously created index is stored</li>
+ * <li>-index <path> : required index folder used to store created index or where previously created index is
+ * stored</li>
* <li>-name <path> : required repository name/id</li>
* <li>-target <path> : optional folder name where to save produced index files</li>
* <li>-type <path> : optional indexer types</li>
@@ -206,7 +207,8 @@
.withDescription( "Create checksums for all files (sha1, md5)." ).create( CREATE_FILE_CHECKSUMS ) );
options.addOption( OptionBuilder.withLongOpt( "type" ).hasArg() //
- .withDescription( "Indexer type (default, min, full or comma separated list of custom types)." ).create( TYPE ) );
+ .withDescription( "Indexer type (default, min, full or comma separated list of custom types)." )
+ .create( TYPE ) );
options.addOption( OptionBuilder.withLongOpt( "unpack" ) //
.withDescription( "Unpack an index file" ).create( UNPACK ) );
@@ -308,8 +310,8 @@
boolean quiet = cli.hasOption( QUIET );
- Integer chunkCount =
- cli.hasOption( INCREMENTAL_CHUNK_KEEP_COUNT ) ? Integer.parseInt( cli.getOptionValue( INCREMENTAL_CHUNK_KEEP_COUNT ) )
+ Integer chunkCount = cli.hasOption( INCREMENTAL_CHUNK_KEEP_COUNT )
+ ? Integer.parseInt( cli.getOptionValue( INCREMENTAL_CHUNK_KEEP_COUNT ) )
: null;
if ( !quiet )
@@ -365,24 +367,24 @@
try
{
IndexPackingRequest request =
- new IndexPackingRequest(context, indexSearcher.getIndexReader(), outputFolder);
+ new IndexPackingRequest( context, indexSearcher.getIndexReader(), outputFolder );
- request.setCreateChecksumFiles(createChecksums);
+ request.setCreateChecksumFiles( createChecksums );
- request.setCreateIncrementalChunks(createIncrementalChunks);
+ request.setCreateIncrementalChunks( createIncrementalChunks );
- request.setFormats(Arrays.asList(IndexFormat.FORMAT_V1));
+ request.setFormats( Arrays.asList( IndexFormat.FORMAT_V1 ) );
- if (chunkCount != null)
+ if ( chunkCount != null )
{
- request.setMaxIndexChunks(chunkCount.intValue());
+ request.setMaxIndexChunks( chunkCount.intValue() );
}
- packIndex(packer, request, debug, quiet);
+ packIndex( packer, request, debug, quiet );
}
finally
{
- context.releaseIndexSearcher(indexSearcher);
+ context.releaseIndexSearcher( indexSearcher );
}
if ( !quiet )
@@ -417,8 +419,8 @@
final List<IndexCreator> indexers = getIndexers( cli, plexus );
- try (BufferedInputStream is = new BufferedInputStream( new FileInputStream( indexArchive ) ); //
- FSDirectory directory = FSDirectory.open( outputFolder.toPath() ))
+ try ( BufferedInputStream is = new BufferedInputStream( new FileInputStream( indexArchive ) ); //
+ FSDirectory directory = FSDirectory.open( outputFolder.toPath() ) )
{
DefaultIndexUpdater.unpackIndexData( is, directory, (IndexingContext) Proxy.newProxyInstance(
getClass().getClassLoader(), new Class[] { IndexingContext.class }, new PartialImplementation()
@@ -496,10 +498,10 @@
{
long t = System.currentTimeMillis() - startTimeInMillis;
- long s = t / 1000L;
- if ( t > 60 * 1000 )
+ long s = TimeUnit.MILLISECONDS.toSeconds( t );
+ if ( t > TimeUnit.MINUTES.toMillis( 1 ) )
{
- long m = t / 1000L / 60L;
+ long m = TimeUnit.MILLISECONDS.toMinutes( t );
System.err.printf( "Total time: %d min %d sec\n", m, s - ( m * 60 ) );
}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfoGroup.java b/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfoGroup.java
index aec5b13..aa03678 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfoGroup.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/ArtifactInfoGroup.java
@@ -24,7 +24,7 @@
import java.util.TreeSet;
/**
- * An object that holds grouped sets of {@link ArtifactInfos} in case of grouped search.
+ * An object that holds grouped sets of {@link ArtifactInfo} in case of grouped search.
*
* @author Tamas Cservenak
*/
@@ -32,7 +32,7 @@
{
private String groupKey;
- public final Set<ArtifactInfo> artifactInfos;
+ private final Set<ArtifactInfo> artifactInfos;
public ArtifactInfoGroup( String groupKey )
{
@@ -64,7 +64,7 @@
@Override
public String toString()
{
- return new StringBuilder().append( groupKey ).append( "=" ).append( artifactInfos.toString() ).toString();
+ return groupKey + "=" + artifactInfos;
}
}
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 64ccda1..b9ae97b 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
@@ -30,8 +30,6 @@
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
@@ -214,8 +212,8 @@
* @param expression
* @return the query to be used for search.
* @see SearchExpression
- * @see UserInputSearchExpression
- * @see SourcedSearchExpression
+ * @see org.apache.maven.index.expr.UserInputSearchExpression
+ * @see org.apache.maven.index.expr.SourcedSearchExpression
* @throws IllegalArgumentException
*/
Query constructQuery( Field field, SearchExpression expression )
diff --git a/indexer-core/src/main/java/org/apache/maven/index/NexusIndexer.java b/indexer-core/src/main/java/org/apache/maven/index/NexusIndexer.java
index 2172816..ab0678f 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/NexusIndexer.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/NexusIndexer.java
@@ -32,8 +32,6 @@
import org.apache.maven.index.context.IndexingContext;
import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
import org.apache.maven.index.expr.SearchExpression;
-import org.apache.maven.index.packer.IndexPacker;
-import org.apache.maven.index.updater.IndexUpdater;
/**
* The Nexus indexer is a statefull facade that maintains state of indexing contexts.
@@ -57,8 +55,9 @@
* {@link #addArtifactToIndex(ArtifactContext, IndexingContext)} or
* {@link #deleteArtifactFromIndex(ArtifactContext, IndexingContext)} methods.
* <p>
- * An {@link IndexUpdater} could be used to fetch indexes from remote repositories. These indexers could be created
- * using the {@link NexusIndexerCli} command line tool or {@link IndexPacker} API.
+ * An {@link org.apache.maven.index.updater.IndexUpdater} could be used to fetch indexes from remote repositories.
+ * These indexers could be created using the Indexer CLI command line tool or
+ * {@link org.apache.maven.index.packer.IndexPacker} API.
* <p>
* Once index is populated you can perform search queries using field names declared in the {@link ArtifactInfo}:
*
@@ -79,7 +78,7 @@
* supported queries.
*
* @see IndexingContext
- * @see IndexUpdater
+ * @see org.apache.maven.index.updater.IndexUpdater
* @see DefaultQueryCreator
* @author Jason van Zyl
* @author Tamas Cservenak
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 bfbaaf1..d56be7f 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
@@ -19,16 +19,14 @@
* 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
* matches the context repositoryId, etc.
*
* @author Tamas Cservenak
- * @deprecated The deprecated {@link NexusIndexer} uses this exception. Use {@link Indexer} instead.
+ * @deprecated The deprecated {@link org.apache.maven.index.NexusIndexer} uses this exception. Use
+ * {@link org.apache.maven.index.Indexer} instead.
*/
public class UnsupportedExistingLuceneIndexException
extends Exception
diff --git a/indexer-core/src/main/java/org/apache/maven/index/packer/IndexPacker.java b/indexer-core/src/main/java/org/apache/maven/index/packer/IndexPacker.java
index ea40db0..7fe4ee6 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/packer/IndexPacker.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/packer/IndexPacker.java
@@ -21,10 +21,9 @@
import java.io.IOException;
-import org.apache.maven.index.updater.IndexUpdater;
-
/**
- * An index packer used to create transfer index format that can be used by the {@link IndexUpdater}.
+ * An index packer used to create transfer index format that can be used by the
+ * {@link org.apache.maven.index.updater.IndexUpdater}.
*
* @author Tamas Cservenak
*/
@@ -36,8 +35,7 @@
* Pack a context into a target directory. If the directory does not exists, it will be created. If the directory
* exists, it should be writable.
*
- * @param context the context to pack-up
- * @param targetDir the directory where to write results, has to be non-null
+ * @param request the request to process.
* @throws IllegalArgumentException when the targetDir already exists and is not a writable directory.
* @throws IOException on lethal IO problem
*/
diff --git a/indexer-core/src/main/java/org/apache/maven/index/search/grouping/GAGrouping.java b/indexer-core/src/main/java/org/apache/maven/index/search/grouping/GAGrouping.java
index 0f7af72..393a182 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/search/grouping/GAGrouping.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/search/grouping/GAGrouping.java
@@ -22,10 +22,9 @@
import java.util.Comparator;
import org.apache.maven.index.ArtifactInfo;
-import org.apache.maven.index.Grouping;
/**
- * A GroupId : ArtifactId {@link Grouping} implementation.
+ * A GroupId : ArtifactId grouping implementation.
*
* @author Tamas Cservenak
*/
diff --git a/indexer-core/src/main/java/org/apache/maven/index/search/grouping/GAVGrouping.java b/indexer-core/src/main/java/org/apache/maven/index/search/grouping/GAVGrouping.java
index 28f1d57..74b538a 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/search/grouping/GAVGrouping.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/search/grouping/GAVGrouping.java
@@ -22,10 +22,9 @@
import java.util.Comparator;
import org.apache.maven.index.ArtifactInfo;
-import org.apache.maven.index.Grouping;
/**
- * A GroupId : ArtifactId : Version {@link Grouping} implementation.
+ * A GroupId : ArtifactId : Version grouping implementation.
*
* @author Tamas Cservenak
*/
diff --git a/indexer-core/src/main/java/org/apache/maven/index/search/grouping/GGrouping.java b/indexer-core/src/main/java/org/apache/maven/index/search/grouping/GGrouping.java
index 4b11fde..9bcf356 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/search/grouping/GGrouping.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/search/grouping/GGrouping.java
@@ -22,10 +22,9 @@
import java.util.Comparator;
import org.apache.maven.index.ArtifactInfo;
-import org.apache.maven.index.Grouping;
/**
- * A GroupId {@link Grouping} implementation.
+ * A GroupId grouping implementation.
*
* @author Tamas Cservenak
*/
diff --git a/indexer-core/src/main/java/org/apache/maven/index/search/grouping/RGAVGrouping.java b/indexer-core/src/main/java/org/apache/maven/index/search/grouping/RGAVGrouping.java
index 76e3163..ddabf28 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/search/grouping/RGAVGrouping.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/search/grouping/RGAVGrouping.java
@@ -22,10 +22,9 @@
import java.util.Comparator;
import org.apache.maven.index.ArtifactInfo;
-import org.apache.maven.index.Grouping;
/**
- * A Repository : GroupId : ArtifactId : Version {@link Grouping} implementation.
+ * A Repository : GroupId : ArtifactId : Version grouping implementation.
*
* @author Tamas Cservenak
*/
diff --git a/indexer-core/src/main/java/org/apache/maven/index/search/grouping/RGGrouping.java b/indexer-core/src/main/java/org/apache/maven/index/search/grouping/RGGrouping.java
index f98e869..00d2273 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/search/grouping/RGGrouping.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/search/grouping/RGGrouping.java
@@ -22,10 +22,9 @@
import java.util.Comparator;
import org.apache.maven.index.ArtifactInfo;
-import org.apache.maven.index.Grouping;
/**
- * A Repository : GroupId {@link Grouping} implementation.
+ * A Repository : GroupId grouping implementation.
*
* @author Tamas Cservenak
*/
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 716fda6..67f823d 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
@@ -125,9 +125,9 @@
public long readHeader()
throws IOException
{
- final byte HDRBYTE = (byte) ( ( IndexDataWriter.VERSION << 24 ) >> 24 );
+ final byte hdrbyte = (byte) ( ( IndexDataWriter.VERSION << 24 ) >> 24 );
- if ( HDRBYTE != dis.readByte() )
+ if ( hdrbyte != dis.readByte() )
{
// data format version mismatch
throw new IOException( "Provided input contains unexpected data (0x01 expected as 1st byte)!" );
@@ -224,7 +224,7 @@
int c, char2, char3;
int count = 0;
- int chararr_count = 0;
+ int chararrCount = 0;
in.readFully( bytearr, 0, utflen );
@@ -236,7 +236,7 @@
break;
}
count++;
- chararr[chararr_count++] = (char) c;
+ chararr[chararrCount++] = (char) c;
}
while ( count < utflen )
@@ -254,7 +254,7 @@
case 7:
/* 0xxxxxxx */
count++;
- chararr[chararr_count++] = (char) c;
+ chararr[chararrCount++] = (char) c;
break;
case 12:
@@ -270,7 +270,7 @@
{
throw new UTFDataFormatException( "malformed input around byte " + count );
}
- chararr[chararr_count++] = (char) ( ( ( c & 0x1F ) << 6 ) | ( char2 & 0x3F ) );
+ chararr[chararrCount++] = (char) ( ( ( c & 0x1F ) << 6 ) | ( char2 & 0x3F ) );
break;
case 14:
@@ -286,7 +286,7 @@
{
throw new UTFDataFormatException( "malformed input around byte " + ( count - 1 ) );
}
- chararr[chararr_count++] =
+ chararr[chararrCount++] =
(char) ( ( ( c & 0x0F ) << 12 ) | ( ( char2 & 0x3F ) << 6 ) | ( ( char3 & 0x3F ) << 0 ) );
break;
@@ -297,7 +297,7 @@
}
// The number of chars produced may be less than utflen
- return new String( chararr, 0, chararr_count );
+ return new String( chararr, 0, chararrCount );
}
/**
diff --git a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdater.java b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdater.java
index e61bd6f..8a5d812 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdater.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdater.java
@@ -21,11 +21,9 @@
import java.io.IOException;
-import org.apache.maven.index.packer.IndexPacker;
-
/**
* An index updater provides functionality to update index for remote repositories using transfer format produced by the
- * {@link IndexPacker}.
+ * {@link org.apache.maven.index.packer.IndexPacker}.
* <p>
* The following snippet shows how to update/download remote index:
*
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 fc23bc2..6bdf666 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
@@ -74,6 +74,9 @@
import java.util.List;
import java.util.Map;
+/**
+ * Collection of some use cases.
+ */
public class BasicUsageExample
{
public static void main( String[] args )
@@ -295,7 +298,9 @@
// doing sha1 search
searchAndDump( indexer, "SHA1 7ab67e6b20e5332a7fb4fdf2f019aec4275846c2",
indexer.constructQuery( MAVEN.SHA1,
- new SourcedSearchExpression( "7ab67e6b20e5332a7fb4fdf2f019aec4275846c2" ) ) );
+ new SourcedSearchExpression( "7ab67e6b20e5332a7fb4fdf2f019aec4275846c2" )
+ )
+ );
searchAndDump( indexer, "SHA1 7ab67e6b20 (partial hash)",
indexer.constructQuery( MAVEN.SHA1, new UserInputSearchExpression( "7ab67e6b20" ) ) );
@@ -339,6 +344,8 @@
System.out.println();
}
+ private static final int MAX_WIDTH = 60;
+
public void searchGroupedAndDump( Indexer nexusIndexer, String descr, Query q, Grouping g )
throws IOException
{
@@ -353,7 +360,7 @@
System.out.println( " Latest version: " + ai.getVersion() );
System.out.println( StringUtils.isBlank( ai.getDescription() )
? "No description in plugin's POM."
- : StringUtils.abbreviate( ai.getDescription(), 60 ) );
+ : StringUtils.abbreviate( ai.getDescription(), MAX_WIDTH ) );
System.out.println();
}
diff --git a/indexer-examples/indexer-examples-spring/src/main/java/org/apache/maven/indexer/examples/indexing/RepositoryIndexer.java b/indexer-examples/indexer-examples-spring/src/main/java/org/apache/maven/indexer/examples/indexing/RepositoryIndexer.java
index fada90d..a9dbf1b 100644
--- a/indexer-examples/indexer-examples-spring/src/main/java/org/apache/maven/indexer/examples/indexing/RepositoryIndexer.java
+++ b/indexer-examples/indexer-examples-spring/src/main/java/org/apache/maven/indexer/examples/indexing/RepositoryIndexer.java
@@ -60,9 +60,9 @@
private static final Logger LOGGER = LoggerFactory.getLogger( RepositoryIndexer.class );
- private static final String[] luceneFields = new String[]{ "g", "a", "v", "p", "c" };
+ private static final String[] LUCENE_FIELDS = new String[]{"g", "a", "v", "p", "c" };
- private static final WhitespaceAnalyzer luceneAnalyzer = new WhitespaceAnalyzer( );
+ private static final WhitespaceAnalyzer LUCENE_ANALYZER = new WhitespaceAnalyzer( );
private Indexer indexer;
@@ -173,7 +173,7 @@
public Set<ArtifactInfo> search( final String queryText )
throws ParseException, IOException
{
- final Query query = new MultiFieldQueryParser( luceneFields, luceneAnalyzer ).parse( queryText );
+ final Query query = new MultiFieldQueryParser( LUCENE_FIELDS, LUCENE_ANALYZER ).parse( queryText );
LOGGER.debug( "Executing search query: {}; ctx id: {}; idx dir: {}",
new String[]{ query.toString(), indexingContext.getId(),
diff --git a/indexer-examples/indexer-examples-spring/src/main/java/org/apache/maven/indexer/examples/services/impl/ArtifactIndexingServiceImpl.java b/indexer-examples/indexer-examples-spring/src/main/java/org/apache/maven/indexer/examples/services/impl/ArtifactIndexingServiceImpl.java
index 5b2caf1..5adb1cf 100644
--- a/indexer-examples/indexer-examples-spring/src/main/java/org/apache/maven/indexer/examples/services/impl/ArtifactIndexingServiceImpl.java
+++ b/indexer-examples/indexer-examples-spring/src/main/java/org/apache/maven/indexer/examples/services/impl/ArtifactIndexingServiceImpl.java
@@ -47,7 +47,7 @@
implements ArtifactIndexingService
{
- private static final Logger logger = LoggerFactory.getLogger( ArtifactIndexingServiceImpl.class );
+ private static final Logger LOGGER = LoggerFactory.getLogger( ArtifactIndexingServiceImpl.class );
@Autowired
private RepositoryIndexManager repositoryIndexManager;
@@ -86,7 +86,7 @@
if ( repositoryId != null && !repositoryId.isEmpty() )
{
- logger.debug( "Repository: {}", repositoryId );
+ LOGGER.debug( "Repository: {}", repositoryId );
final Map<String, Collection<ArtifactInfo>> resultsMap =
getResultsMap( repositoryId, searchRequest.getQuery() );
@@ -96,11 +96,11 @@
searchResults.setResults( resultsMap );
}
- if ( logger.isDebugEnabled() )
+ if ( LOGGER.isDebugEnabled() )
{
int results = resultsMap.entrySet().iterator().next().getValue().size();
- logger.debug( "Results: {}", results );
+ LOGGER.debug( "Results: {}", results );
}
}
else
@@ -108,7 +108,7 @@
Map<String, Collection<ArtifactInfo>> resultsMap = new LinkedHashMap<>();
for ( String repoId : repositoryIndexManager.getIndexes().keySet() )
{
- logger.debug( "Repository: {}", repoId );
+ LOGGER.debug( "Repository: {}", repoId );
final RepositoryIndexer repositoryIndex = repositoryIndexManager.getRepositoryIndex( repoId );
if ( repositoryIndex != null )
@@ -121,7 +121,7 @@
resultsMap.put( repoId, artifactInfoResults );
}
- logger.debug( "Results: {}", artifactInfoResults.size() );
+ LOGGER.debug( "Results: {}", artifactInfoResults.size() );
}
}
diff --git a/indexer-reader/src/main/java/org/apache/maven/index/reader/ChunkReader.java b/indexer-reader/src/main/java/org/apache/maven/index/reader/ChunkReader.java
index 9ce6bfa..159f440 100644
--- a/indexer-reader/src/main/java/org/apache/maven/index/reader/ChunkReader.java
+++ b/indexer-reader/src/main/java/org/apache/maven/index/reader/ChunkReader.java
@@ -116,7 +116,7 @@
private Map<String, String> nextRecord;
- public IndexIterator( final DataInputStream dataInputStream )
+ private IndexIterator( final DataInputStream dataInputStream )
throws IOException
{
this.dataInputStream = dataInputStream;
@@ -212,7 +212,7 @@
int c, char2, char3;
int count = 0;
- int chararr_count = 0;
+ int chararrCount = 0;
dataInput.readFully( bytearr, 0, utflen );
@@ -224,7 +224,7 @@
break;
}
count++;
- chararr[chararr_count++] = (char) c;
+ chararr[chararrCount++] = (char) c;
}
while ( count < utflen )
@@ -242,7 +242,7 @@
case 7:
/* 0xxxxxxx */
count++;
- chararr[chararr_count++] = (char) c;
+ chararr[chararrCount++] = (char) c;
break;
case 12:
@@ -258,7 +258,7 @@
{
throw new UTFDataFormatException( "malformed input around byte " + count );
}
- chararr[chararr_count++] = (char) ( ( ( c & 0x1F ) << 6 ) | ( char2 & 0x3F ) );
+ chararr[chararrCount++] = (char) ( ( ( c & 0x1F ) << 6 ) | ( char2 & 0x3F ) );
break;
case 14:
@@ -274,7 +274,7 @@
{
throw new UTFDataFormatException( "malformed input around byte " + ( count - 1 ) );
}
- chararr[chararr_count++] =
+ chararr[chararrCount++] =
(char) ( ( ( c & 0x0F ) << 12 ) | ( ( char2 & 0x3F ) << 6 ) | ( char3 & 0x3F ) );
break;
@@ -285,6 +285,6 @@
}
// The number of chars produced may be less than utflen
- return new String( chararr, 0, chararr_count );
+ return new String( chararr, 0, chararrCount );
}
}
diff --git a/indexer-reader/src/main/java/org/apache/maven/index/reader/IndexReader.java b/indexer-reader/src/main/java/org/apache/maven/index/reader/IndexReader.java
index 8f3ee2a..54a5c92 100644
--- a/indexer-reader/src/main/java/org/apache/maven/index/reader/IndexReader.java
+++ b/indexer-reader/src/main/java/org/apache/maven/index/reader/IndexReader.java
@@ -77,7 +77,8 @@
{
if ( local != null )
{
- Properties localProperties = loadProperties( local.locate( Utils.INDEX_FILE_PREFIX + ".properties" ) );
+ Properties localProperties =
+ loadProperties( local.locate( Utils.INDEX_FILE_PREFIX + ".properties" ) );
if ( localProperties != null )
{
this.localIndexProperties = localProperties;
@@ -135,8 +136,8 @@
}
/**
- * Returns {@code true} if incremental update is about to happen. If incremental update, the {@link #iterator()} will
- * return only the diff from the last update.
+ * Returns {@code true} if incremental update is about to happen. If incremental update, the {@link #iterator()}
+ * will return only the diff from the last update.
*/
public boolean isIncremental()
{
@@ -155,9 +156,9 @@
/**
* Closes the underlying {@link ResourceHandler}s. In case of incremental update use, it also assumes that user
- * consumed all the iterator and integrated it, hence, it will update the {@link WritableResourceHandler} contents to
- * prepare it for future incremental update. If this is not desired (ie. due to aborted update), then this method
- * should NOT be invoked, but rather the {@link ResourceHandler}s that caller provided in constructor of
+ * consumed all the iterator and integrated it, hence, it will update the {@link WritableResourceHandler} contents
+ * to prepare it for future incremental update. If this is not desired (ie. due to aborted update), then this
+ * method should NOT be invoked, but rather the {@link ResourceHandler}s that caller provided in constructor of
* this class should be closed manually.
*/
public void close()
diff --git a/indexer-reader/src/main/java/org/apache/maven/index/reader/IndexWriter.java b/indexer-reader/src/main/java/org/apache/maven/index/reader/IndexWriter.java
index e997b67..dd91510 100644
--- a/indexer-reader/src/main/java/org/apache/maven/index/reader/IndexWriter.java
+++ b/indexer-reader/src/main/java/org/apache/maven/index/reader/IndexWriter.java
@@ -134,8 +134,8 @@
}
/**
- * Returns the chain id of published index. If {@link #isIncremental()} is {@code false}, this is the newly generated
- * chain ID.
+ * Returns the chain id of published index. If {@link #isIncremental()} is {@code false}, this is the newly
+ * generated chain ID.
*/
public String getChainId()
{
@@ -158,7 +158,7 @@
{
int written;
- try (WritableResource writableResource = local.locate( nextChunkName ))
+ try ( WritableResource writableResource = local.locate( nextChunkName ) )
{
final ChunkWriter chunkWriter =
new ChunkWriter( nextChunkName, writableResource.write(), INDEX_V1, new Date() );
diff --git a/indexer-reader/src/main/java/org/apache/maven/index/reader/Record.java b/indexer-reader/src/main/java/org/apache/maven/index/reader/Record.java
index e636ff1..757b959 100644
--- a/indexer-reader/src/main/java/org/apache/maven/index/reader/Record.java
+++ b/indexer-reader/src/main/java/org/apache/maven/index/reader/Record.java
@@ -28,6 +28,11 @@
*/
public final class Record
{
+ /**
+ * Entry key is field key with some metadata.
+ *
+ * @param <T> The type of the value belonging to this key instance.
+ */
public static final class EntryKey<T>
{
private final String name;
@@ -273,8 +278,8 @@
public static final EntryKey<String> OSGI_FRAGMENT_HOST = new EntryKey<String>( "Fragment-Host", String.class );
/**
- * Key of deprecated OSGi "Bundle-RequiredExecutionEnvironment" manifest entry, that contains {@link String}. Extracted by {@code
- * OsgiArtifactIndexCreator}.
+ * Key of deprecated OSGi "Bundle-RequiredExecutionEnvironment" manifest entry, that contains {@link String}.
+ * Extracted by {@code OsgiArtifactIndexCreator}.
*/
public static final EntryKey<String> OSGI_BREE =
new EntryKey<String>( "Bundle-RequiredExecutionEnvironment", String.class );
@@ -327,8 +332,8 @@
ARTIFACT_ADD,
/**
- * Artifact REMOVE record. In case of incremental updates, signals that this artifact was removed. Records of this
- * type should be removed from your indexing system.
+ * Artifact REMOVE record. In case of incremental updates, signals that this artifact was removed. Records of
+ * this type should be removed from your indexing system.
* Contains following entries:
* <ul>
* <li>{@link #REC_MODIFIED} (when record was deleted from index)</li>
@@ -352,8 +357,8 @@
ALL_GROUPS,
/**
- * Special record, containing all the root groups of Maven "groupId"s that are enlisted on the index. Can be safely
- * ignored.
+ * Special record, containing all the root groups of Maven "groupId"s that are enlisted on the index. Can be
+ * safely ignored.
* Contains following entries:
* <ul>
* <li>{@link #ROOT_GROUPS}</li>
@@ -373,9 +378,9 @@
}
/**
- * Returns the {@link Type} of this record. Usually users would be interested in {@link Type#ARTIFACT_ADD} and {@link
- * Type#ARTIFACT_REMOVE} types only to maintain their own index. Still, indexer offers extra records too, see {@link
- * Type} for all existing types.
+ * Returns the {@link Type} of this record. Usually users would be interested in {@link Type#ARTIFACT_ADD} and
+ * {@link Type#ARTIFACT_REMOVE} types only to maintain their own index. Still, indexer offers extra records too,
+ * see {@link Type} for all existing types.
*/
public Type getType()
{
diff --git a/indexer-reader/src/main/java/org/apache/maven/index/reader/RecordCompactor.java b/indexer-reader/src/main/java/org/apache/maven/index/reader/RecordCompactor.java
index 74a7d11..17765ef 100644
--- a/indexer-reader/src/main/java/org/apache/maven/index/reader/RecordCompactor.java
+++ b/indexer-reader/src/main/java/org/apache/maven/index/reader/RecordCompactor.java
@@ -24,7 +24,10 @@
import java.util.HashMap;
import java.util.Map;
-import static org.apache.maven.index.reader.Utils.*;
+import static org.apache.maven.index.reader.Utils.FIELD_SEPARATOR;
+import static org.apache.maven.index.reader.Utils.INFO;
+import static org.apache.maven.index.reader.Utils.UINFO;
+import static org.apache.maven.index.reader.Utils.nvl;
/**
* Maven 2 Index record transformer, that transforms {@link Record}s into "native" Maven Indexer records.
diff --git a/indexer-reader/src/main/java/org/apache/maven/index/reader/RecordExpander.java b/indexer-reader/src/main/java/org/apache/maven/index/reader/RecordExpander.java
index 3b61307..3d57525 100644
--- a/indexer-reader/src/main/java/org/apache/maven/index/reader/RecordExpander.java
+++ b/indexer-reader/src/main/java/org/apache/maven/index/reader/RecordExpander.java
@@ -25,7 +25,13 @@
import java.util.HashMap;
import java.util.Map;
-import static org.apache.maven.index.reader.Utils.*;
+import static org.apache.maven.index.reader.Utils.FIELD_SEPARATOR;
+import static org.apache.maven.index.reader.Utils.FS_PATTERN;
+import static org.apache.maven.index.reader.Utils.INFO;
+import static org.apache.maven.index.reader.Utils.NOT_AVAILABLE;
+import static org.apache.maven.index.reader.Utils.UINFO;
+import static org.apache.maven.index.reader.Utils.renvl;
+
/**
* Maven 2 Index record transformer, that transforms "native" Maven Indexer records into {@link Record}s.
diff --git a/indexer-reader/src/main/java/org/apache/maven/index/reader/ResourceHandler.java b/indexer-reader/src/main/java/org/apache/maven/index/reader/ResourceHandler.java
index 02dd913..111e872 100644
--- a/indexer-reader/src/main/java/org/apache/maven/index/reader/ResourceHandler.java
+++ b/indexer-reader/src/main/java/org/apache/maven/index/reader/ResourceHandler.java
@@ -33,6 +33,9 @@
public interface ResourceHandler
extends Closeable
{
+ /**
+ * Handle of content.
+ */
interface Resource
{
/**
diff --git a/indexer-reader/src/main/java/org/apache/maven/index/reader/WritableResourceHandler.java b/indexer-reader/src/main/java/org/apache/maven/index/reader/WritableResourceHandler.java
index 01c7aa5..207b076 100644
--- a/indexer-reader/src/main/java/org/apache/maven/index/reader/WritableResourceHandler.java
+++ b/indexer-reader/src/main/java/org/apache/maven/index/reader/WritableResourceHandler.java
@@ -34,16 +34,19 @@
public interface WritableResourceHandler
extends ResourceHandler
{
+ /**
+ * Resource that is writable.
+ */
interface WritableResource
extends Resource, Closeable
{
/**
- * Returns the {@link OutputStream} stream of the resource, if exists, it will replace the existing content, or if
- * not exists, the resource will be created. The stream should be closed by caller, otherwise resource leaks might
- * be introduced. How and when content is written is left to implementation, but it is guaranteed that this method
- * is called only once, and will be followed by {@link #close()} on the resource itself. Implementation does not
- * have to be "read consistent", in a way to worry what subsequent {@link #read()} method will return, as mixed
- * calls will not happen on same instance of resource.
+ * Returns the {@link OutputStream} stream of the resource, if exists, it will replace the existing content, or
+ * if not exists, the resource will be created. The stream should be closed by caller, otherwise resource leaks
+ * might be introduced. How and when content is written is left to implementation, but it is guaranteed that
+ * this method is called only once, and will be followed by {@link #close()} on the resource itself.
+ * Implementation does not have to be "read consistent", in a way to worry what subsequent {@link #read()}
+ * method will return, as mixed calls will not happen on same instance of resource.
*/
OutputStream write()
throws IOException;