#fixed code
                                public void testWriteLongCustomEscapes() throws Exception
    {
        JsonFactory jf = new JsonFactory();
        jf.setCharacterEscapes(ESC_627); // must set to trigger bug
        StringBuilder longString = new StringBuilder();
        while (longString.length() < 2000) {
          longString.append("\u65e5\u672c\u8a9e");
        }

        StringWriter writer = new StringWriter();
        // must call #createGenerator(Writer), #createGenerator(OutputStream) doesn't trigger bug
        JsonGenerator jgen = jf.createGenerator(writer);
        jgen.setHighestNonEscapedChar(127); // must set to trigger bug
        jgen.writeString(longString.toString());
      }
#vulnerable code 
                                public void testWriteLongCustomEscapes() throws Exception
    {
        JsonFactory jf = new JsonFactory();
        jf.setCharacterEscapes(ESC_627); // must set to trigger bug
        StringBuilder longString = new StringBuilder();
        while (longString.length() < 2000) {
          longString.append("\u65e5\u672c\u8a9e");
        }

        StringWriter writer = new StringWriter();
        // must call #createJsonGenerator(Writer), #createJsonGenerator(OutputStream) doesn't trigger bug
        JsonGenerator jgen = jf.createJsonGenerator(writer);
        jgen.setHighestNonEscapedChar(127); // must set to trigger bug
        jgen.writeString(longString.toString());
      } 
                            #location 14 
                            #vulnerability type RESOURCE_LEAK