Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.KeyStore;
import java.util.Collections;
import java.util.List;
Expand All @@ -28,11 +29,10 @@
private final SecretKeyFactory kf = SecretKeyFactory.getInstance("PBE");
private final KeyStore store;
private final File secure_file;
private byte[] secureStoreByteArray;
private final char[] store_pass;
private final KeyStore.ProtectionParameter pp;

private static final Logger LOGGER = Logger.getLogger(SecureStore.class.getName());
private static final Logger LOGGER = Logger.getLogger(FileBasedStore.class.getName());

/**
* Create with default file in 'user' location
Expand Down Expand Up @@ -63,6 +63,14 @@
* @throws Exception on error
*/
public FileBasedStore(final File secure_file, final char[] store_pass) throws Exception {

File secureFileDir = secure_file.getParentFile();
if (!secureFileDir.exists()) {
if(!secureFileDir.mkdirs()){

Check warning on line 69 in core/security/src/main/java/org/phoebus/security/store/FileBasedStore.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Merge this if statement with the enclosing one.

See more on https://sonarcloud.io/project/issues?id=ControlSystemStudio_phoebus&issues=AZ5vA6PGHQMz5Dl40GjS&open=AZ5vA6PGHQMz5Dl40GjS&pullRequest=3813
throw new IOException("Cannot create directory for secure store");
}
}

this.secure_file = secure_file;
this.store_pass = store_pass;

Expand Down
Loading