Skip to content

Remove wrong assert statement#13906

Merged
Siedlerchr merged 2 commits into
mainfrom
hotfix-assertion
Sep 14, 2025
Merged

Remove wrong assert statement#13906
Siedlerchr merged 2 commits into
mainfrom
hotfix-assertion

Conversation

@koppor

@koppor koppor commented Sep 14, 2025

Copy link
Copy Markdown
Member

I had dozens of exceptions while running LSP:

caused by: java.lang.AssertionError

	at org.jabref.jablib/org.jabref.logic.quality.consistency.BibliographyConsistencyCheck.check(BibliographyConsistencyCheck.java:149)
	at org.jabref.jabls/org.jabref.languageserver.util.LspConsistencyCheck.check(LspConsistencyCheck.java:27)
	at org.jabref.jabls/org.jabref.languageserver.util.LspDiagnosticHandler.computeDiagnostics(LspDiagnosticHandler.java:93)
	at org.jabref.jabls/org.jabref.languageserver.util.LspDiagnosticHandler.computeAndPublishDiagnostics(LspDiagnosticHandler.java:54)
	at org.jabref.jabls/org.jabref.languageserver.BibtexTextDocumentService.didOpen(BibtexTextDocumentService.java:36)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at org.eclipse.lsp4j.jsonrpc@0.24.0/org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$recursiveFindRpcMethods$0(GenericEndpoint.java:65)
	at org.eclipse.lsp4j.jsonrpc@0.24.0/org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:160)

Steps to test

  1. Have VS Code running with JabRef plugin
  2. Open a .bib file in VSCode with one @Book entry
  3. Don't see any exception

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • [/] I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (if applicable)
  • [/] I added screenshots in the PR description (if change is visible to the user)
  • [/] I described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • [/] I checked the user documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

@koppor koppor changed the title Change assert to LOGGER Remove wrong assert statement Sep 14, 2025
assert entries != null;
assert entries.size() != 1; // Either there is no entry with different fields or more than one
if (entries == null || entries.size() <= 1 || differingFields.isEmpty()) {
// entries.size == 1 can happen if there is only one entry for one type. (E.g., only one `@Book` entry)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is trivial and restates the obvious logic of the code. Comments should provide new insights or reasoning, not describe what the code already clearly does.

@Siedlerchr Siedlerchr added this pull request to the merge queue Sep 14, 2025
Merged via the queue into JabRef:main with commit 9847d21 Sep 14, 2025
46 of 50 checks passed
@Siedlerchr Siedlerchr deleted the hotfix-assertion branch September 14, 2025 19:55
Siedlerchr added a commit that referenced this pull request Sep 17, 2025
* upstream/main:
  Add new check for format (#13909)
  Consistent casing in fieldnames (#13867)
  Revert "Pressing TAB in last field in entry editor moves focus to the next ta…" (#13912)
  Fix YAML
  Fix on-pr-opened-updated.yml syntax
  Pressing TAB in last field in entry editor moves focus to the next tab's first field  (#13870)
  Modularize JabSrv (#13908)
  New translations jabref_en.properties (Italian) (#13907)
  Remove wrong `assert` statement (#13906)
  Add .git-blame-ignore-revs (#13884)
  Do not show transprot info messages (#13904)
  Pubmed api key support (#13899)
  Fix warnings for native access
  Fix automerge workflow (#13903)
  Add comment on issue on binary (#13902)
  Have checkstyle and VCS configuration distributed (#13900)
  Add unknown field to lsp consistency check (#13880)
  Put config for general tab if missing (#13901)
  Fix autosave manager exception on shutdown (#13882)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants