Skip to content

Commit

Permalink
Camel-case internal names
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Oct 19, 2023
1 parent dc62137 commit e79aa98
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 110 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
* c_min[8]
* c_rmaj[8] only valid for chr and blk special files
* c_rmin[8] only valid for chr and blk special files
* c_namesize[8] count includes terminating NUL in pathname
* c_namesize[8] count includes terminating NUL in path name
* c_check[8] 0 for "new" portable format; for CRC format
* the sum of all the bytes in the file
* </pre>
Expand Down
26 changes: 13 additions & 13 deletions src/test/java/org/apache/commons/compress/AbstractTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ protected void closeQuietly(final Closeable closeable){

/**
* Creates an archive of text-based files in several directories. The
* archivename is the factory identifier for the archiver, for example zip,
* archive name is the factory identifier for the archiver, for example zip,
* tar, cpio, jar, ar. The archive is created as a temp file.
*
* The archive contains the following files:
Expand All @@ -269,22 +269,22 @@ protected void closeQuietly(final Closeable closeable){
* <li>test with spaces.txt</li>
* </ul>
*
* @param archivename
* @param archiveName
* the identifier of this archive
* @return the newly created file
* @throws Exception
* in case something goes wrong
*/
protected Path createArchive(final String archivename) throws Exception {
protected Path createArchive(final String archiveName) throws Exception {
ArchiveOutputStream out = null;
OutputStream stream = null;
try {
archive = Files.createTempFile("test", "." + archivename);
archive = Files.createTempFile("test", "." + archiveName);
archive.toFile().deleteOnExit();
archiveList = new ArrayList<>();

stream = Files.newOutputStream(archive);
out = factory.createArchiveOutputStream(archivename, stream);
out = factory.createArchiveOutputStream(archiveName, stream);

final File file1 = getFile("test1.xml");
final File file2 = getFile("test2.xml");
Expand Down Expand Up @@ -316,19 +316,19 @@ protected Path createArchive(final String archivename) throws Exception {

/**
* Create an empty archive.
* @param archivename
* @param archiveName
* @return the archive File
* @throws Exception
*/
protected Path createEmptyArchive(final String archivename) throws Exception {
protected Path createEmptyArchive(final String archiveName) throws Exception {
ArchiveOutputStream out = null;
OutputStream stream = null;
archiveList = new ArrayList<>();
try {
archive = Files.createTempFile("empty", "." + archivename);
archive = Files.createTempFile("empty", "." + archiveName);
archive.toFile().deleteOnExit();
stream = Files.newOutputStream(archive);
out = factory.createArchiveOutputStream(archivename, stream);
out = factory.createArchiveOutputStream(archiveName, stream);
out.finish();
} finally {
if (out != null) {
Expand All @@ -343,19 +343,19 @@ protected Path createEmptyArchive(final String archivename) throws Exception {
/**
* Create an archive with a single file "test1.xml".
*
* @param archivename
* @param archiveName
* @return the archive File
* @throws Exception
*/
protected Path createSingleEntryArchive(final String archivename) throws Exception {
protected Path createSingleEntryArchive(final String archiveName) throws Exception {
ArchiveOutputStream out = null;
OutputStream stream = null;
archiveList = new ArrayList<>();
try {
archive = Files.createTempFile("empty", "." + archivename);
archive = Files.createTempFile("empty", "." + archiveName);
archive.toFile().deleteOnExit();
stream = Files.newOutputStream(archive);
out = factory.createArchiveOutputStream(archivename, stream);
out = factory.createArchiveOutputStream(archiveName, stream);
// Use short file name so does not cause problems for ar
addArchiveEntry(out, "test1.xml", getFile("test1.xml"));
out.finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

public class ExceptionMessageTest {

private static final String ARCHIVER_NULL_MESSAGE = "Archivername must not be null.";
private static final String ARCHIVER_NULL_MESSAGE = "Archiver name must not be null.";

private static final String INPUTSTREAM_NULL_MESSAGE = "InputStream must not be null.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@

public class TarArchiveOutputStreamTest extends AbstractTestCase {

private static byte[] createTarArchiveContainingOneDirectory(final String fname, final Date modificationDate) throws IOException {
private static byte[] createTarArchiveContainingOneDirectory(final String fileName, final Date modificationDate) throws IOException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (TarArchiveOutputStream tarOut = new TarArchiveOutputStream(baos, 1024)) {
tarOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
final TarArchiveEntry tarEntry = new TarArchiveEntry("d");
tarEntry.setModTime(modificationDate);
tarEntry.setMode(TarArchiveEntry.DEFAULT_DIR_MODE);
tarEntry.setModTime(modificationDate.getTime());
tarEntry.setName(fname);
tarEntry.setName(fileName);
tarOut.putArchiveEntry(tarEntry);
tarOut.closeArchiveEntry();
}
Expand Down Expand Up @@ -569,11 +569,11 @@ public void testWriteLongFileNameThrowsException() throws Exception {
* @see "https://issues.apache.org/jira/browse/COMPRESS-237"
*/
private void testWriteLongLinkName(final int mode) throws Exception {
final String linkname = "01234567890123456789012345678901234567890123456789"
final String linkName = "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789/test";
final TarArchiveEntry entry = new TarArchiveEntry("test", TarConstants.LF_SYMLINK);
entry.setLinkName(linkname);
entry.setLinkName(linkName);

final ByteArrayOutputStream bos = new ByteArrayOutputStream();
try (TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII")) {
Expand All @@ -586,7 +586,7 @@ private void testWriteLongLinkName(final int mode) throws Exception {
try (TarArchiveInputStream tin = new TarArchiveInputStream(new ByteArrayInputStream(data))) {
final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals("test", e.getName(), "Entry name");
assertEquals(linkname, e.getLinkName(), "Link name");
assertEquals(linkName, e.getLinkName(), "Link name");
assertTrue(e.isSymbolicLink(), "The entry is not a symbolic link");
assertEquals(TarConstants.LF_SYMLINK, e.getLinkFlag(), "Link flag");
}
Expand All @@ -597,11 +597,11 @@ private void testWriteLongLinkName(final int mode) throws Exception {
*/
@Test
public void testWriteLongLinkNameErrorMode() throws Exception {
final String linkname = "01234567890123456789012345678901234567890123456789"
final String linkName = "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789/test";
final TarArchiveEntry entry = new TarArchiveEntry("test", TarConstants.LF_SYMLINK);
entry.setLinkName(linkname);
entry.setLinkName(linkName);

assertThrows(RuntimeException.class, () -> {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
Expand Down Expand Up @@ -631,11 +631,11 @@ public void testWriteLongLinkNamePosixMode() throws Exception {

@Test
public void testWriteLongLinkNameTruncateMode() throws Exception {
final String linkname = "01234567890123456789012345678901234567890123456789"
final String linkName = "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789"
+ "01234567890123456789012345678901234567890123456789/";
final TarArchiveEntry entry = new TarArchiveEntry("test", TarConstants.LF_SYMLINK);
entry.setLinkName(linkname);
entry.setLinkName(linkName);

final ByteArrayOutputStream bos = new ByteArrayOutputStream();
try (TarArchiveOutputStream tos = new TarArchiveOutputStream(bos, "ASCII")) {
Expand All @@ -647,7 +647,7 @@ public void testWriteLongLinkNameTruncateMode() throws Exception {
final byte[] data = bos.toByteArray();
try (TarArchiveInputStream tin = new TarArchiveInputStream(new ByteArrayInputStream(data))) {
final TarArchiveEntry e = tin.getNextTarEntry();
assertEquals(linkname.substring(0, TarConstants.NAMELEN), e.getLinkName(), "Link name");
assertEquals(linkName.substring(0, TarConstants.NAMELEN), e.getLinkName(), "Link name");
assertEquals(TarConstants.LF_SYMLINK, e.getLinkFlag(), "Link flag");
}
}
Expand Down
Loading

0 comments on commit e79aa98

Please sign in to comment.