|
1 | 1 | /*
|
2 |
| - * Copyright 2009-2023 the original author or authors. |
| 2 | + * Copyright 2009-2024 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -137,19 +137,15 @@ public Object getNamedParams(Object[] args) {
|
137 | 137 | } else {
|
138 | 138 | final Map<String, Object> param = new ParamMap<>();
|
139 | 139 | int i = 0;
|
140 |
| - try { |
141 |
| - for (Map.Entry<Integer, String> entry : names.entrySet()) { |
142 |
| - param.put(entry.getValue(), args[entry.getKey()]); |
143 |
| - // add generic param names (param1, param2, ...) |
144 |
| - final String genericParamName = GENERIC_NAME_CACHE[i]; |
145 |
| - // ensure not to overwrite parameter named with @Param |
146 |
| - if (!names.containsValue(genericParamName)) { |
147 |
| - param.put(genericParamName, args[entry.getKey()]); |
148 |
| - } |
149 |
| - i++; |
| 140 | + for (Map.Entry<Integer, String> entry : names.entrySet()) { |
| 141 | + param.put(entry.getValue(), args[entry.getKey()]); |
| 142 | + // add generic param names (param1, param2, ...) |
| 143 | + final String genericParamName = i < 10 ? GENERIC_NAME_CACHE[i] : GENERIC_NAME_PREFIX + (i + 1); |
| 144 | + // ensure not to overwrite parameter named with @Param |
| 145 | + if (!names.containsValue(genericParamName)) { |
| 146 | + param.put(genericParamName, args[entry.getKey()]); |
150 | 147 | }
|
151 |
| - } catch (ArrayIndexOutOfBoundsException e) { |
152 |
| - throw new ArrayIndexOutOfBoundsException("The parameter list is too long, the maximum supported length is 10"); |
| 148 | + i++; |
153 | 149 | }
|
154 | 150 | return param;
|
155 | 151 | }
|
|
0 commit comments