You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2018/08/13 01:52:33 UTC
svn commit: r1837911 - in /pivot/trunk: core/src/org/apache/pivot/beans/
core/src/org/apache/pivot/collections/ core/src/org/apache/pivot/text/
core/src/org/apache/pivot/util/ core/test/org/apache/pivot/json/test/
core/test/org/apache/pivot/serializati...
Author: rwhitcomb
Date: Mon Aug 13 01:52:33 2018
New Revision: 1837911
URL: http://svn.apache.org/viewvc?rev=1837911&view=rev
Log:
PIVOT-1032: Fix the remaining "Whitespace" errors in all the source.
Plus fix some other style errors in several of the smaller files in
this set.
Modified:
pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java
pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java
pivot/trunk/core/src/org/apache/pivot/text/CharSpan.java
pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java
pivot/trunk/core/src/org/apache/pivot/util/ImageUtils.java
pivot/trunk/core/src/org/apache/pivot/util/Resources.java
pivot/trunk/core/src/org/apache/pivot/util/Utils.java
pivot/trunk/core/src/org/apache/pivot/util/Version.java
pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java
pivot/trunk/core/test/org/apache/pivot/serialization/test/BinarySerializerTest.java
pivot/trunk/demos/src/org/apache/pivot/demos/rest/RESTDemoTest.java
pivot/trunk/eclipse/src/org/apache/pivot/eclipse/PivotApplicationLaunchShortcut.java
pivot/trunk/eclipse/src/org/apache/pivot/eclipse/PivotScriptApplicationLaunchShortcut.java
Modified: pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java?rev=1837911&r1=1837910&r2=1837911&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java Mon Aug 13 01:52:33 2018
@@ -193,7 +193,7 @@ public class BXMLSerializer implements S
if (bindings.containsKey(methodName)) {
result = invokeMethod(methodName, args);
} else if (bindings.containsKey(NASHORN_GLOBAL)) {
- Bindings globalBindings = (Bindings)bindings.get(NASHORN_GLOBAL);
+ Bindings globalBindings = (Bindings) bindings.get(NASHORN_GLOBAL);
if (globalBindings.containsKey(methodName)) {
result = invokeMethod(methodName, args);
} else {
@@ -258,7 +258,7 @@ public class BXMLSerializer implements S
if (bindings.containsKey(functionName)) {
result = invokeFunction(functionName, result);
} else if (bindings.containsKey(NASHORN_GLOBAL)) {
- Bindings globalBindings = (Bindings)bindings.get(NASHORN_GLOBAL);
+ Bindings globalBindings = (Bindings) bindings.get(NASHORN_GLOBAL);
if (globalBindings.containsKey(functionName)) {
result = invokeFunction(functionName, result);
} else {
@@ -1164,7 +1164,7 @@ public class BXMLSerializer implements S
+ "\" is not defined.");
} else {
if (nashornGlobal instanceof Bindings) {
- Bindings bindings = (Bindings)nashornGlobal;
+ Bindings bindings = (Bindings) nashornGlobal;
if (bindings.containsKey(value)) {
attribute.value = bindings.get(value);
} else {
Modified: pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java?rev=1837911&r1=1837910&r2=1837911&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/Dictionary.java Mon Aug 13 01:52:33 2018
@@ -24,10 +24,14 @@ import org.apache.pivot.util.Utils;
/**
* Interface representing a set of key/value pairs.
+ * @param <K> Type for the keys in this dictionary.
+ * @param <V> Type for each of the values in the dictionary.
*/
public interface Dictionary<K, V> {
/**
* Class representing a key/value pair.
+ * @param <K> Type of the key part of the pair.
+ * @param <V> Type of the value in the pair.
*/
public static final class Pair<K, V> implements Serializable {
private static final long serialVersionUID = 5010958035775950649L;
@@ -35,7 +39,7 @@ public interface Dictionary<K, V> {
public final K key;
public final V value;
- public Pair(K key, V value) {
+ public Pair(final K key, final V value) {
Utils.checkNull(key, "key");
this.key = key;
@@ -44,12 +48,13 @@ public interface Dictionary<K, V> {
@Override
@SuppressWarnings("unchecked")
- public boolean equals(Object object) {
+ public boolean equals(final Object object) {
boolean equals = false;
if (object instanceof Pair<?, ?>) {
Pair<K, V> pair = (Pair<K, V>) object;
- equals = (key.equals(pair.key) && ((value == null && pair.value == null) || (value != null && value.equals(pair.value))));
+ equals = (key.equals(pair.key) && ((value == null && pair.value == null)
+ || (value != null && value.equals(pair.value))));
}
return equals;
@@ -148,7 +153,7 @@ public interface Dictionary<K, V> {
* @return The string value, or <tt>null</tt> if the key is not present.
*/
default String getString(K key) {
- return (String)get(key);
+ return (String) get(key);
}
/**
@@ -161,7 +166,7 @@ public interface Dictionary<K, V> {
*/
default String getString(K key, String defaultValue) {
if (containsKey(key)) {
- return (String)get(key);
+ return (String) get(key);
}
return defaultValue;
}
@@ -189,7 +194,7 @@ public interface Dictionary<K, V> {
*/
default int getInt(K key, int defaultValue) {
if (containsKey(key)) {
- return ((Number)get(key)).intValue();
+ return ((Number) get(key)).intValue();
}
return defaultValue;
}
@@ -217,7 +222,7 @@ public interface Dictionary<K, V> {
*/
default boolean getBoolean(K key, boolean defaultValue) {
if (containsKey(key)) {
- return ((Boolean)get(key)).booleanValue();
+ return ((Boolean) get(key)).booleanValue();
}
return defaultValue;
}
@@ -231,7 +236,7 @@ public interface Dictionary<K, V> {
* @return The color value, or <tt>null</tt> if the key is not present.
*/
default Color getColor(K key) {
- return (Color)get(key);
+ return (Color) get(key);
}
/**
@@ -243,7 +248,7 @@ public interface Dictionary<K, V> {
* @return The font value, or <tt>null</tt> if the key is not present.
*/
default Font getFont(K key) {
- return (Font)get(key);
+ return (Font) get(key);
}
/**
Modified: pivot/trunk/core/src/org/apache/pivot/text/CharSpan.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/text/CharSpan.java?rev=1837911&r1=1837910&r2=1837911&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/text/CharSpan.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/text/CharSpan.java Mon Aug 13 01:52:33 2018
@@ -42,7 +42,7 @@ public final class CharSpan {
*
* @param start The start of this char span.
*/
- public CharSpan(int start) {
+ public CharSpan(final int start) {
Utils.checkNonNegative(start, "start");
this.start = start;
this.length = 0;
@@ -53,7 +53,7 @@ public final class CharSpan {
* @param start The start of this char span.
* @param length The length of this char span.
*/
- public CharSpan(int start, int length) {
+ public CharSpan(final int start, final int length) {
Utils.checkNonNegative(start, "start");
Utils.checkNonNegative(length, "length");
this.start = start;
@@ -66,7 +66,7 @@ public final class CharSpan {
* @param charSpan An existing char span (which must not be {@code null}).
* @throws IllegalArgumentException if the given char span is {@code null}.
*/
- public CharSpan(CharSpan charSpan) {
+ public CharSpan(final CharSpan charSpan) {
Utils.checkNull(charSpan, "charSpan");
this.start = charSpan.start;
@@ -81,7 +81,7 @@ public final class CharSpan {
* @throws IllegalArgumentException if the given char span is {@code null}
* or if the dictionary does not contain the start and length keys.
*/
- public CharSpan(Dictionary<String, ?> charSpan) {
+ public CharSpan(final Dictionary<String, ?> charSpan) {
Utils.checkNull(charSpan, "charSpan");
if (!charSpan.containsKey(START_KEY)) {
@@ -110,11 +110,11 @@ public final class CharSpan {
* @param charSpan A sequence containing the start and length values.
* @throws IllegalArgumentException if the given char span is {@code null}.
*/
- public CharSpan(Sequence<?> charSpan) {
+ public CharSpan(final Sequence<?> charSpan) {
Utils.checkNull(charSpan, "charSpan");
- int start = ((Number)charSpan.get(0)).intValue();
- int length = ((Number)charSpan.get(1)).intValue();
+ int start = ((Number) charSpan.get(0)).intValue();
+ int length = ((Number) charSpan.get(1)).intValue();
Utils.checkNonNegative(start, "start");
Utils.checkNonNegative(length, "length");
@@ -142,7 +142,7 @@ public final class CharSpan {
* @return A new {@link CharSpan} with the updated value.
* @throws IllegalArgumentException if the updated start value goes negative.
*/
- public CharSpan offset(int offset) {
+ public CharSpan offset(final int offset) {
return new CharSpan(this.start + offset, this.length);
}
@@ -155,12 +155,12 @@ public final class CharSpan {
* @return A new {@link CharSpan} with the updated value.
* @throws IllegalArgumentException if the updated length value goes negative.
*/
- public CharSpan lengthen(int offset) {
+ public CharSpan lengthen(final int offset) {
return new CharSpan(this.start, this.length + offset);
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
boolean equal = false;
if (o instanceof CharSpan) {
@@ -201,7 +201,7 @@ public final class CharSpan {
* a JSON map, or if it starts with <code>"["</code> but cannot be parsed
* as a JSON list.
*/
- public static CharSpan decode(String value) {
+ public static CharSpan decode(final String value) {
Utils.checkNullOrEmpty(value, "value");
CharSpan charSpan;
Modified: pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java?rev=1837911&r1=1837910&r2=1837911&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/CharUtils.java Mon Aug 13 01:52:33 2018
@@ -22,6 +22,11 @@ import org.apache.pivot.text.CharSpan;
* A set of static methods that perform various character-based operations.
*/
public class CharUtils {
+ /**
+ * Private constructor for a utility class.
+ */
+ private CharUtils() {
+ }
/**
* Return a {@link CharSpan} describing a "word" which contains the given
@@ -35,7 +40,7 @@ public class CharUtils {
* word around the given starting point, or {@code null} if a word selection
* cannot be made.
*/
- public static CharSpan selectWord(CharSequence sequence, int start) {
+ public static CharSpan selectWord(final CharSequence sequence, final int start) {
int length = sequence.length();
int adjustedStart = start;
char ch;
@@ -104,7 +109,7 @@ public class CharUtils {
* @param start The starting point to find the start of the word prior to.
* @return The index of the prior word start.
*/
- public static int findPriorWord(CharSequence sequence, int start) {
+ public static int findPriorWord(final CharSequence sequence, final int start) {
int wordStart = start;
// Skip over any space immediately to the left
@@ -134,7 +139,7 @@ public class CharUtils {
* @param start The starting point to find the start of the word after.
* @return The index of the next word start.
*/
- public static int findNextWord(CharSequence sequence, int start) {
+ public static int findNextWord(final CharSequence sequence, final int start) {
int wordStart = start;
int count = sequence.length();
Modified: pivot/trunk/core/src/org/apache/pivot/util/ImageUtils.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/ImageUtils.java?rev=1837911&r1=1837910&r2=1837911&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/ImageUtils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/ImageUtils.java Mon Aug 13 01:52:33 2018
@@ -22,6 +22,11 @@ import java.net.URL;
* Utility class for dealing with images.
*/
public class ImageUtils {
+ /**
+ * Private constructor for a utility class.
+ */
+ private ImageUtils() {
+ }
/**
* Find an image in the application's resources given the name.
@@ -34,7 +39,7 @@ public class ImageUtils {
* @throws IllegalArgumentException if the image resource cannot be found,
* or if the {@code imageName} is null or empty.
*/
- public static URL findByName(String imageName, String imageType) {
+ public static URL findByName(final String imageName, final String imageType) {
Utils.checkNullOrEmpty(imageName, "imageName");
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
Modified: pivot/trunk/core/src/org/apache/pivot/util/Resources.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Resources.java?rev=1837911&r1=1837910&r2=1837911&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/Resources.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/Resources.java Mon Aug 13 01:52:33 2018
@@ -41,28 +41,28 @@ public class Resources implements Dictio
public static final String DEFAULT_CHARSET_NAME = "UTF-8";
- public Resources(String baseName) throws IOException, SerializationException {
+ public Resources(final String baseName) throws IOException, SerializationException {
this(null, baseName, Locale.getDefault(), Charset.forName(DEFAULT_CHARSET_NAME));
}
- public Resources(Resources parent, String baseName) throws IOException, SerializationException {
+ public Resources(final Resources parent, final String baseName) throws IOException, SerializationException {
this(parent, baseName, Locale.getDefault(), Charset.forName(DEFAULT_CHARSET_NAME));
}
- public Resources(String baseName, Locale locale) throws IOException, SerializationException {
+ public Resources(final String baseName, final Locale locale) throws IOException, SerializationException {
this(null, baseName, locale, Charset.forName(DEFAULT_CHARSET_NAME));
}
- public Resources(Resources parent, String baseName, Locale locale) throws IOException,
+ public Resources(final Resources parent, final String baseName, final Locale locale) throws IOException,
SerializationException {
this(parent, baseName, locale, Charset.forName(DEFAULT_CHARSET_NAME));
}
- public Resources(String baseName, Charset charset) throws IOException, SerializationException {
+ public Resources(final String baseName, final Charset charset) throws IOException, SerializationException {
this(null, baseName, Locale.getDefault(), charset);
}
- public Resources(Resources parent, String baseName, Charset charset) throws IOException,
+ public Resources(final Resources parent, final String baseName, final Charset charset) throws IOException,
SerializationException {
this(parent, baseName, Locale.getDefault(), charset);
}
@@ -83,7 +83,7 @@ public class Resources implements Dictio
* @throws MissingResourceException If no resource for the specified base
* name can be found.
*/
- public Resources(Resources parent, String baseName, Locale locale, Charset charset)
+ public Resources(final Resources parent, final String baseName, final Locale locale, final Charset charset)
throws IOException, SerializationException {
Utils.checkNull(baseName, "Base name");
Utils.checkNull(locale, "Locale");
@@ -150,35 +150,35 @@ public class Resources implements Dictio
* pair doesn't exist. If the resource object is not a {@link String}
* then the {@link Object#toString} method will be called to return the value.
*/
- public String getString(String key) {
+ public String getString(final String key) {
Object value = get(key);
if (value == null) {
return null;
} else if (value instanceof String) {
- return (String)value;
+ return (String) value;
} else {
return value.toString();
}
}
@Override
- public Object get(String key) {
+ public Object get(final String key) {
return (this.resourceMap.containsKey(key)) ? this.resourceMap.get(key)
: (this.parent == null) ? null : this.parent.get(key);
}
@Override
- public Object put(String key, Object value) {
+ public Object put(final String key, final Object value) {
throw new UnsupportedOperationException("Resources are immutable.");
}
@Override
- public Object remove(String key) {
+ public Object remove(final String key) {
throw new UnsupportedOperationException("Resources are immutable.");
}
@Override
- public boolean containsKey(String key) {
+ public boolean containsKey(final String key) {
return this.resourceMap.containsKey(key)
|| (this.parent != null && this.parent.containsKey(key));
}
@@ -189,7 +189,7 @@ public class Resources implements Dictio
}
@SuppressWarnings("unchecked")
- private void applyOverrides(Map<String, Object> sourceMap, Map<String, Object> overridesMap) {
+ private void applyOverrides(final Map<String, Object> sourceMap, final Map<String, Object> overridesMap) {
for (String key : overridesMap) {
if (sourceMap.containsKey(key)) {
Object source = sourceMap.get(key);
@@ -205,7 +205,7 @@ public class Resources implements Dictio
}
@SuppressWarnings("unchecked")
- private Map<String, Object> readJSONResource(String name) throws IOException,
+ private Map<String, Object> readJSONResource(final String name) throws IOException,
SerializationException {
Map<String, Object> resourceMapFromResource = null;
Modified: pivot/trunk/core/src/org/apache/pivot/util/Utils.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Utils.java?rev=1837911&r1=1837910&r2=1837911&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/Utils.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/Utils.java Mon Aug 13 01:52:33 2018
@@ -21,6 +21,12 @@ package org.apache.pivot.util;
*/
public class Utils {
/**
+ * Non-public constructor for a utility class.
+ */
+ private Utils() {
+ }
+
+ /**
* Decide if two strings are the same content (not just the same reference).
* <p> Works properly for either string being <tt>null</tt>.
* @param s1 First string to compare (can be {@code null}).
@@ -28,7 +34,7 @@ public class Utils {
* @return <tt>true</tt> if both strings are <tt>null</tt> or if
* <code>s1.equals(s2)</code>.
*/
- public static boolean stringsAreEqual(String s1, String s2) {
+ public static boolean stringsAreEqual(final String s1, final String s2) {
if (s1 == null && s2 == null) {
return true;
}
@@ -50,7 +56,7 @@ public class Utils {
* {@link IllegalArgumentException} is thrown without any detail message.
* @throws IllegalArgumentException if the value is {@code null}.
*/
- public static void checkNull(Object value, String description) {
+ public static void checkNull(final Object value, final String description) {
if (value == null) {
if (isNullOrEmpty(description)) {
throw new IllegalArgumentException();
@@ -67,7 +73,7 @@ public class Utils {
* @param value The argument value to check for {@code null}.
* @throws IllegalArgumentException if the value is {@code null}.
*/
- public static void checkNull(Object value) {
+ public static void checkNull(final Object value) {
checkNull(value, null);
}
@@ -78,7 +84,7 @@ public class Utils {
* @return {@code true} if the input is {@code null} or empty, {@code false}
* otherwise.
*/
- public static boolean isNullOrEmpty(String value) {
+ public static boolean isNullOrEmpty(final String value) {
if (value == null) {
return true;
}
@@ -94,11 +100,11 @@ public class Utils {
* {@code false} otherwise (which would include a non-null object other
* than a string).
*/
- public static boolean isNullOrEmpty(Object value) {
+ public static boolean isNullOrEmpty(final Object value) {
if (value == null) {
return true;
}
- return (value instanceof String) && ((String)value).trim().isEmpty();
+ return (value instanceof String) && ((String) value).trim().isEmpty();
}
/**
@@ -113,8 +119,8 @@ public class Utils {
* {@link IllegalArgumentException} is thrown without any detail message.
* @throws IllegalArgumentException if the value is {@code null}.
*/
- public static void checkNullOrEmpty(Object value, String argument) {
- if (value == null || (value instanceof String && isNullOrEmpty((String)value))) {
+ public static void checkNullOrEmpty(final Object value, final String argument) {
+ if (value == null || (value instanceof String && isNullOrEmpty((String) value))) {
if (isNullOrEmpty(argument)) {
throw new IllegalArgumentException();
} else {
@@ -135,7 +141,7 @@ public class Utils {
* {@link IllegalArgumentException} is thrown without any detail message.
* @throws IllegalArgumentException if the value is negative.
*/
- public static void checkNonNegative(int value, String argument) {
+ public static void checkNonNegative(final int value, final String argument) {
if (value < 0) {
if (isNullOrEmpty(argument)) {
throw new IllegalArgumentException();
@@ -157,7 +163,7 @@ public class Utils {
* {@link IllegalArgumentException} is thrown without any detail message.
* @throws IllegalArgumentException if the value is negative.
*/
- public static void checkNonNegative(float value, String argument) {
+ public static void checkNonNegative(final float value, final String argument) {
if (value < 0.0f) {
if (isNullOrEmpty(argument)) {
throw new IllegalArgumentException();
@@ -179,7 +185,7 @@ public class Utils {
* {@link IllegalArgumentException} is thrown without any detail message.
* @throws IllegalArgumentException if the value is negative.
*/
- public static void checkPositive(int value, String argument) {
+ public static void checkPositive(final int value, final String argument) {
if (value <= 0) {
if (isNullOrEmpty(argument)) {
throw new IllegalArgumentException();
@@ -201,7 +207,7 @@ public class Utils {
* {@link IllegalArgumentException} is thrown without any detail message.
* @throws IllegalArgumentException if the value is negative.
*/
- public static void checkPositive(float value, String argument) {
+ public static void checkPositive(final float value, final String argument) {
if (value <= 0.0f) {
if (isNullOrEmpty(argument)) {
throw new IllegalArgumentException();
@@ -220,11 +226,11 @@ public class Utils {
* (used in the thrown exception).
* @throws IllegalArgumentException if the value is out of range.
*/
- public static void checkInRangeOfShort(int value, String argument) {
- if (value < 0 || value > 0x7FFF) {
+ public static void checkInRangeOfShort(final int value, final String argument) {
+ if (value < 0 || value > (int) Short.MAX_VALUE) {
String valueMsg = isNullOrEmpty(argument) ? "value" : argument;
throw new IllegalArgumentException(valueMsg + " must be less than or equal "
- + 0x7FFF + ".");
+ + Short.MAX_VALUE + ".");
}
}
@@ -238,7 +244,7 @@ public class Utils {
* @throws IllegalArgumentException if {@code end} is < {@code start}.
* @throws IndexOutOfBoundsException if {@code index} is < {@code start} or > {@code end}.
*/
- public static void checkIndexBounds(int index, int start, int end) {
+ public static void checkIndexBounds(final int index, final int start, final int end) {
if (end < start) {
throw new IllegalArgumentException("end (" + end + ") < " + "start (" + start + ")");
}
@@ -256,25 +262,27 @@ public class Utils {
* @param size The size of the array/list/etc. (so the proper range is {@code 0 .. size - 1}).
* @throws IndexOutOfBoundsException if the {@code index} is < 0 or >= {@code size}.
*/
- public static void checkZeroBasedIndex(int index, int size) {
+ public static void checkZeroBasedIndex(final int index, final int size) {
if (index < 0 || index >= size) {
throw new IndexOutOfBoundsException("Index " + index + " out of bounds [0," + (size - 1) + "].");
}
}
/**
- * Check that the given {@code index} plus {@code count} are between the values of {@code start} and {@code end}.
+ * Check that the given {@code index} plus {@code count} are between the values of
+ * {@code start} and {@code end}.
*
* @param index The candidate index into the range.
* @param count The number of elements in the indexed selection.
* @param start The start of the acceptable range (inclusive).
* @param end The end of the acceptable range (inclusive).
*
- * @throws IllegalArgumentException if {@code end} is < {@code start}, or if {@code count} or {@code start}
- * are < zero.
- * @throws IndexOutOfBoundsException if {@code index} is < {@code start} or {@code index + start} is > {@code end}.
+ * @throws IllegalArgumentException if {@code end} is < {@code start}, or if {@code count}
+ * or {@code start} are < zero.
+ * @throws IndexOutOfBoundsException if {@code index} is < {@code start} or {@code index + start}
+ * is > {@code end}.
*/
- public static void checkIndexBounds(int index, int count, int start, int end) {
+ public static void checkIndexBounds(final int index, final int count, final int start, final int end) {
if (end < start) {
throw new IllegalArgumentException("end (" + end + ") < " + "start (" + start + ")");
}
@@ -302,9 +310,10 @@ public class Utils {
* @param end The end of the acceptable range (inclusive).
*
* @throws IllegalArgumentException if {@code endIndex} is < {@code startIndex}.
- * @throws IndexOutOfBoundsException if {@code startIndex} is < {@code start} or {@code endIndex} is > {@code end}.
+ * @throws IndexOutOfBoundsException if {@code startIndex} is < {@code start} or
+ * {@code endIndex} is > {@code end}.
*/
- public static void checkTwoIndexBounds(int startIndex, int endIndex, int start, int end) {
+ public static void checkTwoIndexBounds(final int startIndex, final int endIndex, final int start, final int end) {
if (startIndex > endIndex) {
throw new IllegalArgumentException("endIndex (" + endIndex + ") < " + "startIndex (" + startIndex + ")");
}
Modified: pivot/trunk/core/src/org/apache/pivot/util/Version.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Version.java?rev=1837911&r1=1837910&r2=1837911&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/Version.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/Version.java Mon Aug 13 01:52:33 2018
@@ -32,19 +32,20 @@ public class Version implements Comparab
private long updateRevision = 0;
private String build = null;
- public Version(int majorRevision, int minorRevision, int maintenanceRevision, long updateRevision) {
+ public Version(final int majorRevision, final int minorRevision, final int maintenanceRevision,
+ final long updateRevision) {
this(majorRevision, minorRevision, maintenanceRevision, updateRevision, null);
}
- public Version(int majorRevision, int minorRevision, int maintenanceRevision,
- long updateRevision, String build) {
+ public Version(final int majorRevision, final int minorRevision, final int maintenanceRevision,
+ final long updateRevision, final String build) {
Utils.checkInRangeOfShort(majorRevision, "majorRevision");
Utils.checkInRangeOfShort(minorRevision, "minorRevision");
Utils.checkInRangeOfShort(maintenanceRevision, "maintenanceRevision");
- this.majorRevision = (short)majorRevision;
- this.minorRevision = (short)minorRevision;
- this.maintenanceRevision = (short)maintenanceRevision;
+ this.majorRevision = (short) majorRevision;
+ this.minorRevision = (short) minorRevision;
+ this.maintenanceRevision = (short) maintenanceRevision;
this.updateRevision = updateRevision;
this.build = build;
}
@@ -66,21 +67,21 @@ public class Version implements Comparab
}
public long getNumber() {
- long number = ((long)((majorRevision) & 0xffff) << (16 * 3)
- | (long)((minorRevision) & 0xffff) << (16 * 2)
- | (long)((maintenanceRevision) & 0xffff) << (16 * 1))
+ long number = ((long) ((majorRevision) & 0xffff) << (16 * 3)
+ | (long) ((minorRevision) & 0xffff) << (16 * 2)
+ | (long) ((maintenanceRevision) & 0xffff) << (16 * 1))
+ updateRevision;
return number;
}
@Override
- public int compareTo(Version version) {
+ public int compareTo(final Version version) {
return new Long(getNumber()).compareTo(version.getNumber());
}
@Override
- public boolean equals(Object object) {
+ public boolean equals(final Object object) {
return (object instanceof Version && compareTo((Version) object) == 0);
}
@@ -113,7 +114,7 @@ public class Version implements Comparab
this.maintenanceRevision);
}
- public static Version decode(String string) {
+ public static Version decode(final String string) {
Version version = null;
short majorRevision = 0;
Modified: pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java?rev=1837911&r1=1837910&r2=1837911&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java Mon Aug 13 01:52:33 2018
@@ -86,48 +86,48 @@ public class JSONSerializerTest {
jsonSerializer.setAllowMacros(true);
JSONSerializerListener jsonSerializerListener = new JSONSerializerListener() {
@Override
- public void beginDictionary(JSONSerializer jsonSerializerArgument,
- Dictionary<String, ?> value) {
+ public void beginDictionary(final JSONSerializer jsonSerializerArgument,
+ final Dictionary<String, ?> value) {
System.out.println("Begin dictionary: " + value);
}
@Override
- public void endDictionary(JSONSerializer jsonSerializerArgument) {
+ public void endDictionary(final JSONSerializer jsonSerializerArgument) {
System.out.println("End dictionary");
}
@Override
- public void readKey(JSONSerializer jsonSerializerArgument, String key) {
+ public void readKey(final JSONSerializer jsonSerializerArgument, final String key) {
System.out.println("Read key: " + key);
}
@Override
- public void beginSequence(JSONSerializer jsonSerializerArgument, Sequence<?> value) {
+ public void beginSequence(final JSONSerializer jsonSerializerArgument, final Sequence<?> value) {
System.out.println("Begin sequence: " + value);
}
@Override
- public void endSequence(JSONSerializer jsonSerializerArgument) {
+ public void endSequence(final JSONSerializer jsonSerializerArgument) {
System.out.println("End sequence");
}
@Override
- public void readString(JSONSerializer jsonSerializerArgument, String value) {
+ public void readString(final JSONSerializer jsonSerializerArgument, final String value) {
System.out.println("Read string: " + value);
}
@Override
- public void readNumber(JSONSerializer jsonSerializerArgument, Number value) {
+ public void readNumber(final JSONSerializer jsonSerializerArgument, final Number value) {
System.out.println("Read number: " + value);
}
@Override
- public void readBoolean(JSONSerializer jsonSerializerArgument, Boolean value) {
+ public void readBoolean(final JSONSerializer jsonSerializerArgument, final Boolean value) {
System.out.println("Read boolean: " + value);
}
@Override
- public void readNull(JSONSerializer jsonSerializerArgument) {
+ public void readNull(final JSONSerializer jsonSerializerArgument) {
System.out.println("Read null");
}
};
@@ -135,21 +135,21 @@ public class JSONSerializerTest {
jsonSerializer.getJSONSerializerListeners().add(jsonSerializerListener);
Object o1 = jsonSerializer.readObject(getClass().getResourceAsStream("map.json"));
- assertEquals((Integer)JSON.get(o1, "a"), (Integer)100);
+ assertEquals((Integer) JSON.get(o1, "a"), (Integer) 100);
assertEquals(JSON.get(o1, "b"), "Hello");
assertEquals(JSON.get(o1, "c"), false);
- assertEquals((Integer)JSON.get(o1, "e.g"), (Integer)5);
- assertEquals((Integer)JSON.get(o1, "i.a"), (Integer)200);
+ assertEquals((Integer) JSON.get(o1, "e.g"), (Integer) 5);
+ assertEquals((Integer) JSON.get(o1, "i.a"), (Integer) 200);
assertEquals(JSON.get(o1, "i.c"), true);
assertEquals(JSON.get(o1, "m"), "Hello\r\n\tWorld!");
jsonSerializer.getJSONSerializerListeners().remove(jsonSerializerListener);
Object o2 = jsonSerializer.readObject(getClass().getResourceAsStream("map.json"));
- assertEquals((Integer)JSON.get(o2, "k[1].a"), (Integer)10);
- assertEquals((Integer)JSON.get(o2, "k[2].a"), (Integer)100);
- assertEquals((Integer)JSON.get(o2, "k[2].b"), (Integer)200);
+ assertEquals((Integer) JSON.get(o2, "k[1].a"), (Integer) 10);
+ assertEquals((Integer) JSON.get(o2, "k[2].a"), (Integer) 100);
+ assertEquals((Integer) JSON.get(o2, "k[2].b"), (Integer) 200);
assertEquals(JSON.get(o2, "k[2].c"), "300");
- assertEquals((Integer)JSON.get(o2, "j"), (Integer)200);
+ assertEquals((Integer) JSON.get(o2, "j"), (Integer) 200);
assertEquals(JSON.get(o2, "n"), "This is a \"test\" of the 'quoting' in \\JSON\\");
assertTrue(o1.equals(o2));
Modified: pivot/trunk/core/test/org/apache/pivot/serialization/test/BinarySerializerTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/serialization/test/BinarySerializerTest.java?rev=1837911&r1=1837910&r2=1837911&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/serialization/test/BinarySerializerTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/serialization/test/BinarySerializerTest.java Mon Aug 13 01:52:33 2018
@@ -31,7 +31,7 @@ public class BinarySerializerTest {
public void testBinarySerializer() {
Serializer<Object> serializer = new BinarySerializer();
- Object[] outputData = { "Hello World", 123.456, true };
+ Object[] outputData = {"Hello World", 123.456, true};
Object[] inputData;
try {
Modified: pivot/trunk/demos/src/org/apache/pivot/demos/rest/RESTDemoTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/rest/RESTDemoTest.java?rev=1837911&r1=1837910&r2=1837911&view=diff
==============================================================================
--- pivot/trunk/demos/src/org/apache/pivot/demos/rest/RESTDemoTest.java (original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/rest/RESTDemoTest.java Mon Aug 13 01:52:33 2018
@@ -67,7 +67,8 @@ public class RESTDemoTest {
GetQuery getQuery = new GetQuery(hostname, port, path, secure);
Object result = getQuery.execute();
- assertArrayEquals((Object[])JSON.get(contact, "address.street"), (Object[])JSON.get(result, "address.street"));
+ assertArrayEquals((Object[]) JSON.get(contact, "address.street"),
+ (Object[]) JSON.get(result, "address.street"));
assertEquals(contact, result);
// Update
Modified: pivot/trunk/eclipse/src/org/apache/pivot/eclipse/PivotApplicationLaunchShortcut.java
URL: http://svn.apache.org/viewvc/pivot/trunk/eclipse/src/org/apache/pivot/eclipse/PivotApplicationLaunchShortcut.java?rev=1837911&r1=1837910&r2=1837911&view=diff
==============================================================================
--- pivot/trunk/eclipse/src/org/apache/pivot/eclipse/PivotApplicationLaunchShortcut.java (original)
+++ pivot/trunk/eclipse/src/org/apache/pivot/eclipse/PivotApplicationLaunchShortcut.java Mon Aug 13 01:52:33 2018
@@ -137,7 +137,7 @@ public class PivotApplicationLaunchShort
IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, applicationProjectName);
workingLaunchConfiguration.setAttribute(
IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, applicationTypeName);
- workingLaunchConfiguration.setMappedResources(new IResource[] { type.getUnderlyingResource() });
+ workingLaunchConfiguration.setMappedResources(new IResource[] {type.getUnderlyingResource()});
launchConfiguration = workingLaunchConfiguration.doSave();
} catch (CoreException exception) {
Modified: pivot/trunk/eclipse/src/org/apache/pivot/eclipse/PivotScriptApplicationLaunchShortcut.java
URL: http://svn.apache.org/viewvc/pivot/trunk/eclipse/src/org/apache/pivot/eclipse/PivotScriptApplicationLaunchShortcut.java?rev=1837911&r1=1837910&r2=1837911&view=diff
==============================================================================
--- pivot/trunk/eclipse/src/org/apache/pivot/eclipse/PivotScriptApplicationLaunchShortcut.java (original)
+++ pivot/trunk/eclipse/src/org/apache/pivot/eclipse/PivotScriptApplicationLaunchShortcut.java Mon Aug 13 01:52:33 2018
@@ -132,7 +132,7 @@ public class PivotScriptApplicationLaunc
IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, fileProjectName);
workingLaunchConfiguration.setAttribute(
IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, getProgramArguments(file));
- workingLaunchConfiguration.setMappedResources(new IResource[] { file });
+ workingLaunchConfiguration.setMappedResources(new IResource[] {file});
launchConfiguration = workingLaunchConfiguration.doSave();
} catch (CoreException exception) {