diff --git a/spring-core/src/main/java/org/springframework/core/convert/converter/GenericConverter.java b/spring-core/src/main/java/org/springframework/core/convert/converter/GenericConverter.java index 65d1def81f..99b071d96d 100644 --- a/spring-core/src/main/java/org/springframework/core/convert/converter/GenericConverter.java +++ b/spring-core/src/main/java/org/springframework/core/convert/converter/GenericConverter.java @@ -29,10 +29,10 @@ import org.springframework.util.Assert; * type pairs (see {@link #getConvertibleTypes()}. In addition, GenericConverter implementations * have access to source/target {@link TypeDescriptor field context} during the type conversion * process. This allows for resolving source and target field metadata such as annotations and - * generics information, which can be used influence the conversion logic. + * generics information, which can be used to influence the conversion logic. * *

This interface should generally not be used when the simpler {@link Converter} or - * {@link ConverterFactory} interfaces are sufficient. + * {@link ConverterFactory} interface is sufficient. * *

Implementations may additionally implement {@link ConditionalConverter}. * @@ -47,16 +47,16 @@ import org.springframework.util.Assert; public interface GenericConverter { /** - * Return the source and target types which this converter can convert between. Each - * entry is a convertible source-to-target type pair. - *

For {@link ConditionalConverter conditional} converters this method may return + * Return the source and target types that this converter can convert between. + *

Each entry is a convertible source-to-target type pair. + *

For {@link ConditionalConverter conditional converters} this method may return * {@code null} to indicate all source-to-target pairs should be considered. */ Set getConvertibleTypes(); /** - * Convert the source to the targetType described by the TypeDescriptor. - * @param source the source object to convert (may be null) + * Convert the source object to the targetType described by the {@code TypeDescriptor}. + * @param source the source object to convert (may be {@code null}) * @param sourceType the type descriptor of the field we are converting from * @param targetType the type descriptor of the field we are converting to * @return the converted object @@ -67,7 +67,7 @@ public interface GenericConverter { /** * Holder for a source-to-target class pair. */ - public static final class ConvertiblePair { + final class ConvertiblePair { private final Class sourceType; diff --git a/spring-web/src/main/java/org/springframework/http/client/support/ProxyFactoryBean.java b/spring-web/src/main/java/org/springframework/http/client/support/ProxyFactoryBean.java index 6ff8d581f3..f19b7df943 100644 --- a/spring-web/src/main/java/org/springframework/http/client/support/ProxyFactoryBean.java +++ b/spring-web/src/main/java/org/springframework/http/client/support/ProxyFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,41 +42,46 @@ public class ProxyFactoryBean implements FactoryBean, InitializingBean { private Proxy proxy; + /** - * Sets the proxy type. Defaults to {@link java.net.Proxy.Type#HTTP}. + * Set the proxy type. + *

Defaults to {@link java.net.Proxy.Type#HTTP}. */ public void setType(Proxy.Type type) { this.type = type; } /** - * Sets the proxy host name. + * Set the proxy host name. */ public void setHostname(String hostname) { this.hostname = hostname; } /** - * Sets the proxy port. + * Set the proxy port. */ public void setPort(int port) { this.port = port; } + @Override public void afterPropertiesSet() throws IllegalArgumentException { - Assert.notNull(type, "'type' must not be null"); - Assert.hasLength(hostname, "'hostname' must not be empty"); - Assert.isTrue(port >= 0 && port <= 65535, "'port' out of range: " + port); - - SocketAddress socketAddress = new InetSocketAddress(hostname, port); - this.proxy = new Proxy(type, socketAddress); + Assert.notNull(this.type, "'type' must not be null"); + Assert.hasLength(this.hostname, "'hostname' must not be empty"); + if (this.port < 0 || this.port > 65535) { + throw new IllegalArgumentException("'port' value out of range: " + this.port); + } + SocketAddress socketAddress = new InetSocketAddress(this.hostname, this.port); + this.proxy = new Proxy(this.type, socketAddress); } + @Override public Proxy getObject() { - return proxy; + return this.proxy; } @Override @@ -88,4 +93,5 @@ public class ProxyFactoryBean implements FactoryBean, InitializingBean { public boolean isSingleton() { return true; } + }