Skip to content

Commit e15b9a8

Browse files
committed
minor cleanup
1 parent 6884325 commit e15b9a8

File tree

3 files changed

+29
-65
lines changed

3 files changed

+29
-65
lines changed

src/main/java/com/fasterxml/jackson/core/JsonFactory.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,26 +99,18 @@ public enum Feature {
9999
* Method that calculates bit set (flags) of all features that
100100
* are enabled by default.
101101
*/
102-
public static int collectDefaults()
103-
{
102+
public static int collectDefaults() {
104103
int flags = 0;
105104
for (Feature f : values()) {
106-
if (f.enabledByDefault()) {
107-
flags |= f.getMask();
108-
}
105+
if (f.enabledByDefault()) { flags |= f.getMask(); }
109106
}
110107
return flags;
111108
}
112109

113-
private Feature(boolean defaultState)
114-
{
115-
_defaultState = defaultState;
116-
}
110+
private Feature(boolean defaultState) { _defaultState = defaultState; }
117111

118112
public boolean enabledByDefault() { return _defaultState; }
119-
120113
public boolean enabledIn(int flags) { return (flags & getMask()) != 0; }
121-
122114
public int getMask() { return (1 << ordinal()); }
123115
}
124116

src/main/java/com/fasterxml/jackson/core/io/SerializedString.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ public class SerializedString
2727
* enough to omit volatiles here, given how simple lazy initialization is.
2828
* This can be compared to how {@link String#intern} works; lazily and
2929
* without synchronization or use of volatile keyword.
30-
*
30+
*
3131
* Change to remove volatile was a request by implementors of a high-throughput
3232
* search framework; and they believed this is an important optimization for
3333
* heaviest, multi-core deployed use cases.
3434
*/
3535
/*
3636
* 22-Sep-2013, tatu: FWIW, there have been no reports of problems in this
3737
* area, or anything pointing to it. So I think we are safe up to JDK7
38+
* and hopefully beyond.
3839
*/
3940

4041
protected /*volatile*/ byte[] _quotedUTF8Ref;

src/main/java/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.java

Lines changed: 24 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -93,33 +93,20 @@ public ReaderBasedJsonParser(IOContext ctxt, int features, Reader r,
9393
/**********************************************************
9494
*/
9595

96-
@Override
97-
public ObjectCodec getCodec() {
98-
return _objectCodec;
99-
}
100-
101-
@Override
102-
public void setCodec(ObjectCodec c) {
103-
_objectCodec = c;
104-
}
96+
@Override public ObjectCodec getCodec() { return _objectCodec; }
97+
@Override public void setCodec(ObjectCodec c) { _objectCodec = c; }
10598

10699
@Override
107-
public int releaseBuffered(Writer w) throws IOException
108-
{
100+
public int releaseBuffered(Writer w) throws IOException {
109101
int count = _inputEnd - _inputPtr;
110-
if (count < 1) {
111-
return 0;
112-
}
102+
if (count < 1) { return 0; }
113103
// let's just advance ptr to end
114104
int origPtr = _inputPtr;
115105
w.write(_inputBuffer, origPtr, count);
116106
return count;
117107
}
118108

119-
@Override
120-
public Object getInputSource() {
121-
return _reader;
122-
}
109+
@Override public Object getInputSource() { return _reader; }
123110

124111
@Override
125112
protected boolean loadMore() throws IOException
@@ -144,8 +131,7 @@ protected boolean loadMore() throws IOException
144131
return false;
145132
}
146133

147-
protected char getNextChar(String eofMsg)
148-
throws IOException, JsonParseException
134+
protected char getNextChar(String eofMsg) throws IOException
149135
{
150136
if (_inputPtr >= _inputEnd) {
151137
if (!loadMore()) {
@@ -180,8 +166,7 @@ protected void _closeInput() throws IOException
180166
* separately (if need be).
181167
*/
182168
@Override
183-
protected void _releaseBuffers()
184-
throws IOException
169+
protected void _releaseBuffers() throws IOException
185170
{
186171
super._releaseBuffers();
187172
// merge new symbols, if any
@@ -206,8 +191,7 @@ protected void _releaseBuffers()
206191
* Method can be called for any event.
207192
*/
208193
@Override
209-
public String getText()
210-
throws IOException, JsonParseException
194+
public String getText() throws IOException
211195
{
212196
JsonToken t = _currToken;
213197
if (t == JsonToken.VALUE_STRING) {
@@ -224,7 +208,7 @@ public String getText()
224208

225209
// @since 2.1
226210
@Override
227-
public String getValueAsString() throws IOException, JsonParseException
211+
public String getValueAsString() throws IOException
228212
{
229213
if (_currToken == JsonToken.VALUE_STRING) {
230214
if (_tokenIncomplete) {
@@ -238,8 +222,7 @@ public String getValueAsString() throws IOException, JsonParseException
238222

239223
// @since 2.1
240224
@Override
241-
public String getValueAsString(String defValue) throws IOException, JsonParseException
242-
{
225+
public String getValueAsString(String defValue) throws IOException {
243226
if (_currToken == JsonToken.VALUE_STRING) {
244227
if (_tokenIncomplete) {
245228
_tokenIncomplete = false;
@@ -250,8 +233,7 @@ public String getValueAsString(String defValue) throws IOException, JsonParseExc
250233
return super.getValueAsString(defValue);
251234
}
252235

253-
protected String _getText2(JsonToken t)
254-
{
236+
protected String _getText2(JsonToken t) {
255237
if (t == null) {
256238
return null;
257239
}
@@ -270,8 +252,7 @@ protected String _getText2(JsonToken t)
270252
}
271253

272254
@Override
273-
public char[] getTextCharacters()
274-
throws IOException, JsonParseException
255+
public char[] getTextCharacters() throws IOException
275256
{
276257
if (_currToken != null) { // null only before/after document
277258
switch (_currToken.id()) {
@@ -307,8 +288,7 @@ public char[] getTextCharacters()
307288
}
308289

309290
@Override
310-
public int getTextLength()
311-
throws IOException, JsonParseException
291+
public int getTextLength() throws IOException
312292
{
313293
if (_currToken != null) { // null only before/after document
314294
switch (_currToken.id()) {
@@ -333,7 +313,7 @@ public int getTextLength()
333313
}
334314

335315
@Override
336-
public int getTextOffset() throws IOException, JsonParseException
316+
public int getTextOffset() throws IOException
337317
{
338318
// Most have offset of 0, only some may have other values:
339319
if (_currToken != null) {
@@ -356,8 +336,7 @@ public int getTextOffset() throws IOException, JsonParseException
356336
}
357337

358338
@Override
359-
public byte[] getBinaryValue(Base64Variant b64variant)
360-
throws IOException, JsonParseException
339+
public byte[] getBinaryValue(Base64Variant b64variant) throws IOException
361340
{
362341
if (_currToken != JsonToken.VALUE_STRING &&
363342
(_currToken != JsonToken.VALUE_EMBEDDED_OBJECT || _binaryValue == null)) {
@@ -388,8 +367,7 @@ public byte[] getBinaryValue(Base64Variant b64variant)
388367
}
389368

390369
@Override
391-
public int readBinaryValue(Base64Variant b64variant, OutputStream out)
392-
throws IOException, JsonParseException
370+
public int readBinaryValue(Base64Variant b64variant, OutputStream out) throws IOException
393371
{
394372
// if we have already read the token, just use whatever we may have
395373
if (!_tokenIncomplete || _currToken != JsonToken.VALUE_STRING) {
@@ -406,8 +384,7 @@ public int readBinaryValue(Base64Variant b64variant, OutputStream out)
406384
}
407385
}
408386

409-
protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buffer)
410-
throws IOException, JsonParseException
387+
protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buffer) throws IOException
411388
{
412389
int outputPtr = 0;
413390
final int outputEnd = buffer.length - 3;
@@ -544,8 +521,7 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buf
544521
* to indicate end-of-input
545522
*/
546523
@Override
547-
public JsonToken nextToken()
548-
throws IOException, JsonParseException
524+
public JsonToken nextToken() throws IOException
549525
{
550526
_numTypesValid = NR_UNKNOWN;
551527

@@ -705,13 +681,12 @@ private JsonToken _nextAfterName()
705681
/*
706682
@Override
707683
public boolean nextFieldName(SerializableString str)
708-
throws IOException, JsonParseException
684+
throws IOException
709685
*/
710686

711687
// note: identical to one in UTF8StreamJsonParser
712688
@Override
713-
public String nextTextValue()
714-
throws IOException, JsonParseException
689+
public String nextTextValue() throws IOException
715690
{
716691
if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName'
717692
_nameCopied = false;
@@ -738,8 +713,7 @@ public String nextTextValue()
738713

739714
// note: identical to one in Utf8StreamParser
740715
@Override
741-
public int nextIntValue(int defaultValue)
742-
throws IOException, JsonParseException
716+
public int nextIntValue(int defaultValue) throws IOException
743717
{
744718
if (_currToken == JsonToken.FIELD_NAME) {
745719
_nameCopied = false;
@@ -762,8 +736,7 @@ public int nextIntValue(int defaultValue)
762736

763737
// note: identical to one in Utf8StreamParser
764738
@Override
765-
public long nextLongValue(long defaultValue)
766-
throws IOException, JsonParseException
739+
public long nextLongValue(long defaultValue) throws IOException
767740
{
768741
if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName'
769742
_nameCopied = false;
@@ -786,8 +759,7 @@ public long nextLongValue(long defaultValue)
786759

787760
// note: identical to one in UTF8StreamJsonParser
788761
@Override
789-
public Boolean nextBooleanValue()
790-
throws IOException, JsonParseException
762+
public Boolean nextBooleanValue() throws IOException
791763
{
792764
if (_currToken == JsonToken.FIELD_NAME) { // mostly copied from '_nextAfterName'
793765
_nameCopied = false;
@@ -2018,8 +1990,7 @@ protected void _reportInvalidToken(String matchedPart) throws IOException {
20181990
_reportInvalidToken(matchedPart, "'null', 'true', 'false' or NaN");
20191991
}
20201992

2021-
protected void _reportInvalidToken(String matchedPart, String msg)
2022-
throws IOException
1993+
protected void _reportInvalidToken(String matchedPart, String msg) throws IOException
20231994
{
20241995
StringBuilder sb = new StringBuilder(matchedPart);
20251996
/* Let's just try to find what appears to be the token, using

0 commit comments

Comments
 (0)