Codebase list jackson-core / 3cce7a0
New upstream version 2.10.2 Mechtilde 4 years ago
11 changed file(s) with 203 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
44 - oraclejdk11
55
66 # Below this line is configuration for deploying to the Sonatype OSS repo
7 # http://blog.xeiam.com/2013/05/configure-travis-ci-to-deploy-snapshots.html
7 # https://knowm.org/configure-travis-ci-to-deploy-snapshots/
8
89 before_install: "git clone -b travis `git config --get remote.origin.url` target/travis"
910 after_success: "mvn deploy --settings target/travis/settings.xml"
1011
1415 - master
1516 - "2.10"
1617
17 # to make jdk6 work, as per: https://github.com/travis-ci/travis-ci/issues/8199
18 addons:
19 apt:
20 packages:
21 - openjdk-6-jdk
22
2318 env:
2419 global:
2520 - secure: "YW0hrdsHvH41pb5uPJ2DGzXrBgOVT7nEyag/bAQoDcSlOQ/g55tnY6rIGkqE/aYD47IroTEhW4yLyM3tZpbrqwagX4dUX90ukjcUwUvFE1ePTSEfdBtuHVwl8f6HmLIIw2yK0dQ1gOJ21T+3g+wddvK+6sWBJJ+s3O1FePDh6X0="
22 <parent>
33 <groupId>com.fasterxml.jackson</groupId>
44 <artifactId>jackson-base</artifactId>
5 <version>2.10.1</version>
5 <version>2.10.2</version>
66 </parent>
77
88 <groupId>com.fasterxml.jackson.core</groupId>
99 <artifactId>jackson-core</artifactId>
1010 <name>Jackson-core</name>
11 <version>2.10.1</version>
11 <version>2.10.2</version>
1212 <packaging>bundle</packaging>
1313 <description>Core Jackson processing abstractions (aka Streaming API), implementation for JSON</description>
1414 <inceptionYear>2008</inceptionYear>
1818 <connection>scm:git:git@github.com:FasterXML/jackson-core.git</connection>
1919 <developerConnection>scm:git:git@github.com:FasterXML/jackson-core.git</developerConnection>
2020 <url>http://github.com/FasterXML/jackson-core</url>
21 <tag>jackson-core-2.10.1</tag>
21 <tag>jackson-core-2.10.2</tag>
2222 </scm>
2323
2424 <properties>
114114 Arnaud Roger (arnaudroger@github)
115115 * Contributed #359: FilteringGeneratorDelegate does not override writeStartObject(Object forValue)
116116 (2.8.8)
117 * Reported, contributed fix for #580: FilteringGeneratorDelegate writeRawValue delegate
118 to `writeRaw()` instead of `writeRawValue()`
119 (2.10.2)
117120
118121
119122 Emily Selwood (emilyselwood@github)
1212 ------------------------------------------------------------------------
1313 === Releases ===
1414 ------------------------------------------------------------------------
15
16 2.10.2 (05-Jan-2020)
17
18 #580: FilteringGeneratorDelegate writeRawValue delegate to `writeRaw()`
19 instead of `writeRawValue()`
20 (reported by Arnaud R)
21 #582: `FilteringGeneratorDelegate` bug when filtering arrays (in 2.10.1)
22 (reported by alarribeau@github)
1523
1624 2.10.1 (09-Nov-2019)
1725
172172 _filterContext = _filterContext.createChildArrayContext(_itemFilter, false);
173173 }
174174 }
175
175
176176 @Override
177177 public void writeStartArray(int size) throws IOException
178178 {
201201 _filterContext = _filterContext.createChildArrayContext(_itemFilter, false);
202202 }
203203 }
204
205 @Override
206 public void writeStartArray(Object forValue) throws IOException
207 {
208 if (_itemFilter == null) {
209 _filterContext = _filterContext.createChildArrayContext(null, false);
210 return;
211 }
212 if (_itemFilter == TokenFilter.INCLUDE_ALL) {
213 _filterContext = _filterContext.createChildArrayContext(_itemFilter, true);
214 delegate.writeStartArray(forValue);
215 return;
216 }
217 _itemFilter = _filterContext.checkValue(_itemFilter);
218 if (_itemFilter == null) {
219 _filterContext = _filterContext.createChildArrayContext(null, false);
220 return;
221 }
222 if (_itemFilter != TokenFilter.INCLUDE_ALL) {
223 _itemFilter = _itemFilter.filterStartArray();
224 }
225 if (_itemFilter == TokenFilter.INCLUDE_ALL) {
226 _checkParentPath();
227 _filterContext = _filterContext.createChildArrayContext(_itemFilter, true);
228 delegate.writeStartArray(forValue);
229 } else {
230 _filterContext = _filterContext.createChildArrayContext(_itemFilter, false);
231 }
232 }
233
234 @Override
235 public void writeStartArray(Object forValue, int size) throws IOException
236 {
237 if (_itemFilter == null) {
238 _filterContext = _filterContext.createChildArrayContext(null, false);
239 return;
240 }
241 if (_itemFilter == TokenFilter.INCLUDE_ALL) {
242 _filterContext = _filterContext.createChildArrayContext(_itemFilter, true);
243 delegate.writeStartArray(forValue, size);
244 return;
245 }
246 _itemFilter = _filterContext.checkValue(_itemFilter);
247 if (_itemFilter == null) {
248 _filterContext = _filterContext.createChildArrayContext(null, false);
249 return;
250 }
251 if (_itemFilter != TokenFilter.INCLUDE_ALL) {
252 _itemFilter = _itemFilter.filterStartArray();
253 }
254 if (_itemFilter == TokenFilter.INCLUDE_ALL) {
255 _checkParentPath();
256 _filterContext = _filterContext.createChildArrayContext(_itemFilter, true);
257 delegate.writeStartArray(forValue, size);
258 } else {
259 _filterContext = _filterContext.createChildArrayContext(_itemFilter, false);
260 }
261 }
204262
205263 @Override
206264 public void writeEndArray() throws IOException
241299 _filterContext = _filterContext.createChildObjectContext(f, false);
242300 }
243301 }
244
302
245303 @Override
246304 public void writeStartObject(Object forValue) throws IOException
247305 {
273331 }
274332
275333 @Override
334 public void writeStartObject(Object forValue, int size) throws IOException
335 {
336 if (_itemFilter == null) {
337 _filterContext = _filterContext.createChildObjectContext(_itemFilter, false);
338 return;
339 }
340 if (_itemFilter == TokenFilter.INCLUDE_ALL) {
341 _filterContext = _filterContext.createChildObjectContext(_itemFilter, true);
342 delegate.writeStartObject(forValue, size);
343 return;
344 }
345
346 TokenFilter f = _filterContext.checkValue(_itemFilter);
347 if (f == null) {
348 return;
349 }
350
351 if (f != TokenFilter.INCLUDE_ALL) {
352 f = f.filterStartObject();
353 }
354 if (f == TokenFilter.INCLUDE_ALL) {
355 _checkParentPath();
356 _filterContext = _filterContext.createChildObjectContext(f, true);
357 delegate.writeStartObject(forValue, size);
358 } else {
359 _filterContext = _filterContext.createChildObjectContext(f, false);
360 }
361 }
362
363 @Override
276364 public void writeEndObject() throws IOException
277365 {
278366 _filterContext = _filterContext.closeObject(delegate);
321409 }
322410 }
323411
412 // 02-Dec-2019, tatu: Not sure what else to do... so use default impl from base class
413 @Override
414 public void writeFieldId(long id) throws IOException {
415 writeFieldName(Long.toString(id));
416 }
417
324418 /*
325419 /**********************************************************
326420 /* Public API, write methods, text/String values
426520 public void writeRaw(String text, int offset, int len) throws IOException
427521 {
428522 if (_checkRawValueWrite()) {
429 delegate.writeRaw(text);
523 delegate.writeRaw(text, offset, len);
430524 }
431525 }
432526
458552 public void writeRawValue(String text) throws IOException
459553 {
460554 if (_checkRawValueWrite()) {
461 delegate.writeRaw(text);
555 delegate.writeRawValue(text);
462556 }
463557 }
464558
466560 public void writeRawValue(String text, int offset, int len) throws IOException
467561 {
468562 if (_checkRawValueWrite()) {
469 delegate.writeRaw(text, offset, len);
563 delegate.writeRawValue(text, offset, len);
470564 }
471565 }
472566
474568 public void writeRawValue(char[] text, int offset, int len) throws IOException
475569 {
476570 if (_checkRawValueWrite()) {
477 delegate.writeRaw(text, offset, len);
571 delegate.writeRawValue(text, offset, len);
478572 }
479573 }
480574
19271927 case 4: // 4-byte UTF
19281928 c = _decodeUtf8_4(c);
19291929 // Let's add first part right away:
1930 outBuf[outPtr++] = (char) (0xD800 | (c >> 10));
19311930 if (outPtr >= outBuf.length) {
19321931 outBuf = _textBuffer.finishCurrentSegment();
19331932 outPtr = 0;
19341933 outEnd = outBuf.length;
19351934 }
1935 outBuf[outPtr++] = (char) (0xD800 | (c >> 10));
19361936 c = 0xDC00 | (c & 0x3FF);
19371937 // And let the other char output down below
19381938 break;
17191719 return (outputPtr + len);
17201720 }
17211721
1722 private final int _handleLongCustomEscape(byte[] outputBuffer, int outputPtr, int outputEnd, byte[] raw,
1723 int remainingChars)
1722 private final int _handleLongCustomEscape(byte[] outputBuffer, int outputPtr, int outputEnd,
1723 byte[] raw, int remainingChars)
17241724 throws IOException, JsonGenerationException
17251725 {
1726 int len = raw.length;
1726 final int len = raw.length;
17271727 if ((outputPtr + len) > outputEnd) {
17281728 _outputTail = outputPtr;
17291729 _flushBuffer();
17321732 _outputStream.write(raw, 0, len);
17331733 return outputPtr;
17341734 }
1735 System.arraycopy(raw, 0, outputBuffer, outputPtr, len);
1736 outputPtr += len;
1737 }
1735 }
1736 System.arraycopy(raw, 0, outputBuffer, outputPtr, len);
1737 outputPtr += len;
17381738 // but is the invariant still obeyed? If not, flush once more
17391739 if ((outputPtr + 6 * remainingChars) > outputEnd) {
1740 _outputTail = outputPtr;
17401741 _flushBuffer();
17411742 return _outputTail;
17421743 }
9999
100100 @Override
101101 public boolean canOmitFields() { return delegate.canOmitFields(); }
102
102
103 @Override
104 public boolean canWriteFormattedNumbers() { return delegate.canWriteFormattedNumbers(); }
105
103106 /*
104107 /**********************************************************
105108 /* Public API, configuration
336336 gen.close();
337337 assertEquals(aposToQuotes("{'field1':{},'field2':'val2'}"), w.toString());
338338 }
339
340 // [core#580]
341 public void testRawValueDelegation() throws Exception
342 {
343 StringWriter w = new StringWriter();
344 FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(JSON_F.createGenerator(w),
345 TokenFilter.INCLUDE_ALL, true, true);
346
347 gen.writeStartArray();
348 gen.writeRawValue(new char[] { '1'}, 0, 1);
349 gen.writeRawValue("123", 2, 1);
350 gen.writeRaw(',');
351 gen.writeRaw("/* comment */");
352 gen.writeRaw(" ,42", 1, 3);
353 gen.writeEndArray();
354
355 gen.close();
356 assertEquals("[1,3,/* comment */,42]", w.toString());
357 }
339358 }
107107
108108 assertEquals(aposToQuotes(exp), w.toString());
109109 }
110
111
112 // for [core#582]: regression wrt array filtering
113
114 public void testArrayFiltering582WithoutObject() throws IOException {
115 _testArrayFiltering582(0);
116 }
117
118 public void testArrayFiltering582WithoutSize() throws IOException {
119 _testArrayFiltering582(1);
120 }
121
122 public void testArrayFiltering582WithSize() throws IOException {
123 _testArrayFiltering582(2);
124 }
125
126 private void _testArrayFiltering582(int mode) throws IOException
127 {
128 StringWriter output = new StringWriter();
129 JsonGenerator jg = JSON_F.createGenerator(output);
130
131 FilteringGeneratorDelegate gen = new FilteringGeneratorDelegate(jg,
132 new JsonPointerBasedFilter("/noMatch"), true, true);
133 final String[] stuff = new String[] { "foo", "bar" };
134
135 switch (mode) {
136 case 0:
137 gen.writeStartArray();
138 break;
139 case 1:
140 gen.writeStartArray(stuff);
141 break;
142 default:
143 gen.writeStartArray(stuff, stuff.length);
144 }
145 gen.writeString(stuff[0]);
146 gen.writeString(stuff[1]);
147 gen.writeEndArray();
148 gen.close();
149 jg.close();
150
151 assertEquals("", output.toString());
152 }
110153 }
156156
157157 public void testUtf8StringValue() throws Exception
158158 {
159 _testUtf8StringValue(MODE_INPUT_STREAM);
160 _testUtf8StringValue(MODE_DATA_INPUT);
161 _testUtf8StringValue(MODE_INPUT_STREAM_THROTTLED);
162 }
163
164 public void _testUtf8StringValue(int mode) throws Exception
159 _testUtf8StringValue(MODE_INPUT_STREAM, 2900);
160 _testUtf8StringValue(MODE_DATA_INPUT, 2900);
161 _testUtf8StringValue(MODE_INPUT_STREAM_THROTTLED, 2900);
162
163 _testUtf8StringValue(MODE_INPUT_STREAM, 5300);
164 _testUtf8StringValue(MODE_DATA_INPUT, 5300);
165 _testUtf8StringValue(MODE_INPUT_STREAM_THROTTLED, 5300);
166 }
167
168 public void _testUtf8StringValue(int mode, int len) throws Exception
165169 {
166170 Random r = new Random(13);
167 //int LEN = 72000;
168 int LEN = 720;
169 StringBuilder sb = new StringBuilder(LEN + 20);
170 while (sb.length() < LEN) {
171 StringBuilder sb = new StringBuilder(len + 20);
172 while (sb.length() < len) {
171173 int c;
172174 if (r.nextBoolean()) { // ascii
173175 c = 32 + (r.nextInt() & 0x3F);
187189 sb.append((char) c);
188190 }
189191
190 ByteArrayOutputStream bout = new ByteArrayOutputStream(LEN);
192 ByteArrayOutputStream bout = new ByteArrayOutputStream(len + (len >> 2));
191193 OutputStreamWriter out = new OutputStreamWriter(bout, "UTF-8");
192194 out.write("[\"");
193195 String VALUE = sb.toString();