Skip to content
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

MIR-1393 PMD rule MissingSerialVersionUID #1108

Open
wants to merge 1 commit into
base: 2024.06.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.mycore.mir;

import java.io.Serial;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
Expand All @@ -21,6 +22,7 @@

public class MIRClassificationServlet extends MCRServlet {

@Serial
private static final long serialVersionUID = 1L;

private static final String LAYOUT_ELEMENT_KEY = MIRClassificationServlet.class.getName() + ".layoutElement";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.IOException;
import java.io.InputStream;
import java.io.Serial;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
Expand All @@ -20,6 +21,7 @@

public class MIRGetOpenAIREProjectsServlet extends HttpServlet {

@Serial
private static final long serialVersionUID = 1L;

private static Logger LOGGER = LogManager.getLogger();
Expand Down
4 changes: 4 additions & 0 deletions mir-module/src/main/java/org/mycore/mir/MIRStateServlet.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.mycore.mir;

import java.io.Serial;
import java.util.Arrays;
import java.util.Optional;

Expand All @@ -20,6 +21,9 @@

public class MIRStateServlet extends MCRServlet {

@Serial
private static final long serialVersionUID = 1L;

protected static final String X_NEXT_LANGUAGE = "x-next";

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
public class MirSelfRegistrationServlet extends MCRServlet {

@Serial
private static final long serialVersionUID = -7105234919911900795L;
private static final long serialVersionUID = 1L;

private static final Logger LOGGER = LogManager.getLogger();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
@Table(name = "miraccesskey")
public class MIRAccessKey {

private static final long serialVersionUID = 1L;

/** The unique and internal information id */
private int id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package org.mycore.mir.authorization.accesskeys.backend;

import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -76,6 +77,7 @@ public class MIRAccessKeyPair implements Serializable {

public static final String PERMISSION_WRITE = "write";

@Serial
private static final long serialVersionUID = 1L;

private MCRObjectID mcrObjectId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.Serial;

public class MIRAccessKeyServlet extends MCRServlet {

@Serial
private static final long serialVersionUID = 1L;

private static final String REDIRECT_URL_PARAMETER = "url";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.mycore.mir.index;

import java.io.InputStream;
import java.io.Serial;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
Expand Down Expand Up @@ -63,6 +64,9 @@ public void startElement(String uri, String localName, String qName, Attributes

private static class ProbeXMLException extends RuntimeException {

@Serial
private static final long serialVersionUID = 1L;

private String rootName;

private ProbeXMLException(String rootName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.mycore.mir.orcid;

import java.io.IOException;
import java.io.Serial;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -34,6 +35,9 @@

public class MIROrcidServlet extends MCRServlet {

@Serial
private static final long serialVersionUID = 1L;

private static final String ORCID_URL = "https://orcid.org/";

private static final String ORCID_API_URL = "https://pub.orcid.org/";
Expand Down
2 changes: 2 additions & 0 deletions mir-wizard/src/main/java/org/mycore/mir/wizard/MIRWizard.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
import org.mycore.frontend.servlets.MCRServlet;

import java.io.File;
import java.io.Serial;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class MIRWizard extends MCRServlet {

@Serial
private static final long serialVersionUID = 1L;

private static final Logger LOGGER = LogManager.getLogger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package org.mycore.mir.wizard;

import java.io.IOException;
import java.io.Serial;
import java.util.StringTokenizer;

import org.apache.logging.log4j.LogManager;
Expand All @@ -46,6 +47,7 @@
*/
public class MIRWizardServlet extends MCRServlet {

@Serial
private static final long serialVersionUID = 1L;

private static final Logger LOGGER = LogManager.getLogger();
Expand Down
3 changes: 0 additions & 3 deletions ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,7 @@
<rule ref="category/java/errorprone.xml/JUnitStaticSuite"/>
<rule ref="category/java/errorprone.xml/MethodWithSameNameAsEnclosingClass"/>
<rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
<!-- TODO: Create PR to fix this rule -->
<!--
<rule ref="category/java/errorprone.xml/MissingSerialVersionUID"/>
-->
<rule ref="category/java/errorprone.xml/MissingStaticMethodInNonInstantiatableClass"/>
<rule ref="category/java/errorprone.xml/MoreThanOneLogger"/>
<rule ref="category/java/errorprone.xml/NonCaseLabelInSwitch"/>
Expand Down
Loading