[GitHub] geode pull request #578: GEODE-1958: Removing/deprecating PasswordUtil

2017-06-21 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/geode/pull/578


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #578: GEODE-1958: Removing/deprecating PasswordUtil

2017-06-15 Thread YehEmily
Github user YehEmily commented on a diff in the pull request:

https://github.com/apache/geode/pull/578#discussion_r122279107
  
--- Diff: 
geode-core/src/test/java/org/apache/geode/cache/util/PasswordUtilJUnitTest.java 
---
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
- * agreements. See the NOTICE file distributed with this work for 
additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the 
License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software 
distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 
ANY KIND, either express
- * or implied. See the License for the specific language governing 
permissions and limitations under
- * the License.
- */
-package org.apache.geode.cache.util;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.internal.util.PasswordUtil;
-import org.apache.geode.test.junit.categories.SecurityTest;
-import org.apache.geode.test.junit.categories.UnitTest;
-
-@Category({UnitTest.class, SecurityTest.class})
-public class PasswordUtilJUnitTest {
-
-  @Test
-  public void testPasswordUtil() {
-String x = "password";
-String z = null;
-
-// System.out.println(x);
-String y = PasswordUtil.encrypt(x);
--- End diff --

Fixed - thank you!


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #578: GEODE-1958: Removing/deprecating PasswordUtil

2017-06-13 Thread PurelyApplied
Github user PurelyApplied commented on a diff in the pull request:

https://github.com/apache/geode/pull/578#discussion_r121799720
  
--- Diff: 
geode-core/src/main/java/org/apache/geode/internal/SystemAdmin.java ---
@@ -1909,10 +1900,7 @@ private static boolean needsSysDir(String cmd) {
 if (cmd.equalsIgnoreCase("version")) {
   return false;
 }
-if (cmd.equalsIgnoreCase("help")) {
-  return false;
-}
-return true;
+return !cmd.equalsIgnoreCase("help");
--- End diff --

If you want to collapse this block, I think this might read a little better.

```
if (cmd.equalsIgnoreCase("stats")
|| cmd.equalsIgnoreCase("merge-logs")
|| cmd.equalsIgnoreCase("version")
|| cmd.equalsIgnoreCase("help")) {
return false;
}
return true;
```

I guess you could collapse that to a one-liner, but I don't think that 
would read as well.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #578: GEODE-1958: Removing/deprecating PasswordUtil

2017-06-13 Thread PurelyApplied
Github user PurelyApplied commented on a diff in the pull request:

https://github.com/apache/geode/pull/578#discussion_r121798399
  
--- Diff: 
geode-core/src/main/java/org/apache/geode/internal/util/PasswordUtil.java ---
@@ -44,72 +42,29 @@
   private static byte[] init = "string".getBytes();
 
   /**
-   * Encrypts a password string
-   * 
-   * @param password String to be encrypted.
-   * @return String encrypted String
-   */
-  public static String encrypt(String password) {
-return encrypt(password, true);
-  }
-
-  /**
-   * 
-   * @param password String to be encrypted
-   * @param echo if true prints result to system.out
-   * @return String encrypted String
+   * Decrypts an encrypted password string.
+   *
+   * @param password String to be decrypted
+   * @return String decrypted String
*/
-  public static String encrypt(String password, boolean echo) {
-String encryptedString = null;
+  @Deprecated
+  public static String decrypt(String password) {
+String toDecrypt;
+if (password.startsWith("encrypted(") && password.endsWith(")"))
--- End diff --

I don't think it gets caught by spotless, but officially we prefer to wrap 
every `if` and `else` in curly braces, even when they're just one-liners.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---