This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new 815fbacbee Avoid unlikely NPE 815fbacbee is described below commit 815fbacbeec54c83c78ba3abc39e6995b5a5af42 Author: remm <r...@apache.org> AuthorDate: Fri Sep 15 15:40:15 2023 +0200 Avoid unlikely NPE Found by coverity. --- java/org/apache/naming/factory/DataSourceLinkFactory.java | 4 ++-- java/org/apache/naming/factory/SendMailFactory.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/org/apache/naming/factory/DataSourceLinkFactory.java b/java/org/apache/naming/factory/DataSourceLinkFactory.java index cd19e29627..ca360a9a24 100644 --- a/java/org/apache/naming/factory/DataSourceLinkFactory.java +++ b/java/org/apache/naming/factory/DataSourceLinkFactory.java @@ -58,8 +58,8 @@ public class DataSourceLinkFactory extends ResourceLinkFactory { Reference ref = (Reference) obj; RefAddr userAttr = ref.get("username"); RefAddr passAttr = ref.get("password"); - if (userAttr.getContent()!=null && passAttr.getContent()!=null) { - result = wrapDataSource(result,userAttr.getContent().toString(), passAttr.getContent().toString()); + if (userAttr != null && passAttr != null && userAttr.getContent() != null && passAttr.getContent() != null) { + result = wrapDataSource(result, userAttr.getContent().toString(), passAttr.getContent().toString()); } } return result; diff --git a/java/org/apache/naming/factory/SendMailFactory.java b/java/org/apache/naming/factory/SendMailFactory.java index 886839ba2b..d91a484081 100644 --- a/java/org/apache/naming/factory/SendMailFactory.java +++ b/java/org/apache/naming/factory/SendMailFactory.java @@ -112,7 +112,7 @@ public class SendMailFactory implements ObjectFactory RefAddr fromAddr = ref.get("mail.from"); String from = null; if (fromAddr != null) { - from = (String)ref.get("mail.from").getContent(); + from = (String) fromAddr.getContent(); } if (from != null) { message.setFrom(new InternetAddress(from)); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org