Skip to content

Commit 2351d86

Browse files
committed
Update BeanAdapter and Pipe.
1 parent 5c5ecf8 commit 2351d86

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
subprojects {
1616
group = 'org.httprpc'
17-
version = '4.9.3'
17+
version = '4.9.4'
1818

1919
apply plugin: 'java-library'
2020

kilo-client/src/main/java/org/httprpc/kilo/beans/BeanAdapter.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,15 +1044,15 @@ private static Object toRawType(Object value, Class<?> type) {
10441044
} else if (type.isEnum()) {
10451045
return toEnum(value.toString(), type);
10461046
} else {
1047-
if (value instanceof Map<?, ?> map) {
1048-
if (type.isRecord()) {
1049-
return toRecord(map, type);
1050-
} else {
1051-
return toBean(map, type);
1052-
}
1053-
} else {
1047+
if (!(value instanceof Map<?, ?> map)) {
10541048
throw new IllegalArgumentException("Value is not a map.");
10551049
}
1050+
1051+
if (type.isRecord()) {
1052+
return toRecord(map, type);
1053+
} else {
1054+
return toBean(map, type);
1055+
}
10561056
}
10571057
}
10581058
}
@@ -1267,7 +1267,7 @@ private static String getPropertyName(Method method) {
12671267

12681268
String prefix;
12691269
if (methodName.startsWith(GET_PREFIX)
1270-
&& !(returnType == Void.TYPE || returnType == Void.class)
1270+
&& returnType != Void.TYPE && returnType != Void.class
12711271
&& parameterCount == 0) {
12721272
prefix = GET_PREFIX;
12731273
} else if (methodName.startsWith(IS_PREFIX)
@@ -1279,10 +1279,6 @@ private static String getPropertyName(Method method) {
12791279
&& parameterCount == 1) {
12801280
prefix = SET_PREFIX;
12811281
} else {
1282-
prefix = null;
1283-
}
1284-
1285-
if (prefix == null) {
12861282
return null;
12871283
}
12881284

kilo-client/src/main/java/org/httprpc/kilo/util/concurrent/Pipe.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ private void submit(Object value) {
145145
if (timeout == 0) {
146146
queue.put(value);
147147
} else {
148-
if (!queue.offer(value, timeout, TimeUnit.MILLISECONDS)) {
148+
var result = queue.offer(value, timeout, TimeUnit.MILLISECONDS);
149+
150+
if (!result) {
149151
throw new TimeoutException("Offer timed out.");
150152
}
151153
}

0 commit comments

Comments
 (0)