Skip to content

Commit 6132a0f

Browse files
committed
bean parser fails on empty parameters fix #550
1 parent 374a34f commit 6132a0f

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.jooby.issues;
2+
3+
import org.jooby.test.ServerFeature;
4+
import org.junit.Test;
5+
6+
public class Issue550 extends ServerFeature {
7+
8+
public static class Person {
9+
public String name;
10+
}
11+
12+
{
13+
get("/550", req -> {
14+
return req.params(Person.class).name;
15+
});
16+
}
17+
18+
@Test
19+
public void shouldIgnoreEmptyParams() throws Exception {
20+
request()
21+
.get("/550?name=pedro&person.sync")
22+
.expect("pedro")
23+
.expect(200);
24+
}
25+
26+
}

jooby/src/main/java/org/jooby/internal/parser/bean/BeanPlan.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,10 @@ private List<BeanPath> compile(final Iterator<String> it, final TypeLiteral bean
155155
}
156156
cpath = getter;
157157
}
158-
chain.add(cpath);
159-
ittype = TypeLiteral.get(cpath.type());
158+
if (cpath != null) {
159+
chain.add(cpath);
160+
ittype = TypeLiteral.get(cpath.type());
161+
}
160162
}
161163

162164
// set path

0 commit comments

Comments
 (0)