Skip to content

Commit

Permalink
Add the failing test for #207
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jul 31, 2015
1 parent bcbc3df commit a71a00e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public final class ByteQuadsCanonicalizer
* Array that contains <code>String</code> instances matching
* entries in {@link #_hashArea}.
* Contains nulls for unused entries. Note that this size is twice
* that o
* that of {@link #_hashArea}
*/
protected String[] _names;

Expand Down Expand Up @@ -1266,7 +1266,7 @@ public static TableInfo createInitial(int sz) {
0, // count
tertShift,
new int[hashAreaSize], // mainHash, 2x slots, 4 ints per slot
new String[sz << 1], // 2x slots
new String[sz << 1], // names == 2x slots
hashAreaSize - sz, // at 7/8 of the total area
hashAreaSize // longNameOffset, immediately after main hashes
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.fasterxml.jackson.core.sym;

import java.io.*;
import java.lang.reflect.Field;

import com.fasterxml.jackson.core.*;

/**
* Unit test(s) to verify that handling of (byte-based) symbol tables
* is working. Created to verify fix to [JACKSON-5] (although not very
* good at catching it...).
* is working.
*/
public class TestByteBasedSymbols
extends com.fasterxml.jackson.core.BaseTest
Expand Down Expand Up @@ -97,7 +97,29 @@ public void testAuxMethodsWithNewSymboTable() throws Exception
*/
assertNotNull(nc.toString());
}


// as per name, for [core#207]
public void testIssue207() throws Exception
{
ByteQuadsCanonicalizer nc = ByteQuadsCanonicalizer.createRoot(-523743345);
Field byteSymbolCanonicalizerField = JsonFactory.class.getDeclaredField("_byteSymbolCanonicalizer");
byteSymbolCanonicalizerField.setAccessible(true);
JsonFactory jsonF = new JsonFactory();
byteSymbolCanonicalizerField.set(jsonF, nc);

StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("{\n");
stringBuilder.append(" \"expectedGCperPosition\": null");
for (int i = 0; i < 60; ++i) {
stringBuilder.append(",\n \"").append(i + 1).append("\": null");
}
stringBuilder.append("\n}");

JsonParser p = jsonF.createParser(stringBuilder.toString().getBytes("UTF-8"));
while (p.nextToken() != null) { }
p.close();
}

/*
/**********************************************************
/* Helper methods
Expand Down

0 comments on commit a71a00e

Please sign in to comment.