File tree Expand file tree Collapse file tree 6 files changed +65
-4
lines changed
main/java/com/networknt/schema
test/java/com/networknt/schema Expand file tree Collapse file tree 6 files changed +65
-4
lines changed Original file line number Diff line number Diff line change 84
84
<artifactId >slf4j-api</artifactId >
85
85
<version >${version.slf4j} </version >
86
86
</dependency >
87
+ <!--
88
+ Commons lang slated for removal but kept for projects that accidentally depend on it
89
+ through accidental transitive runtime dependencies.
90
+
91
+ For projects that depend on it for compile they will get an immediate failure as the
92
+ scope is now runtime instead of compile.
93
+ -->
87
94
<dependency >
88
95
<groupId >org.apache.commons</groupId >
89
96
<artifactId >commons-lang3</artifactId >
90
97
<version >${version.common-lang3} </version >
98
+ <scope >runtime</scope >
91
99
</dependency >
92
100
<dependency >
93
101
<groupId >org.jruby.joni</groupId >
Original file line number Diff line number Diff line change 26
26
import com .fasterxml .jackson .databind .JsonNode ;
27
27
import com .fasterxml .jackson .databind .node .ObjectNode ;
28
28
import com .networknt .schema .ValidationContext .DiscriminatorContext ;
29
- import org . apache . commons . lang3 .StringUtils ;
29
+ import com . networknt . schema . utils .StringUtils ;
30
30
import org .slf4j .Logger ;
31
31
32
32
public abstract class BaseJsonValidator implements JsonValidator {
Original file line number Diff line number Diff line change 17
17
package com .networknt .schema ;
18
18
19
19
import com .fasterxml .jackson .databind .JsonNode ;
20
- import org . apache . commons . lang3 .StringUtils ;
20
+ import com . networknt . schema . utils .StringUtils ;
21
21
import org .slf4j .Logger ;
22
22
import org .slf4j .LoggerFactory ;
23
23
Original file line number Diff line number Diff line change 16
16
17
17
package com .networknt .schema ;
18
18
19
- import org . apache . commons . lang3 .StringUtils ;
19
+ import com . networknt . schema . utils .StringUtils ;
20
20
21
21
import java .text .MessageFormat ;
22
22
import java .util .Arrays ;
Original file line number Diff line number Diff line change
1
+ package com .networknt .schema .utils ;
2
+
3
+ public final class StringUtils {
4
+
5
+ private StringUtils () {
6
+ }
7
+
8
+ public static boolean isBlank (final CharSequence cs ) {
9
+ int strLen = length (cs );
10
+ if (strLen == 0 ) {
11
+ return true ;
12
+ }
13
+ for (int i = 0 ; i < strLen ; i ++) {
14
+ if (!Character .isWhitespace (cs .charAt (i ))) {
15
+ return false ;
16
+ }
17
+ }
18
+ return true ;
19
+ }
20
+
21
+ public static boolean isNotBlank (final CharSequence cs ) {
22
+ return !isBlank (cs );
23
+ }
24
+
25
+ private static int length (final CharSequence cs ) {
26
+ return cs == null ? 0 : cs .length ();
27
+ }
28
+
29
+ // The following was borrowed from Apache Commons Lang 3
30
+ public static boolean equals (final CharSequence cs1 , final CharSequence cs2 ) {
31
+ if (cs1 == cs2 ) {
32
+ return true ;
33
+ }
34
+ if (cs1 == null || cs2 == null ) {
35
+ return false ;
36
+ }
37
+ if (cs1 .length () != cs2 .length ()) {
38
+ return false ;
39
+ }
40
+ if (cs1 instanceof String && cs2 instanceof String ) {
41
+ return cs1 .equals (cs2 );
42
+ }
43
+ // Step-wise comparison
44
+ final int length = cs1 .length ();
45
+ for (int i = 0 ; i < length ; i ++) {
46
+ if (cs1 .charAt (i ) != cs2 .charAt (i )) {
47
+ return false ;
48
+ }
49
+ }
50
+ return true ;
51
+ }
52
+
53
+ }
Original file line number Diff line number Diff line change 21
21
import com .fasterxml .jackson .databind .node .ArrayNode ;
22
22
import io .undertow .Undertow ;
23
23
import io .undertow .server .handlers .resource .FileResourceManager ;
24
- import org . apache . commons . lang3 .StringUtils ;
24
+ import com . networknt . schema . utils .StringUtils ;
25
25
import org .junit .jupiter .api .AfterAll ;
26
26
import org .junit .jupiter .api .BeforeAll ;
27
27
You can’t perform that action at this time.
0 commit comments