File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
hugegraph-api/src/main/java/com/baidu/hugegraph/api Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 3434import javax .ws .rs .QueryParam ;
3535import javax .ws .rs .core .Context ;
3636
37+ import org .apache .commons .lang3 .StringUtils ;
3738import org .slf4j .Logger ;
3839
3940import com .baidu .hugegraph .HugeGraph ;
@@ -208,15 +209,15 @@ public HugeUser build() {
208209
209210 @ Override
210211 public void checkCreate (boolean isBatch ) {
211- E .checkArgumentNotNull ( this .name ,
212- "The name of user can't be null" );
213- E .checkArgumentNotNull ( this .password ,
214- "The password of user can't be null" );
212+ E .checkArgument (! StringUtils . isEmpty ( this .name ) ,
213+ "The name of user can't be null" );
214+ E .checkArgument (! StringUtils . isEmpty ( this .password ) ,
215+ "The password of user can't be null" );
215216 }
216217
217218 @ Override
218219 public void checkUpdate () {
219- E .checkArgument (this .password != null ||
220+ E .checkArgument (! StringUtils . isEmpty ( this .password ) ||
220221 this .phone != null ||
221222 this .email != null ||
222223 this .avatar != null ,
Original file line number Diff line number Diff line change 3737import javax .ws .rs .ext .Provider ;
3838import javax .xml .bind .DatatypeConverter ;
3939
40+ import org .apache .commons .lang3 .StringUtils ;
4041import org .apache .tinkerpop .gremlin .server .auth .AuthenticationException ;
4142import org .glassfish .grizzly .http .server .Request ;
4243import org .glassfish .grizzly .utils .Charsets ;
@@ -113,7 +114,11 @@ protected User authenticate(ContainerRequestContext context) {
113114
114115 final String username = values [0 ];
115116 final String password = values [1 ];
116- assert username != null && password != null ;
117+
118+ if (StringUtils .isEmpty (username ) || StringUtils .isEmpty (password )) {
119+ throw new BadRequestException (
120+ "Invalid syntax for username and password" );
121+ }
117122
118123 // Validate the extracted credentials
119124 try {
You can’t perform that action at this time.
0 commit comments