/** * Tries to get a codespace from the specified authority. This method scan first through the * identifier, then through the titles if no suitable identifier were found. */ private static String getCodeSpace(final Citation authority) { final Collection<? extends Identifier> identifiers = authority.getIdentifiers(); if (identifiers != null) { for (final Identifier id : identifiers) { final String identifier = id.getCode(); if (isValidCodeSpace(identifier)) { return identifier; } } } // The "null" locale argument is required for getting the unlocalized version. final String title = getShortestTitle(authority).toString(null); if (isValidCodeSpace(title)) { return title; } return null; }