Skip to content

Commit

Permalink
Add failing test for #236 (in 2.11 in case we can add fix there)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 29, 2021
1 parent b38679f commit a13523f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.fasterxml.jackson.dataformat.avro;

import com.fasterxml.jackson.dataformat.avro.AvroMapper;
import com.fasterxml.jackson.dataformat.avro.AvroSchema;

/* 23-Aug-2017, tatu: There was some confusion on whether potential ambiguity
* might be problematic (compared to actual one) -- this test verifies
* it should not be.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class CBORTestBase
protected CBORParser cborParser(ByteArrayOutputStream bytes) throws IOException {
return cborParser(bytes.toByteArray());
}

protected CBORParser cborParser(byte[] input) throws IOException {
return cborParser(cborFactory(), input);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.fasterxml.jackson.dataformat.cbor.failing;

import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.dataformat.cbor.CBORParser;
import com.fasterxml.jackson.dataformat.cbor.CBORTestBase;

public class ParseInvalidUTF8String236Test extends CBORTestBase
{
// [dataformats-binary#236]: Ends with the first byte of alleged 2-byte
// UTF-8 character; parser trying to access second byte beyond end.
public void testArrayIssue236() throws Exception
{
final byte[] input = {0x66, (byte) 0xef, 0x7d, 0x7d, 0xa, 0x2d, (byte) 0xda};
try (CBORParser p = cborParser(input)) {
assertToken(JsonToken.VALUE_STRING, p.nextToken());
assertEquals("foobar", p.getText());
assertNull(p.nextToken());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.dataformat.ion.EnumAsIonSymbolSerializer;
import com.fasterxml.jackson.dataformat.ion.IonSymbolSerializer;
import com.fasterxml.jackson.dataformat.ion.IonObjectMapper;

import com.amazon.ion.IonStruct;
import com.amazon.ion.IonSystem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
import org.junit.Assert;

import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.dataformat.smile.SmileFactory;
import com.fasterxml.jackson.dataformat.smile.SmileGenerator;
import com.fasterxml.jackson.dataformat.smile.SmileParser;

import com.fasterxml.jackson.dataformat.smile.databind.SmileMapper;

public abstract class BaseTestForSmile
Expand Down

0 comments on commit a13523f

Please sign in to comment.