Coverage Report - org.codehaus.plexus.archiver.filters.JarSecurityFileSelector
 
Classes in this File Line Coverage Branch Coverage Complexity
JarSecurityFileSelector
0%
0/7
0%
0/4
4
 
 1  
 /*
 2  
  * Copyright 2007 The Codehaus Foundation.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 5  
  * in compliance with the License. You may obtain a copy of the License at
 6  
  *
 7  
  * http://www.apache.org/licenses/LICENSE-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing, software distributed under the License
 10  
  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 11  
  * or implied. See the License for the specific language governing permissions and limitations under
 12  
  * the License.
 13  
  */
 14  
 package org.codehaus.plexus.archiver.filters;
 15  
 
 16  
 import java.io.IOException;
 17  
 import javax.annotation.Nonnull;
 18  
 import org.codehaus.plexus.components.io.fileselectors.FileInfo;
 19  
 import org.codehaus.plexus.components.io.fileselectors.FileSelector;
 20  
 import org.codehaus.plexus.util.SelectorUtils;
 21  
 
 22  
 /**
 23  
  * @since 1.0-alpha-9
 24  
  */
 25  0
 public class JarSecurityFileSelector
 26  
     implements FileSelector
 27  
 {
 28  
 
 29  
     public static final String ROLE_HINT = "jar-security";
 30  
 
 31  0
     public static final String[] SECURITY_FILE_PATTERNS =
 32  
     {
 33  
         "META-INF/*.RSA",
 34  
         "META-INF/*.DSA",
 35  
         "META-INF/*.SF",
 36  
         "META-INF/*.EC",
 37  
         "META-INF/*.rsa",
 38  
         "META-INF/*.dsa",
 39  
         "META-INF/*.sf",
 40  
         "META-INF/*.ec"
 41  
     };
 42  
 
 43  
     @Override
 44  
     public boolean isSelected( @Nonnull FileInfo fileInfo )
 45  
         throws IOException
 46  
     {
 47  0
         String name = fileInfo.getName();
 48  
 
 49  0
         for ( String pattern : SECURITY_FILE_PATTERNS )
 50  
         {
 51  0
             if ( SelectorUtils.match( pattern, name ) )
 52  
             {
 53  0
                 return false;
 54  
             }
 55  
         }
 56  
 
 57  0
         return true;
 58  
     }
 59  
 
 60  
 }