Skip to content

Implement performSearchPaged for ACMPortalFetcher #12922

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ruarijupp
Copy link

Closes #10507

Describe the changes you have made here: what, where, why, ...
I implemented performSearchPaged in ACMPortalFetcher.java to enable paging support for ACM search results. This aligns the ACM fetcher with the existing structure used by other fetchers like GoogleScholarFetcher. The method builds the correct URL for a given page, supports pagination, and returns the appropriate Page<BibEntry> object.

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (if change is visible to the user)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked 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 to the documentation repository.

Comment on lines +96 to +104
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
deleteWhenClosingPath.ifPresent(path -> {
try {
Files.deleteIfExists(Paths.get(path));
} catch (IOException e) {
LOGGER.warn("Failed to delete temporary file: " + path, e);
}
});
}));
Copy link

Choose a reason for hiding this comment

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

Using 'new Thread()' is discouraged. Instead, 'org.jabref.logic.util.BackgroundTask' and its 'executeWith' should be used for better resource management and consistency.

Comment on lines +77 to +78
assertNotNull(results);
assertFalse(results.isEmpty());
Copy link

Choose a reason for hiding this comment

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

The test should assert the contents of the results using assertEquals instead of checking for Boolean conditions with assertNotNull and assertFalse.

Comment on lines +90 to +91
BibEntry expectedEntry = new BibEntry();
expectedEntry.setField("title", "Machine Learning: A Probabilistic Perspective");
Copy link

Choose a reason for hiding this comment

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

When creating a new BibEntry object, 'withers' should be used instead of 'setField' to improve code readability and maintainability.

@jabref-machine
Copy link
Collaborator

JUnit tests are failing. You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page. To see the test output, locate "Tests / Unit tests (pull_request)" and click on it.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@@ -2,5 +2,6 @@
"java.configuration.updateBuildConfiguration": "interactive",
"java.format.settings.url": "/config/VSCode Code Style.xml",
"java.checkstyle.configuration": "${workspaceFolder}/config/checkstyle/checkstyle_reviewdog.xml",
"java.checkstyle.version": "10.21.0"
"java.checkstyle.version": "10.21.0",
Copy link
Member

Choose a reason for hiding this comment

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

I think this shouldn't be modified

try {Optional<String> deleteWhenClosingPath = Optional.empty();
JabKit.deleteWhenClosingPath = deleteWhenClosingPath;

for (String arg : args) {
Copy link
Member

Choose a reason for hiding this comment

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

Oh, this is from other PRs of yours, right?

Is this code related to this PR or not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import by id: make button larger
3 participants