Github user asdf2014 commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/293#discussion_r124947780
--- Diff:
src/java/main/org/apache/zookeeper/server/auth/SASLAuthenticationProvider.java
---
@@ -28,24 +28,20 @@ public String getScheme() {
}
public KeeperException.Code
- handleAuthentication(ServerCnxn cnxn, byte[] authData)
- {
+ handleAuthentication(ServerCnxn cnxn, byte[] authData) {
// Should never call this: SASL authentication is negotiated at
session initiation.
// TODO: consider substituting current implementation of direct
ClientCnxn manipulation with
// a call to this method
(SASLAuthenticationProvider:handleAuthentication()) at session initiation.
return KeeperException.Code.AUTHFAILED;
}
- public boolean matches(String id,String aclExpr) {
- if ((id.equals("super") || id.equals(aclExpr))) {
--- End diff --
Due to...
```java
@Test
public void equalsNullPointException() throws Exception {
String normal = "yuzhouwan.com", unmoral = null;
try {
if (normal.equals("yuzhouwan.com") && unmoral.equals("")) { //
bad habit
}
} catch (Exception e) {
System.out.println("Will throw NullPointException!");
assertEquals(true, e instanceof NullPointerException);
}
boolean equals = false;
if ("yuzhouwan.com".equals(normal) || "".equals(unmoral)) { //
good habit
equals = true;
}
assertEquals(true, equals);
}
```
Full code is
[here](https://github.com/asdf2014/yuzhouwan/blob/master/yuzhouwan-hacker/src/test/java/com/yuzhouwan/hacker/effective/StringStuffTest.java).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---