[
https://issues.apache.org/jira/browse/HADOOP-19993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18124221#comment-18124221
]
ASF GitHub Bot commented on HADOOP-19993:
-----------------------------------------
slfan1989 commented on code in PR #8753:
URL: https://github.com/apache/hadoop/pull/8753#discussion_r4202036294
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/mcp/McpHttpServlet.java:
##########
@@ -46,8 +46,8 @@ public final class McpHttpServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
- private final ObjectMapper objectMapper;
- private final McpRequestHandler requestHandler;
+ private final transient ObjectMapper objectMapper;
Review Comment:
Thanks for the suggestion! I've removed transient from objectMapper and kept
it on requestHandler. This should address SE_BAD_FIELD without introducing
SE_TRANSIENT_FIELD_NOT_RESTORED.
Let's wait for CI to confirm.
> Fix SpotBugs SE_BAD_FIELD in McpHttpServlet blocking trunk precommit
> --------------------------------------------------------------------
>
> Key: HADOOP-19993
> URL: https://issues.apache.org/jira/browse/HADOOP-19993
> Project: Hadoop Common
> Issue Type: Bug
> Components: common
> Reporter: Wei-Chiu Chuang
> Assignee: Wei-Chiu Chuang
> Priority: Major
> Labels: pull-request-available
>
> After YARN-11977 added the MCP HTTP server in hadoop-common, SpotBugs reports
> one remaining warning on trunk in hadoop-common-project/hadoop-common:
> * SE_BAD_FIELD: Class org.apache.hadoop.mcp.McpHttpServlet defines
> non-transient non-serializable instance field requestHandler
> Yetus runs with spotbugs-strict-precheck. While this warning exists on trunk,
> PRs that build modules depending on hadoop-common can fail precommit with:
> {code}hadoop-common-project/hadoop-common in trunk has 1 extant spotbugs
> warnings.{code}
> even when patch SpotBugs and unit tests pass (example: PR-8744 / HDFS-17981).
> *Fix:* mark servlet dependency fields transient (HttpServlet is Serializable
> but instances are not serialized in normal use).
> *Pull request:* https://github.com/apache/hadoop/pull/8753
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]