Skip to content

Commit 95d10d3

Browse files
Add validation checks for keyPath whitespace in NGAssociation creation
1 parent 5141802 commit 95d10d3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ng-appserver/src/main/java/ng/appserver/NGKeyValueAssociation.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ private static void validateKeyPath( final String keyPath ) {
3939
throw new NGAssociationConstructionException( "[keyPath] doesn't support operators (keys prefixed with '@')" );
4040
}
4141

42+
if( keyPath.contains( ". " ) ) {
43+
throw new NGAssociationConstructionException( "[keyPath] has an element that starts with a space" );
44+
}
45+
46+
if( keyPath.contains( " ." ) ) {
47+
throw new NGAssociationConstructionException( "[keyPath] has an element that ends with a space" );
48+
}
49+
50+
if( keyPath.startsWith( " " ) ) {
51+
throw new NGAssociationConstructionException( "[keyPath] can't start with a space." );
52+
}
53+
54+
if( keyPath.endsWith( " " ) ) {
55+
throw new NGAssociationConstructionException( "[keyPath] can't end with a space." );
56+
}
57+
4258
if( keyPath.contains( ".." ) ) {
4359
throw new NGAssociationConstructionException( "[keyPath] can't contain two (or more) consecutive periods" );
4460
}

0 commit comments

Comments
 (0)