View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.commons.compress.archivers.jar;
20  
21  import java.security.cert.Certificate;
22  import java.util.jar.Attributes;
23  import java.util.jar.JarEntry;
24  import java.util.zip.ZipEntry;
25  import java.util.zip.ZipException;
26  
27  import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
28  
29  /**
30   *
31   * @NotThreadSafe (parent is not thread-safe)
32   */
33  public class JarArchiveEntry extends ZipArchiveEntry {
34  
35      // These are always null - see https://issues.apache.org/jira/browse/COMPRESS-18 for discussion
36      private final Attributes manifestAttributes = null;
37      private final Certificate[] certificates = null;
38  
39      public JarArchiveEntry(ZipEntry entry) throws ZipException {
40          super(entry);
41      }
42  
43      public JarArchiveEntry(String name) {
44          super(name);
45      }
46  
47      public JarArchiveEntry(ZipArchiveEntry entry) throws ZipException {
48          super(entry);
49      }
50  
51      public JarArchiveEntry(JarEntry entry) throws ZipException {
52          super(entry);
53  
54      }
55  
56      /**
57       * This method is not implemented and won't ever be.
58       * The JVM equivalent has a different name {@link java.util.jar.JarEntry#getAttributes()}
59       *
60       * @deprecated since 1.5, do not use; always returns null
61       * @return Always returns null.
62       */
63      @Deprecated
64      public Attributes getManifestAttributes() {
65          return manifestAttributes;
66      }
67  
68      /**
69       * Return a copy of the list of certificates or null if there are none.
70       *
71       * @return Always returns null in the current implementation
72       *
73       * @deprecated since 1.5, not currently implemented
74       */
75      @Deprecated
76      public Certificate[] getCertificates() {
77          if (certificates != null) { // never true currently
78              Certificate[] certs = new Certificate[certificates.length];
79              System.arraycopy(certificates, 0, certs, 0, certs.length);
80              return certs;
81          }
82          /*
83           * Note, the method
84           * Certificate[] java.util.jar.JarEntry.getCertificates()
85           * also returns null or the list of certificates (but not copied)
86           */
87          return null;
88      }
89  
90  }