This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new a432937164 Fix possible NPE a432937164 is described below commit a4329371648b339668c463c0b51a577fa41c48ab Author: remm <r...@apache.org> AuthorDate: Fri Sep 15 15:40:15 2023 +0200 Fix possible NPE And a false positive cleanup. 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 51a086eb36..451961f9a8 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 6448b4dfd6..9590b1a5c2 100644 --- a/java/org/apache/naming/factory/SendMailFactory.java +++ b/java/org/apache/naming/factory/SendMailFactory.java @@ -105,7 +105,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