code: protected static int safeToInt (String intstr)
      {
          if (!StringUtil.isBlank(intstr)) {
              try {
                  return Integer.parseInt(intstr);
              } catch (NumberFormatException nfe) {
              }
          }
          return -1;
      }
docs: Converts the string to an integer, returning -1 on any error.