code: public static String get(final String key, String def) {
          if (key == null) {
              throw new NullPointerException("key");
          }
          if (key.isEmpty()) {
              throw new IllegalArgumentException("key must not be empty.");
          }
  
          String value = null;
          try {
              if (System.getSecurityManager() == null) {
                  value = System.getProperty(key);
              } else {
                  value = AccessController.doPrivileged(new PrivilegedAction<String>() {
                      @Override
                      public String run() {
                          return System.getProperty(key);
                      }
                  });
              }
          } catch (SecurityException e) {
              logger.warn("Unable to retrieve a system property '{}'; default values will be used.", key, e);
          }
  
          if (value == null) {
              return def;
          }
  
          return value;
      }
docs: Returns the value of the Java system property with the specified
  {@code key}, while falling back to the specified default value if
  the property access fails.
  
  @return the property value.
  {@code def} if there's no such property or if an access to the
  specified property is not allowed.