Skip to content

Commit

Permalink
Warnings clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Aug 1, 2023
1 parent 75303dd commit f34de3d
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class ErrorReportConfiguration
public static final int DEFAULT_MAX_ERROR_TOKEN_LENGTH = 256;

/**
* Previous was {@link com.fasterxml.jackson.core.io.ContentReference#DEFAULT_MAX_CONTENT_SNIPPET}.
* Previously was {@code com.fasterxml.jackson.core.io.ContentReference#DEFAULT_MAX_CONTENT_SNIPPET}.
* Default value for {@link #_maxRawContentLength}.
*/
public static final int DEFAULT_MAX_RAW_CONTENT_LENGTH = 500;
Expand Down
20 changes: 13 additions & 7 deletions src/test/java/com/fasterxml/jackson/core/JsonLocationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,30 +156,36 @@ public void testLocationEquality() throws Exception
}

private ContentReference _sourceRef(String rawSrc) {
return ContentReference.construct(true, rawSrc, 0, rawSrc.length());
return ContentReference.construct(true, rawSrc, 0, rawSrc.length(),
ErrorReportConfiguration.defaults());
}

private ContentReference _sourceRef(char[] rawSrc) {
return ContentReference.construct(true, rawSrc, 0, rawSrc.length);
return ContentReference.construct(true, rawSrc, 0, rawSrc.length,
ErrorReportConfiguration.defaults());
}

private ContentReference _sourceRef(byte[] rawSrc) {
return ContentReference.construct(true, rawSrc, 0, rawSrc.length);
return ContentReference.construct(true, rawSrc, 0, rawSrc.length,
ErrorReportConfiguration.defaults());
}

private ContentReference _sourceRef(byte[] rawSrc, int offset, int length) {
return ContentReference.construct(true, rawSrc, offset, length);
return ContentReference.construct(true, rawSrc, offset, length,
ErrorReportConfiguration.defaults());
}

private ContentReference _sourceRef(InputStream rawSrc) {
return ContentReference.construct(true, rawSrc, -1, -1);
return ContentReference.construct(true, rawSrc, -1, -1,
ErrorReportConfiguration.defaults());
}

private ContentReference _sourceRef(File rawSrc) {
return ContentReference.construct(true, rawSrc, -1, -1);
return ContentReference.construct(true, rawSrc, -1, -1,
ErrorReportConfiguration.defaults());
}

