/**
  * same as {@link #getWordSet(ResourceLoader, String, boolean)}, except the input is in snowball
  * format.
  */
 protected final CharArraySet getSnowballWordSet(
     ResourceLoader loader, String wordFiles, boolean ignoreCase) throws IOException {
   List<String> files = splitFileNames(wordFiles);
   CharArraySet words = null;
   if (files.size() > 0) {
     // default stopwords list has 35 or so words, but maybe don't make it that
     // big to start
     words = new CharArraySet(files.size() * 10, ignoreCase);
     for (String file : files) {
       InputStream stream = null;
       Reader reader = null;
       try {
         stream = loader.openResource(file.trim());
         CharsetDecoder decoder =
             StandardCharsets.UTF_8
                 .newDecoder()
                 .onMalformedInput(CodingErrorAction.REPORT)
                 .onUnmappableCharacter(CodingErrorAction.REPORT);
         reader = new InputStreamReader(stream, decoder);
         WordlistLoader.getSnowballWordSet(reader, words);
       } finally {
         IOUtils.closeWhileHandlingException(reader, stream);
       }
     }
   }
   return words;
 }
 /**
  * Returns the password that is bound to the username and is stored for the specified <code>
  * forUser</code> If the <code>forUser</code> is not specified the system user is used.
  *
  * @param forUser the user for whom the password is being retrieved
  * @param username the matching username to go with the password
  * @return the password as a character array or empty object if password could not be loaded
  */
 public static Optional<char[]> getPassword(Optional<String> forUser, String username) {
   if (username == null) {
     return Optional.empty();
   }
   final String user = forUser.orElse(System.getProperty(SYSTEM_PROPERTY_USER_NAME));
   try {
     byte[] val =
         SecurePreferences.getSecurePreferences()
             .node(Activator.ID)
             .node(user)
             .node(username)
             .getByteArray(PREF_PASSWORD, null);
     if (val != null) {
       CharBuffer buffer = StandardCharsets.UTF_8.newDecoder().decode(ByteBuffer.wrap(val));
       return Optional.of(Arrays.copyOfRange(buffer.array(), buffer.position(), buffer.limit()));
     }
   } catch (StorageException | IOException e) {
     SaveRestoreService.LOGGER.log(
         Level.WARNING,
         e,
         () -> String.format("Could not read the password for '%s' from secured storage.", user));
   }
   return Optional.empty();
 }