Author: krosenvold
Date: Tue Jan 13 17:26:02 2015
New Revision: 1651417

URL: http://svn.apache.org/r1651417
Log:
COMPRESS-290 Fixed error message with large groupid

This is a bit of a simple solution to the issue, since there are obviously lots 
of other options that
could have similar updates. The reality is that most recent macs that are 
initialized to run in corporate
networks tend to get large GID's for the users. So I just fixed the one we 
actually have complaints about

Modified:
    
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java

Modified: 
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
URL: 
http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java?rev=1651417&r1=1651416&r2=1651417&view=diff
==============================================================================
--- 
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
 (original)
+++ 
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
 Tue Jan 13 17:26:02 2015
@@ -606,7 +606,7 @@ public class TarArchiveOutputStream exte
 
     private void failForBigNumbers(TarArchiveEntry entry) {
         failForBigNumber("entry size", entry.getSize(), TarConstants.MAXSIZE);
-        failForBigNumber("group id", entry.getGroupId(), TarConstants.MAXID);
+        failForBigNumberWithPosixMessage("group id", entry.getGroupId(), 
TarConstants.MAXID);
         failForBigNumber("last modification time",
                          entry.getModTime().getTime() / 1000,
                          TarConstants.MAXSIZE);
@@ -619,10 +619,18 @@ public class TarArchiveOutputStream exte
     }
 
     private void failForBigNumber(String field, long value, long maxValue) {
+        failForBigNumber(field, value, maxValue, "");
+    }
+
+    private void failForBigNumberWithPosixMessage(String field, long value, 
long maxValue) {
+        failForBigNumber(field, value, maxValue, " Use STAR or POSIX 
extensions to overcome this limit");
+    }
+
+    private void failForBigNumber(String field, long value, long maxValue, 
String additionalMsg) {
         if (value < 0 || value > maxValue) {
             throw new RuntimeException(field + " '" + value
-                                       + "' is too big ( > "
-                                       + maxValue + " )");
+                    + "' is too big ( > "
+                    + maxValue + " )." + additionalMsg);
         }
     }
 


Reply via email to