protected long toLongSafe ( String toParseParam ) { if ( toParseParam == null || toParseParam . trim ( ) . isEmpty ( ) ) { return - 1 ; } try { return Long . parseLong ( toParseParam . trim ( ) ) ; } catch ( NumberFormatException e ) { return - 1 ; } }
Returns - 1 if there is a problem with conversion .