for and while loop to foreach conversions
This commit is contained in:
parent
e1728f0797
commit
d5242978d5
|
@ -106,16 +106,16 @@ public abstract class URISchema<T, P> {
|
|||
Map<String, String> rc = new HashMap<>();
|
||||
if (uri != null && !uri.isEmpty()) {
|
||||
String[] parameters = uri.split("&");
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
int p = parameters[i].indexOf("=");
|
||||
for (String parameter : parameters) {
|
||||
int p = parameter.indexOf("=");
|
||||
if (p >= 0) {
|
||||
String name = BeanSupport.decodeURI(parameters[i].substring(0, p));
|
||||
String value = BeanSupport.decodeURI(parameters[i].substring(p + 1));
|
||||
String name = BeanSupport.decodeURI(parameter.substring(0, p));
|
||||
String value = BeanSupport.decodeURI(parameter.substring(p + 1));
|
||||
rc.put(name, value);
|
||||
}
|
||||
else {
|
||||
if (!parameters[i].trim().isEmpty()) {
|
||||
rc.put(parameters[i], null);
|
||||
if (!parameter.trim().isEmpty()) {
|
||||
rc.put(parameter, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,15 +135,15 @@ public class URISupport {
|
|||
|
||||
private static void parseParameters(Map<String, String> rc,
|
||||
String[] parameters) throws UnsupportedEncodingException {
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
int p = parameters[i].indexOf("=");
|
||||
for (String parameter : parameters) {
|
||||
int p = parameter.indexOf("=");
|
||||
if (p >= 0) {
|
||||
String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8");
|
||||
String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8");
|
||||
String name = URLDecoder.decode(parameter.substring(0, p), "UTF-8");
|
||||
String value = URLDecoder.decode(parameter.substring(p + 1), "UTF-8");
|
||||
rc.put(name, value);
|
||||
}
|
||||
else {
|
||||
rc.put(parameters[i], null);
|
||||
rc.put(parameter, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,8 +67,8 @@ public class SSLSupport {
|
|||
public static String parseArrayIntoCommandSeparatedList(String[] suites) {
|
||||
StringBuilder supportedSuites = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < suites.length; i++) {
|
||||
supportedSuites.append(suites[i]);
|
||||
for (String suite : suites) {
|
||||
supportedSuites.append(suite);
|
||||
supportedSuites.append(", ");
|
||||
}
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ public class SecurityFormatter {
|
|||
return list;
|
||||
}
|
||||
String[] values = commaSeparatedString.split(",");
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
list.add(values[i].trim());
|
||||
for (String value : values) {
|
||||
list.add(value.trim());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -366,8 +366,8 @@ public final class XMLUtil {
|
|||
for (int i = 0; i < nl.getLength(); i++) {
|
||||
Node n = nl.item(i);
|
||||
short type = n.getNodeType();
|
||||
for (int j = 0; j < typesToFilter.length; j++) {
|
||||
if (typesToFilter[j] == type) {
|
||||
for (short typeToFilter : typesToFilter) {
|
||||
if (typeToFilter == type) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1602,11 +1602,8 @@ public final class JMSBridgeImpl implements JMSBridge {
|
|||
msg.clearProperties();
|
||||
|
||||
if (oldProps != null) {
|
||||
Iterator<Entry<String, Object>> oldPropsIter = oldProps.entrySet().iterator();
|
||||
|
||||
while (oldPropsIter.hasNext()) {
|
||||
Entry<String, Object> entry = oldPropsIter.next();
|
||||
|
||||
for (Entry<String, Object> entry : oldProps.entrySet()) {
|
||||
String propName = entry.getKey();
|
||||
|
||||
Object val = entry.getValue();
|
||||
|
|
|
@ -140,9 +140,7 @@ final class MappedByteBufferCache implements AutoCloseable {
|
|||
public void closeAndResize(long length) {
|
||||
if (!closed) {
|
||||
//TO_FIX: unmap in this way is not portable BUT required on Windows that can't resize a memmory mapped file!
|
||||
final int mappedBuffers = this.byteBuffers.size();
|
||||
for (int i = 0; i < mappedBuffers; i++) {
|
||||
final WeakReference<MappedByteBuffer> mbbRef = byteBuffers.get(i);
|
||||
for (final WeakReference<MappedByteBuffer> mbbRef : this.byteBuffers) {
|
||||
if (mbbRef != null) {
|
||||
final MappedByteBuffer mbb = mbbRef.get();
|
||||
if (mbb != null) {
|
||||
|
@ -204,9 +202,7 @@ final class MappedByteBufferCache implements AutoCloseable {
|
|||
public void close() {
|
||||
if (!closed) {
|
||||
//TO_FIX: unmap in this way is not portable BUT required on Windows that can't resize a memory mapped file!
|
||||
final int mappedBuffers = this.byteBuffers.size();
|
||||
for (int i = 0; i < mappedBuffers; i++) {
|
||||
final WeakReference<MappedByteBuffer> mbbRef = byteBuffers.get(i);
|
||||
for (final WeakReference<MappedByteBuffer> mbbRef : this.byteBuffers) {
|
||||
if (mbbRef != null) {
|
||||
final MappedByteBuffer mbb = mbbRef.get();
|
||||
if (mbb != null) {
|
||||
|
@ -237,4 +233,4 @@ final class MappedByteBufferCache implements AutoCloseable {
|
|||
closed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import javax.transaction.xa.XAResource;
|
|||
import javax.transaction.xa.Xid;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
|
@ -764,9 +763,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
|
|||
}
|
||||
|
||||
public void addSessions(Set<SessionId> sessionSet) {
|
||||
Iterator<SessionId> iter = sessionSet.iterator();
|
||||
while (iter.hasNext()) {
|
||||
SessionId sid = iter.next();
|
||||
for (SessionId sid : sessionSet) {
|
||||
addSession(getState().getSessionState(sid).getInfo(), true);
|
||||
}
|
||||
}
|
||||
|
@ -805,10 +802,9 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
|
|||
}
|
||||
else {
|
||||
Bindings bindings = server.getPostOffice().getBindingsForAddress(OpenWireUtil.toCoreAddress(dest));
|
||||
Iterator<Binding> iterator = bindings.getBindings().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Queue b = (Queue) iterator.next().getBindable();
|
||||
for (Binding binding : bindings.getBindings()) {
|
||||
Queue b = (Queue) binding.getBindable();
|
||||
if (b.getConsumerCount() > 0) {
|
||||
throw new Exception("Destination still has an active subscription: " + dest.getPhysicalName());
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
@ -353,10 +352,7 @@ public class OpenWireMessageConverter implements MessageConverter {
|
|||
//unmarshall properties to core so selector will work
|
||||
Map<String, Object> props = messageSend.getProperties();
|
||||
//Map<String, Object> props = MarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(propBytes)));
|
||||
Iterator<Entry<String, Object>> iterEntries = props.entrySet().iterator();
|
||||
while (iterEntries.hasNext()) {
|
||||
Entry<String, Object> ent = iterEntries.next();
|
||||
|
||||
for (Entry<String, Object> ent : props.entrySet()) {
|
||||
Object value = ent.getValue();
|
||||
try {
|
||||
coreMessage.putObjectProperty(ent.getKey(), value);
|
||||
|
@ -394,9 +390,7 @@ public class OpenWireMessageConverter implements MessageConverter {
|
|||
}
|
||||
|
||||
private static void loadMapIntoProperties(TypedProperties props, Map<String, Object> map) {
|
||||
Iterator<Entry<String, Object>> iter = map.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entry<String, Object> entry = iter.next();
|
||||
for (Entry<String, Object> entry : map.entrySet()) {
|
||||
SimpleString key = new SimpleString(entry.getKey());
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof UTF8Buffer) {
|
||||
|
|
|
@ -343,9 +343,7 @@ public class StompSession implements SessionCallback {
|
|||
}
|
||||
|
||||
boolean containsSubscription(String subscriptionID) {
|
||||
Iterator<Entry<Long, StompSubscription>> iterator = subscriptions.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<Long, StompSubscription> entry = iterator.next();
|
||||
for (Entry<Long, StompSubscription> entry : subscriptions.entrySet()) {
|
||||
StompSubscription sub = entry.getValue();
|
||||
if (sub.getID().equals(subscriptionID)) {
|
||||
return true;
|
||||
|
|
|
@ -27,7 +27,6 @@ import javax.resource.spi.ResourceAdapterAssociation;
|
|||
import javax.security.auth.Subject;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -203,11 +202,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti
|
|||
ActiveMQRALogger.LOGGER.trace("Looking for connection matching credentials: " + credential);
|
||||
}
|
||||
|
||||
Iterator<?> connections = connectionSet.iterator();
|
||||
|
||||
while (connections.hasNext()) {
|
||||
Object obj = connections.next();
|
||||
|
||||
for (Object obj : connectionSet) {
|
||||
if (obj instanceof ActiveMQRAManagedConnection) {
|
||||
ActiveMQRAManagedConnection mc = (ActiveMQRAManagedConnection) obj;
|
||||
ManagedConnectionFactory mcf = mc.getManagedConnectionFactory();
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.beans.PropertyDescriptor;
|
|||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.activemq.artemis.ra.ConnectionFactoryProperties;
|
||||
|
@ -722,9 +721,9 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen
|
|||
if (propsNotSet.size() > 0) {
|
||||
StringBuffer b = new StringBuffer();
|
||||
b.append("Invalid settings:");
|
||||
for (Iterator<String> iter = errorMessages.iterator(); iter.hasNext(); ) {
|
||||
for (String errorMessage : errorMessages) {
|
||||
b.append(" ");
|
||||
b.append(iter.next());
|
||||
b.append(errorMessage);
|
||||
}
|
||||
InvalidPropertyException e = new InvalidPropertyException(b.toString());
|
||||
final PropertyDescriptor[] descriptors = propsNotSet.toArray(new PropertyDescriptor[propsNotSet.size()]);
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.activemq.artemis.selector.filter;
|
|||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -98,8 +97,7 @@ public abstract class UnaryExpression implements Expression {
|
|||
answer.append(" ( ");
|
||||
|
||||
int count = 0;
|
||||
for (Iterator<Object> i = inList.iterator(); i.hasNext(); ) {
|
||||
Object o = i.next();
|
||||
for (Object o : inList) {
|
||||
if (count != 0) {
|
||||
answer.append(", ");
|
||||
}
|
||||
|
|
|
@ -382,8 +382,8 @@ public final class ClusterConnectionConfiguration implements Serializable {
|
|||
|
||||
List<TransportConfiguration> list = new LinkedList<>();
|
||||
|
||||
for (int i = 0; i < members.length; i++) {
|
||||
list.addAll(connectorTransportConfigurationParser.newObject(members[i], null));
|
||||
for (URI member : members) {
|
||||
list.addAll(connectorTransportConfigurationParser.newObject(member, null));
|
||||
}
|
||||
|
||||
return list.toArray(new TransportConfiguration[list.size()]);
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -47,14 +46,10 @@ public class SecurityConfiguration extends Configuration {
|
|||
}
|
||||
|
||||
public SecurityConfiguration(Map<String, String> users, Map<String, List<String>> roles) {
|
||||
Iterator<Map.Entry<String, String>> iter = users.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Map.Entry<String, String> entry = iter.next();
|
||||
for (Map.Entry<String, String> entry : users.entrySet()) {
|
||||
addUser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
Iterator<Map.Entry<String, List<String>>> iter1 = roles.entrySet().iterator();
|
||||
while (iter1.hasNext()) {
|
||||
Map.Entry<String, List<String>> entry = iter1.next();
|
||||
for (Map.Entry<String, List<String>> entry : roles.entrySet()) {
|
||||
for (String role : entry.getValue()) {
|
||||
addRole(entry.getKey(), role);
|
||||
}
|
||||
|
|
|
@ -288,9 +288,7 @@ public class MessageCounter {
|
|||
ret.append(dayCounters.size() + "\n");
|
||||
|
||||
// following lines: day counter data
|
||||
for (int i = 0; i < dayCounters.size(); i++) {
|
||||
DayCounter counter = dayCounters.get(i);
|
||||
|
||||
for (DayCounter counter : dayCounters) {
|
||||
ret.append(counter.getDayCounterAsString() + "\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.apache.activemq.artemis.core.messagecounter.impl;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
|
@ -141,11 +140,7 @@ public class MessageCounterManagerImpl implements MessageCounterManager {
|
|||
@Override
|
||||
public void resetAllCounters() {
|
||||
synchronized (messageCounters) {
|
||||
Iterator<MessageCounter> iter = messageCounters.values().iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
MessageCounter counter = iter.next();
|
||||
|
||||
for (MessageCounter counter : messageCounters.values()) {
|
||||
counter.resetCounter();
|
||||
}
|
||||
}
|
||||
|
@ -154,11 +149,7 @@ public class MessageCounterManagerImpl implements MessageCounterManager {
|
|||
@Override
|
||||
public void resetAllCounterHistories() {
|
||||
synchronized (messageCounters) {
|
||||
Iterator<MessageCounter> iter = messageCounters.values().iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
MessageCounter counter = iter.next();
|
||||
|
||||
for (MessageCounter counter : messageCounters.values()) {
|
||||
counter.resetHistory();
|
||||
}
|
||||
}
|
||||
|
@ -177,11 +168,7 @@ public class MessageCounterManagerImpl implements MessageCounterManager {
|
|||
}
|
||||
|
||||
synchronized (messageCounters) {
|
||||
Iterator<MessageCounter> iter = messageCounters.values().iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
MessageCounter counter = iter.next();
|
||||
|
||||
for (MessageCounter counter : messageCounters.values()) {
|
||||
counter.onTimer();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.security.AccessController;
|
|||
import java.security.PrivilegedAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -513,9 +512,7 @@ public class NettyAcceptor extends AbstractAcceptor {
|
|||
|
||||
if (!future.isSuccess()) {
|
||||
ActiveMQServerLogger.LOGGER.nettyChannelGroupError();
|
||||
Iterator<Channel> iterator = future.group().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Channel channel = iterator.next();
|
||||
for (Channel channel : future.group()) {
|
||||
if (channel.isActive()) {
|
||||
ActiveMQServerLogger.LOGGER.nettyChannelStillOpen(channel, channel.remoteAddress());
|
||||
}
|
||||
|
@ -573,9 +570,7 @@ public class NettyAcceptor extends AbstractAcceptor {
|
|||
ChannelGroupFuture future = serverChannelGroup.close().awaitUninterruptibly();
|
||||
if (!future.isSuccess()) {
|
||||
ActiveMQServerLogger.LOGGER.nettyChannelGroupBindError();
|
||||
Iterator<Channel> iterator = future.group().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Channel channel = iterator.next();
|
||||
for (Channel channel : future.group()) {
|
||||
if (channel.isActive()) {
|
||||
ActiveMQServerLogger.LOGGER.nettyChannelStillBound(channel, channel.remoteAddress());
|
||||
}
|
||||
|
|
|
@ -295,12 +295,12 @@ public class ClusterConnectionBridge extends BridgeImpl {
|
|||
List<String> excludes = new ArrayList<>();
|
||||
|
||||
// Split the list into addresses to match and addresses to exclude.
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
if (list[i].startsWith("!")) {
|
||||
excludes.add(list[i].substring(1, list[i].length()));
|
||||
for (String s : list) {
|
||||
if (s.startsWith("!")) {
|
||||
excludes.add(s.substring(1, s.length()));
|
||||
}
|
||||
else {
|
||||
includes.add(list[i]);
|
||||
includes.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@ public class JaasCallbackHandler implements CallbackHandler {
|
|||
|
||||
@Override
|
||||
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
|
||||
for (int i = 0; i < callbacks.length; i++) {
|
||||
Callback callback = callbacks[i];
|
||||
for (Callback callback : callbacks) {
|
||||
if (callback instanceof PasswordCallback) {
|
||||
PasswordCallback passwordCallback = (PasswordCallback) callback;
|
||||
if (password == null) {
|
||||
|
|
|
@ -274,8 +274,8 @@ public class LDAPLoginModule implements LoginModule {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Roles " + roles + " for user " + username);
|
||||
}
|
||||
for (int i = 0; i < roles.size(); i++) {
|
||||
groups.add(new RolePrincipal(roles.get(i)));
|
||||
for (String role : roles) {
|
||||
groups.add(new RolePrincipal(role));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -488,15 +488,15 @@ public class LDAPLoginModule implements LoginModule {
|
|||
}
|
||||
|
||||
private String getLDAPPropertyValue(String propertyName) {
|
||||
for (int i = 0; i < config.length; i++)
|
||||
if (config[i].getPropertyName().equals(propertyName))
|
||||
return config[i].getPropertyValue();
|
||||
for (LDAPLoginProperty conf : config)
|
||||
if (conf.getPropertyName().equals(propertyName))
|
||||
return conf.getPropertyValue();
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isLoginPropertySet(String propertyName) {
|
||||
for (int i = 0; i < config.length; i++) {
|
||||
if (config[i].getPropertyName().equals(propertyName) && (config[i].getPropertyValue() != null && !"".equals(config[i].getPropertyValue())))
|
||||
for (LDAPLoginProperty conf : config) {
|
||||
if (conf.getPropertyName().equals(propertyName) && (conf.getPropertyValue() != null && !"".equals(conf.getPropertyValue())))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -61,8 +61,8 @@ public class CramMD5Mechanism extends AbstractMechanism {
|
|||
|
||||
StringBuffer hash = new StringBuffer(getUsername());
|
||||
hash.append(' ');
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
String hex = Integer.toHexString(0xFF & bytes[i]);
|
||||
for (byte b : bytes) {
|
||||
String hex = Integer.toHexString(0xFF & b);
|
||||
if (hex.length() == 1) {
|
||||
hash.append('0');
|
||||
}
|
||||
|
|
|
@ -172,15 +172,15 @@ public class PropertyUtil {
|
|||
if (queryString != null && !queryString.isEmpty()) {
|
||||
Map<String, String> rc = new HashMap<>();
|
||||
String[] parameters = queryString.split("&");
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
int p = parameters[i].indexOf("=");
|
||||
for (String parameter : parameters) {
|
||||
int p = parameter.indexOf("=");
|
||||
if (p >= 0) {
|
||||
String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8");
|
||||
String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8");
|
||||
String name = URLDecoder.decode(parameter.substring(0, p), "UTF-8");
|
||||
String value = URLDecoder.decode(parameter.substring(p + 1), "UTF-8");
|
||||
rc.put(name, value);
|
||||
}
|
||||
else {
|
||||
rc.put(parameters[i], null);
|
||||
rc.put(parameter, null);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
|
@ -352,8 +352,7 @@ public class PropertyUtil {
|
|||
Object[] NULL_ARG = {};
|
||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||
if (propertyDescriptors != null) {
|
||||
for (int i = 0; i < propertyDescriptors.length; i++) {
|
||||
PropertyDescriptor pd = propertyDescriptors[i];
|
||||
for (PropertyDescriptor pd : propertyDescriptors) {
|
||||
if (pd.getReadMethod() != null && !pd.getName().equals("class") && !pd.getName().equals("properties") && !pd.getName().equals("reference")) {
|
||||
Object value = pd.getReadMethod().invoke(object, NULL_ARG);
|
||||
if (value != null) {
|
||||
|
@ -365,7 +364,7 @@ public class PropertyUtil {
|
|||
}
|
||||
else {
|
||||
Map<String, String> inner = getProperties(value);
|
||||
for (Map.Entry<String, String> entry : inner.entrySet()) {
|
||||
for (Entry<String, String> entry : inner.entrySet()) {
|
||||
properties.put(pd.getName() + "." + entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
@ -389,8 +388,7 @@ public class PropertyUtil {
|
|||
BeanInfo beanInfo = Introspector.getBeanInfo(object.getClass());
|
||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||
if (propertyDescriptors != null) {
|
||||
for (int i = 0; i < propertyDescriptors.length; i++) {
|
||||
PropertyDescriptor pd = propertyDescriptors[i];
|
||||
for (PropertyDescriptor pd : propertyDescriptors) {
|
||||
if (pd.getReadMethod() != null && pd.getName().equals(name)) {
|
||||
return pd.getReadMethod().invoke(object);
|
||||
}
|
||||
|
@ -497,8 +495,7 @@ public class PropertyUtil {
|
|||
// Build the method name.
|
||||
name = "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
|
||||
Method[] methods = clazz.getMethods();
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
Method method = methods[i];
|
||||
for (Method method : methods) {
|
||||
Class<?>[] params = method.getParameterTypes();
|
||||
if (method.getName().equals(name) && params.length == 1) {
|
||||
return method;
|
||||
|
|
Loading…
Reference in New Issue