From 0e17c1e93c5a5e5adf930d945a3235cc09361d7c Mon Sep 17 00:00:00 2001 From: XenoAmess Date: Sat, 13 Jun 2020 23:11:17 +0800 Subject: [PATCH] fix_typos (#539) --- .../org/apache/commons/lang3/ClassLoaderUtils.java | 4 ++-- src/main/java/org/apache/commons/lang3/Locks.java | 4 ++-- .../apache/commons/lang3/reflect/MemberUtils.java | 4 ++-- .../org/apache/commons/lang3/time/DateUtils.java | 4 ++-- .../java/org/apache/commons/lang3/EnumUtilsTest.java | 12 ++++++------ .../apache/commons/lang3/event/EventUtilsTest.java | 8 ++++---- .../lang3/text/ExtendedMessageFormatTest.java | 6 +++--- .../commons/lang3/time/FastDateParserTest.java | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/ClassLoaderUtils.java b/src/main/java/org/apache/commons/lang3/ClassLoaderUtils.java index 95cdd2aab..a87156a08 100644 --- a/src/main/java/org/apache/commons/lang3/ClassLoaderUtils.java +++ b/src/main/java/org/apache/commons/lang3/ClassLoaderUtils.java @@ -31,7 +31,7 @@ public class ClassLoaderUtils { * Converts the given class loader to a String calling {@link #toString(URLClassLoader)}. * * @param classLoader to URLClassLoader to convert. - * @return the formated string. + * @return the formatted string. */ public static String toString(final ClassLoader classLoader) { if (classLoader instanceof URLClassLoader) { @@ -45,7 +45,7 @@ public static String toString(final ClassLoader classLoader) { * {@code "URLClassLoader.toString() + [URL1, URL2, ...]"}. * * @param classLoader to URLClassLoader to convert. - * @return the formated string. + * @return the formatted string. */ public static String toString(final URLClassLoader classLoader) { return classLoader + Arrays.toString(classLoader.getURLs()); diff --git a/src/main/java/org/apache/commons/lang3/Locks.java b/src/main/java/org/apache/commons/lang3/Locks.java index 6bb800b5c..b8fcc45b4 100644 --- a/src/main/java/org/apache/commons/lang3/Locks.java +++ b/src/main/java/org/apache/commons/lang3/Locks.java @@ -37,7 +37,7 @@ * references to the locked object. Instead, use references to the lock. *
  • If you want to access the locked object, create a {@link FailableConsumer}. The consumer * will receive the locked object as a parameter. For convenience, the consumer may be - * implemented as a Lamba. Then invoke {@link Locks.Lock#runReadLocked(FailableConsumer)}, + * implemented as a Lambda. Then invoke {@link Locks.Lock#runReadLocked(FailableConsumer)}, * or {@link Locks.Lock#runWriteLocked(FailableConsumer)}, passing the consumer.
  • *
  • As an alternative, if you need to produce a result object, you may use a * {@link FailableFunction}. This function may also be implemented as a Lambda. To @@ -51,7 +51,7 @@ * private final Lock<PrintStream> lock; * * public SimpleLogger(OutputStream out) { - * PrintStream ps = new Printstream(out); + * PrintStream ps = new PrintStream(out); * lock = Locks.lock(ps); * } * diff --git a/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java index 73fa2f1c0..83b9ca5a0 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java @@ -162,14 +162,14 @@ private static float getTotalTransformationCost(final Class[] srcArgs, final // When isVarArgs is true, srcArgs and dstArgs may differ in length. // There are two special cases to consider: final boolean noVarArgsPassed = srcArgs.length < destArgs.length; - final boolean explicitArrayForVarags = srcArgs.length == destArgs.length && srcArgs[srcArgs.length-1] != null && srcArgs[srcArgs.length-1].isArray(); + final boolean explicitArrayForVarargs = srcArgs.length == destArgs.length && srcArgs[srcArgs.length-1] != null && srcArgs[srcArgs.length-1].isArray(); final float varArgsCost = 0.001f; final Class destClass = destArgs[destArgs.length-1].getComponentType(); if (noVarArgsPassed) { // When no varargs passed, the best match is the most generic matching type, not the most specific. totalCost += getObjectTransformationCost(destClass, Object.class) + varArgsCost; - } else if (explicitArrayForVarags) { + } else if (explicitArrayForVarargs) { final Class sourceClass = srcArgs[srcArgs.length-1].getComponentType(); totalCost += getObjectTransformationCost(sourceClass, destClass) + varArgsCost; } else { diff --git a/src/main/java/org/apache/commons/lang3/time/DateUtils.java b/src/main/java/org/apache/commons/lang3/time/DateUtils.java index 300b7ea94..078c21e6a 100644 --- a/src/main/java/org/apache/commons/lang3/time/DateUtils.java +++ b/src/main/java/org/apache/commons/lang3/time/DateUtils.java @@ -352,7 +352,7 @@ public static Date parseDateStrictly(final String str, final Locale locale, fina * If no parse patterns match, a ParseException is thrown.

    * * @param str the date to parse, not null - * @param locale the locale to use when interpretting the pattern, can be null in which + * @param locale the locale to use when interpreting the pattern, can be null in which * case the default system locale is used * @param parsePatterns the date format patterns to use, see SimpleDateFormat, not null * @param lenient Specify whether or not date/time parsing is to be lenient. @@ -1055,7 +1055,7 @@ private static void modify(final Calendar val, final int field, final ModifyType if (aField[0] == Calendar.DATE) { //If we're going to drop the DATE field's value, // we want to do this our own way. - //We need to subtrace 1 since the date has a minimum of 1 + //We need to subtract 1 since the date has a minimum of 1 offset = val.get(Calendar.DATE) - 1; //If we're above 15 days adjustment, that means we're in the // bottom half of the month and should stay accordingly. diff --git a/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java b/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java index 1e79f4571..1f9d3a3d6 100644 --- a/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/EnumUtilsTest.java @@ -292,7 +292,7 @@ public void test_generateBitVector() { assertEquals(6L, EnumUtils.generateBitVector(Traffic.class, EnumSet.of(Traffic.AMBER, Traffic.GREEN))); assertEquals(7L, EnumUtils.generateBitVector(Traffic.class, EnumSet.of(Traffic.RED, Traffic.AMBER, Traffic.GREEN))); - // 64 values Enum (to test whether no int<->long jdk convertion issue exists) + // 64 values Enum (to test whether no int<->long jdk conversion issue exists) assertEquals((1L << 31), EnumUtils.generateBitVector(Enum64.class, EnumSet.of(Enum64.A31))); assertEquals((1L << 32), EnumUtils.generateBitVector(Enum64.class, EnumSet.of(Enum64.A32))); assertEquals((1L << 63), EnumUtils.generateBitVector(Enum64.class, EnumSet.of(Enum64.A63))); @@ -310,7 +310,7 @@ public void test_generateBitVectors() { assertArrayEquals(EnumUtils.generateBitVectors(Traffic.class, EnumSet.of(Traffic.AMBER, Traffic.GREEN)), 6L); assertArrayEquals(EnumUtils.generateBitVectors(Traffic.class, EnumSet.of(Traffic.RED, Traffic.AMBER, Traffic.GREEN)), 7L); - // 64 values Enum (to test whether no int<->long jdk convertion issue exists) + // 64 values Enum (to test whether no int<->long jdk conversion issue exists) assertArrayEquals(EnumUtils.generateBitVectors(Enum64.class, EnumSet.of(Enum64.A31)), (1L << 31)); assertArrayEquals(EnumUtils.generateBitVectors(Enum64.class, EnumSet.of(Enum64.A32)), (1L << 32)); assertArrayEquals(EnumUtils.generateBitVectors(Enum64.class, EnumSet.of(Enum64.A63)), (1L << 63)); @@ -334,7 +334,7 @@ public void test_generateBitVectorFromArray() { //gracefully handles duplicates: assertEquals(7L, EnumUtils.generateBitVector(Traffic.class, Traffic.RED, Traffic.AMBER, Traffic.GREEN, Traffic.GREEN)); - // 64 values Enum (to test whether no int<->long jdk convertion issue exists) + // 64 values Enum (to test whether no int<->long jdk conversion issue exists) assertEquals((1L << 31), EnumUtils.generateBitVector(Enum64.class, Enum64.A31)); assertEquals((1L << 32), EnumUtils.generateBitVector(Enum64.class, Enum64.A32)); assertEquals((1L << 63), EnumUtils.generateBitVector(Enum64.class, Enum64.A63)); @@ -354,7 +354,7 @@ public void test_generateBitVectorsFromArray() { //gracefully handles duplicates: assertArrayEquals(EnumUtils.generateBitVectors(Traffic.class, Traffic.RED, Traffic.AMBER, Traffic.GREEN, Traffic.GREEN), 7L); - // 64 values Enum (to test whether no int<->long jdk convertion issue exists) + // 64 values Enum (to test whether no int<->long jdk conversion issue exists) assertArrayEquals(EnumUtils.generateBitVectors(Enum64.class, Enum64.A31), (1L << 31)); assertArrayEquals(EnumUtils.generateBitVectors(Enum64.class, Enum64.A32), (1L << 32)); assertArrayEquals(EnumUtils.generateBitVectors(Enum64.class, Enum64.A63), (1L << 63)); @@ -393,7 +393,7 @@ public void test_processBitVector() { assertEquals(EnumSet.of(Traffic.AMBER, Traffic.GREEN), EnumUtils.processBitVector(Traffic.class, 6L)); assertEquals(EnumSet.of(Traffic.RED, Traffic.AMBER, Traffic.GREEN), EnumUtils.processBitVector(Traffic.class, 7L)); - // 64 values Enum (to test whether no int<->long jdk convertion issue exists) + // 64 values Enum (to test whether no int<->long jdk conversion issue exists) assertEquals(EnumSet.of(Enum64.A31), EnumUtils.processBitVector(Enum64.class, (1L << 31))); assertEquals(EnumSet.of(Enum64.A32), EnumUtils.processBitVector(Enum64.class, (1L << 32))); assertEquals(EnumSet.of(Enum64.A63), EnumUtils.processBitVector(Enum64.class, (1L << 63))); @@ -430,7 +430,7 @@ public void test_processBitVectors() { assertEquals(EnumSet.of(Traffic.AMBER, Traffic.GREEN), EnumUtils.processBitVectors(Traffic.class, 666L, 6L)); assertEquals(EnumSet.of(Traffic.RED, Traffic.AMBER, Traffic.GREEN), EnumUtils.processBitVectors(Traffic.class, 666L, 7L)); - // 64 values Enum (to test whether no int<->long jdk convertion issue exists) + // 64 values Enum (to test whether no int<->long jdk conversion issue exists) assertEquals(EnumSet.of(Enum64.A31), EnumUtils.processBitVectors(Enum64.class, (1L << 31))); assertEquals(EnumSet.of(Enum64.A32), EnumUtils.processBitVectors(Enum64.class, (1L << 32))); assertEquals(EnumSet.of(Enum64.A63), EnumUtils.processBitVectors(Enum64.class, (1L << 63))); diff --git a/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java b/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java index 1736e1380..6352301ad 100644 --- a/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/event/EventUtilsTest.java @@ -55,7 +55,7 @@ public void testConstructor() { @Test public void testAddEventListener() { final PropertyChangeSource src = new PropertyChangeSource(); - final EventCountingInvociationHandler handler = new EventCountingInvociationHandler(); + final EventCountingInvocationHandler handler = new EventCountingInvocationHandler(); final PropertyChangeListener listener = handler.createListener(PropertyChangeListener.class); assertEquals(0, handler.getEventCount("propertyChange")); EventUtils.addEventListener(src, PropertyChangeListener.class, listener); @@ -67,7 +67,7 @@ public void testAddEventListener() { @Test public void testAddEventListenerWithNoAddMethod() { final PropertyChangeSource src = new PropertyChangeSource(); - final EventCountingInvociationHandler handler = new EventCountingInvociationHandler(); + final EventCountingInvocationHandler handler = new EventCountingInvocationHandler(); final ObjectChangeListener listener = handler.createListener(ObjectChangeListener.class); final IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> EventUtils.addEventListener(src, ObjectChangeListener.class, listener)); @@ -88,7 +88,7 @@ public void testAddEventListenerThrowsException() { @Test public void testAddEventListenerWithPrivateAddMethod() { final PropertyChangeSource src = new PropertyChangeSource(); - final EventCountingInvociationHandler handler = new EventCountingInvociationHandler(); + final EventCountingInvocationHandler handler = new EventCountingInvocationHandler(); final VetoableChangeListener listener = handler.createListener(VetoableChangeListener.class); final IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> EventUtils.addEventListener(src, VetoableChangeListener.class, listener)); @@ -161,7 +161,7 @@ public int getCount() { } - private static class EventCountingInvociationHandler implements InvocationHandler { + private static class EventCountingInvocationHandler implements InvocationHandler { private final Map eventCounts = new TreeMap<>(); public L createListener(final Class listenerType) { diff --git a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java index cf8994597..4a3ad3199 100644 --- a/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java +++ b/src/test/java/org/apache/commons/lang3/text/ExtendedMessageFormatTest.java @@ -291,7 +291,7 @@ public void testBuiltInNumberFormat() { @Test public void testEqualsHashcode() { final Map fmtRegistry = Collections.singletonMap("testfmt", new LowerCaseFormatFactory()); - final Map otherRegitry = Collections.singletonMap("testfmt", new UpperCaseFormatFactory()); + final Map otherRegistry = Collections.singletonMap("testfmt", new UpperCaseFormatFactory()); final String pattern = "Pattern: {0,testfmt}"; final ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, Locale.US, fmtRegistry); @@ -318,7 +318,7 @@ public void testEqualsHashcode() { assertNotEquals(emf.hashCode(), other.hashCode(), "pattern, hashcode()"); // Different registry - other = new ExtendedMessageFormat(pattern, Locale.US, otherRegitry); + other = new ExtendedMessageFormat(pattern, Locale.US, otherRegistry); assertNotEquals(emf, other, "registry, equals()"); assertNotEquals(emf.hashCode(), other.hashCode(), "registry, hashcode()"); @@ -354,7 +354,7 @@ private void checkBuiltInFormat(final String pattern, final Map fmtRe /** * Create an ExtendedMessageFormat for the specified pattern and locale and check the - * formated output matches the expected result for the parameters. + * formatted output matches the expected result for the parameters. * @param pattern string * @param registryUnused map (currently unused) * @param args Object[] diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java index f7e2bd4cd..529d66233 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java @@ -1,7 +1,7 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with - * this work for additional inparserion regarding copyright ownership. + * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at