Skip to content

Commit

Permalink
Removed some tabs and fixed a camel case label.
Browse files Browse the repository at this point in the history
  • Loading branch information
nclarkekb committed Sep 1, 2022
1 parent d132062 commit f45dd0b
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 45 deletions.
12 changes: 6 additions & 6 deletions jwat-arc/src/main/java/org/jwat/arc/ArcFileWriter.java
Expand Up @@ -69,12 +69,12 @@ protected ArcFileWriter() {
* @return ARC file writer instance using the supplied configuration
*/
public static ArcFileWriter getArcWriterInstance(ArcFileNaming arcFileNaming, ArcFileWriterConfig arcFileConfig) {
if (arcFileNaming == null) {
throw new IllegalArgumentException("'arcFileNaming' is null!");
}
if (arcFileConfig == null) {
throw new IllegalArgumentException("'arcFileConfig' is null!");
}
if (arcFileNaming == null) {
throw new IllegalArgumentException("'arcFileNaming' is null!");
}
if (arcFileConfig == null) {
throw new IllegalArgumentException("'arcFileConfig' is null!");
}
ArcFileWriter wfw = new ArcFileWriter();
wfw.arcFileNaming = arcFileNaming;
wfw.arcFileConfig = arcFileConfig;
Expand Down
4 changes: 2 additions & 2 deletions jwat-arc/src/main/java/org/jwat/arc/ArcReader.java
Expand Up @@ -418,11 +418,11 @@ public Exception getIteratorExceptionThrown() {
}

public ArcRecordParserCallback getArcRecordParserCallback() {
return arpCallback;
return arpCallback;
}

public void setArcRecordParserCallback(ArcRecordParserCallback arpCallback) {
this.arpCallback = arpCallback;
this.arpCallback = arpCallback;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions jwat-arc/src/main/java/org/jwat/arc/ArcRecordBase.java
Expand Up @@ -150,7 +150,7 @@ public static ArcRecordBase parseRecord(ByteCountingPushBackInputStream in, ArcR
// And false if only garbage has been processed.
if (header.parseHeader(in)) {
if (reader.arpCallback != null) {
reader.arpCallback.arcParsedRecordHeader(reader, startOffset, header);
reader.arpCallback.arcParsedRecordHeader(reader, startOffset, header);
}
if (header.urlScheme != null && header.urlScheme.startsWith(ArcConstants.ARC_SCHEME)) {
record = ArcVersionBlock.parseVersionBlock(reader, diagnostics, header, reader.fieldParsers, in);
Expand Down Expand Up @@ -208,7 +208,7 @@ record = ArcRecord.parseArcRecord(reader, diagnostics, header, in);
reader.bIsCompliant &= record.bIsCompliant;
} else {
// Transfer errors/warnings identified in the header parser to the reader since we are not returning a record.
long excess = in.getConsumed() - startOffset;
long excess = in.getConsumed() - startOffset;
reader.consumed += excess;
reader.diagnostics.addAll(diagnostics);
if (diagnostics.hasErrors() || diagnostics.hasWarnings()) {
Expand All @@ -222,9 +222,9 @@ record = ArcRecord.parseArcRecord(reader, diagnostics, header, in);
++reader.errors;
reader.bIsCompliant = false;
}
if (excess != 0) {
reader.diagnostics.addError(new Diagnosis(DiagnosisType.UNDESIRED_DATA, "Trailing data", "Garbage data found at offset=" + startOffset + " - length=" + excess));
}
if (excess != 0) {
reader.diagnostics.addError(new Diagnosis(DiagnosisType.UNDESIRED_DATA, "Trailing data", "Garbage data found at offset=" + startOffset + " - length=" + excess));
}
}
return record;
}
Expand Down
Expand Up @@ -19,6 +19,6 @@

public interface ArcRecordParserCallback {

public void arcParsedRecordHeader(ArcReader reader, long startOffset, ArcHeader header);
public void arcParsedRecordHeader(ArcReader reader, long startOffset, ArcHeader header);

}
10 changes: 5 additions & 5 deletions jwat-arc/src/test/java/org/jwat/arc/TestArcReader.java
Expand Up @@ -148,7 +148,7 @@ public void test_empty_arcfile() {

@Test
public void test_arcfile_garbage() {
try {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
out.write("http://www.bt.dk/node/100".getBytes());

Expand All @@ -173,7 +173,7 @@ public void test_arcfile_garbage() {

reader.close();
in.close();
}
}
catch (IOException e) {
e.printStackTrace();
Assert.fail("Unexpected exception!");
Expand All @@ -183,9 +183,9 @@ public void test_arcfile_garbage() {
@Test
public void test_arcfile_record_then_garbage() {
try {
File testfile = TestHelpers.getTestResourceFile("invalid-arcfile-record-then-garbage.arc");
RandomAccessFile raf = new RandomAccessFile(testfile, "r");
RandomAccessFileInputStream rafIn = new RandomAccessFileInputStream(raf);
File testfile = TestHelpers.getTestResourceFile("invalid-arcfile-record-then-garbage.arc");
RandomAccessFile raf = new RandomAccessFile(testfile, "r");
RandomAccessFileInputStream rafIn = new RandomAccessFileInputStream(raf);

ArcReader reader = ArcReaderFactory.getReaderUncompressed(rafIn);
ArcRecordBase record = reader.getNextRecord();
Expand Down
Expand Up @@ -41,7 +41,7 @@
*/
public class ArchiveParser {

/** Buffer size used to read the input stream. */
/** Buffer size used to read the input stream. */
public static final int DEFAULT_READER_BUFFER_SIZE = 8192;

/** Buffer size used to peek into the input stream. */
Expand Down
Expand Up @@ -26,12 +26,12 @@

public abstract class ArchiveRecordParserCallback implements ArcRecordParserCallback, WarcRecordParserCallback {

@Override
public void arcParsedRecordHeader(ArcReader reader, long startOffset, ArcHeader header) {
}
@Override
public void arcParsedRecordHeader(ArcReader reader, long startOffset, ArcHeader header) {
}

@Override
public void warcParsedRecordHeader(WarcReader reader, long startOffset, WarcHeader header) {
}
@Override
public void warcParsedRecordHeader(WarcReader reader, long startOffset, WarcHeader header) {
}

}
6 changes: 3 additions & 3 deletions jwat-archive/src/main/java/org/jwat/archive/Cloner.java
Expand Up @@ -37,10 +37,10 @@
*/
public class Cloner {

/** Buffer size used when writing (W)ARC data. */
public static final int DEFAULT_WRITER_BUFFER_SIZE = 8192;
/** Buffer size used when writing (W)ARC data. */
public static final int DEFAULT_WRITER_BUFFER_SIZE = 8192;

private static Cloner cloner;
private static Cloner cloner;

public static synchronized Cloner getCloner() {
if (cloner == null) {
Expand Down
2 changes: 1 addition & 1 deletion jwat-archive/src/main/java/org/jwat/archive/FileIdent.java
Expand Up @@ -32,7 +32,7 @@

public final class FileIdent {

/** Buffer size used to read the input stream. */
/** Buffer size used to read the input stream. */
public static final int DEFAULT_READER_BUFFER_SIZE = 8192;

/** Buffer size used to peek into the input stream. */
Expand Down
Expand Up @@ -112,7 +112,7 @@ public void checkin() {
public long httpHeaderLength;

protected ManagedPayload(int copyBufferSize, int inMemorybufferSize) {
this(copyBufferSize, inMemorybufferSize, DEFAULT_BLOCK_DIGEST_ALGO, DEFAULT_PAYLOAD_DIGEST_ALGO);
this(copyBufferSize, inMemorybufferSize, DEFAULT_BLOCK_DIGEST_ALGO, DEFAULT_PAYLOAD_DIGEST_ALGO);
}

protected ManagedPayload(int copyBufferSize, int inMemorybufferSize, String blockDigestAlgo, String payloadDigestAlgo) {
Expand Down
16 changes: 8 additions & 8 deletions jwat-common/src/main/java/org/jwat/common/UriProfile.java
Expand Up @@ -75,7 +75,7 @@ public class UriProfile {
public boolean bAllow16bitPercentEncoding;

/** Does profile allow invalid percent encoding. */
public boolean bAllowinvalidPercentEncoding;
public boolean bAllowInvalidPercentEncoding;

/**
* Construct an <code>UriProfile</code> initialized with RFC3986
Expand All @@ -87,7 +87,7 @@ public UriProfile() {
}
bAllowRelativeUris = true;
bAllow16bitPercentEncoding = false;
bAllowinvalidPercentEncoding = false;
bAllowInvalidPercentEncoding = false;
}

/**
Expand All @@ -100,7 +100,7 @@ public UriProfile(UriProfile uriProfile) {
}
bAllowRelativeUris = uriProfile.bAllowRelativeUris;
bAllow16bitPercentEncoding = uriProfile.bAllow16bitPercentEncoding;
bAllowinvalidPercentEncoding = uriProfile.bAllowinvalidPercentEncoding;
bAllowInvalidPercentEncoding = uriProfile.bAllowInvalidPercentEncoding;
}

/**
Expand Down Expand Up @@ -196,7 +196,7 @@ public String validate_decode(int bw_and, String componentName, String str) thro
c = str.charAt(pos);
if (c == 'u' || c == 'U') {
if (!bAllow16bitPercentEncoding) {
if (!bAllowinvalidPercentEncoding) {
if (!bAllowInvalidPercentEncoding) {
throw new URISyntaxException(str, "Invalid URI " + componentName + " component - 16-bit percent encoding not allowed");
} else {
bValid = false;
Expand Down Expand Up @@ -230,12 +230,12 @@ public String validate_decode(int bw_and, String componentName, String str) thro
bValid = false;
}
}
if (!bValid && !bAllowinvalidPercentEncoding) {
if (!bValid && !bAllowInvalidPercentEncoding) {
throw new URISyntaxException(str, "Invalid URI " + componentName + " component - invalid percent encoding");
}
sb.append((char) decodedC);
} else {
if (!bAllowinvalidPercentEncoding) {
if (!bAllowInvalidPercentEncoding) {
throw new URISyntaxException(str, "Invalid URI " + componentName + " component - incomplete percent encoding");
} else {
bValid = false;
Expand Down Expand Up @@ -390,7 +390,7 @@ public static void charTypeAddAndOr(int[] charTypeMap, String chars, int bw_and,
RFC3986_ABS_16BIT = new UriProfile();
RFC3986_ABS_16BIT.bAllowRelativeUris = false;
RFC3986_ABS_16BIT.bAllow16bitPercentEncoding = true;
RFC3986_ABS_16BIT.bAllowinvalidPercentEncoding = false;
RFC3986_ABS_16BIT.bAllowInvalidPercentEncoding = false;

StringBuilder sb = new StringBuilder("[]");
for (int i=33; i<127; ++i) {
Expand All @@ -406,7 +406,7 @@ public static void charTypeAddAndOr(int[] charTypeMap, String chars, int bw_and,
RFC3986_ABS_16BIT_LAX = new UriProfile();
RFC3986_ABS_16BIT_LAX.bAllowRelativeUris = false;
RFC3986_ABS_16BIT_LAX.bAllow16bitPercentEncoding = true;
RFC3986_ABS_16BIT_LAX.bAllowinvalidPercentEncoding = true;
RFC3986_ABS_16BIT_LAX.bAllowInvalidPercentEncoding = true;
RFC3986_ABS_16BIT_LAX.charTypeAddAndOr(sb.toString(), 0, B_PATH | B_QUERY | B_FRAGMENT);
RFC3986_ABS_16BIT_LAX.charTypeAddAndOr("#", 0, B_FRAGMENT);
}
Expand Down
12 changes: 6 additions & 6 deletions jwat-common/src/test/java/org/jwat/common/TestUriProfile.java
Expand Up @@ -42,23 +42,23 @@ public void test_uriprofile() {
uriProfile2 = new UriProfile(uriProfile);
Assert.assertNotSame(uriProfile, uriProfile2);
Assert.assertEquals(uriProfile.bAllowRelativeUris, uriProfile2.bAllowRelativeUris);
Assert.assertEquals(uriProfile.bAllowinvalidPercentEncoding, uriProfile2.bAllowinvalidPercentEncoding);
Assert.assertEquals(uriProfile.bAllowInvalidPercentEncoding, uriProfile2.bAllowInvalidPercentEncoding);
Assert.assertEquals(uriProfile.bAllow16bitPercentEncoding, uriProfile2.bAllow16bitPercentEncoding);
Assert.assertArrayEquals(uriProfile.charTypeMap, uriProfile2.charTypeMap);

uriProfile = UriProfile.RFC3986_ABS_16BIT_LAX;
uriProfile2 = new UriProfile(uriProfile);
Assert.assertNotSame(uriProfile, uriProfile2);
Assert.assertEquals(uriProfile.bAllowRelativeUris, uriProfile2.bAllowRelativeUris);
Assert.assertEquals(uriProfile.bAllowinvalidPercentEncoding, uriProfile2.bAllowinvalidPercentEncoding);
Assert.assertEquals(uriProfile.bAllowInvalidPercentEncoding, uriProfile2.bAllowInvalidPercentEncoding);
Assert.assertEquals(uriProfile.bAllow16bitPercentEncoding, uriProfile2.bAllow16bitPercentEncoding);
Assert.assertArrayEquals(uriProfile.charTypeMap, uriProfile2.charTypeMap);

uriProfile = UriProfile.RFC3986;
uriProfile2 = new UriProfile(UriProfile.RFC3986_ABS_16BIT_LAX);
Assert.assertNotSame(uriProfile, uriProfile2);
Assert.assertNotSame(uriProfile.bAllowRelativeUris, uriProfile2.bAllowRelativeUris);
Assert.assertNotSame(uriProfile.bAllowinvalidPercentEncoding, uriProfile2.bAllowinvalidPercentEncoding);
Assert.assertNotSame(uriProfile.bAllowInvalidPercentEncoding, uriProfile2.bAllowInvalidPercentEncoding);
Assert.assertNotSame(uriProfile.bAllow16bitPercentEncoding, uriProfile2.bAllow16bitPercentEncoding);
Assert.assertThat(uriProfile, is(not(equalTo(uriProfile2))));
/*
Expand Down Expand Up @@ -195,19 +195,19 @@ public void test_uriprofile() {
uriProfile.validate_decode(UriProfile.B_ALPHAS, "unit-test", "\n");
Assert.fail("Exception expected!");
} catch (URISyntaxException e) {
Assert.assertEquals(e.getMessage(), "Invalid URI unit-test component - invalid character '0x0a': \n");
Assert.assertEquals(e.getMessage(), "Invalid URI unit-test component - invalid character '0x0a': \n");
}
try {
uriProfile.validate_decode(UriProfile.B_ALPHAS, "unit-test", " ");
Assert.fail("Exception expected!");
} catch (URISyntaxException e) {
Assert.assertEquals(e.getMessage(), "Invalid URI unit-test component - invalid character ' ': ");
Assert.assertEquals(e.getMessage(), "Invalid URI unit-test component - invalid character ' ': ");
}
try {
uriProfile.validate_decode(UriProfile.B_ALPHAS, "unit-test", "\u0019");
Assert.fail("Exception expected!");
} catch (URISyntaxException e) {
Assert.assertEquals(e.getMessage(), "Invalid URI unit-test component - invalid character '0x19': \u0019");
Assert.assertEquals(e.getMessage(), "Invalid URI unit-test component - invalid character '0x19': \u0019");
}

valid_cases = new String[][] {
Expand Down

0 comments on commit f45dd0b

Please sign in to comment.