Skip to content

Commit aa5b5ad

Browse files
committed
edit
1 parent c5521a9 commit aa5b5ad

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- name: Set up JDK 11
4545
uses: actions/setup-java@v3
4646
with:
47-
java-version: '11'
47+
java-version: '17'
4848
distribution: 'temurin'
4949
server-id: ossrh
5050
server-username: MAVEN_USERNAME

src/main/java/org/usf/jquery/core/JDBCType.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static java.util.Objects.isNull;
44
import static java.util.Optional.empty;
5+
import static java.util.Optional.ofNullable;
56

67
/**
78
*
@@ -72,8 +73,8 @@ public Class<?> typeClass() {
7273

7374
@Override
7475
public boolean accept(Object o) {
75-
if(o instanceof Typed) {
76-
var t = ((Typed) o).getType();
76+
if(o instanceof Typed v) {
77+
var t = v.getType();
7778
return t == this || isNull(t) || superType.isAssignableFrom(t.typeClass());
7879
}
7980
return isNull(o) || matcher.test(o);
@@ -99,7 +100,7 @@ public static Optional<JDBCType> typeOf(Object o) {
99100
if(o instanceof Typed to) {
100101
return Optional.of(to.getType());
101102
}
102-
return Optional.of(o).flatMap(v-> findType(e-> e.typeClass().isInstance(o)));
103+
return ofNullable(o).flatMap(v-> findType(e-> e.typeClass().isInstance(o)));
103104
}
104105

105106
public static Optional<JDBCType> fromDataType(int value) {

src/main/java/org/usf/jquery/web/RequestParser.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public final class RequestParser {
2121
private char c;
2222

2323
private RequestParser(String s) {
24-
this.s = requireNonNull(s, "value is null");
24+
this.s = s;
2525
this.size = s.length();
2626
this.c = size == 0 ? 0 : s.charAt(idx);
2727
}
@@ -31,15 +31,17 @@ public static RequestEntryChain parseEntry(String s) {
3131
}
3232

3333
public static List<RequestEntryChain> parseEntries(String s) {
34-
return s.isEmpty() ? emptyList() : new RequestParser(s).parseEntries(true, c-> false);
34+
return requireNonNull(s, "value is null").isEmpty()
35+
? emptyList()
36+
: new RequestParser(s).parseEntries(true, c-> false);
3537
}
3638

3739
private List<RequestEntryChain> parseEntries(boolean multiple, CharPredicate until) {
3840
var entries = new ArrayList<RequestEntryChain>();
3941
entries.add(parseEntry());
4042
if(multiple) {
4143
while(c == ',') {
42-
nextChar(true);
44+
nextChar(false); //null parameter
4345
entries.add(parseEntry());
4446
}
4547
}
@@ -77,7 +79,7 @@ private RequestEntryChain parseEntry() {
7779
nextChar(false);
7880
return new RequestEntryChain(txt, true); //no next, no args, no tag
7981
}
80-
return new RequestEntryChain(legalNumber(c) || c == '-' ? nextWhile(RequestParser::legalValChar) : null); // decimal negative? & instant format
82+
return new RequestEntryChain(legalNumber(c) || c == '-' ? nextWhile(RequestParser::legalValChar) : null); // decimal negative? | instant format
8183
}
8284

8385
private String nextWhile(CharPredicate cp) {

0 commit comments

Comments
 (0)