Author: sebb
Date: Wed Apr 1 00:00:49 2009
New Revision: 760741
URL: http://svn.apache.org/viewvc?rev=760741&view=rev
Log:
Javadoc and test corrections
Modified:
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
Modified:
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java?rev=760741&r1=760740&r2=760741&view=diff
==============================================================================
---
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
(original)
+++
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java
Wed Apr 1 00:00:49 2009
@@ -130,6 +130,10 @@
/**
* Fill buffer with octal number, with leading zeroes
*
+ * The output for negative numbers is not specified,
+ * but currently the method returns a buffer filled with zeros.
+ * This may change.
+ *
* @param value number to convert to octal (assumed >=0)
* @param buffer destination buffer
* @param offset starting offset in buffer
@@ -160,8 +164,7 @@
* Adds a trailing space and NUL to end of the buffer.
* [Appears to be standard for V7 Unix BSD]
* Converts the long value (assumed positive) to the buffer.
- * Adds leading spaces to the buffer.
- * [V7 Unix and Posix use leading zeroes]
+ * Adds leading zeros to the buffer.
*
* @param value The value to write
* @param buf The buffer to receive the output
@@ -182,6 +185,8 @@
/**
* Write an octal long integer into a buffer.
+ * Converts the long value (assumed positive) to the buffer.
+ * Adds leading zeros to the buffer.
* The buffer is terminated with a space.
*
* @param value The value to write as octal
@@ -203,6 +208,8 @@
/**
* Writes an octal value into a buffer.
*
+ * Converts the long value (assumed positive) to the buffer.
+ * Adds leading zeros to the buffer.
* Checksum is followed by NUL and then space.
*
* @param value The value to convert
Modified:
commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java?rev=760741&r1=760740&r2=760741&view=diff
==============================================================================
---
commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
(original)
+++
commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
Wed Apr 1 00:00:49 2009
@@ -96,4 +96,12 @@
assertEquals(0 , buffer[buffer.length-2]);
assertEquals('3', buffer[buffer.length-3]); // end of number
}
+
+ public void testNegative() {
+ byte [] buffer = new byte[10];
+ TarUtils.formatUnsignedOctalString(-1, buffer, 0, buffer.length);
+ // Currently negative numbers generate all zero buffer. This may need
to change.
+ assertEquals("0000000000", new String(buffer));
+
+ }
}