Skip to content

Commit

Permalink
typos, grammar,
Browse files Browse the repository at this point in the history
javadoc formatting,
minor code cleanup

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Feb 18, 2024
1 parent 62206ad commit b2c0e7a
Show file tree
Hide file tree
Showing 61 changed files with 236 additions and 249 deletions.
8 changes: 4 additions & 4 deletions api/src/main/java/jakarta/xml/bind/Binder.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ protected Binder() {}
public abstract Object getJAXBNode( XmlNode xmlNode );

/**
* Takes an Jakarta XML Binding object and updates
* Takes a Jakarta XML Binding object and updates
* its associated XML node and its descendants.
*
* <p>
Expand Down Expand Up @@ -272,7 +272,7 @@ protected Binder() {}
* would create a new tree that doesn't contain any of those.)
*
* <p>
* As a side-effect, this operation updates the association between
* As a side effect, this operation updates the association between
* XML nodes and Jakarta XML Binding objects.
*
* @param jaxbObject root of potentially modified Jakarta XML Binding object tree
Expand Down Expand Up @@ -301,7 +301,7 @@ protected Binder() {}
* as possible.
*
* <p>
* As a side-effect, this operation updates the association between
* As a side effect, this operation updates the association between
* XML nodes and Jakarta XML Binding objects.
*
* @param xmlNode the XML node
Expand Down Expand Up @@ -350,7 +350,7 @@ protected Binder() {}
*
* <p>
* Calling this method with a null parameter will cause the Binder
* to revert back to the default default event handler.
* to revert back to the default event handler.
*
* @param handler the validation event handler
* @throws JAXBException if an error was encountered while setting the
Expand Down
24 changes: 12 additions & 12 deletions api/src/main/java/jakarta/xml/bind/ContextFinder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -28,7 +28,7 @@
/**
* This class is package private and therefore is not exposed as part of the
* Jakarta XML Binding API.
*
* <p>
* This code is designed to implement the XML Binding spec pluggability feature
*
* @author <ul><li>Ryan Shoemaker, Sun Microsystems, Inc.</li></ul>
Expand Down Expand Up @@ -77,7 +77,7 @@ class ContextFinder {
}

private static ServiceLoaderUtil.ExceptionHandler<JAXBException> EXCEPTION_HANDLER =
new ServiceLoaderUtil.ExceptionHandler<JAXBException>() {
new ServiceLoaderUtil.ExceptionHandler<>() {
@Override
public JAXBException createException(Throwable throwable, String message) {
return new JAXBException(message, throwable);
Expand All @@ -86,7 +86,7 @@ public JAXBException createException(Throwable throwable, String message) {

/**
* If the {@link InvocationTargetException} wraps an exception that shouldn't be wrapped,
* throw the wrapped exception. Otherwise returns exception to be wrapped for further processing.
* throw the wrapped exception. Otherwise, returns exception to be wrapped for further processing.
*/
private static Throwable handleInvocationTargetException(InvocationTargetException x) throws JAXBException {
Throwable t = x.getTargetException();
Expand All @@ -107,7 +107,7 @@ private static Throwable handleInvocationTargetException(InvocationTargetExcepti

/**
* Determine if two types (JAXBContext in this case) will generate a ClassCastException.
*
* <p>
* For example, (targetType)originalType
*
* @param originalType
Expand Down Expand Up @@ -217,7 +217,7 @@ static JAXBContext newInstance(String contextPath,
private static Object instantiateProviderIfNecessary(final Class<?> implClass) throws JAXBException {
try {
if (JAXBContextFactory.class.isAssignableFrom(implClass)) {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
return AccessController.doPrivileged(new PrivilegedExceptionAction<>() {
@Override
public Object run() throws Exception {
return implClass.getConstructor().newInstance();
Expand Down Expand Up @@ -330,7 +330,7 @@ static JAXBContext find(String factoryId,
try {
return newInstance(contextPath, contextPathClasses, ctxFactory, classLoader, properties);
} catch (Throwable t) {
logger.log(Level.FINE, t, () -> "Error instantiating provivder " + ctxFactory);
logger.log(Level.FINE, t, () -> "Error instantiating provider " + ctxFactory);
}
}
}
Expand Down Expand Up @@ -432,9 +432,9 @@ static URL which(Class<?> clazz, ClassLoader loader) {

/**
* Get the URL for the Class from it's ClassLoader.
*
* <p>
* Convenience method for {@link #which(Class, ClassLoader)}.
*
* <p>
* Equivalent to calling: which(clazz, clazz.getClassLoader())
*
* @param clazz
Expand All @@ -451,7 +451,7 @@ private static ClassLoader getContextClassLoader() {
return Thread.currentThread().getContextClassLoader();
} else {
return AccessController.doPrivileged(
new PrivilegedAction<ClassLoader>() {
new PrivilegedAction<>() {
@Override
public ClassLoader run() {
return Thread.currentThread().getContextClassLoader();
Expand All @@ -465,7 +465,7 @@ private static ClassLoader getClassClassLoader(final Class<?> c) {
return c.getClassLoader();
} else {
return AccessController.doPrivileged(
new PrivilegedAction<ClassLoader>() {
new PrivilegedAction<>() {
@Override
public ClassLoader run() {
return c.getClassLoader();
Expand All @@ -479,7 +479,7 @@ private static ClassLoader getSystemClassLoader() {
return ClassLoader.getSystemClassLoader();
} else {
return AccessController.doPrivileged(
new PrivilegedAction<ClassLoader>() {
new PrivilegedAction<>() {
@Override
public ClassLoader run() {
return ClassLoader.getSystemClassLoader();
Expand Down
6 changes: 3 additions & 3 deletions api/src/main/java/jakarta/xml/bind/DatatypeConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* The javaType binding declaration can be used to customize the binding of
* an XML schema datatype to a Java datatype. Customizations can involve
* writing a parse and print method for parsing and printing lexical
* representations of a XML schema datatype respectively. However, writing
* representations of an XML schema datatype respectively. However, writing
* parse and print methods requires knowledge of the lexical representations (
* <a href="http://www.w3.org/TR/xmlschema-2/"> XML Schema Part2: Datatypes
* specification </a>) and hence may be difficult to write.
Expand Down Expand Up @@ -61,7 +61,7 @@
* </p>
*
* <p>
* A print method for a XML schema datatype can output any lexical
* A print method for an XML schema datatype can output any lexical
* representation that is valid with respect to the XML schema datatype.
* If an error is encountered during conversion, then an IllegalArgumentException,
* or a subclass of IllegalArgumentException must be thrown by the method.
Expand Down Expand Up @@ -158,7 +158,7 @@ public static java.math.BigInteger parseInteger( String lexicalXSDInteger ) {
* A string containing a lexical representation of
* xsd:int.
* @return
* A int value represented by the string argument.
* An int value represented by the string argument.
* @throws NumberFormatException <code>lexicalXSDInt</code> is not a valid string representation of an <code>int</code> value.
*/
public static int parseInt( String lexicalXSDInt ) {
Expand Down
24 changes: 12 additions & 12 deletions api/src/main/java/jakarta/xml/bind/DatatypeConverterImpl.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -77,7 +77,7 @@ public int parseInt(String s) {

/**
* Faster but less robust {@code String->int} conversion.
*
* <p>
* Note that:
* <ol>
* <li>XML Schema allows '+', but {@link Integer#valueOf(String)} is not.
Expand Down Expand Up @@ -175,7 +175,7 @@ public static float _parseFloat(CharSequence _val) {
* jfloat.valueOf ignores leading and trailing whitespaces,
whereas this is not allowed in xfloat.
* jfloat.valueOf allows "float type suffix" (f, F) to be
appended after float literal (e.g., 1.52e-2f), whereare
appended after float literal (e.g., 1.52e-2f), whereas
this is not the case of xfloat.
gray zone
Expand All @@ -195,7 +195,7 @@ appended after float literal (e.g., 1.52e-2f), whereare
return Float.NEGATIVE_INFINITY;
}

if (s.length() == 0
if (s.isEmpty()
|| !isDigitOrPeriodOrSign(s.charAt(0))
|| !isDigitOrPeriodOrSign(s.charAt(s.length() - 1))) {
throw new NumberFormatException();
Expand Down Expand Up @@ -241,7 +241,7 @@ public static double _parseDouble(CharSequence _val) {
return Double.NEGATIVE_INFINITY;
}

if (val.length() == 0
if (val.isEmpty()
|| !isDigitOrPeriodOrSign(val.charAt(0))
|| !isDigitOrPeriodOrSign(val.charAt(val.length() - 1))) {
throw new NumberFormatException(val);
Expand Down Expand Up @@ -398,7 +398,7 @@ public static QName _parseQName(CharSequence text, NamespaceContext nsc) {
uri = nsc.getNamespaceURI(prefix);
// uri can never be null according to javadoc,
// but some users reported that there are implementations that return null.
if (uri == null || uri.length() == 0) // crap. the NamespaceContext interface is broken.
if (uri == null || uri.isEmpty()) // crap. the NamespaceContext interface is broken.
// error: unbound prefix
{
throw new IllegalArgumentException("prefix " + prefix + " is not bound to a namespace");
Expand Down Expand Up @@ -520,7 +520,7 @@ public String printDate(Calendar val) {

public static String _printDate(Calendar val) {
if (null == val) throw new IllegalArgumentException("val is null");
return CalendarFormatter.doFormat((new StringBuilder("%Y-%M-%D").append("%z")).toString(),val);
return CalendarFormatter.doFormat("%Y-%M-%D%z",val);
}

@Override
Expand Down Expand Up @@ -592,7 +592,7 @@ public static String _printQName(QName val, NamespaceContext nsc) {
String prefix = nsc.getPrefix(val.getNamespaceURI());
String localPart = val.getLocalPart();

if (prefix == null || prefix.length() == 0) { // be defensive
if (prefix == null || prefix.isEmpty()) { // be defensive
qname = localPart;
} else {
qname = prefix + ':' + localPart;
Expand Down Expand Up @@ -706,7 +706,7 @@ private static int guessLength(String text) {
* base64Binary data is likely to be long, and decoding requires
* each character to be accessed twice (once for counting length, another
* for decoding.)
*
* <p>
* A benchmark showed that taking {@link String} is faster, presumably
* because JIT can inline a lot of string access (with data of 1K chars, it was twice as fast)
*/
Expand Down Expand Up @@ -799,7 +799,7 @@ public static String _printBase64Binary(byte[] input, int offset, int len) {

/**
* Encodes a byte array into a char array by doing base64 encoding.
*
* <p>
* The caller must supply a big enough buffer.
*
* @return
Expand Down Expand Up @@ -841,7 +841,7 @@ public static int _printBase64Binary(byte[] input, int offset, int len, char[] b
/**
* Encodes a byte array into another byte array by first doing base64 encoding
* then encoding the result in ASCII.
*
* <p>
* The caller must supply a big enough buffer.
*
* @return
Expand Down Expand Up @@ -1050,7 +1050,7 @@ private static void formatTimeZone(Calendar cal, StringBuilder buf) {
offset *= -1;
}

offset /= 60 * 1000; // offset is in milli-seconds
offset /= 60 * 1000; // offset is in milliseconds

formatTwoDigits(offset / 60, buf);
buf.append(':');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -35,15 +35,15 @@
* class.
*
* <p>
* A parse method for a XML schema datatype must be capable of converting any
* A parse method for an XML schema datatype must be capable of converting any
* lexical representation of the XML schema datatype ( specified by the
* <a href="http://www.w3.org/TR/xmlschema-2/"> XML Schema Part2: Datatypes
* specification</a> into a value in the value space of the XML schema datatype.
* If an error is encountered during conversion, then an IllegalArgumentException
* or a subclass of IllegalArgumentException must be thrown by the method.
*
* <p>
* A print method for a XML schema datatype can output any lexical
* A print method for an XML schema datatype can output any lexical
* representation that is valid with respect to the XML schema datatype.
* If an error is encountered during conversion, then an IllegalArgumentException,
* or a subclass of IllegalArgumentException must be thrown by the method.
Expand Down
4 changes: 2 additions & 2 deletions api/src/main/java/jakarta/xml/bind/Element.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand All @@ -12,7 +12,7 @@

/**
* This is an element marker interface.
*
* <p>
* Under certain circumstances, it is necessary for the binding compiler to
* generate derived java content classes that implement this interface. In
* those cases, client applications must supply element instances rather than
Expand Down
10 changes: 5 additions & 5 deletions api/src/main/java/jakarta/xml/bind/JAXB.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -37,8 +37,8 @@
* in the {@link JAXBContext}, {@link Unmarshaller}, and {@link Marshaller}.
*
* They are designed
* to be the prefered methods for developers new to Jakarta XML Binding. They have
* the following characterstics:
* to be the preferred methods for developers new to Jakarta XML Binding. They have
* the following characteristics:
*
* <ol>
* <li>Generally speaking, the performance is not necessarily optimal.
Expand Down Expand Up @@ -457,8 +457,8 @@ public static void marshal( Object jaxbObject, Result xml ) {
* <p>
* This method is a convenience method that combines several basic operations
* in the {@link JAXBContext} and {@link Marshaller}. This method is designed
* to be the prefered method for developers new to Jakarta XML Binding. This method
* has the following characterstics:
* to be the preferred method for developers new to Jakarta XML Binding. This method
* has the following characteristics:
*
* <ol>
* <li>Generally speaking, the performance is not necessarily optimal.
Expand Down
Loading

0 comments on commit b2c0e7a

Please sign in to comment.