Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4456750

javax.print: exception getting supported chromaticity values

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • client-libs
    • None
    • 2d
    • beta2
    • sparc
    • solaris_7

      The following program gets a NPE on both win32 & solaris.

      Exception in thread "main" java.lang.NullPointerException
              at sun.print.UnixPrintService.getSupportedAttributeValues(UnixPrintService.java:535)
              at Chroma.checkChroma(Chroma.java:31)
              at Chroma.main(Chroma.java:24)

      // Chroma.java
      import java.io.*;

      import javax.print.*;
      import javax.print.attribute.*;
      import javax.print.attribute.standard.*;

      public class Chroma {

         public static void main(String args[]) {
       
            StreamPrintServiceFactory []fact =
              StreamPrintServiceFactory.lookupStreamPrintServiceFactories(
                    DocFlavor.SERVICE_FORMATTED.PRINTABLE,
                    DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType());

            if (fact.length != 0) {
                OutputStream out = new ByteArrayOutputStream();
                StreamPrintService sps = fact[0].getPrintService(out);
                checkChroma(sps);
            }

            PrintService defSvc = PrintServiceLookup.lookupDefaultPrintService();
            if (defSvc != null) {
                 checkChroma(defSvc);
            }

         }

          static void checkChroma(PrintService svc) {
             if (svc.isAttributeCategorySupported(Chromaticity.class)) {
                  svc.getSupportedAttributeValues(Chromaticity.class,null,null);
             }
          }
       
      }

            jgodinez Jennifer Godinez (Inactive)
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: