Skip to content

Commit

Permalink
Fix issues reported by CodeQL (Missing Override annotation)
Browse files Browse the repository at this point in the history
'Missing Override annotation' was reported 21 times.
This commit adds the missing annotations.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Sep 30, 2024
1 parent c4ddc1b commit 2500e63
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ private static class ContextDescriptor {

private final String fileName;

@Override
public boolean equals(Object potentialContextDescriptor) {
if (potentialContextDescriptor instanceof ContextDescriptor) {
final ContextDescriptor contextDescriptor = ((ContextDescriptor) potentialContextDescriptor);
Expand All @@ -127,6 +128,7 @@ public boolean equals(Object potentialContextDescriptor) {
return false;
}

@Override
public int hashCode() {
return (clazz + fileName).hashCode();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class MetsKitodoObjectFactory extends ObjectFactory {
*
* @return The KitodoType object.
*/
@Override
public KitodoType createKitodoType() {
KitodoType kitodoType = super.createKitodoType();
kitodoType.setVersion(VersionProvider.getDataFormatVersion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ public void setWorkpieces(List<Process> workpieces) {
* object
* @return int
*/
@Override
public int compareTo(Property property) {
int titleMatch = this.getTitle().toLowerCase().compareTo(property.getTitle().toLowerCase());
int valueMatch = this.getValue().toLowerCase().compareTo(property.getValue().toLowerCase());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ private void initiateClientWithAuth(String host, Integer port, String protocol,
*
* @return information about the server
*/
@Override
public String getServerInformation() throws IOException {
Request request = new Request(HttpMethod.GET, "/");
request.addParameter("pretty", "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ private String getDecodedPath(URI uri) {
return decodedPath;
}

@Override
public File getFile(URI uri) {
uri = fileMapper.mapUriToKitodoDataDirectoryUri(uri);
return new File(uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ public void setSelectedProcessesOrProcessDTOs(List<? extends Object> selectedPro
* Update selection and first row to show in datatable on PageEvent.
* @param pageEvent PageEvent triggered by data tables paginator
*/
@Override
public void onPageChange(PageEvent pageEvent) {
this.setFirstRow(((DataTable) pageEvent.getSource()).getFirst());
if (allSelected) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ public String getReferringView() {
* @param treeNode treeNode to be added
* @return whether the given ProcessDetail can be added or not
*/
@Override
public boolean canBeAdded(TreeNode treeNode) throws InvalidMetadataValueException {
if (Objects.isNull(treeNode.getParent().getParent())) {
if (Objects.nonNull(currentProcess.getProcessMetadata().getSelectedMetadataTreeNode())
Expand Down Expand Up @@ -746,6 +747,7 @@ public boolean canBeDeleted(ProcessDetail processDetail) {
* @param metadataNode TreeNode for which the check is performed
* @return whether given TreeNode contains ProcessFieldedMetadata and if any further metadata can be added to it
*/
@Override
public boolean metadataAddableToGroup(TreeNode metadataNode) {
if (metadataNode.getData() instanceof ProcessFieldedMetadata) {
return !(DataEditorService.getAddableMetadataForGroup(getMainProcess().getRuleset(), metadataNode).isEmpty());
Expand All @@ -757,6 +759,7 @@ public boolean metadataAddableToGroup(TreeNode metadataNode) {
* Prepare addable metadata for metadata group.
* @param treeNode metadataGroup treeNode
*/
@Override
public void prepareAddableMetadataForGroup(TreeNode treeNode) {
addMetadataDialog.prepareAddableMetadataForGroup(getMainProcess().getRuleset(), treeNode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ void markLeadingMetadataFields(List<Map<MetadataEntry, Boolean>> leadingMetadata
* there is no setter corresponding to the name configured in
* the rule set
*/
@Override
public void preserve() throws InvalidMetadataValueException, NoSuchMetadataFieldException {
try {
if (Objects.nonNull(division)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public boolean isUndefined() {
return Objects.isNull(settings) || settings.isUndefined();
}

@Override
public boolean isRequired() {
ComplexMetadataViewInterface containerSettings = container.getMetadataView();
if (!(containerSettings instanceof StructuralElementViewInterface) && container.getChildMetadata().isEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public String getInput() {
* @param skipEmpty boolean
* @return the metadata from this row
*/
@Override
public Collection<Metadata> getMetadata(boolean skipEmpty) {
value = value.trim();
if (skipEmpty && value.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,7 @@ public String getReferringView() {
* @param treeNode treeNode to be added
* @return whether the given ProcessDetail can be added or not
*/
@Override
public boolean canBeAdded(TreeNode treeNode) {
if (Objects.isNull(treeNode.getParent().getParent())) {
if (Objects.nonNull(metadataPanel.getSelectedMetadataTreeNode()) || Objects.isNull(addMetadataDialog.getAddableMetadata())) {
Expand Down Expand Up @@ -1116,13 +1117,15 @@ public void preserveMetadataPanel() {
*
* @return whether given TreeNode contains ProcessFieldedMetadata and if any further metadata can be added to it
*/
@Override
public boolean metadataAddableToGroup(TreeNode metadataNode) {
return metadataPanel.metadataAddableToGroup(metadataNode);
}

/**
* Prepare addable metadata for metadata group.
*/
@Override
public void prepareAddableMetadataForGroup(TreeNode treeNode) {
addMetadataDialog.prepareAddableMetadataForGroup(treeNode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class AddDataScript extends EditDataScript {
* @param process the related process
* @param metadataScript the script to execute
*/
@Override
public void executeScript(LegacyMetsModsDigitalDocumentHelper metadataFile, Process process,
MetadataScript metadataScript) throws KitodoScriptExecutionException {
Workpiece workpiece = metadataFile.getWorkpiece();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class DeleteDataScript extends EditDataScript {
* @param process the related process
* @param metadataScript the script to execute
*/
@Override
public void executeScript(LegacyMetsModsDigitalDocumentHelper metadataFile, Process process,
MetadataScript metadataScript) throws KitodoScriptExecutionException {
Workpiece workpiece = metadataFile.getWorkpiece();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ private int getNumberOfDatabaseObjects(ObjectType objectType) throws DAOExceptio
private ExecutorService createDeamonizedExecutorService(int threads) {
return Executors.newFixedThreadPool(threads,
new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public ProjectsPage() {
*
* @return The projects page.
*/
@Override
public ProjectsPage goTo() throws Exception {
Pages.getTopNavigation().gotoProjects();
await("Wait for execution of link click").pollDelay(Browser.getDelayMinAfterLinkClick(), TimeUnit.MILLISECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public UsersPage() {
*
* @return The users page.
*/
@Override
public UsersPage goTo() throws Exception {
Pages.getTopNavigation().gotoUsers();
await("Wait for execution of link click").pollDelay(Browser.getDelayMinAfterLinkClick(), TimeUnit.MILLISECONDS)
Expand Down

0 comments on commit 2500e63

Please sign in to comment.