"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/FilePasswordProvider.java" between
apache-log4j-2.11.1-src.tar.gz and apache-log4j-2.11.2-src.tar.gz

About: Apache Log4j 2 is a logging library for Java. Source distribution (Java).

FilePasswordProvider.java  (apache-log4j-2.11.1-src):FilePasswordProvider.java  (apache-log4j-2.11.2-src)
skipping to change at line 68 skipping to change at line 68
if (!Files.exists(passwordPath)) { if (!Files.exists(passwordPath)) {
throw new NoSuchFileException("PasswordFile '" + passwordFile + "' d oes not exist"); throw new NoSuchFileException("PasswordFile '" + passwordFile + "' d oes not exist");
} }
} }
@Override @Override
public char[] getPassword() { public char[] getPassword() {
byte[] bytes = null; byte[] bytes = null;
try { try {
bytes = Files.readAllBytes(passwordPath); bytes = Files.readAllBytes(passwordPath);
ByteBuffer bb = ByteBuffer.wrap(bytes); final ByteBuffer bb = ByteBuffer.wrap(bytes);
CharBuffer decoded = Charset.defaultCharset().decode(bb); final CharBuffer decoded = Charset.defaultCharset().decode(bb);
char[] result = new char[decoded.limit()]; final char[] result = new char[decoded.limit()];
decoded.get(result, 0, result.length); decoded.get(result, 0, result.length);
decoded.rewind(); decoded.rewind();
decoded.put(new char[result.length]); // erase decoded CharBuffer decoded.put(new char[result.length]); // erase decoded CharBuffer
return result; return result;
} catch (IOException e) { } catch (final IOException e) {
throw new IllegalStateException("Could not read password from " + pa sswordPath + ": " + e, e); throw new IllegalStateException("Could not read password from " + pa sswordPath + ": " + e, e);
} finally { } finally {
if (bytes != null) { if (bytes != null) {
Arrays.fill(bytes, (byte) 0x0); Arrays.fill(bytes, (byte) 0x0);
} }
} }
} }
} }
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)