You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2020/02/02 20:53:05 UTC
[maven-indexer] 01/01: [MINDEXER-120] Remove TrueZip
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch MINDEXER-120
in repository https://gitbox.apache.org/repos/asf/maven-indexer.git
commit e70632ede948b5c1d1da27c56b5c1627bd100dd1
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Jun 23 23:23:45 2019 +0200
[MINDEXER-120] Remove TrueZip
---
indexer-cli/pom.xml | 19 ----
indexer-core/pom.xml | 18 ----
.../org/apache/maven/index/ArtifactContext.java | 14 +--
.../index/creator/JarFileContentsIndexCreator.java | 27 ++---
.../MavenArchetypeArtifactInfoIndexCreator.java | 22 +---
.../MavenPluginArtifactInfoIndexCreator.java | 33 ++----
.../index/creator/OsgiArtifactIndexCreator.java | 35 ++-----
.../maven/index/util/zip/AbstractZipHandle.java | 44 --------
.../maven/index/util/zip/EntryNameFilter.java | 25 -----
.../maven/index/util/zip/JavaZipFileHandle.java | 110 --------------------
.../maven/index/util/zip/TrueZipZipFileHandle.java | 112 ---------------------
.../org/apache/maven/index/util/zip/ZipFacade.java | 76 --------------
.../org/apache/maven/index/util/zip/ZipHandle.java | 75 --------------
pom.xml | 32 ------
14 files changed, 33 insertions(+), 609 deletions(-)
diff --git a/indexer-cli/pom.xml b/indexer-cli/pom.xml
index 74642b3..3501f8a 100644
--- a/indexer-cli/pom.xml
+++ b/indexer-cli/pom.xml
@@ -77,16 +77,6 @@ under the License.
<version>1.2</version>
</dependency>
- <!-- ZipFacade -->
- <dependency>
- <groupId>de.schlichtherle.truezip</groupId>
- <artifactId>truezip-file</artifactId>
- </dependency>
- <dependency>
- <groupId>de.schlichtherle.truezip</groupId>
- <artifactId>truezip-driver-zip</artifactId>
- </dependency>
-
<!-- Test -->
<dependency>
<groupId>junit</groupId>
@@ -132,15 +122,6 @@ under the License.
<mainClass>org.apache.maven.index.cli.NexusIndexerCli</mainClass>
</transformer>
</transformers>
- <filters>
- <filter>
- <artifact>org.bouncycastle:*</artifact>
- <excludes>
- <exclude>META-INF/BCKEY.SF</exclude>
- <exclude>META-INF/BCKEY.DSA</exclude>
- </excludes>
- </filter>
- </filters>
</configuration>
</execution>
</executions>
diff --git a/indexer-core/pom.xml b/indexer-core/pom.xml
index 1618823..d6f6fdc 100644
--- a/indexer-core/pom.xml
+++ b/indexer-core/pom.xml
@@ -135,19 +135,6 @@ under the License.
<optional>true</optional>
</dependency>
- <!-- ZipFacade (as optional, who wants to use it should include TrueZip) -->
- <dependency>
- <groupId>de.schlichtherle.truezip</groupId>
- <artifactId>truezip-file</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
- <groupId>de.schlichtherle.truezip</groupId>
- <artifactId>truezip-driver-zip</artifactId>
- <optional>true</optional>
- </dependency>
-
<!-- Test -->
<dependency>
<groupId>junit</groupId>
@@ -230,10 +217,6 @@ under the License.
<shadedPattern>org.apache.maven.index_shaded.lucene</shadedPattern>
</relocation>
<relocation>
- <pattern>org.bouncycastle</pattern>
- <shadedPattern>org.apache.maven.index_shaded.lucene</shadedPattern>
- </relocation>
- <relocation>
<pattern>org.apache.commons.compress</pattern>
<shadedPattern>org.apache.maven.index_shaded.lucene</shadedPattern>
</relocation>
@@ -249,7 +232,6 @@ under the License.
<exclude>org.apache.maven.archetype:*</exclude>
<exclude>org.apache.maven.wagon:*</exclude>
<exclude>org.codehaus.*:*</exclude>
- <exclude>de.schlichtherle.truezip:*</exclude>
<exclude>org.apache.maven.resolver:*</exclude>
<exclude>org.apache.maven:maven-model</exclude>
<exclude>org.apache.commons:*</exclude>
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 18a5e94..8803654 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
@@ -25,6 +25,8 @@ import java.io.InputStream;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -32,8 +34,6 @@ import org.apache.lucene.document.StoredField;
import org.apache.maven.index.artifact.Gav;
import org.apache.maven.index.context.IndexCreator;
import org.apache.maven.index.context.IndexingContext;
-import org.apache.maven.index.util.zip.ZipFacade;
-import org.apache.maven.index.util.zip.ZipHandle;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
@@ -103,16 +103,16 @@ public class ArtifactContext
// Otherwise, check for pom contained in maven generated artifact
else if ( getArtifact() != null && getArtifact().isFile() )
{
- File artifact = getArtifact();
- try ( ZipHandle handle = ZipFacade.getZipHandle( artifact ) )
+ try ( ZipFile zipFile = new ZipFile( artifact ) )
{
-
final String embeddedPomPath =
"META-INF/maven/" + getGav().getGroupId() + "/" + getGav().getArtifactId() + "/pom.xml";
- if ( handle.hasEntry( embeddedPomPath ) )
+ ZipEntry zipEntry = zipFile.getEntry( embeddedPomPath );
+
+ if ( zipEntry != null )
{
- try ( InputStream inputStream = handle.getEntryContent( embeddedPomPath ) )
+ try ( InputStream inputStream = zipFile.getInputStream( zipEntry ) )
{
return new MavenXpp3Reader().read( inputStream, false );
}
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 3b1fe06..4659f85 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
@@ -25,7 +25,9 @@ import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
-import java.util.List;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
import org.apache.lucene.document.Document;
import org.apache.maven.index.ArtifactContext;
@@ -33,8 +35,6 @@ 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.util.zip.ZipFacade;
-import org.apache.maven.index.util.zip.ZipHandle;
import org.codehaus.plexus.util.StringUtils;
/**
@@ -158,18 +158,16 @@ public class JarFileContentsIndexCreator
private void updateArtifactInfo( final ArtifactInfo ai, final File f, final String strippedPrefix )
throws IOException
{
- ZipHandle handle = null;
- try
+ try ( ZipFile zipFile = new ZipFile( f ) )
{
- handle = ZipFacade.getZipHandle( f );
-
- final List<String> entries = handle.getEntries();
+ final Enumeration<? extends ZipEntry> entries = zipFile.entries();
final StringBuilder sb = new StringBuilder();
- for ( String name : entries )
+ while ( entries.hasMoreElements() )
{
+ String name = entries.nextElement().getName();
if ( name.endsWith( ".class" ) )
{
// TODO verify if class is public or protected
@@ -210,17 +208,6 @@ public class JarFileContentsIndexCreator
ai.setClassNames( null );
}
}
- finally
- {
- try
- {
- ZipFacade.close( handle );
- }
- catch ( Exception e )
- {
- getLogger().error( "Could not close jar file properly.", e );
- }
- }
}
@Override
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 bd6c759..cb2b2b7 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
@@ -22,17 +22,15 @@ package org.apache.maven.index.creator;
import javax.inject.Named;
import javax.inject.Singleton;
import java.io.File;
-import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.zip.ZipFile;
import org.apache.lucene.document.Document;
import org.apache.maven.index.ArtifactContext;
import org.apache.maven.index.ArtifactInfo;
import org.apache.maven.index.IndexerField;
-import org.apache.maven.index.util.zip.ZipFacade;
-import org.apache.maven.index.util.zip.ZipHandle;
/**
* A Maven Archetype index creator used to detect and correct the artifact packaging to "maven-archetype" if the
@@ -85,15 +83,11 @@ public class MavenArchetypeArtifactInfoIndexCreator
*/
private void checkMavenArchetype( ArtifactInfo ai, File artifact )
{
- ZipHandle handle = null;
-
- try
+ try ( ZipFile zipFile = new ZipFile( artifact ) )
{
- handle = ZipFacade.getZipHandle( artifact );
-
for ( String path : ARCHETYPE_XML_LOCATIONS )
{
- if ( handle.hasEntry( path ) )
+ if ( zipFile.getEntry( path ) != null )
{
ai.setPackaging( MAVEN_ARCHETYPE_PACKAGING );
@@ -114,16 +108,6 @@ public class MavenArchetypeArtifactInfoIndexCreator
"Failed to parse Maven artifact " + artifact.getAbsolutePath() + " due to " + e.getMessage() );
}
}
- finally
- {
- try
- {
- ZipFacade.close( handle );
- }
- catch ( IOException ex )
- {
- }
- }
}
public void updateDocument( ArtifactInfo ai, Document doc )
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 694ad1a..dad2b32 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
@@ -23,12 +23,13 @@ import javax.inject.Named;
import javax.inject.Singleton;
import java.io.BufferedInputStream;
import java.io.File;
-import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
import org.apache.lucene.document.Document;
import org.apache.maven.index.ArtifactContext;
@@ -36,8 +37,6 @@ 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.util.zip.ZipFacade;
-import org.apache.maven.index.util.zip.ZipHandle;
import org.codehaus.plexus.configuration.PlexusConfiguration;
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
@@ -88,19 +87,13 @@ public class MavenPluginArtifactInfoIndexCreator
private void checkMavenPlugin( ArtifactInfo ai, File artifact )
{
- ZipHandle handle = null;
-
- try
+ try ( ZipFile zipFile = new ZipFile( artifact ) )
{
- handle = ZipFacade.getZipHandle( artifact );
-
final String pluginDescriptorPath = "META-INF/maven/plugin.xml";
-
- if ( handle.hasEntry( pluginDescriptorPath ) )
+ ZipEntry zipEntry = zipFile.getEntry( pluginDescriptorPath );
+ if ( zipEntry != null )
{
- InputStream is = new BufferedInputStream( handle.getEntryContent( pluginDescriptorPath ) );
-
- try
+ try ( InputStream is = new BufferedInputStream( zipFile.getInputStream( zipEntry ) ) )
{
// here the reader is closed
PlexusConfiguration plexusConfig =
@@ -117,10 +110,6 @@ public class MavenPluginArtifactInfoIndexCreator
ai.getGoals().add( mojoConfig.getChild( "goal" ).getValue() );
}
}
- finally
- {
- is.close();
- }
}
}
catch ( Exception e )
@@ -136,16 +125,6 @@ public class MavenPluginArtifactInfoIndexCreator
"Failed to parse Maven artifact " + artifact.getAbsolutePath() + " due to " + e.getMessage() );
}
}
- finally
- {
- try
- {
- ZipFacade.close( handle );
- }
- catch ( IOException e )
- {
- }
- }
}
public void updateDocument( ArtifactInfo ai, Document doc )
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 559d2da..7394e9e 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
@@ -28,8 +28,6 @@ import org.apache.maven.index.ArtifactInfo;
import org.apache.maven.index.IndexerField;
import org.apache.maven.index.IndexerFieldVersion;
import org.apache.maven.index.OSGI;
-import org.apache.maven.index.util.zip.ZipFacade;
-import org.apache.maven.index.util.zip.ZipHandle;
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
@@ -40,9 +38,11 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Collection;
-import java.util.List;
+import java.util.Enumeration;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
/**
* This indexCreator will index some OSGI metadatas.
@@ -419,22 +419,19 @@ public class OsgiArtifactIndexCreator
private boolean updateArtifactInfo( ArtifactInfo ai, File f )
throws IOException
{
- ZipHandle handle = null;
-
boolean updated = false;
-
- try
+ try ( ZipFile zipFile = new ZipFile( f ) )
{
- handle = ZipFacade.getZipHandle( f );
-
- final List<String> entries = handle.getEntries();
+ final Enumeration<? extends ZipEntry> entries = zipFile.entries();
- for ( String name : entries )
+ while ( entries.hasMoreElements() )
{
- if ( name.equals( "META-INF/MANIFEST.MF" ) )
+ ZipEntry zipEntry = entries.nextElement();
+
+ if ( zipEntry.getName().equals( "META-INF/MANIFEST.MF" ) )
{
- Manifest manifest = new Manifest( handle.getEntryContent( name ) );
+ Manifest manifest = new Manifest( zipFile.getInputStream( zipEntry ) );
Attributes mainAttributes = manifest.getMainAttributes();
@@ -596,18 +593,6 @@ public class OsgiArtifactIndexCreator
}
}
}
-
- }
- finally
- {
- try
- {
- ZipFacade.close( handle );
- }
- catch ( Exception e )
- {
- getLogger().error( "Could not close jar file properly.", e );
- }
}
// only calculate sha256 digest for if we are indexing a bundle.
diff --git a/indexer-core/src/main/java/org/apache/maven/index/util/zip/AbstractZipHandle.java b/indexer-core/src/main/java/org/apache/maven/index/util/zip/AbstractZipHandle.java
deleted file mode 100644
index 498db6f..0000000
--- a/indexer-core/src/main/java/org/apache/maven/index/util/zip/AbstractZipHandle.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.apache.maven.index.util.zip;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-
-public abstract class AbstractZipHandle
- implements ZipHandle
-{
- private final File targetFile;
-
- public AbstractZipHandle( final File targetFile )
- {
- if ( targetFile == null || !targetFile.isFile() )
- {
- throw new IllegalArgumentException(
- "The targetFile may not be null, and has to point to an existing file (not a directory!)" );
- }
-
- this.targetFile = targetFile;
- }
-
- public File getTargetFile()
- {
- return targetFile;
- }
-}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/util/zip/EntryNameFilter.java b/indexer-core/src/main/java/org/apache/maven/index/util/zip/EntryNameFilter.java
deleted file mode 100644
index 48a3935..0000000
--- a/indexer-core/src/main/java/org/apache/maven/index/util/zip/EntryNameFilter.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.apache.maven.index.util.zip;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-public interface EntryNameFilter
-{
- boolean accepts( String entryName );
-}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/util/zip/JavaZipFileHandle.java b/indexer-core/src/main/java/org/apache/maven/index/util/zip/JavaZipFileHandle.java
deleted file mode 100644
index 1a1f74b..0000000
--- a/indexer-core/src/main/java/org/apache/maven/index/util/zip/JavaZipFileHandle.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.apache.maven.index.util.zip;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-public class JavaZipFileHandle
- extends AbstractZipHandle
- implements ZipHandle
-{
- private final ZipFile zipFile;
-
- public JavaZipFileHandle( final File targetFile )
- throws IOException
- {
- super( targetFile );
-
- this.zipFile = new ZipFile( targetFile );
- }
-
- protected ZipFile getZipFile()
- {
- return zipFile;
- }
-
- public boolean hasEntry( String path )
- throws IOException
- {
- return getZipFile().getEntry( path ) != null;
- }
-
- public List<String> getEntries()
- {
- return getEntries( new EntryNameFilter()
- {
- public boolean accepts( String entryName )
- {
- return true;
- }
- } );
- }
-
- public List<String> getEntries( EntryNameFilter filter )
- {
- ArrayList<String> entries = new ArrayList<String>();
-
- Enumeration<? extends ZipEntry> en = getZipFile().entries();
-
- while ( en.hasMoreElements() )
- {
- final ZipEntry e = en.nextElement();
-
- final String name = e.getName();
-
- if ( filter != null && !filter.accepts( name ) )
- {
- continue;
- }
-
- entries.add( name );
- }
-
- return entries;
- }
-
- public InputStream getEntryContent( String path )
- throws IOException
- {
- ZipEntry entry = getZipFile().getEntry( path );
-
- if ( entry != null )
- {
- return getZipFile().getInputStream( entry );
- }
- else
- {
- return null;
- }
- }
-
- public void close()
- throws IOException
- {
- getZipFile().close();
- }
-}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/util/zip/TrueZipZipFileHandle.java b/indexer-core/src/main/java/org/apache/maven/index/util/zip/TrueZipZipFileHandle.java
deleted file mode 100644
index 4ca7e8e..0000000
--- a/indexer-core/src/main/java/org/apache/maven/index/util/zip/TrueZipZipFileHandle.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.apache.maven.index.util.zip;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-import de.schlichtherle.truezip.zip.ZipEntry;
-import de.schlichtherle.truezip.zip.ZipFile;
-
-public class TrueZipZipFileHandle
- extends AbstractZipHandle
- implements ZipHandle
-{
- private final ZipFile zipFile;
-
- public TrueZipZipFileHandle( final File targetFile )
- throws IOException
- {
- super( targetFile );
-
- this.zipFile = new ZipFile( targetFile );
- }
-
- protected ZipFile getZipFile()
- {
- return zipFile;
- }
-
- public boolean hasEntry( String path )
- throws IOException
- {
- return getZipFile().getEntry( path ) != null;
- }
-
- public List<String> getEntries()
- {
- return getEntries( new EntryNameFilter()
- {
- public boolean accepts( String entryName )
- {
- return true;
- }
- } );
- }
-
- public List<String> getEntries( EntryNameFilter filter )
- {
- ArrayList<String> entries = new ArrayList<String>();
-
- Enumeration<? extends ZipEntry> en = getZipFile().entries();
-
- while ( en.hasMoreElements() )
- {
- final ZipEntry e = en.nextElement();
-
- final String name = e.getName();
-
- if ( filter != null && !filter.accepts( name ) )
- {
- continue;
- }
-
- entries.add( name );
- }
-
- return entries;
- }
-
- public InputStream getEntryContent( String path )
- throws IOException
- {
- ZipEntry entry = getZipFile().getEntry( path );
-
- if ( entry != null )
- {
- return getZipFile().getInputStream( entry );
- }
- else
- {
- return null;
- }
- }
-
- public void close()
- throws IOException
- {
- getZipFile().close();
- }
-
-}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/util/zip/ZipFacade.java b/indexer-core/src/main/java/org/apache/maven/index/util/zip/ZipFacade.java
deleted file mode 100644
index 1dcae06..0000000
--- a/indexer-core/src/main/java/org/apache/maven/index/util/zip/ZipFacade.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.apache.maven.index.util.zip;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-
-public class ZipFacade
-{
- public static final long MEGABYTE = 1048576L;
-
- public static final long JAVA_ZIPFILE_SIZE_THRESHOLD = Long.getLong(
- "org.apache.maven.index.util.zip.ZipFacade.javaZipFileSizeThreshold", 100L * MEGABYTE );
-
- private static final boolean TRUEZIP_AVAILABLE;
-
- static
- {
- Class<?> clazz;
-
- try
- {
- clazz = Class.forName( "de.schlichtherle.truezip.zip.ZipFile" );
- }
- catch ( ClassNotFoundException e )
- {
- clazz = null;
- }
-
- TRUEZIP_AVAILABLE = clazz != null;
- }
-
- public static ZipHandle getZipHandle( File targetFile )
- throws IOException
- {
- if ( targetFile.isFile() )
- {
- if ( TRUEZIP_AVAILABLE && targetFile.length() > JAVA_ZIPFILE_SIZE_THRESHOLD )
- {
- return new TrueZipZipFileHandle( targetFile );
- }
- else
- {
- return new JavaZipFileHandle( targetFile );
- }
- }
-
- throw new IOException( "The targetFile should point to an existing ZIP file:" + targetFile );
- }
-
- public static void close( ZipHandle handle )
- throws IOException
- {
- if ( handle != null )
- {
- handle.close();
- }
- }
-}
diff --git a/indexer-core/src/main/java/org/apache/maven/index/util/zip/ZipHandle.java b/indexer-core/src/main/java/org/apache/maven/index/util/zip/ZipHandle.java
deleted file mode 100644
index c278a68..0000000
--- a/indexer-core/src/main/java/org/apache/maven/index/util/zip/ZipHandle.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.apache.maven.index.util.zip;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-
-/**
- * A very simplistic approach to hide the underlying mech to deal with ZipFiles, suited for use cases happening in Maven
- * Indexer.
- *
- * @author cstamas
- */
-public interface ZipHandle
- extends Closeable
-{
- /**
- * Returns true if Zip file this handle is pointing to contains an entry at given path.
- *
- * @param path
- * @return
- */
- boolean hasEntry( String path )
- throws IOException;
-
- /**
- * Returns a list of string, with each string representing a valid path for existing entry in this Zip handle.
- *
- * @return
- */
- List<String> getEntries();
-
- /**
- * Returns a list of string, with each string representing a valid path for existing entry in this Zip handle.
- *
- * @return
- */
- List<String> getEntries( EntryNameFilter filter );
-
- /**
- * Returns the "payload" (uncompressed) of the entry at given path, or null if no such path exists in the Zip file
- * this handle points to.
- *
- * @param path
- * @return
- */
- InputStream getEntryContent( String path )
- throws IOException;
-
- /**
- * Closes the zip handle (performs resource cleanup). This method should be called when this zip handle is not
- * needed anymore, and calling it should be obligatory to prevent resource leaks.
- */
- void close()
- throws IOException;
-}
diff --git a/pom.xml b/pom.xml
index 69fa45f..23cd025 100644
--- a/pom.xml
+++ b/pom.xml
@@ -93,7 +93,6 @@ under the License.
<lucene.version>5.5.5</lucene.version>
<maven.version>3.5.2</maven.version>
<resolver.version>1.1.0</resolver.version>
- <truezip.version>7.7.10</truezip.version>
<archetype.version>2.4</archetype.version>
<wagon.version>2.12</wagon.version>
<surefire.version>2.22.2</surefire.version>
@@ -267,37 +266,6 @@ under the License.
<version>${archetype.version}</version>
</dependency>
- <!-- ZipFacade -->
- <dependency>
- <groupId>de.schlichtherle.truezip</groupId>
- <artifactId>truezip-kernel</artifactId>
- <version>${truezip.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>annotations</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>de.schlichtherle.truezip</groupId>
- <artifactId>truezip-file</artifactId>
- <version>${truezip.version}</version>
- </dependency>
-
- <dependency>
- <groupId>de.schlichtherle.truezip</groupId>
- <artifactId>truezip-driver-zip</artifactId>
- <version>${truezip.version}</version>
- <exclusions>
- <exclusion>
- <groupId>de.schlichtherle.truezip</groupId>
- <artifactId>truezip-swing</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
<!-- Test -->
<dependency>
<groupId>junit</groupId>