code: private static long parseLong(String s) {
          try {
              return Long.parseLong(s);
          } catch (NumberFormatException nfe) {
              log.error("Unable to parse long value '" + s + "'", nfe);
          }
  
          return -1;
      }
docs: Safely parses the specified string as a long and returns the value. If a
  NumberFormatException occurs while parsing the long, an error is logged
  and -1 is returned.
  
  @param s
  The string to parse and return as a long.
  
  @return The long value of the specified string, otherwise -1 if there
  were any problems parsing the string as a long.