Skip to content

Commit 4c29e49

Browse files
committed
restore static blocks in jackson
1 parent ce1ef7a commit 4c29e49

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

google-http-client-jackson2/src/main/java/com/google/api/client/json/jackson2/JacksonFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
public final class JacksonFactory extends JsonFactory {
4040

4141
/** JSON factory. */
42-
private final com.fasterxml.jackson.core.JsonFactory factory;
42+
private final com.fasterxml.jackson.core.JsonFactory factory =
43+
new com.fasterxml.jackson.core.JsonFactory();
4344

44-
public JacksonFactory() {
45-
factory = new com.fasterxml.jackson.core.JsonFactory();
45+
{
4646
// don't auto-close JSON content in order to ensure consistent behavior across JSON factories
4747
// TODO(rmistry): Should we disable the JsonGenerator.Feature.AUTO_CLOSE_TARGET feature?
4848
factory.configure(

google-http-client-jackson2/src/test/java/com/google/api/client/json/jackson2/JacksonFactoryTest.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,9 @@
3333
*/
3434
public class JacksonFactoryTest extends AbstractJsonFactoryTest {
3535

36-
private static final String JSON_ENTRY_PRETTY;
37-
private static final String JSON_FEED_PRETTY;
38-
39-
static {
40-
JSON_ENTRY_PRETTY =
41-
"{"
42-
+ StringUtils.LINE_SEPARATOR
43-
+ " \"title\" : \"foo\""
44-
+ StringUtils.LINE_SEPARATOR
45-
+ "}";
46-
JSON_FEED_PRETTY =
36+
private static final String JSON_ENTRY_PRETTY =
37+
"{" + StringUtils.LINE_SEPARATOR + " \"title\" : \"foo\"" + StringUtils.LINE_SEPARATOR + "}";
38+
private static final String JSON_FEED_PRETTY =
4739
"{"
4840
+ StringUtils.LINE_SEPARATOR
4941
+ " \"entries\" : [ {"
@@ -57,7 +49,6 @@ public class JacksonFactoryTest extends AbstractJsonFactoryTest {
5749
+ " } ]"
5850
+ StringUtils.LINE_SEPARATOR
5951
+ "}";
60-
}
6152

6253
@Override
6354
protected JsonFactory newFactory() {

google-http-client-jackson2/src/test/java/com/google/api/client/json/jackson2/JacksonGeneratorTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@
2121

2222
public class JacksonGeneratorTest extends AbstractJsonGeneratorTest {
2323

24-
private static final JacksonFactory FACTORY;
25-
26-
static {
27-
FACTORY = new JacksonFactory();
28-
}
24+
private static final JacksonFactory FACTORY = new JacksonFactory();
2925

3026
@Override
3127
protected JsonGenerator newGenerator(Writer writer) throws IOException {

0 commit comments

Comments
 (0)