Coverage Report - org.codehaus.plexus.archiver.util.ArchiveEntryUtils
 
Classes in this File Line Coverage Branch Coverage Complexity
ArchiveEntryUtils
30%
4/13
50%
1/2
2
 
 1  
 /*
 2  
  * Copyright 2014 The Codehaus Foundation.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.codehaus.plexus.archiver.util;
 17  
 
 18  
 import java.io.File;
 19  
 import java.io.IOException;
 20  
 import org.codehaus.plexus.archiver.ArchiverException;
 21  
 import org.codehaus.plexus.components.io.attributes.AttributeUtils;
 22  
 import org.codehaus.plexus.logging.Logger;
 23  
 import org.codehaus.plexus.util.Os;
 24  
 
 25  
 @SuppressWarnings( "JavaDoc" )
 26  
 public final class ArchiveEntryUtils
 27  
 {
 28  
 
 29  
     private ArchiveEntryUtils()
 30  0
     {
 31  
         // no op
 32  0
     }
 33  
 
 34  
     /**
 35  
      * This method is now deprecated.
 36  
      *
 37  
      * The {@code useJvmChmod} flag is ignored as the JVM is always used.
 38  
      * The {@code logger} provided is no longer used.
 39  
      *
 40  
      * @deprecated Use {@link #chmod(File, int)}
 41  
      */
 42  
     @Deprecated
 43  
     public static void chmod( final File file, final int mode, final Logger logger, boolean useJvmChmod )
 44  
         throws ArchiverException
 45  
     {
 46  0
         chmod( file, mode );
 47  0
     }
 48  
 
 49  
     /**
 50  
      * This method is now deprecated.
 51  
      *
 52  
      * The {@code logger} provided is no longer used.
 53  
      *
 54  
      * @deprecated Use {@link #chmod(File, int)}
 55  
      */
 56  
     @Deprecated
 57  
     public static void chmod( final File file, final int mode, final Logger logger )
 58  
         throws ArchiverException
 59  
     {
 60  0
         chmod( file, mode );
 61  0
     }
 62  
 
 63  
     public static void chmod( final File file, final int mode )
 64  
         throws ArchiverException
 65  
     {
 66  124
         if ( !Os.isFamily( Os.FAMILY_UNIX ) )
 67  
         {
 68  0
             return;
 69  
         }
 70  
 
 71  
         try
 72  
         {
 73  124
             AttributeUtils.chmod( file, mode );
 74  
         }
 75  0
         catch ( IOException e )
 76  
         {
 77  0
             throw new ArchiverException( "Failed setting file attributes", e );
 78  124
         }
 79  124
     }
 80  
 
 81  
 }