From 7ddc4eeb2f66a8ce472e29c30c1e3dfd7c50b042 Mon Sep 17 00:00:00 2001
From: Mat Booth <mat.booth@redhat.com>
Date: Tue, 18 Jun 2019 15:45:18 +0100
Subject: [PATCH 2/2] Port to latest versions of maven-indexer and lucene
---
.../org.eclipse.m2e.maven.indexer/pom.xml | 4 +-
.../maven/index/DefaultIndexerEngine.java | 27 ++---
.../core/ui/internal/util/ProposalUtil.java | 2 +-
.../nexus/AetherClientResourceFetcher.java | 11 +-
.../core/internal/index/nexus/NexusIndex.java | 10 +-
.../index/nexus/NexusIndexManager.java | 100 +++++++++---------
6 files changed, 83 insertions(+), 71 deletions(-)
diff --git a/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml b/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml
index eb809b6..85d3dfe 100644
--- a/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml
+++ b/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml
@@ -25,7 +25,7 @@
<dependency>
<groupId>org.apache.maven.indexer</groupId>
<artifactId>indexer-core</artifactId>
- <version>3.1.0</version>
+ <version>6.0.0</version>
<optional>true</optional>
<exclusions>
<exclusion>
@@ -68,7 +68,7 @@
</_exportcontents>
<Import-Package>
- !*
+ org.apache.lucene*,!*
</Import-Package>
<Require-Bundle>
org.eclipse.m2e.maven.runtime;bundle-version="[1.11.0,1.12.0)",
diff --git a/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java b/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java
index 4b155c1..6aa1359 100644
--- a/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java
+++ b/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java
@@ -25,7 +25,9 @@ import java.util.Set;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.index.IndexableField;
+import org.apache.lucene.index.IndexableFieldType;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.IndexSearcher;
@@ -112,10 +114,9 @@ public class DefaultIndexerEngine
{
final HashMap<String, String> result = new HashMap<String, String>();
- for ( Object o : d.getFields() )
+ for ( IndexableField f : d.getFields() )
{
- Fieldable f = (Fieldable) o;
- if ( f.isStored() )
+ if ( f.fieldType().stored() )
{
result.put( f.name(), f.stringValue() );
}
@@ -128,13 +129,15 @@ public class DefaultIndexerEngine
{
try
{
- IndexSearcher indexSearcher = context.getIndexSearcher();
+ IndexSearcher indexSearcher = context.acquireIndexSearcher();
TopDocs result =
indexSearcher.search( new TermQuery( new Term( ArtifactInfo.UINFO, ac.getArtifactInfo().getUinfo() ) ),
2 );
- if ( result.totalHits == 1 )
+ if ( result.totalHits.value == 1 )
{
- return indexSearcher.doc( result.scoreDocs[0].doc );
+ Document doc = indexSearcher.doc( result.scoreDocs[0].doc );
+ context.releaseIndexSearcher( indexSearcher );
+ return doc;
}
}
catch ( IOException e )
@@ -155,9 +158,9 @@ public class DefaultIndexerEngine
}
Set<String> allGroups = context.getAllGroups();
- if ( !allGroups.contains( ac.getArtifactInfo().groupId ) )
+ if ( !allGroups.contains( ac.getArtifactInfo().getGroupId() ) )
{
- allGroups.add( ac.getArtifactInfo().groupId );
+ allGroups.add( ac.getArtifactInfo().getGroupId() );
context.setAllGroups( allGroups );
}
}
@@ -170,9 +173,9 @@ public class DefaultIndexerEngine
String uinfo = ac.getArtifactInfo().getUinfo();
// add artifact deletion marker
Document doc = new Document();
- doc.add( new Field( ArtifactInfo.DELETED, uinfo, Field.Store.YES, Field.Index.NO ) );
- doc.add( new Field( ArtifactInfo.LAST_MODIFIED, //
- Long.toString( System.currentTimeMillis() ), Field.Store.YES, Field.Index.NO ) );
+ doc.add( new StringField( ArtifactInfo.DELETED, uinfo, Field.Store.YES ) );
+ doc.add( new StringField( ArtifactInfo.LAST_MODIFIED, //
+ Long.toString( System.currentTimeMillis() ), Field.Store.YES ) );
IndexWriter w = context.getIndexWriter();
w.addDocument( doc );
w.deleteDocuments( new Term( ArtifactInfo.UINFO, uinfo ) );
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java
index e8d735c..69e42fd 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java
@@ -31,7 +31,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
-import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.maven.project.MavenProject;
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java
index 16a5b90..aa5e9a0 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java
@@ -31,7 +31,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
-import org.apache.maven.index.updater.AbstractResourceFetcher;
+import org.apache.maven.index.updater.ResourceFetcher;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
@@ -46,7 +46,7 @@ import io.takari.aether.client.Response;
import io.takari.aether.okhttp.OkHttpAetherClient;
-public class AetherClientResourceFetcher extends AbstractResourceFetcher {
+public class AetherClientResourceFetcher implements ResourceFetcher {
private AetherClient aetherClient;
@@ -94,6 +94,13 @@ public class AetherClientResourceFetcher extends AbstractResourceFetcher {
}
}
+ public InputStream retrieve(String name) throws IOException, FileNotFoundException {
+ String url = baseUrl + "/" + name;
+ Response response = aetherClient.get(url);
+
+ return response.getInputStream();
+ }
+
class AetherClientConfigAdapter extends AetherClientConfig {
private final Logger log = LoggerFactory.getLogger(AetherClientConfigAdapter.class);
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndex.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndex.java
index de52ffc..eb578e8 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndex.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndex.java
@@ -105,7 +105,7 @@ public class NexusIndex implements IIndex, IMutableIndex {
public Collection<IndexedArtifact> find(Collection<SearchExpression> groupId,
Collection<SearchExpression> artifactId, Collection<SearchExpression> version,
Collection<SearchExpression> packaging) throws CoreException {
- BooleanQuery query = new BooleanQuery();
+ BooleanQuery.Builder query = new BooleanQuery.Builder();
addQueryFromSearchExpressionCollection(query, MAVEN.PACKAGING, packaging);
@@ -115,18 +115,18 @@ public class NexusIndex implements IIndex, IMutableIndex {
addQueryFromSearchExpressionCollection(query, MAVEN.VERSION, version);
- return indexManager.search(repository, query).values();
+ return indexManager.search(repository, query.build()).values();
}
- private void addQueryFromSearchExpressionCollection(final BooleanQuery query, final Field field,
+ private void addQueryFromSearchExpressionCollection(final BooleanQuery.Builder query, final Field field,
final Collection<SearchExpression> sec) {
if(sec != null && !sec.isEmpty()) {
if(sec.size() > 1) {
- BooleanQuery q = new BooleanQuery();
+ BooleanQuery.Builder q = new BooleanQuery.Builder();
for(SearchExpression se : sec) {
q.add(indexManager.constructQuery(field, se), Occur.SHOULD);
}
- query.add(q, Occur.MUST);
+ query.add(q.build(), Occur.MUST);
} else {
query.add(indexManager.constructQuery(field, sec.iterator().next()), Occur.MUST);
}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java
index 9686315..7ecbb18 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java
@@ -52,9 +52,7 @@ import org.codehaus.plexus.util.IOUtil;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.FilteredQuery;
import org.apache.lucene.search.Query;
-import org.apache.lucene.search.QueryWrapperFilter;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
@@ -69,7 +67,6 @@ import org.apache.maven.index.MAVEN;
import org.apache.maven.index.NexusIndexer;
import org.apache.maven.index.SearchType;
import org.apache.maven.index.artifact.Gav;
-import org.apache.maven.index.artifact.IllegalArtifactCoordinateException;
import org.apache.maven.index.context.IndexCreator;
import org.apache.maven.index.context.IndexingContext;
import org.apache.maven.index.creator.JarFileContentsIndexCreator;
@@ -229,7 +226,7 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
public IndexedArtifactFile getIndexedArtifactFile(IRepository repository, ArtifactKey gav) throws CoreException {
try {
- BooleanQuery query = new BooleanQuery();
+ BooleanQuery.Builder query = new BooleanQuery.Builder();
query.add(constructQuery(MAVEN.GROUP_ID, gav.getGroupId(), SearchType.EXACT), BooleanClause.Occur.MUST);
query.add(constructQuery(MAVEN.ARTIFACT_ID, gav.getArtifactId(), SearchType.EXACT), BooleanClause.Occur.MUST);
query.add(constructQuery(MAVEN.VERSION, gav.getVersion(), SearchType.EXACT), BooleanClause.Occur.MUST);
@@ -239,9 +236,10 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
}
synchronized(getIndexLock(repository)) {
- ArtifactInfo artifactInfo = getIndexer().identify(query, Collections.singleton(getIndexingContext(repository)));
- if(artifactInfo != null) {
- return getIndexedArtifactFile(artifactInfo);
+ Collection<ArtifactInfo> artifactInfo = getIndexer().identify(query.build(),
+ Collections.singleton(getIndexingContext(repository)));
+ if(artifactInfo != null && !artifactInfo.isEmpty()) {
+ return getIndexedArtifactFile((ArtifactInfo) artifactInfo.toArray()[0]);
}
}
} catch(Exception ex) {
@@ -255,26 +253,26 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
/** for Unit test */
public IndexedArtifactFile getIndexedArtifactFile(ArtifactInfo artifactInfo) {
- String groupId = artifactInfo.groupId;
- String artifactId = artifactInfo.artifactId;
- String repository = artifactInfo.repository;
- String version = artifactInfo.version;
- String classifier = artifactInfo.classifier;
- String packaging = artifactInfo.packaging;
- String fname = artifactInfo.fname;
+ String groupId = artifactInfo.getGroupId();
+ String artifactId = artifactInfo.getArtifactId();
+ String repository = artifactInfo.getRepository();
+ String version = artifactInfo.getVersion();
+ String classifier = artifactInfo.getClassifier();
+ String packaging = artifactInfo.getPackaging();
+ String fname = artifactInfo.getFileName();
if(fname == null) {
fname = artifactId + '-' + version
+ (classifier != null ? '-' + classifier : "") + (packaging != null ? ('.' + packaging) : ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- long size = artifactInfo.size;
- Date date = new Date(artifactInfo.lastModified);
+ long size = artifactInfo.getSize();
+ Date date = new Date(artifactInfo.getLastModified());
- int sourcesExists = artifactInfo.sourcesExists.ordinal();
- int javadocExists = artifactInfo.javadocExists.ordinal();
+ int sourcesExists = artifactInfo.getSourcesExists().ordinal();
+ int javadocExists = artifactInfo.getJavadocExists().ordinal();
- String prefix = artifactInfo.prefix;
- List<String> goals = artifactInfo.goals;
+ String prefix = artifactInfo.getPrefix();
+ List<String> goals = artifactInfo.getGoals();
return new IndexedArtifactFile(repository, groupId, artifactId, version, packaging, classifier, fname, size, date,
sourcesExists, javadocExists, prefix, goals);
@@ -282,8 +280,9 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
public IndexedArtifactFile identify(File file) throws CoreException {
try {
- ArtifactInfo artifactInfo = getIndexer().identify(file);
- return artifactInfo == null ? null : getIndexedArtifactFile(artifactInfo);
+ Collection<ArtifactInfo> artifactInfo = getIndexer().identify(file);
+ return artifactInfo == null || artifactInfo.isEmpty() ? null
+ : getIndexedArtifactFile((ArtifactInfo) artifactInfo.toArray()[0]);
} catch(IOException ex) {
throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1,
Messages.NexusIndexManager_error_search, ex));
@@ -341,7 +340,7 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
return search(null, term, type, classifier);
}
- private void addClassifiersToQuery(BooleanQuery bq, int classifier) {
+ private void addClassifiersToQuery(BooleanQuery.Builder bq, int classifier) {
boolean includeJavaDocs = (classifier & IIndex.SEARCH_JAVADOCS) > 0;
Query tq = null;
if(!includeJavaDocs) {
@@ -372,46 +371,55 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
// query = new TermQuery(new Term(ArtifactInfo.GROUP_ID, term));
// query = new PrefixQuery(new Term(ArtifactInfo.GROUP_ID, term));
} else if(IIndex.SEARCH_ARTIFACT.equals(type)) {
- BooleanQuery bq = new BooleanQuery();
+ BooleanQuery.Builder bq = new BooleanQuery.Builder();
bq.add(constructQuery(MAVEN.GROUP_ID, term), Occur.SHOULD); //$NON-NLS-1$
bq.add(constructQuery(MAVEN.ARTIFACT_ID, term), Occur.SHOULD); //$NON-NLS-1$
bq.add(
constructQuery(MAVEN.SHA1, term.getStringValue(), term.getStringValue().length() == 40 ? SearchType.EXACT
: SearchType.SCORED), Occur.SHOULD);
addClassifiersToQuery(bq, classifier);
- query = bq;
+ query = bq.build();
} else if(IIndex.SEARCH_PARENTS.equals(type)) {
if(term == null) {
query = constructQuery(MAVEN.PACKAGING, "pom", SearchType.EXACT); //$NON-NLS-1$
} else {
- BooleanQuery bq = new BooleanQuery();
+ BooleanQuery.Builder bq = new BooleanQuery.Builder();
bq.add(constructQuery(MAVEN.GROUP_ID, term), Occur.SHOULD); //$NON-NLS-1$
bq.add(constructQuery(MAVEN.ARTIFACT_ID, term), Occur.SHOULD); //$NON-NLS-1$
bq.add(
constructQuery(MAVEN.SHA1, term.getStringValue(), term.getStringValue().length() == 40 ? SearchType.EXACT
: SearchType.SCORED), Occur.SHOULD);
Query tq = constructQuery(MAVEN.PACKAGING, "pom", SearchType.EXACT); //$NON-NLS-1$
- query = new FilteredQuery(tq, new QueryWrapperFilter(bq));
+ BooleanQuery.Builder builder = new BooleanQuery.Builder();
+ builder.add(bq.build(), Occur.MUST);
+ builder.add(tq, Occur.FILTER);
+ query = builder.build();
}
} else if(IIndex.SEARCH_PLUGIN.equals(type)) {
if(term == null) {
query = constructQuery(MAVEN.PACKAGING, "maven-plugin", SearchType.EXACT); //$NON-NLS-1$
} else {
- BooleanQuery bq = new BooleanQuery();
+ BooleanQuery.Builder bq = new BooleanQuery.Builder();
bq.add(constructQuery(MAVEN.GROUP_ID, term), Occur.SHOULD); //$NON-NLS-1$
bq.add(constructQuery(MAVEN.ARTIFACT_ID, term), Occur.SHOULD); //$NON-NLS-1$
Query tq = constructQuery(MAVEN.PACKAGING, "maven-plugin", SearchType.EXACT); //$NON-NLS-1$
- query = new FilteredQuery(tq, new QueryWrapperFilter(bq));
+ BooleanQuery.Builder builder = new BooleanQuery.Builder();
+ builder.add(bq.build(), Occur.MUST);
+ builder.add(tq, Occur.FILTER);
+ query = builder.build();
}
} else if(IIndex.SEARCH_ARCHETYPE.equals(type)) {
- BooleanQuery bq = new BooleanQuery();
+ BooleanQuery.Builder bq = new BooleanQuery.Builder();
bq.add(constructQuery(MAVEN.GROUP_ID, term), Occur.SHOULD); //$NON-NLS-1$
bq.add(constructQuery(MAVEN.ARTIFACT_ID, term), Occur.SHOULD); //$NON-NLS-1$
Query tq = constructQuery(MAVEN.PACKAGING, "maven-archetype", SearchType.EXACT); //$NON-NLS-1$
- query = new FilteredQuery(tq, new QueryWrapperFilter(bq));
+ BooleanQuery.Builder builder = new BooleanQuery.Builder();
+ builder.add(bq.build(), Occur.MUST);
+ builder.add(tq, Occur.FILTER);
+ query = builder.build();
} else if(IIndex.SEARCH_PACKAGING.equals(type)) {
query = constructQuery(MAVEN.PACKAGING, term);
@@ -437,7 +445,7 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
}
for(ArtifactInfo artifactInfo : response.getResults()) {
- addArtifactFile(result, getIndexedArtifactFile(artifactInfo), null, null, artifactInfo.packaging);
+ addArtifactFile(result, getIndexedArtifactFile(artifactInfo), null, null, artifactInfo.getPackaging());
}
// https://issues.sonatype.org/browse/MNGECLIPSE-1630
@@ -488,7 +496,7 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
}
for(ArtifactInfo artifactInfo : response.getResults()) {
- addArtifactFile(result, getIndexedArtifactFile(artifactInfo), null, null, artifactInfo.packaging);
+ addArtifactFile(result, getIndexedArtifactFile(artifactInfo), null, null, artifactInfo.getPackaging());
}
} catch(IOException ex) {
@@ -626,27 +634,20 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
fireIndexChanged(repository);
}
- private ArtifactContext getArtifactContext(File file, IndexingContext context)
- throws IllegalArtifactCoordinateException {
+ private ArtifactContext getArtifactContext(File file, IndexingContext context) {
return getArtifactContextProducer().getArtifactContext(context, file);
}
- private ArtifactContext getWorkspaceArtifactContext(IMavenProjectFacade facade, IndexingContext context)
- throws CoreException {
+ private ArtifactContext getWorkspaceArtifactContext(IMavenProjectFacade facade, IndexingContext context) {
IRepository workspaceRepository = repositoryRegistry.getWorkspaceRepository();
ArtifactKey key = facade.getArtifactKey();
ArtifactInfo ai = new ArtifactInfo(workspaceRepository.getUid(), key.getGroupId(), key.getArtifactId(),
- key.getVersion(), null);
- ai.packaging = facade.getPackaging();
+ key.getVersion(), key.getClassifier(), null);
+ ai.setPackaging(facade.getPackaging());
File pomFile = facade.getPomFile();
File artifactFile = (pomFile != null) ? pomFile.getParentFile() : null;
- try {
- Gav gav = new Gav(key.getGroupId(), key.getArtifactId(), key.getVersion());
- return new ArtifactContext(pomFile, artifactFile, null, ai, gav);
- } catch(IllegalArtifactCoordinateException ex) {
- throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1,
- Messages.NexusIndexManager_error_unexpected, ex));
- }
+ Gav gav = new Gav(key.getGroupId(), key.getArtifactId(), key.getVersion());
+ return new ArtifactContext(pomFile, artifactFile, null, ai, gav);
}
protected void scheduleIndexUpdate(final IRepository repository, final boolean force) {
@@ -843,7 +844,7 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
}
protected Directory getIndexDirectory(IRepository repository) throws IOException {
- return FSDirectory.getDirectory(getIndexDirectoryFile(repository));
+ return FSDirectory.open(getIndexDirectoryFile(repository).toPath());
}
public IndexedArtifactGroup resolveGroup(IndexedArtifactGroup group) {
@@ -1132,7 +1133,7 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
String details = getIndexDetails(repository);
String id = repository.getUid() + "-cache"; //$NON-NLS-1$
File luceneCache = new File(request.getLocalIndexCacheDir(), details);
- Directory directory = FSDirectory.getDirectory(luceneCache);
+ Directory directory = FSDirectory.open(luceneCache.toPath());
IndexingContext cacheCtx = getIndexer().addIndexingContextForced(id, id, null, directory, null, null,
getIndexers(details));
request = newIndexUpdateRequest(repository, cacheCtx, monitor);
@@ -1276,7 +1277,8 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
Query q = getIndexer().constructQuery(MAVEN.SHA1, encode(digest), SearchType.EXACT);
- return getIndexer().identify(q, contexts);
+ Collection<ArtifactInfo> result = getIndexer().identify(q, contexts);
+ return result == null || result.isEmpty() ? null : (ArtifactInfo) result.toArray()[0];
} catch(NoSuchAlgorithmException ex) {
throw new IOException("Unable to calculate digest");
--
2.20.1