private ContentReference _rawSourceRef(boolean textual, Object rawSrc) {
return ContentReference.rawReference(textual, rawSrc);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ public void testLocation() throws Exception

public void testSourceReference() throws Exception
{
ContentReference ref = ContentReference.construct(true, "text");
ContentReference ref = ContentReference.construct(true, "text",
ErrorReportConfiguration.defaults());

byte[] stuff = jdkSerialize(ref);
ContentReference ref2 = jdkDeserialize(stuff);
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/fasterxml/jackson/core/TestVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ private void assertVersion(Version v)
private IOContext getIOContext() {
return new IOContext(StreamReadConstraints.defaults(),
StreamWriteConstraints.defaults(),
ErrorReportConfiguration.defaults(),
new BufferRecycler(), ContentReference.unknown(), false);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.fasterxml.jackson.core.io;

import com.fasterxml.jackson.core.ErrorReportConfiguration;
import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.core.StreamWriteConstraints;
import com.fasterxml.jackson.core.util.BufferRecycler;
Expand All @@ -9,7 +10,9 @@ public class TestIOContext
{
public void testAllocations() throws Exception
{
IOContext ctxt = new IOContext(StreamReadConstraints.defaults(), StreamWriteConstraints.defaults(),
IOContext ctxt = new IOContext(StreamReadConstraints.defaults(),
StreamWriteConstraints.defaults(),
ErrorReportConfiguration.defaults(),
new BufferRecycler(),
ContentReference.rawReference("N/A"), true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.*;

import com.fasterxml.jackson.core.ErrorReportConfiguration;
import com.fasterxml.jackson.core.JsonEncoding;
import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.core.StreamWriteConstraints;
Expand All @@ -15,6 +16,7 @@ public void testSimple() throws Exception
BufferRecycler rec = new BufferRecycler();
IOContext ctxt = new IOContext(StreamReadConstraints.defaults(),
StreamWriteConstraints.defaults(),
ErrorReportConfiguration.defaults(),
rec, ContentReference.UNKNOWN_CONTENT, false);
// bit complicated; must use recyclable buffer...
byte[] first = ctxt.allocReadIOBuffer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import org.junit.Assert;

import com.fasterxml.jackson.core.ErrorReportConfiguration;
import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.core.StreamWriteConstraints;
import com.fasterxml.jackson.core.util.BufferRecycler;
Expand Down Expand Up @@ -151,7 +152,9 @@ private IOContext _ioContext() {
}

private IOContext _ioContext(BufferRecycler br) {
return new IOContext(StreamReadConstraints.defaults(), StreamWriteConstraints.defaults(),
return new IOContext(StreamReadConstraints.defaults(),
StreamWriteConstraints.defaults(),
ErrorReportConfiguration.defaults(),
br, ContentReference.unknown(), false);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.fasterxml.jackson.core.util;

import com.fasterxml.jackson.core.ErrorReportConfiguration;
import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.core.StreamWriteConstraints;
import com.fasterxml.jackson.core.io.ContentReference;
Expand Down Expand Up @@ -47,6 +48,7 @@ private static TextBuffer makeConstrainedBuffer(int maxStringLen) {
IOContext ioContext = new IOContext(
constraints,
StreamWriteConstraints.defaults(),
ErrorReportConfiguration.defaults(),
new BufferRecycler(),
ContentReference.rawReference("N/A"), true);
return ioContext.constructReadConstrainedTextBuffer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public class UTF8GeneratorTest extends BaseTest
public void testUtf8Issue462() throws Exception
{
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
IOContext ioc = new IOContext(StreamReadConstraints.defaults(), StreamWriteConstraints.defaults(),
IOContext ioc = new IOContext(StreamReadConstraints.defaults(),
StreamWriteConstraints.defaults(),
ErrorReportConfiguration.defaults(),
new BufferRecycler(),
ContentReference.rawReference(bytes), true);
JsonGenerator gen = new UTF8JsonGenerator(ioc, 0, null, bytes, '"');
Expand Down Expand Up @@ -50,6 +52,7 @@ public void testNestingDepthWithSmallLimit() throws Exception
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
IOContext ioc = new IOContext(null,
StreamWriteConstraints.builder().maxNestingDepth(1).build(),
ErrorReportConfiguration.defaults(),
new BufferRecycler(),
ContentReference.rawReference(bytes), true);
try (JsonGenerator gen = new UTF8JsonGenerator(ioc, 0, null, bytes, '"')) {
Expand All @@ -68,6 +71,7 @@ public void testNestingDepthWithSmallLimitNestedObject() throws Exception
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
IOContext ioc = new IOContext(null,
StreamWriteConstraints.builder().maxNestingDepth(1).build(),
ErrorReportConfiguration.defaults(),
new BufferRecycler(),
ContentReference.rawReference(bytes), true);
try (JsonGenerator gen = new UTF8JsonGenerator(ioc, 0, null, bytes, '"')) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.fasterxml.jackson.core.write;

import java.io.StringWriter;

import com.fasterxml.jackson.core.BaseTest;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.ErrorReportConfiguration;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.StreamWriteConstraints;
import com.fasterxml.jackson.core.exc.StreamConstraintsException;
Expand All @@ -10,17 +12,14 @@
import com.fasterxml.jackson.core.json.WriterBasedJsonGenerator;
import com.fasterxml.jackson.core.util.BufferRecycler;

import java.io.StringWriter;

public class WriterBasedJsonGeneratorTest extends BaseTest
{
private final JsonFactory JSON_F = new JsonFactory();

public void testNestingDepthWithSmallLimit() throws Exception
{
StringWriter sw = new StringWriter();
IOContext ioc = new IOContext(null,
StreamWriteConstraints.builder().maxNestingDepth(1).build(),
ErrorReportConfiguration.defaults(),
new BufferRecycler(),
ContentReference.rawReference(sw), true);
try (JsonGenerator gen = new WriterBasedJsonGenerator(ioc, 0, null, sw, '"')) {
Expand All @@ -39,6 +38,7 @@ public void testNestingDepthWithSmallLimitNestedObject() throws Exception
StringWriter sw = new StringWriter();
IOContext ioc = new IOContext(null,
StreamWriteConstraints.builder().maxNestingDepth(1).build(),
ErrorReportConfiguration.defaults(),
new BufferRecycler(),
ContentReference.rawReference(sw), true);
try (JsonGenerator gen = new WriterBasedJsonGenerator(ioc, 0, null, sw, '"')) {
Expand Down

0 comments on commit f34de3d

Please sign in to comment.