You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2019/09/05 08:51:13 UTC
[cxf] branch master updated: cxf-rt-rs-client: use ArrayList in
ClientProxyImpl
This is an automated email from the ASF dual-hosted git repository.
buhhunyx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/master by this push:
new 9fd3ec9 cxf-rt-rs-client: use ArrayList in ClientProxyImpl
9fd3ec9 is described below
commit 9fd3ec99d73449779915279cd8bdabe484c29fda
Author: Alexey Markevich <bu...@gmail.com>
AuthorDate: Tue Sep 3 19:35:32 2019 +0300
cxf-rt-rs-client: use ArrayList in ClientProxyImpl
---
.../java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
index a4f8cc4..3cd2c0d 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
@@ -33,13 +33,13 @@ import java.net.URI;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
@@ -512,7 +512,7 @@ public class ClientProxyImpl extends AbstractClient implements
List<Parameter> beanParams,
OperationResourceInfo ori,
int bodyIndex) {
- List<Object> list = new LinkedList<>();
+ List<Object> list = new ArrayList<>();
List<String> methodVars = ori.getURITemplate().getVariables();
List<Parameter> paramsList = getParameters(map, ParameterType.PATH);
@@ -541,7 +541,7 @@ public class ClientProxyImpl extends AbstractClient implements
Map<String, Parameter> paramsMap = new LinkedHashMap<>();
paramsList.forEach(p -> {
- if (p.getName().length() == 0) {
+ if (p.getName().isEmpty()) {
MultivaluedMap<String, Object> values = InjectionUtils.extractValuesFromBean(params[p.getIndex()], "");
methodVars.forEach(var -> {
list.addAll(values.get(var));
@@ -577,8 +577,7 @@ public class ClientProxyImpl extends AbstractClient implements
int index = 0;
for (Iterator<String> it = valuesMap.keySet().iterator(); it.hasNext(); index++) {
if (it.next().equals(p.getName()) && index < list.size()) {
- list.remove(index);
- list.add(index, convertParamValue(params[p.getIndex()], null));
+ list.set(index, convertParamValue(params[p.getIndex()], null));
break;
}
}
@@ -766,9 +765,8 @@ public class ClientProxyImpl extends AbstractClient implements
protected List<Attachment> handleMultipart(MultivaluedMap<ParameterType, Parameter> map,
OperationResourceInfo ori,
Object[] params) {
-
- List<Attachment> atts = new LinkedList<>();
List<Parameter> fm = getParameters(map, ParameterType.REQUEST_BODY);
+ List<Attachment> atts = new ArrayList<>(fm.size());
fm.forEach(p -> {
Multipart part = getMultipart(ori, p.getIndex());
if (part != null) {