8021583: test/javax/print/autosense/PrintAutoSenseData.java throwing NPE
authorjgodinez
Tue, 06 Aug 2013 14:22:48 -0700
changeset 19167 c575eb772ac8
parent 19166 e6cd1eb44237
child 19168 ff364494f2b8
8021583: test/javax/print/autosense/PrintAutoSenseData.java throwing NPE Reviewed-by: jchen, prr
jdk/src/solaris/classes/sun/print/UnixPrintJob.java
jdk/src/windows/classes/sun/print/Win32PrintJob.java
jdk/test/javax/print/attribute/autosense/PrintAutoSenseData.java
jdk/test/javax/print/attribute/autosense/sample.txt
--- a/jdk/src/solaris/classes/sun/print/UnixPrintJob.java	Tue Aug 06 13:38:27 2013 -0700
+++ b/jdk/src/solaris/classes/sun/print/UnixPrintJob.java	Tue Aug 06 14:22:48 2013 -0700
@@ -334,6 +334,10 @@
             throw new PrintException("can't get print data: " + e.toString());
         }
 
+        if (data == null) {
+            throw new PrintException("Null print data.");
+        }
+
         if (flavor == null || (!service.isDocFlavorSupported(flavor))) {
             notifyEvent(PrintJobEvent.JOB_FAILED);
             throw new PrintJobFlavorException("invalid flavor", flavor);
--- a/jdk/src/windows/classes/sun/print/Win32PrintJob.java	Tue Aug 06 13:38:27 2013 -0700
+++ b/jdk/src/windows/classes/sun/print/Win32PrintJob.java	Tue Aug 06 14:22:48 2013 -0700
@@ -340,6 +340,10 @@
             throw new PrintException("can't get print data: " + e.toString());
         }
 
+        if (data == null) {
+            throw new PrintException("Null print data.");
+        }
+
         if (flavor == null || (!service.isDocFlavorSupported(flavor))) {
             notifyEvent(PrintJobEvent.JOB_FAILED);
             throw new PrintJobFlavorException("invalid flavor", flavor);
--- a/jdk/test/javax/print/attribute/autosense/PrintAutoSenseData.java	Tue Aug 06 13:38:27 2013 -0700
+++ b/jdk/test/javax/print/attribute/autosense/PrintAutoSenseData.java	Tue Aug 06 14:22:48 2013 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4468109
+ * @bug 4468109 8021583
  * @summary Test for printing AUTOSENSE DocFlavor.  No exception should be thrown.
  * @run main PrintAutoSenseData
 */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/print/attribute/autosense/sample.txt	Tue Aug 06 14:22:48 2013 -0700
@@ -0,0 +1,1 @@
+This is a program for testing AutoSense data.