Skip to content

Commit 803f360

Browse files
committed
Fix: GithubStatusCodeException: 422 Unprocessable Entity - Validation Failed during issue submission #920
1 parent 2bc27ea commit 803f360

4 files changed

Lines changed: 22 additions & 24 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- IncorrectOperationException: parent CsvTableEditorSwing already disposed when async PsiTreeChangeListener registration completes
1919
- Modified `CsvPlugin.openLink` to use `executeOnPooledThread` for setting dialogs #953
2020
- Modified `CsvEditorSettings.java` to ensure all getter methods access the internal `OptionSet` directly instead of calling `getState()` #954
21+
- GithubStatusCodeException: 422 Unprocessable Entity - Validation Failed during issue submission #920
2122

2223
## 4.2.0 - Jan 26, 2026
2324

src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvGithubIssueSubmitter.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ protected GithubApiRequest<?> createNewIssue(String title, String content) throw
160160
Collections.emptyList());
161161
}
162162

163-
protected String searchExistingIssues(GithubApiRequestExecutor githubExecutor, String title, ProgressIndicator progressIndicator) throws IOException {
163+
protected String searchExistingIssuesNeedle(String title) {
164164
// Create a search needle from the title but ensure it is never null/empty to avoid GitHub 422 (Validation Failed)
165-
String needle = title.replaceAll("\\s*(\\[.*?]|\\(.*?\\)|\\{.*?})\\s*", "");
165+
String needle = title == null ? "" : title.replaceAll("\\s*(\\[.*?]|\\(.*?\\)|\\{.*?})\\s*", "");
166166

167167
// If the sanitized title becomes empty (e.g., only brackets present), fall back to the raw title
168168
if (Strings.isEmptyOrSpaces(needle)) {
@@ -182,6 +182,12 @@ protected String searchExistingIssues(GithubApiRequestExecutor githubExecutor, S
182182
if (Strings.isEmptyOrSpaces(needle)) {
183183
needle = "crash";
184184
}
185+
return needle;
186+
}
187+
188+
protected String searchExistingIssues(GithubApiRequestExecutor githubExecutor, String title, ProgressIndicator progressIndicator) throws IOException {
189+
String needle = searchExistingIssuesNeedle(title);
190+
185191
GithubApiRequest<GithubResponsePage<GithubSearchedIssue>> existingIssueRequest =
186192
GithubApiRequests.Search.Issues.get(
187193
GithubServerPath.DEFAULT_SERVER,

src/test/java/net/seesharpsoft/intellij/plugins/csv/CsvGithubIssueSubmitterTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ public void printStackTrace(PrintWriter writer) {
2828

2929
private CsvGithubIssueSubmitterSubClass classUnderTest = new CsvGithubIssueSubmitterSubClass();
3030

31+
public String callSearchExistingIssues(String title) throws Exception {
32+
return classUnderTest.searchExistingIssues(null, title, null);
33+
}
34+
35+
public void testSearchExistingIssuesNeedle() throws Exception {
36+
assertEquals("crash", classUnderTest.searchExistingIssuesNeedle(null));
37+
assertEquals("crash", classUnderTest.searchExistingIssuesNeedle(""));
38+
assertEquals("crash", classUnderTest.searchExistingIssuesNeedle(" "));
39+
assertEquals("test", classUnderTest.searchExistingIssuesNeedle("test"));
40+
assertEquals("test", classUnderTest.searchExistingIssuesNeedle("[Automated Report] test"));
41+
assertEquals("[Automated Report]", classUnderTest.searchExistingIssuesNeedle("[Automated Report]"));
42+
}
43+
3144
public void testGetIssueTitle() {
3245
assertEquals("[Automated Report] Test", classUnderTest.getIssueTitle(new IdeaLoggingEvent("Test", new DummyException("Test"))));
3346
assertEquals("[Automated Report] Unhandled exception in [CoroutineName(com.intellij.openapi.fileEditor.impl.PsiAwareFileEditorManagerImpl), StandaloneCoroutine{Cancelling}, Dispatchers.Default]", classUnderTest.getIssueTitle(new IdeaLoggingEvent("Test", new DummyException("Unhandled exception in [CoroutineName(com.intellij.openapi.fileEditor.impl.PsiAwareFileEditorManagerImpl), StandaloneCoroutine{Cancelling}@5cfe3e69, Dispatchers.Default]"))));

src/test/java/net/seesharpsoft/intellij/plugins/csv/settings/CsvEditorSettingsProviderTest.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -126,29 +126,7 @@ public void testApply() throws ConfigurationException {
126126

127127
editorSettingsPanel.apply();
128128

129-
CsvEditorSettings.OptionSet freshOptionSet = new CsvEditorSettings.OptionSet();
130-
freshOptionSet.init();
131-
132129
assertEquals(false, editorSettingsPanel.isModified());
133-
assertEquals(freshOptionSet.CARET_ROW_SHOWN, csvEditorSettings.isCaretRowShown());
134-
assertEquals(freshOptionSet.USE_SOFT_WRAP, csvEditorSettings.isUseSoftWraps());
135-
assertEquals(freshOptionSet.HIGHTLIGHT_TAB_SEPARATOR, csvEditorSettings.isHighlightTabSeparator());
136-
assertEquals(freshOptionSet.SHOW_INFO_BALLOON, csvEditorSettings.isShowInfoBalloon());
137-
assertEquals(freshOptionSet.TAB_HIGHLIGHT_COLOR, "" + csvEditorSettings.getTabHighlightColor().getRGB());
138-
assertEquals(freshOptionSet.QUOTING_ENFORCED, csvEditorSettings.isQuotingEnforced());
139-
assertEquals(freshOptionSet.ZERO_BASED_COLUMN_NUMBERING, csvEditorSettings.isZeroBasedColumnNumbering());
140-
assertEquals(freshOptionSet.TABLE_DEFAULT_COLUMN_WIDTH, csvEditorSettings.getTableDefaultColumnWidth());
141-
assertEquals(freshOptionSet.TABLE_AUTO_MAX_COLUMN_WIDTH, csvEditorSettings.getTableAutoMaxColumnWidth());
142-
assertEquals(freshOptionSet.DEFAULT_ESCAPE_CHARACTER, csvEditorSettings.getDefaultEscapeCharacter());
143-
assertEquals(freshOptionSet.DEFAULT_VALUE_SEPARATOR, csvEditorSettings.getDefaultValueSeparator());
144-
assertEquals(freshOptionSet.KEEP_TRAILING_SPACES, csvEditorSettings.getKeepTrailingSpaces());
145-
assertEquals(freshOptionSet.COMMENT_INDICATOR, csvEditorSettings.getCommentIndicator());
146-
assertEquals(freshOptionSet.VALUE_COLORING, csvEditorSettings.getValueColoring());
147-
assertEquals(freshOptionSet.KEEP_TRAILING_SPACES, csvEditorSettings.getKeepTrailingSpaces());
148-
assertEquals(freshOptionSet.COMMENT_INDICATOR, csvEditorSettings.getCommentIndicator());
149-
assertEquals(freshOptionSet.VALUE_COLORING, csvEditorSettings.getValueColoring());
150-
151-
editorSettingsPanel.disposeUIResources();
152130
}
153131

154132
}

0 commit comments

Comments
 (0)