From c8c0e827b4638ad8f2076ae17ae9f29a277e5762 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 12 Oct 2012 14:16:42 -0700 Subject: [PATCH] Polish trailing whitespace --- .../support/DefaultConversionService.java | 22 +++++----- .../GenericConversionServiceTests.java | 40 +++++++++---------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/DefaultConversionService.java b/spring-core/src/main/java/org/springframework/core/convert/support/DefaultConversionService.java index 377f1f7deb..e4fffd37c3 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/support/DefaultConversionService.java +++ b/spring-core/src/main/java/org/springframework/core/convert/support/DefaultConversionService.java @@ -43,7 +43,7 @@ public class DefaultConversionService extends GenericConversionService { } // static utility methods - + /** * Add converters appropriate for most environments. * @param converterRegistry the registry of converters to add to (must also be castable to ConversionService) @@ -54,9 +54,9 @@ public class DefaultConversionService extends GenericConversionService { addCollectionConverters(converterRegistry); addFallbackConverters(converterRegistry); } - + // internal helpers - + private static void addScalarConverters(ConverterRegistry converterRegistry) { converterRegistry.addConverter(new StringToBooleanConverter()); converterRegistry.addConverter(Boolean.class, String.class, new ObjectToStringConverter()); @@ -65,16 +65,16 @@ public class DefaultConversionService extends GenericConversionService { converterRegistry.addConverter(Number.class, String.class, new ObjectToStringConverter()); converterRegistry.addConverterFactory(new NumberToNumberConverterFactory()); - + converterRegistry.addConverter(new StringToCharacterConverter()); converterRegistry.addConverter(Character.class, String.class, new ObjectToStringConverter()); converterRegistry.addConverter(new NumberToCharacterConverter()); converterRegistry.addConverterFactory(new CharacterToNumberFactory()); - + converterRegistry.addConverterFactory(new StringToEnumConverterFactory()); converterRegistry.addConverter(Enum.class, String.class, new EnumToStringConverter()); - + converterRegistry.addConverter(new StringToLocaleConverter()); converterRegistry.addConverter(Locale.class, String.class, new ObjectToStringConverter()); @@ -83,13 +83,13 @@ public class DefaultConversionService extends GenericConversionService { } private static void addCollectionConverters(ConverterRegistry converterRegistry) { - ConversionService conversionService = (ConversionService) converterRegistry; + ConversionService conversionService = (ConversionService) converterRegistry; converterRegistry.addConverter(new ArrayToCollectionConverter(conversionService)); converterRegistry.addConverter(new CollectionToArrayConverter(conversionService)); converterRegistry.addConverter(new ArrayToArrayConverter(conversionService)); converterRegistry.addConverter(new CollectionToCollectionConverter(conversionService)); - converterRegistry.addConverter(new MapToMapConverter(conversionService)); + converterRegistry.addConverter(new MapToMapConverter(conversionService)); converterRegistry.addConverter(new ArrayToStringConverter(conversionService)); converterRegistry.addConverter(new StringToArrayConverter(conversionService)); @@ -103,12 +103,12 @@ public class DefaultConversionService extends GenericConversionService { converterRegistry.addConverter(new CollectionToObjectConverter(conversionService)); converterRegistry.addConverter(new ObjectToCollectionConverter(conversionService)); } - + private static void addFallbackConverters(ConverterRegistry converterRegistry) { ConversionService conversionService = (ConversionService) converterRegistry; converterRegistry.addConverter(new ObjectToObjectConverter()); converterRegistry.addConverter(new IdToEntityConverter(conversionService)); - converterRegistry.addConverter(new FallbackObjectToStringConverter()); + converterRegistry.addConverter(new FallbackObjectToStringConverter()); } -} \ No newline at end of file +} diff --git a/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java b/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java index 454c044d22..6c4769a27c 100644 --- a/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java +++ b/spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java @@ -61,9 +61,9 @@ public class GenericConversionServiceTests { public void canConvert() { assertFalse(conversionService.canConvert(String.class, Integer.class)); conversionService.addConverterFactory(new StringToNumberConverterFactory()); - assertTrue(conversionService.canConvert(String.class, Integer.class)); + assertTrue(conversionService.canConvert(String.class, Integer.class)); } - + @Test public void canConvertAssignable() { assertTrue(conversionService.canConvert(String.class, String.class)); @@ -71,29 +71,29 @@ public class GenericConversionServiceTests { assertTrue(conversionService.canConvert(boolean.class, boolean.class)); assertTrue(conversionService.canConvert(boolean.class, Boolean.class)); } - + @Test public void canConvertIllegalArgumentNullTargetType() { try { assertFalse(conversionService.canConvert(String.class, null)); fail("Should have failed"); } catch (IllegalArgumentException e) { - + } try { assertFalse(conversionService.canConvert(TypeDescriptor.valueOf(String.class), null)); fail("Should have failed"); } catch (IllegalArgumentException e) { - + } } - + @Test public void canConvertNullSourceType() { assertTrue(conversionService.canConvert(null, Integer.class)); assertTrue(conversionService.canConvert(null, TypeDescriptor.valueOf(Integer.class))); } - + @Test public void convert() { conversionService.addConverterFactory(new StringToNumberConverterFactory()); @@ -208,7 +208,7 @@ public class GenericConversionServiceTests { } // SPR-8718 - + @Test(expected=ConverterNotFoundException.class) public void convertSuperTarget() { conversionService.addConverter(new ColorConverter()); @@ -235,11 +235,11 @@ public class GenericConversionServiceTests { public void convertObjectToPrimitiveViaConverterFactory() { assertFalse(conversionService.canConvert(String.class, int.class)); conversionService.addConverterFactory(new StringToNumberConverterFactory()); - assertTrue(conversionService.canConvert(String.class, int.class)); + assertTrue(conversionService.canConvert(String.class, int.class)); Integer three = conversionService.convert("3", int.class); assertEquals(3, three.intValue()); } - + @Test public void genericConverterDelegatingBackToConversionServiceConverterNotFound() { conversionService.addConverter(new ObjectToArrayConverter(conversionService)); @@ -398,7 +398,7 @@ public class GenericConversionServiceTests { watch.stop(); System.out.println(watch.prettyPrint()); } - + @Test public void testPerformance2() throws Exception { GenericConversionService conversionService = new DefaultConversionService(); @@ -420,7 +420,7 @@ public class GenericConversionServiceTests { target.add(Integer.valueOf(element)); } } - watch.stop(); + watch.stop(); System.out.println(watch.prettyPrint()); } @@ -435,7 +435,7 @@ public class GenericConversionServiceTests { source.put("1", "1"); source.put("2", "2"); source.put("3", "3"); - TypeDescriptor td = new TypeDescriptor(getClass().getField("map")); + TypeDescriptor td = new TypeDescriptor(getClass().getField("map")); for (int i = 0; i < 1000000; i++) { conversionService.convert(source, TypeDescriptor.forObject(source), td); } @@ -447,10 +447,10 @@ public class GenericConversionServiceTests { target.put(entry.getKey(), Integer.valueOf(entry.getValue())); } } - watch.stop(); + watch.stop(); System.out.println(watch.prettyPrint()); } - + public static Map map; @Test @@ -554,19 +554,19 @@ public class GenericConversionServiceTests { conversionService.addConverterFactory(new StringToNumberConverterFactory()); assertTrue(conversionService.canConvert(String.class, Integer[].class)); } - + @Test public void stringToCollectionCanConvert() throws Exception { conversionService.addConverter(new StringToCollectionConverter(conversionService)); assertTrue(conversionService.canConvert(String.class, Collection.class)); TypeDescriptor targetType = new TypeDescriptor(getClass().getField("stringToCollection")); - assertFalse(conversionService.canConvert(TypeDescriptor.valueOf(String.class), targetType)); + assertFalse(conversionService.canConvert(TypeDescriptor.valueOf(String.class), targetType)); conversionService.addConverterFactory(new StringToNumberConverterFactory()); - assertTrue(conversionService.canConvert(TypeDescriptor.valueOf(String.class), targetType)); + assertTrue(conversionService.canConvert(TypeDescriptor.valueOf(String.class), targetType)); } - + public Collection stringToCollection; - + @Test public void testConvertiblePairsInSet() throws Exception { Set set = new HashSet();