diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 661b29749..90f80f173 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -6,6 +6,7 @@ Alexey Solofnenko
Andreas Ames
Andreas Mross
Andrew Everitt
+Andrey Urazov
Anil K. Vijendran
Anli Shundi
Anthony Goubard
diff --git a/WHATSNEW b/WHATSNEW
index 521c1b47a..3111ea6d8 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -17,6 +17,9 @@ Fixed bugs:
take comparison with another CompressedResouce into account.
Bugzilla 40949.
+* possible NPE in Jar.java.
+ Bugzilla 40847
+
Other changes:
--------------
diff --git a/contributors.xml b/contributors.xml
index 7f542ea93..f65dc24d0 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -34,6 +34,10 @@
Andrew
Everitt
+
+ Andrey
+ Urazov
+
Anil
K.
diff --git a/src/main/org/apache/tools/ant/taskdefs/Jar.java b/src/main/org/apache/tools/ant/taskdefs/Jar.java
index 8f77c1356..f58788634 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Jar.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Jar.java
@@ -526,7 +526,7 @@ public class Jar extends Zip {
Manifest.Attribute classpath =
mf.getMainSection().getAttribute(Manifest.ATTRIBUTE_CLASSPATH);
String[] cpEntries = null;
- if (classpath != null) {
+ if (classpath != null && classpath.getValue() != null) {
StringTokenizer tok = new StringTokenizer(classpath.getValue(),
" ");
cpEntries = new String[tok.countTokens()];