Uploaded image for project: 'CCC Migration Project'
  1. CCC Migration Project
  2. CCC-8034050

Fix serial lint warnings in javax.print

XMLWordPrintable

    • 2d
    • minimal
    • Java API
    • SE

      Summary

      Add missing serialVersionUID fields in javax.print.

      Problem

      Various serializable types in javax.print don't define serialVersionUID fields -- this should be remedied.

      Solution

      Add the fields with values that match the historical output of serialver; both JDK 6 and JDK 8 checked.

      Specification

      --- old/src/share/classes/javax/print/DocFlavor.java    2014-02-09 21:09:29.000000000 -0800
      +++ new/src/share/classes/javax/print/DocFlavor.java    2014-02-09 21:09:29.000000000 -0800
      @@ -1045,6 +1045,7 @@
            * @author  Alan Kaminsky
            */
           public static class URL extends DocFlavor {
      +        private static final long serialVersionUID = 2936725788144902062L;
       
               /**
                * Constructs a new doc flavor with the given MIME type and a print
      --- old/src/share/classes/javax/print/PrintException.java       2014-02-09 21:09:30.000000000 -0800
      +++ new/src/share/classes/javax/print/PrintException.java       2014-02-09 21:09:29.000000000 -0800
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -33,7 +33,7 @@
        *
        */
       public class PrintException extends Exception {
      -
      +    private static final long serialVersionUID = -5932531546705242471L;
       
           /**
            * Construct a print exception with no detail message.
      --- old/src/share/classes/javax/print/attribute/AttributeSetUtilities.java      2014-02-09 21:09:30.000000000 -0800
      +++ new/src/share/classes/javax/print/attribute/AttributeSetUtilities.java      2014-02-09 21:09:30.000000000 -0800
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -77,6 +77,7 @@
             */
           private static class UnmodifiableAttributeSet
               implements AttributeSet, Serializable {
      +        private static final long serialVersionUID = -6131802583863447813L;
       
               private AttributeSet attrset;
       
      @@ -147,6 +148,7 @@
           private static class UnmodifiableDocAttributeSet
               extends UnmodifiableAttributeSet
               implements DocAttributeSet, Serializable {
      +        private static final long serialVersionUID = -6349408326066898956L;
       
               public UnmodifiableDocAttributeSet(DocAttributeSet attributeSet) {
       
      @@ -161,6 +163,7 @@
               extends UnmodifiableAttributeSet
               implements PrintRequestAttributeSet, Serializable
           {
      +        private static final long serialVersionUID = 7799373532614825073L;
               public UnmodifiablePrintRequestAttributeSet
                   (PrintRequestAttributeSet attributeSet) {
       
      @@ -175,6 +178,7 @@
               extends UnmodifiableAttributeSet
               implements PrintJobAttributeSet, Serializable
           {
      +        private static final long serialVersionUID = -8002245296274522112L;
               public UnmodifiablePrintJobAttributeSet
                   (PrintJobAttributeSet attributeSet) {
       
      @@ -189,6 +193,7 @@
               extends UnmodifiableAttributeSet
               implements PrintServiceAttributeSet, Serializable
           {
      +        private static final long serialVersionUID = -7112165137107826819L;
               public UnmodifiablePrintServiceAttributeSet
                   (PrintServiceAttributeSet attributeSet) {
       
      @@ -291,6 +296,7 @@
             */
           private static class SynchronizedAttributeSet
                               implements AttributeSet, Serializable {
      +        private static final long serialVersionUID = 8365731020128564925L;
       
               private AttributeSet attrset;
       
      @@ -357,6 +363,7 @@
           private static class SynchronizedDocAttributeSet
               extends SynchronizedAttributeSet
               implements DocAttributeSet, Serializable {
      +        private static final long serialVersionUID = 6455869095246629354L;
       
               public SynchronizedDocAttributeSet(DocAttributeSet attributeSet) {
                   super(attributeSet);
      @@ -369,6 +376,7 @@
           private static class SynchronizedPrintRequestAttributeSet
               extends SynchronizedAttributeSet
               implements PrintRequestAttributeSet, Serializable {
      +        private static final long serialVersionUID = 5671237023971169027L;
       
               public SynchronizedPrintRequestAttributeSet
                   (PrintRequestAttributeSet attributeSet) {
      @@ -382,6 +390,7 @@
           private static class SynchronizedPrintJobAttributeSet
               extends SynchronizedAttributeSet
               implements PrintJobAttributeSet, Serializable {
      +        private static final long serialVersionUID = 2117188707856965749L;
       
               public SynchronizedPrintJobAttributeSet
                   (PrintJobAttributeSet attributeSet) {
      @@ -395,6 +404,8 @@
           private static class SynchronizedPrintServiceAttributeSet
               extends SynchronizedAttributeSet
               implements PrintServiceAttributeSet, Serializable {
      +        private static final long serialVersionUID = -2830705374001675073L;
      +
               public SynchronizedPrintServiceAttributeSet
                   (PrintServiceAttributeSet attributeSet) {
                   super(attributeSet);
      --- old/src/share/classes/javax/print/attribute/UnmodifiableSetException.java   2014-02-09 21:09:31.000000000 -0800
      +++ new/src/share/classes/javax/print/attribute/UnmodifiableSetException.java   2014-02-09 21:09:30.000000000 -0800
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -33,6 +33,8 @@
        * @since   1.4
        */
       public class UnmodifiableSetException extends RuntimeException {
      +    private static final long serialVersionUID = 2255250308571511731L;
      +
           /**
            * Constructs an UnsupportedOperationException with no detail message.
            */

            darcy Joe Darcy
            darcy Joe Darcy
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: