changeset 9474:c3b91dc2504a

8021583: test/javax/print/autosense/PrintAutoSenseData.java throwing NPE Reviewed-by: jchen, prr
author jgodinez
date Tue, 06 Aug 2013 14:22:48 -0700
parents 1c6bfb303ffc
children fe04f40cf469
files src/solaris/classes/sun/print/UnixPrintJob.java src/windows/classes/sun/print/Win32PrintJob.java test/javax/print/attribute/autosense/PrintAutoSenseData.java test/javax/print/attribute/autosense/sample.txt
diffstat 4 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/classes/sun/print/UnixPrintJob.java	Tue Aug 06 13:38:27 2013 -0700
+++ b/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/src/windows/classes/sun/print/Win32PrintJob.java	Tue Aug 06 13:38:27 2013 -0700
+++ b/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/test/javax/print/attribute/autosense/PrintAutoSenseData.java	Tue Aug 06 13:38:27 2013 -0700
+++ b/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/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.