-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
refine-jabsrv #13044
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
refine-jabsrv #13044
Conversation
@@ -89,7 +93,7 @@ public Response getBibtex(@PathParam("id") String id) { | |||
} | |||
|
|||
private java.nio.file.Path getLibraryPath(String id) { | |||
return preferences.getLastFilesOpenedPreferences().getLastFilesOpened() | |||
return filesToServe.getFilesToServe() |
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.
The method getLibraryPath uses a filter to find a file path, but it throws a NotFoundException if no match is found. This is using exceptions for control flow, which is not recommended.
public List<Path> getFilesToServe() { | ||
return filesToServe; | ||
} |
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.
The method getFilesToServe() should not return null. It should return an Optional to avoid potential null pointer exceptions.
|
||
exports org.jabref.http.dto to com.google.gson, org.glassfish.hk2.locator; | ||
|
||
opens org.jabref.http.server to org.glassfish.hk2.utilities, org.glassfish.hk2.locator; |
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.
The 'opens' directive is reformatted without adding new statements. Reformatting should only occur with new statements to avoid unnecessary changes.
@@ -4,9 +4,12 @@ | |||
|
|||
import org.jabref.logic.util.io.BackupFileUtil; | |||
|
|||
/// Holds information about test .bib files |
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.
The comment uses three slashes which is not standard JavaDoc format. JavaDoc should be used for method and class comments to provide a high-level summary.
@@ -4,9 +4,12 @@ | |||
|
|||
import org.jabref.logic.util.io.BackupFileUtil; | |||
|
|||
/// Holds information about test .bib files | |||
/// | |||
/// We cannot use a string constant as the path changes from OS to OS. Therefore, we need to dynamically create the expected result. |
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.
The comment is trivial and restates the obvious from the code. Comments should provide new information or reasoning not plainly derived from the code.
"automerge" as this is kind of a "hot fix" (a student group is relying in a working http server) |
String expected = """ | ||
[ | ||
"%s" | ||
]""".formatted(TestBibFile.GENERAL_SERVER_TEST.id); |
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.
Using Java Text blocks for single-line strings is unnecessary and can reduce readability. Text blocks are more suitable for multi-line strings.
@@ -34,7 +43,7 @@ public static void main(final String[] args) throws InterruptedException { | |||
SLF4JBridgeHandler.removeHandlersForRootLogger(); | |||
SLF4JBridgeHandler.install(); | |||
|
|||
final List<Path> lastFilesOpened = new ArrayList<>(); // JabRefCliPreferences.getInstance().getGuiPreferences().getLastFilesOpened(); | |||
final List<Path> filesToServe = JabRefCliPreferences.getInstance().getLastFilesOpenedPreferences().getLastFilesOpened().stream().collect(Collectors.toCollection(ArrayList::new)); |
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.
The use of Collectors.toCollection(ArrayList::new) is unnecessary. The Stream API provides a simpler toList() method that should be used for better readability and maintainability.
The build for this PR is no longer available. Please visit https://builds.jabref.org/main/ for the latest build. |
* upstream/main: Fix directory path validation checks (#13029) Keep merge=union for JabRef_en.properties Merging Entry Creation Buttons Into a Single Tool (#13020) refine-jabsrv (#13044) Switch if branches for readbility (#13042) Updating the gradle wrapper does not need any JDK (#13037) Fix path - and fix typo (#13038)
Fixes
jabsrv
Chocolate.bib
rest-api.http
"running" without SSLFuture work: Get SSL working again
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)