New upstream version 2.10.2
Mechtilde
4 years ago
4 | 4 | - oraclejdk11 |
5 | 5 | |
6 | 6 | # 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 | ||
8 | 9 | before_install: "git clone -b travis `git config --get remote.origin.url` target/travis" |
9 | 10 | after_success: "mvn deploy --settings target/travis/settings.xml" |
10 | 11 | |
14 | 15 | - master |
15 | 16 | - "2.10" |
16 | 17 | |
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 | ||
23 | 18 | env: |
24 | 19 | global: |
25 | 20 | - secure: "YW0hrdsHvH41pb5uPJ2DGzXrBgOVT7nEyag/bAQoDcSlOQ/g55tnY6rIGkqE/aYD47IroTEhW4yLyM3tZpbrqwagX4dUX90ukjcUwUvFE1ePTSEfdBtuHVwl8f6HmLIIw2yK0dQ1gOJ21T+3g+wddvK+6sWBJJ+s3O1FePDh6X0=" |
2 | 2 | <parent> |
3 | 3 | <groupId>com.fasterxml.jackson</groupId> |
4 | 4 | <artifactId>jackson-base</artifactId> |
5 | <version>2.10.1</version> | |
5 | <version>2.10.2</version> | |
6 | 6 | </parent> |
7 | 7 | |
8 | 8 | <groupId>com.fasterxml.jackson.core</groupId> |
9 | 9 | <artifactId>jackson-core</artifactId> |
10 | 10 | <name>Jackson-core</name> |
11 | <version>2.10.1</version> | |
11 | <version>2.10.2</version> | |
12 | 12 | <packaging>bundle</packaging> |
13 | 13 | <description>Core Jackson processing abstractions (aka Streaming API), implementation for JSON</description> |
14 | 14 | <inceptionYear>2008</inceptionYear> |
18 | 18 | <connection>scm:git:git@github.com:FasterXML/jackson-core.git</connection> |
19 | 19 | <developerConnection>scm:git:git@github.com:FasterXML/jackson-core.git</developerConnection> |
20 | 20 | <url>http://github.com/FasterXML/jackson-core</url> |
21 | <tag>jackson-core-2.10.1</tag> | |
21 | <tag>jackson-core-2.10.2</tag> | |
22 | 22 | </scm> |
23 | 23 | |
24 | 24 | <properties> |
114 | 114 | Arnaud Roger (arnaudroger@github) |
115 | 115 | * Contributed #359: FilteringGeneratorDelegate does not override writeStartObject(Object forValue) |
116 | 116 | (2.8.8) |
117 | * Reported, contributed fix for #580: FilteringGeneratorDelegate writeRawValue delegate | |
118 | to `writeRaw()` instead of `writeRawValue()` | |
119 | (2.10.2) | |
117 | 120 | |
118 | 121 | |
119 | 122 | Emily Selwood (emilyselwood@github) |
12 | 12 | ------------------------------------------------------------------------ |
13 | 13 | === Releases === |
14 | 14 | ------------------------------------------------------------------------ |
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) | |
15 | 23 | |
16 | 24 | 2.10.1 (09-Nov-2019) |
17 | 25 |
172 | 172 | _filterContext = _filterContext.createChildArrayContext(_itemFilter, false); |
173 | 173 | } |
174 | 174 | } |
175 | ||
175 | ||
176 | 176 | @Override |
177 | 177 | public void writeStartArray(int size) throws IOException |
178 | 178 | { |
201 | 201 | _filterContext = _filterContext.createChildArrayContext(_itemFilter, false); |
202 | 202 | } |
203 | 203 | } |
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 | } | |
204 | 262 | |
205 | 263 | @Override |
206 | 264 | public void writeEndArray() throws IOException |
241 | 299 | _filterContext = _filterContext.createChildObjectContext(f, false); |
242 | 300 | } |
243 | 301 | } |
244 | ||
302 | ||
245 | 303 | @Override |
246 | 304 | public void writeStartObject(Object forValue) throws IOException |
247 | 305 | { |
273 | 331 | } |
274 | 332 | |
275 | 333 | @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 | |
276 | 364 | public void writeEndObject() throws IOException |
277 | 365 | { |
278 | 366 | _filterContext = _filterContext.closeObject(delegate); |
321 | 409 | } |
322 | 410 | } |
323 | 411 | |
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 | ||
324 | 418 | /* |
325 | 419 | /********************************************************** |
326 | 420 | /* Public API, write methods, text/String values |
426 | 520 | public void writeRaw(String text, int offset, int len) throws IOException |
427 | 521 | { |
428 | 522 | if (_checkRawValueWrite()) { |
429 | delegate.writeRaw(text); | |
523 | delegate.writeRaw(text, offset, len); | |
430 | 524 | } |
431 | 525 | } |
432 | 526 | |
458 | 552 | public void writeRawValue(String text) throws IOException |
459 | 553 | { |
460 | 554 | if (_checkRawValueWrite()) { |
461 | delegate.writeRaw(text); | |
555 | delegate.writeRawValue(text); | |
462 | 556 | } |
463 | 557 | } |
464 | 558 | |
466 | 560 | public void writeRawValue(String text, int offset, int len) throws IOException |
467 | 561 | { |
468 | 562 | if (_checkRawValueWrite()) { |
469 | delegate.writeRaw(text, offset, len); | |
563 | delegate.writeRawValue(text, offset, len); | |
470 | 564 | } |
471 | 565 | } |
472 | 566 | |
474 | 568 | public void writeRawValue(char[] text, int offset, int len) throws IOException |
475 | 569 | { |
476 | 570 | if (_checkRawValueWrite()) { |
477 | delegate.writeRaw(text, offset, len); | |
571 | delegate.writeRawValue(text, offset, len); | |
478 | 572 | } |
479 | 573 | } |
480 | 574 |
1927 | 1927 | case 4: // 4-byte UTF |
1928 | 1928 | c = _decodeUtf8_4(c); |
1929 | 1929 | // Let's add first part right away: |
1930 | outBuf[outPtr++] = (char) (0xD800 | (c >> 10)); | |
1931 | 1930 | if (outPtr >= outBuf.length) { |
1932 | 1931 | outBuf = _textBuffer.finishCurrentSegment(); |
1933 | 1932 | outPtr = 0; |
1934 | 1933 | outEnd = outBuf.length; |
1935 | 1934 | } |
1935 | outBuf[outPtr++] = (char) (0xD800 | (c >> 10)); | |
1936 | 1936 | c = 0xDC00 | (c & 0x3FF); |
1937 | 1937 | // And let the other char output down below |
1938 | 1938 | break; |
1719 | 1719 | return (outputPtr + len); |
1720 | 1720 | } |
1721 | 1721 | |
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) | |
1724 | 1724 | throws IOException, JsonGenerationException |
1725 | 1725 | { |
1726 | int len = raw.length; | |
1726 | final int len = raw.length; | |
1727 | 1727 | if ((outputPtr + len) > outputEnd) { |
1728 | 1728 | _outputTail = outputPtr; |
1729 | 1729 | _flushBuffer(); |
1732 | 1732 | _outputStream.write(raw, 0, len); |
1733 | 1733 | return outputPtr; |
1734 | 1734 | } |
1735 | System.arraycopy(raw, 0, outputBuffer, outputPtr, len); | |
1736 | outputPtr += len; | |
1737 | } | |
1735 | } | |
1736 | System.arraycopy(raw, 0, outputBuffer, outputPtr, len); | |
1737 | outputPtr += len; | |
1738 | 1738 | // but is the invariant still obeyed? If not, flush once more |
1739 | 1739 | if ((outputPtr + 6 * remainingChars) > outputEnd) { |
1740 | _outputTail = outputPtr; | |
1740 | 1741 | _flushBuffer(); |
1741 | 1742 | return _outputTail; |
1742 | 1743 | } |
99 | 99 | |
100 | 100 | @Override |
101 | 101 | public boolean canOmitFields() { return delegate.canOmitFields(); } |
102 | ||
102 | ||
103 | @Override | |
104 | public boolean canWriteFormattedNumbers() { return delegate.canWriteFormattedNumbers(); } | |
105 | ||
103 | 106 | /* |
104 | 107 | /********************************************************** |
105 | 108 | /* Public API, configuration |
336 | 336 | gen.close(); |
337 | 337 | assertEquals(aposToQuotes("{'field1':{},'field2':'val2'}"), w.toString()); |
338 | 338 | } |
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 | } | |
339 | 358 | } |
+43
-0
107 | 107 | |
108 | 108 | assertEquals(aposToQuotes(exp), w.toString()); |
109 | 109 | } |
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 | } | |
110 | 153 | } |
156 | 156 | |
157 | 157 | public void testUtf8StringValue() throws Exception |
158 | 158 | { |
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 | |
165 | 169 | { |
166 | 170 | 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) { | |
171 | 173 | int c; |
172 | 174 | if (r.nextBoolean()) { // ascii |
173 | 175 | c = 32 + (r.nextInt() & 0x3F); |
187 | 189 | sb.append((char) c); |
188 | 190 | } |
189 | 191 | |
190 | ByteArrayOutputStream bout = new ByteArrayOutputStream(LEN); | |
192 | ByteArrayOutputStream bout = new ByteArrayOutputStream(len + (len >> 2)); | |
191 | 193 | OutputStreamWriter out = new OutputStreamWriter(bout, "UTF-8"); |
192 | 194 | out.write("[\""); |
193 | 195 | String VALUE = sb.toString(); |