name-parser/src/main/java/org/gbif/nameparser/NameParserGBIF.java
/**
   * Fully parse the supplied name also trying to extract authorships, a conceptual sec reference, remarks or notes
   * on the nomenclatural status. In some cases the authorship parsing proves impossible and this nameparser will
   * return null.
   *
   * For strings which are null, empty, no scientific names and scientific names that cannot be expressed by the ParsedName class
   * the parser will throw an UnparsableException with a given NameType and the original, unparsed name. This is the
   * case for all virus names and proper hybrid formulas, so make sure you catch and process this exception.
   *
   * @param scientificName the full scientific name to parse
   * @param rank the rank of the name if it is known externally. Helps identifying infrageneric names vs bracket authors
   * @param code the nomenclatural code the name falls into. Null if unknown
   *
   * @throws UnparsableNameException
   */
Fully parse the supplied name also trying to extract authorships, a conceptual sec reference, remarks or notes
on the nomenclatural status. In some cases the authorship parsing proves impossible and this nameparser will
return null.

For strings which are null, empty, no scientific names and scientific names that cannot be expressed by the ParsedName class
the parser will throw an UnparsableException with a given NameType and the original, unparsed name. This is the
case for all virus names and proper hybrid formulas, so make sure you catch and process this exception.

@param scientificName the full scientific name to parse
@param rank the rank of the name if it is known externally. Helps identifying infrageneric names vs bracket authors
@param code the nomenclatural code the name falls into. Null if unknown


Fully parse the supplied name also trying to extract authorships a conceptual sec reference remarks or notes on the nomenclatural status . In some cases the authorship parsing proves impossible and this nameparser will return null . For strings which are null empty no scientific names and scientific names that cannot be expressed by the ParsedName class the parser will throw an UnparsableException with a given NameType and the original unparsed name . This is the case for all virus names and proper hybrid formulas so make sure you catch and process this exception . @param scientificName the full scientific name to parse @param rank the rank of the name if it is known externally . Helps identifying infrageneric names vs bracket authors @param code the nomenclatural code the name falls into . Null if unknown
@Override
  public ParsedName parse(final String scientificName, Rank rank, @Nullable NomCode code) throws UnparsableNameException {
    if (Strings.isNullOrEmpty(scientificName)) {
      throw new UnparsableNameException(NameType.NO_NAME, scientificName);
    }
    FutureTask<ParsedName> task = new FutureTask<>(new ParsingJob(scientificName, rank == null ? Rank.UNRANKED : rank, code, configs));
    exec.execute(task);
    try {
      return task.get(timeout, TimeUnit.MILLISECONDS);
    } catch (InterruptedException e) {
      LOG.warn("Thread got interrupted. Stop parse job {} {}", rank, scientificName, e);
    } catch (ExecutionException e) {
      if (e.getCause() instanceof UnparsableNameException) {
        throw (UnparsableNameException) e.getCause();
      } else {
        LOG.warn("ExecutionException when parsing name: {}", scientificName, e);
      }
    } catch (TimeoutException e) {
      LOG.warn("Parsing timeout for name: {}", scientificName);
      task.cancel(true);
    }
    throw new UnparsableNameException(NameType.SCIENTIFIC, scientificName);
  }
@ Override public ParsedName parse ( final String scientificName , Rank rank , @ Nullable NomCode code ) throws UnparsableNameException { if ( Strings . isNullOrEmpty ( scientificName ) ) { throw new UnparsableNameException ( NameType . NO_NAME , scientificName ) ; } FutureTask < ParsedName > task = new FutureTask < > ( new ParsingJob ( scientificName , rank == null ? Rank . UNRANKED : rank , code , configs ) ) ; exec . execute ( task ) ; try { return task . get ( timeout , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException e ) { LOG . warn ( "Thread got interrupted. Stop parse job {} {}" , rank , scientificName , e ) ; } catch ( ExecutionException e ) { if ( e . getCause ( ) instanceof UnparsableNameException ) { throw ( UnparsableNameException ) e . getCause ( ) ; } else { LOG . warn ( "ExecutionException when parsing name: {}" , scientificName , e ) ; } } catch ( TimeoutException e ) { LOG . warn ( "Parsing timeout for name: {}" , scientificName ) ; task . cancel ( true ) ; } throw new UnparsableNameException ( NameType . SCIENTIFIC , scientificName ) ; }
Fully parse the supplied name also trying to extract authorships, a conceptual sec reference, remarks or notes
 on the nomenclatural status.
Fully parse the supplied name also trying to extract authorships a conceptual sec reference remarks or notes on the nomenclatural status .
// unwrap UnparsableNameException // parsing timeout