Skip to content

Commit 249a4f1

Browse files
committed
Apply review suggestions
1 parent 71ca086 commit 249a4f1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

log4j-api/src/main/java/org/apache/logging/log4j/util/internal/SerializationUtil.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ public static String stripArray(final Class<?> clazz) {
163163
* @see Class#getName()
164164
*/
165165
public static String stripArray(final String name) {
166-
int offset;
167-
for (offset = 0; offset < name.length() && name.charAt(offset) == '['; offset++) {}
166+
final int offset = name.lastIndexOf('[') + 1;
168167
if (offset == 0) {
169168
return name;
170169
}
@@ -191,8 +190,7 @@ public static String stripArray(final String name) {
191190
case "S":
192191
return "short";
193192
default:
194-
// Should never happen
195-
return name;
193+
throw new IllegalArgumentException("Unsupported array class signature '" + name + "'");
196194
}
197195
}
198196

0 commit comments

Comments
 (0)