Skip to content

Commit b2c0e7a

Browse files
committed
typos, grammar,
javadoc formatting, minor code cleanup Signed-off-by: Lukas Jungmann <[email protected]>
1 parent 62206ad commit b2c0e7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+236
-249
lines changed

api/src/main/java/jakarta/xml/bind/Binder.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ protected Binder() {}
237237
public abstract Object getJAXBNode( XmlNode xmlNode );
238238

239239
/**
240-
* Takes an Jakarta XML Binding object and updates
240+
* Takes a Jakarta XML Binding object and updates
241241
* its associated XML node and its descendants.
242242
*
243243
* <p>
@@ -272,7 +272,7 @@ protected Binder() {}
272272
* would create a new tree that doesn't contain any of those.)
273273
*
274274
* <p>
275-
* As a side-effect, this operation updates the association between
275+
* As a side effect, this operation updates the association between
276276
* XML nodes and Jakarta XML Binding objects.
277277
*
278278
* @param jaxbObject root of potentially modified Jakarta XML Binding object tree
@@ -301,7 +301,7 @@ protected Binder() {}
301301
* as possible.
302302
*
303303
* <p>
304-
* As a side-effect, this operation updates the association between
304+
* As a side effect, this operation updates the association between
305305
* XML nodes and Jakarta XML Binding objects.
306306
*
307307
* @param xmlNode the XML node
@@ -350,7 +350,7 @@ protected Binder() {}
350350
*
351351
* <p>
352352
* Calling this method with a null parameter will cause the Binder
353-
* to revert back to the default default event handler.
353+
* to revert back to the default event handler.
354354
*
355355
* @param handler the validation event handler
356356
* @throws JAXBException if an error was encountered while setting the

api/src/main/java/jakarta/xml/bind/ContextFinder.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2023 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2024 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -28,7 +28,7 @@
2828
/**
2929
* This class is package private and therefore is not exposed as part of the
3030
* Jakarta XML Binding API.
31-
*
31+
* <p>
3232
* This code is designed to implement the XML Binding spec pluggability feature
3333
*
3434
* @author <ul><li>Ryan Shoemaker, Sun Microsystems, Inc.</li></ul>
@@ -77,7 +77,7 @@ class ContextFinder {
7777
}
7878

7979
private static ServiceLoaderUtil.ExceptionHandler<JAXBException> EXCEPTION_HANDLER =
80-
new ServiceLoaderUtil.ExceptionHandler<JAXBException>() {
80+
new ServiceLoaderUtil.ExceptionHandler<>() {
8181
@Override
8282
public JAXBException createException(Throwable throwable, String message) {
8383
return new JAXBException(message, throwable);
@@ -86,7 +86,7 @@ public JAXBException createException(Throwable throwable, String message) {
8686

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

108108
/**
109109
* Determine if two types (JAXBContext in this case) will generate a ClassCastException.
110-
*
110+
* <p>
111111
* For example, (targetType)originalType
112112
*
113113
* @param originalType
@@ -217,7 +217,7 @@ static JAXBContext newInstance(String contextPath,
217217
private static Object instantiateProviderIfNecessary(final Class<?> implClass) throws JAXBException {
218218
try {
219219
if (JAXBContextFactory.class.isAssignableFrom(implClass)) {
220-
return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
220+
return AccessController.doPrivileged(new PrivilegedExceptionAction<>() {
221221
@Override
222222
public Object run() throws Exception {
223223
return implClass.getConstructor().newInstance();
@@ -330,7 +330,7 @@ static JAXBContext find(String factoryId,
330330
try {
331331
return newInstance(contextPath, contextPathClasses, ctxFactory, classLoader, properties);
332332
} catch (Throwable t) {
333-
logger.log(Level.FINE, t, () -> "Error instantiating provivder " + ctxFactory);
333+
logger.log(Level.FINE, t, () -> "Error instantiating provider " + ctxFactory);
334334
}
335335
}
336336
}
@@ -432,9 +432,9 @@ static URL which(Class<?> clazz, ClassLoader loader) {
432432

433433
/**
434434
* Get the URL for the Class from it's ClassLoader.
435-
*
435+
* <p>
436436
* Convenience method for {@link #which(Class, ClassLoader)}.
437-
*
437+
* <p>
438438
* Equivalent to calling: which(clazz, clazz.getClassLoader())
439439
*
440440
* @param clazz
@@ -451,7 +451,7 @@ private static ClassLoader getContextClassLoader() {
451451
return Thread.currentThread().getContextClassLoader();
452452
} else {
453453
return AccessController.doPrivileged(
454-
new PrivilegedAction<ClassLoader>() {
454+
new PrivilegedAction<>() {
455455
@Override
456456
public ClassLoader run() {
457457
return Thread.currentThread().getContextClassLoader();
@@ -465,7 +465,7 @@ private static ClassLoader getClassClassLoader(final Class<?> c) {
465465
return c.getClassLoader();
466466
} else {
467467
return AccessController.doPrivileged(
468-
new PrivilegedAction<ClassLoader>() {
468+
new PrivilegedAction<>() {
469469
@Override
470470
public ClassLoader run() {
471471
return c.getClassLoader();
@@ -479,7 +479,7 @@ private static ClassLoader getSystemClassLoader() {
479479
return ClassLoader.getSystemClassLoader();
480480
} else {
481481
return AccessController.doPrivileged(
482-
new PrivilegedAction<ClassLoader>() {
482+
new PrivilegedAction<>() {
483483
@Override
484484
public ClassLoader run() {
485485
return ClassLoader.getSystemClassLoader();

api/src/main/java/jakarta/xml/bind/DatatypeConverter.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* The javaType binding declaration can be used to customize the binding of
1818
* an XML schema datatype to a Java datatype. Customizations can involve
1919
* writing a parse and print method for parsing and printing lexical
20-
* representations of a XML schema datatype respectively. However, writing
20+
* representations of an XML schema datatype respectively. However, writing
2121
* parse and print methods requires knowledge of the lexical representations (
2222
* <a href="http://www.w3.org/TR/xmlschema-2/"> XML Schema Part2: Datatypes
2323
* specification </a>) and hence may be difficult to write.
@@ -61,7 +61,7 @@
6161
* </p>
6262
*
6363
* <p>
64-
* A print method for a XML schema datatype can output any lexical
64+
* A print method for an XML schema datatype can output any lexical
6565
* representation that is valid with respect to the XML schema datatype.
6666
* If an error is encountered during conversion, then an IllegalArgumentException,
6767
* or a subclass of IllegalArgumentException must be thrown by the method.
@@ -158,7 +158,7 @@ public static java.math.BigInteger parseInteger( String lexicalXSDInteger ) {
158158
* A string containing a lexical representation of
159159
* xsd:int.
160160
* @return
161-
* A int value represented by the string argument.
161+
* An int value represented by the string argument.
162162
* @throws NumberFormatException <code>lexicalXSDInt</code> is not a valid string representation of an <code>int</code> value.
163163
*/
164164
public static int parseInt( String lexicalXSDInt ) {

api/src/main/java/jakarta/xml/bind/DatatypeConverterImpl.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007, 2023 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2007, 2024 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -77,7 +77,7 @@ public int parseInt(String s) {
7777

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

198-
if (s.length() == 0
198+
if (s.isEmpty()
199199
|| !isDigitOrPeriodOrSign(s.charAt(0))
200200
|| !isDigitOrPeriodOrSign(s.charAt(s.length() - 1))) {
201201
throw new NumberFormatException();
@@ -241,7 +241,7 @@ public static double _parseDouble(CharSequence _val) {
241241
return Double.NEGATIVE_INFINITY;
242242
}
243243

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

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

526526
@Override
@@ -592,7 +592,7 @@ public static String _printQName(QName val, NamespaceContext nsc) {
592592
String prefix = nsc.getPrefix(val.getNamespaceURI());
593593
String localPart = val.getLocalPart();
594594

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

800800
/**
801801
* Encodes a byte array into a char array by doing base64 encoding.
802-
*
802+
* <p>
803803
* The caller must supply a big enough buffer.
804804
*
805805
* @return
@@ -841,7 +841,7 @@ public static int _printBase64Binary(byte[] input, int offset, int len, char[] b
841841
/**
842842
* Encodes a byte array into another byte array by first doing base64 encoding
843843
* then encoding the result in ASCII.
844-
*
844+
* <p>
845845
* The caller must supply a big enough buffer.
846846
*
847847
* @return
@@ -1050,7 +1050,7 @@ private static void formatTimeZone(Calendar cal, StringBuilder buf) {
10501050
offset *= -1;
10511051
}
10521052

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

10551055
formatTwoDigits(offset / 60, buf);
10561056
buf.append(':');

api/src/main/java/jakarta/xml/bind/DatatypeConverterInterface.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2024 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -35,15 +35,15 @@
3535
* class.
3636
*
3737
* <p>
38-
* A parse method for a XML schema datatype must be capable of converting any
38+
* A parse method for an XML schema datatype must be capable of converting any
3939
* lexical representation of the XML schema datatype ( specified by the
4040
* <a href="http://www.w3.org/TR/xmlschema-2/"> XML Schema Part2: Datatypes
4141
* specification</a> into a value in the value space of the XML schema datatype.
4242
* If an error is encountered during conversion, then an IllegalArgumentException
4343
* or a subclass of IllegalArgumentException must be thrown by the method.
4444
*
4545
* <p>
46-
* A print method for a XML schema datatype can output any lexical
46+
* A print method for an XML schema datatype can output any lexical
4747
* representation that is valid with respect to the XML schema datatype.
4848
* If an error is encountered during conversion, then an IllegalArgumentException,
4949
* or a subclass of IllegalArgumentException must be thrown by the method.

api/src/main/java/jakarta/xml/bind/Element.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2024 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -12,7 +12,7 @@
1212

1313
/**
1414
* This is an element marker interface.
15-
*
15+
* <p>
1616
* Under certain circumstances, it is necessary for the binding compiler to
1717
* generate derived java content classes that implement this interface. In
1818
* those cases, client applications must supply element instances rather than

api/src/main/java/jakarta/xml/bind/JAXB.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006, 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2006, 2024 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -37,8 +37,8 @@
3737
* in the {@link JAXBContext}, {@link Unmarshaller}, and {@link Marshaller}.
3838
*
3939
* They are designed
40-
* to be the prefered methods for developers new to Jakarta XML Binding. They have
41-
* the following characterstics:
40+
* to be the preferred methods for developers new to Jakarta XML Binding. They have
41+
* the following characteristics:
4242
*
4343
* <ol>
4444
* <li>Generally speaking, the performance is not necessarily optimal.
@@ -457,8 +457,8 @@ public static void marshal( Object jaxbObject, Result xml ) {
457457
* <p>
458458
* This method is a convenience method that combines several basic operations
459459
* in the {@link JAXBContext} and {@link Marshaller}. This method is designed
460-
* to be the prefered method for developers new to Jakarta XML Binding. This method
461-
* has the following characterstics:
460+
* to be the preferred method for developers new to Jakarta XML Binding. This method
461+
* has the following characteristics:
462462
*
463463
* <ol>
464464
* <li>Generally speaking, the performance is not necessarily optimal.

0 commit comments

Comments
 (0)