8176891: Fix lint warnings in JAXP repo: serial

Reviewed-by: lancea
This commit is contained in:
Joe Wang 2017-10-24 19:05:29 -07:00
parent 483595f375
commit 46582b2d15
16 changed files with 43 additions and 78 deletions

View File

@ -1,6 +1,6 @@
/* /*
* reserved comment block * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT REMOVE OR ALTER! * @LastModified: Oct 2017
*/ */
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
@ -26,6 +26,7 @@ package com.sun.org.apache.xalan.internal.utils;
*/ */
public final class ConfigurationError public final class ConfigurationError
extends Error { extends Error {
private static final long serialVersionUID = 749136645488750664L;
// //
// Data // Data

View File

@ -1,6 +1,6 @@
/* /*
* reserved comment block * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT REMOVE OR ALTER! * @LastModified: Oct 2017
*/ */
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
@ -26,6 +26,8 @@ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
* state from which it cannot recover. * state from which it cannot recover.
*/ */
public class InternalError extends Error { public class InternalError extends Error {
private static final long serialVersionUID = -6690855975016554786L;
/** /**
* Construct an <code>InternalError</code> with the specified error message. * Construct an <code>InternalError</code> with the specified error message.
* @param msg the error message * @param msg the error message

View File

@ -1,6 +1,6 @@
/* /*
* reserved comment block * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT REMOVE OR ALTER! * @LastModified: Oct 2017
*/ */
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
@ -27,6 +27,7 @@ package com.sun.org.apache.xalan.internal.xsltc.runtime;
* As java.lang.AssertionError was introduced in JDK 1.4 we can't use that yet. * As java.lang.AssertionError was introduced in JDK 1.4 we can't use that yet.
*/ */
public class InternalRuntimeError extends Error { public class InternalRuntimeError extends Error {
private static final long serialVersionUID = 2802784919179095307L;
public InternalRuntimeError(String message) { public InternalRuntimeError(String message) {
super(message); super(message);

View File

@ -1,4 +1,5 @@
/* /*
* Copyright (c) 2009, 2017 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,10 +23,6 @@
* questions. * questions.
*/ */
/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/
package com.sun.org.apache.xerces.internal.jaxp.datatype; package com.sun.org.apache.xerces.internal.jaxp.datatype;
@ -52,6 +49,7 @@ import javax.xml.datatype.DatatypeConstants;
class DurationDayTimeImpl class DurationDayTimeImpl
extends DurationImpl { extends DurationImpl {
private static final long serialVersionUID = 844792794952655204L;
public DurationDayTimeImpl( public DurationDayTimeImpl(
boolean isPositive, boolean isPositive,

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2010, 2017 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -48,7 +48,7 @@ import javax.xml.datatype.DatatypeConstants;
class DurationYearMonthImpl class DurationYearMonthImpl
extends DurationImpl { extends DurationImpl {
private static final long serialVersionUID = -4430140662861507958L;
/** /**
* <p>Constructs a new Duration object by specifying each field individually.</p> * <p>Constructs a new Duration object by specifying each field individually.</p>

View File

@ -1,6 +1,6 @@
/* /*
* reserved comment block * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT REMOVE OR ALTER! * @LastModified: Oct 2017
*/ */
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
@ -40,6 +40,8 @@ import org.xml.sax.SAXException;
* Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
*/ */
public class WrappedSAXException extends RuntimeException { public class WrappedSAXException extends RuntimeException {
private static final long serialVersionUID = -3201986204982729962L;
public final SAXException exception; public final SAXException exception;
WrappedSAXException( SAXException e ) { WrappedSAXException( SAXException e ) {

View File

@ -1,6 +1,6 @@
/* /*
* reserved comment block * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT REMOVE OR ALTER! * @LastModified: Oct 2017
*/ */
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
@ -24,8 +24,8 @@ package com.sun.org.apache.xerces.internal.utils;
/** /**
* A configuration error. This was an internal class in ObjectFactory previously * A configuration error. This was an internal class in ObjectFactory previously
*/ */
public final class ConfigurationError public final class ConfigurationError extends Error {
extends Error { private static final long serialVersionUID = 8095902236393167968L;
// //
// Data // Data

View File

@ -1,6 +1,6 @@
/* /*
* reserved comment block * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT REMOVE OR ALTER! * @LastModified: Oct 2017
*/ */
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
@ -73,6 +73,7 @@ final class URI
*/ */
public static class MalformedURIException extends IOException public static class MalformedURIException extends IOException
{ {
private static final long serialVersionUID = 4651455286983598951L;
/** /**
* Constructs a <code>MalformedURIException</code> with no specified * Constructs a <code>MalformedURIException</code> with no specified

View File

@ -1,6 +1,6 @@
/* /*
* reserved comment block * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT REMOVE OR ALTER! * @LastModified: Oct 2017
*/ */
/* /*
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
@ -61,7 +61,7 @@ import java.util.Objects;
*/ */
public class URI implements Serializable public class URI implements Serializable
{ {
static final long serialVersionUID = 7096266377907081897L; private static final long serialVersionUID = 7096266377907081897L;
/** /**
* MalformedURIExceptions are thrown in the process of building a URI * MalformedURIExceptions are thrown in the process of building a URI
@ -71,6 +71,7 @@ public class URI implements Serializable
*/ */
public static class MalformedURIException extends IOException public static class MalformedURIException extends IOException
{ {
private static final long serialVersionUID = -8498313684991136829L;
/** /**
* Constructs a <code>MalformedURIException</code> with no specified * Constructs a <code>MalformedURIException</code> with no specified

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -33,6 +33,7 @@ package javax.xml.datatype;
*/ */
public class DatatypeConfigurationException extends Exception { public class DatatypeConfigurationException extends Exception {
private static final long serialVersionUID = -1699373159027047238L;
/** /**
* <p>Create a new <code>DatatypeConfigurationException</code> with * <p>Create a new <code>DatatypeConfigurationException</code> with

View File

@ -70,57 +70,8 @@ import jdk.xml.internal.SecuritySupport;
*/ */
public class QName implements Serializable { public class QName implements Serializable {
// tests show that the ID is the same from JDK 1.5 through JDK 9
/** private static final long serialVersionUID = -9120448754896609940L;
* <p>Stream Unique Identifier.</p>
*
* <p>Due to a historical defect, QName was released with multiple
* serialVersionUID values even though its serialization was the
* same.</p>
*
* <p>To workaround this issue, serialVersionUID is set with either
* a default value or a compatibility value. To use the
* compatibility value, set the system property:</p>
*
* <code>com.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0</code>
*
* <p>This workaround was inspired by classes in the javax.management
* package, e.g. ObjectName, etc.
* See CR6267224 for original defect report.</p>
*/
private static final long serialVersionUID;
/**
* <p>Default <code>serialVersionUID</code> value.</p>
*/
private static final long defaultSerialVersionUID = -9120448754896609940L;
/**
* <p>Compatibility <code>serialVersionUID</code> value.</p>
*/
private static final long compatibleSerialVersionUID = 4418622981026545151L;
/**
* <p>Flag to use default or campatible serialVersionUID.</p>
*/
private static boolean useDefaultSerialVersionUID = true;
static {
try {
// use a privileged block as reading a system property
String valueUseCompatibleSerialVersionUID = SecuritySupport.getSystemProperty(
"com.sun.xml.namespace.QName.useCompatibleSerialVersionUID");
useDefaultSerialVersionUID = (valueUseCompatibleSerialVersionUID != null
&& valueUseCompatibleSerialVersionUID.equals("1.0")) ? false : true;
} catch (Exception exception) {
// use default if any Exceptions
useDefaultSerialVersionUID = true;
}
// set serialVersionUID to desired value
if (useDefaultSerialVersionUID) {
serialVersionUID = defaultSerialVersionUID;
} else {
serialVersionUID = compatibleSerialVersionUID;
}
}
/** /**
* <p>Namespace URI of this <code>QName</code>.</p> * <p>Namespace URI of this <code>QName</code>.</p>

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,7 @@ package javax.xml.parsers;
*/ */
public class ParserConfigurationException extends Exception { public class ParserConfigurationException extends Exception {
private static final long serialVersionUID = -3688849216575373917L;
/** /**
* Create a new <code>ParserConfigurationException</code> with no * Create a new <code>ParserConfigurationException</code> with no
* detail message. * detail message.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2017 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -35,6 +35,7 @@ package javax.xml.stream;
*/ */
public class XMLStreamException extends Exception { public class XMLStreamException extends Exception {
private static final long serialVersionUID = 2018819321811497362L;
protected Throwable nested; protected Throwable nested;
protected Location location; protected Location location;

View File

@ -48,6 +48,8 @@ package org.w3c.dom.events;
* @since 1.5, DOM Level 2 * @since 1.5, DOM Level 2
*/ */
public class EventException extends RuntimeException { public class EventException extends RuntimeException {
private static final long serialVersionUID = 242753408332692061L;
public EventException(short code, String message) { public EventException(short code, String message) {
super(message); super(message);
this.code = code; this.code = code;

View File

@ -58,6 +58,8 @@ and Save Specification</a>.
* @since 1.5 * @since 1.5
*/ */
public class LSException extends RuntimeException { public class LSException extends RuntimeException {
private static final long serialVersionUID = 5371691160978884690L;
public LSException(short code, String message) { public LSException(short code, String message) {
super(message); super(message);
this.code = code; this.code = code;

View File

@ -48,6 +48,8 @@ package org.w3c.dom.ranges;
* @since 9, DOM Level 2 * @since 9, DOM Level 2
*/ */
public class RangeException extends RuntimeException { public class RangeException extends RuntimeException {
private static final long serialVersionUID = 2427563372446661889L;
public RangeException(short code, String message) { public RangeException(short code, String message) {
super(message); super(message);
this.code = code; this.code = code;