-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #416 - Quick-fix fails due to getData() is null #536
base: main
Are you sure you want to change the base?
Fixes #416 - Quick-fix fails due to getData() is null #536
Conversation
import java.util.stream.Collectors; | ||
|
||
import org.eclipse.lsp4j.CodeActionContext; | ||
import org.eclipse.lsp4j.Diagnostic; | ||
import org.eclipse.lsp4j.Position; | ||
import org.eclipse.lsp4j.Range; | ||
import org.eclipse.lsp4j.TextDocumentIdentifier; | ||
import org.eclipse.lsp4jakarta.jdt.internal.beanvalidation.RemoveDynamicConstraintAnnotationQuickFix; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this unused import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
public static Object getValueFromDataParameter(Map<String, Object> data, String key) { | ||
|
||
Object child = data.get(key); | ||
if (child != null && child instanceof String) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do not need this null check because child will not be an instance of String if it is null. Please remove the null check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
Object child = data.get(key); | ||
if (child != null && child instanceof String) { | ||
// if the value in the 'data' is a string, we string the object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code does not line up because there is a tab character on the line. Please remove the tab and replace with 4 spaces.
The same goes for the following line, the two comment lines in the next if block and one comment line in the subsequent else block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
return jsonArray; | ||
} else { | ||
//Returns the object if it exists and is an object, and null otherwise | ||
return getObject(data, key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify why we need this line? It checks if the data is a Map?
Fixes #416
Quick-fix fails due to getData() is null.
The root cause of the issue is lsp4Jakarta expects a Map object from VS Code, but we are sending a string or array of strings from VS code. Resolved the null pointer exception by adding code to handle both the 'data' format.
eg:
data = “AssertTrue”
data =[“ApplicationScoped", "RequestScoped”]