vscode-groovy-lint
vscode-groovy-lint copied to clipboard
com.fasterxml.jackson.databind.JsonMappingException: Document nesting depth (1001) exceeds the maximum allowed (1000, from `StreamWriteConstraints.getMaxNestingDepth()`)
I have the following file. Below file is just a demo example, extracted from much larger actual file I encountered this error on, but I am able to reproduce the error on example file. I don't think it's a 100% minimial example, but I think it's small enough. I can try to narrow down further if necessary.
I have groovy lint set up in VS code so it runs when my script is changed, but unfortunately it's not able to complete the linting task on this particular file. I have lots of other files on which it "just works".
import groovy.json.JsonOutput
void getJsonData() {
jsonText = '{"values": [{"content": {"raw": "Hello World!"}, "user": {"display_name": "John Doe"}}]}'
return readJSON(text: jsonText)['values']
}
void postContent(String rawContent, String tag=null) {
Map jsonData = [
'content': [
'raw': rawContent
]
]
if (tag != null) {
jsonData['content']['raw'] = "${tag}\n\n${rawContent}"
println("Looking for content tagged \"${tag}\"")
for (value in getJsonData()) {
if (value['content']['raw'].startsWith(tag)) {
println("Found matching content by ${value['user']['display_name']}")
return
}
println("content by ${value['user']['display_name']} doesn't match")
}
}
}
It produces a very lenghty error log which I'll add in full as an attachment because it's too long to add as text to the issue.
full log
cropped log
Below I'll post as text a cropped version that is hopefully more readable.
The actual error contains the bit
org.codehaus.groovy.ast.decompiled.DecompiledClassNode["methods"]->java.util.ArrayList[0]->org.codehaus.groovy.ast.MethodNode["declaringClass"]->
repeating 329 times on a single line, as well as the bit
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)
repeating 225 times across the log.
Below is the cropped log:
Start analyzing file:///home/user/Projects/experiments/groovy/groovy_lint_issue.groovy
(...)
npm-groovy-lint error: Fatal error while calling CodeNarc
Reason: unknown
20:25:47.774 [main] INFO o.c.r.PropertiesFileRuleRegistry -- Loaded properties file in 8ms; 397 rules
20:25:48.493 [main] INFO o.c.r.PropertiesFileRuleSetConfigurer -- RuleSet configuration properties file [codenarc.properties] not found.
Exception in thread "main" com.fasterxml.jackson.databind.JsonMappingException: Document nesting depth (1001) exceeds the maximum allowed (1000, from `StreamWriteConstraints.getMaxNestingDepth()`) (through reference chain: com.nvuillam.Response["parseErrors"]->java.util.LinkedHashMap["/tmp/npm-groovy-lint/codeNarcTmpDir_0.3661186881482361/groovy_lint_issue.groovy"]->java.util.LinkedList[0]->org.codehaus.groovy.control.messages.ExceptionMessage["cause"]->org.codehaus.groovy.syntax.RuntimeParserException["module"]->org.codehaus.groovy.ast.ModuleNode["metaDataMap"]->org.codehaus.groovy.util.ListHashMap["import.aliases"]->java.util.HashMap["JsonOutput"]->org.codehaus.groovy.ast.ImportNode["type"]->org.codehaus.groovy.ast.ClassNode["methods"]->java.util.ArrayList[0]->org.codehaus.groovy.ast.MethodNode["declaringClass"]->org.codehaus.groovy.ast.decompiled.DecompiledClassNode["methods"]->java.util.ArrayList[0]->org.codehaus.groovy.ast.MethodNode["declaringClass"]->org.codehaus.groovy.ast.decompiled.DecompiledClassNode["annotations"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:402)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:361)
at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:323)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:778)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)
Caused by: com.fasterxml.jackson.core.exc.StreamConstraintsException: Document nesting depth (1001) exceeds the maximum allowed (1000, from `StreamWriteConstraints.getMaxNestingDepth()`)
at com.fasterxml.jackson.core.StreamWriteConstraints._constructException(StreamWriteConstraints.java:177)
at com.fasterxml.jackson.core.StreamWriteConstraints.validateNestingDepth(StreamWriteConstraints.java:162)
at com.fasterxml.jackson.core.json.UTF8JsonGenerator.writeStartArray(UTF8JsonGenerator.java:347)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:78)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
... 2 more
undefined
If you still have an error, post an issue to get help: https://github.com/nvuillam/vscode-groovy-lint/issues
environment
VS code installed via snap on Ubuntu 22.04.
$ code --version
1.97.0
33fc5a94a3f99ebe7087e8fe79fbe1d37a251016
x64
Groovy lint extension version 3.3.1 - I think I'm running default settings basically, except a .groovylintrc.json in my home folder, which is:
{
"comment-package": "please see https://www.npmjs.com/package/npm-groovy-lint",
"comment-rules": "please see https://codenarc.org/codenarc-rule-index.html",
"extends": "recommended-jenkinsfile",
"rules": {
"Convention.ParameterReassignment": "off",
"Design.ImplementationAsType": "off",
"Dry.DuplicateStringLiteral": "off",
"Formatting.BlockStartsWithBlankLine": "off",
"Formatting.BlockEndsWithBlankLine": "off",
"Formatting.Indentation": {
"spacesPerIndentLevel": 2
}
}
}
Please let me know if I can post any other information that may help.