mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
refactored method names in pathvalidator
This commit is contained in:
parent
6d0419550f
commit
60ee75098f
@ -319,7 +319,7 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
|
|||||||
|
|
||||||
// Display warning if there is one (but don't disable "next" button)
|
// Display warning if there is one (but don't disable "next" button)
|
||||||
try {
|
try {
|
||||||
if (false == PathValidator.isValid(path, Case.getCurrentCaseThrows().getCaseType())) {
|
if (false == PathValidator.isValidForMultiUserCase(path, Case.getCurrentCaseThrows().getCaseType())) {
|
||||||
pathErrorLabel.setVisible(true);
|
pathErrorLabel.setVisible(true);
|
||||||
pathErrorLabel.setText(Bundle.ImageFilePanel_pathValidation_dataSourceOnCDriveError());
|
pathErrorLabel.setText(Bundle.ImageFilePanel_pathValidation_dataSourceOnCDriveError());
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ final class LocalFilesPanel extends javax.swing.JPanel {
|
|||||||
final Case.CaseType currentCaseType = Case.getCurrentCaseThrows().getCaseType();
|
final Case.CaseType currentCaseType = Case.getCurrentCaseThrows().getCaseType();
|
||||||
|
|
||||||
for (String currentPath : pathsList) {
|
for (String currentPath : pathsList) {
|
||||||
if (!PathValidator.isValid(currentPath, currentCaseType)) {
|
if (!PathValidator.isValidForMultiUserCase(currentPath, currentCaseType)) {
|
||||||
errorLabel.setVisible(true);
|
errorLabel.setVisible(true);
|
||||||
errorLabel.setText(Bundle.LocalFilesPanel_pathValidation_dataSourceOnCDriveError());
|
errorLabel.setText(Bundle.LocalFilesPanel_pathValidation_dataSourceOnCDriveError());
|
||||||
return;
|
return;
|
||||||
|
@ -191,7 +191,7 @@ final class LogicalEvidenceFilePanel extends javax.swing.JPanel implements Docum
|
|||||||
}
|
}
|
||||||
// display warning if there is one (but don't disable "next" button)
|
// display warning if there is one (but don't disable "next" button)
|
||||||
try {
|
try {
|
||||||
if (!PathValidator.isValid(path, Case.getCurrentCaseThrows().getCaseType())) {
|
if (!PathValidator.isValidForMultiUserCase(path, Case.getCurrentCaseThrows().getCaseType())) {
|
||||||
errorLabel.setVisible(true);
|
errorLabel.setVisible(true);
|
||||||
errorLabel.setText(Bundle.LogicalEvidenceFilePanel_pathValidation_dataSourceOnCDriveError());
|
errorLabel.setText(Bundle.LogicalEvidenceFilePanel_pathValidation_dataSourceOnCDriveError());
|
||||||
return false;
|
return false;
|
||||||
|
@ -152,7 +152,7 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
|
|||||||
*/
|
*/
|
||||||
caseParentDirWarningLabel.setVisible(false);
|
caseParentDirWarningLabel.setVisible(false);
|
||||||
String parentDir = getCaseParentDir();
|
String parentDir = getCaseParentDir();
|
||||||
if (!PathValidator.isValid(parentDir, getCaseType())) {
|
if (!PathValidator.isValidForMultiUserCase(parentDir, getCaseType())) {
|
||||||
caseParentDirWarningLabel.setVisible(true);
|
caseParentDirWarningLabel.setVisible(true);
|
||||||
caseParentDirWarningLabel.setText(NbBundle.getMessage(this.getClass(), "NewCaseVisualPanel1.CaseFolderOnCDriveError.text"));
|
caseParentDirWarningLabel.setText(NbBundle.getMessage(this.getClass(), "NewCaseVisualPanel1.CaseFolderOnCDriveError.text"));
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ final class NewCaseVisualPanel1 extends JPanel implements DocumentListener {
|
|||||||
* Check the base case directory if it can persist data and show a
|
* Check the base case directory if it can persist data and show a
|
||||||
* warning if it is a wrong choice
|
* warning if it is a wrong choice
|
||||||
*/
|
*/
|
||||||
if(!PathValidator.isCasedataPersistable(parentDir)){
|
if(!PathValidator.isValidForRunningOnTarget(parentDir)){
|
||||||
caseParentDirWarningLabel.setVisible(true);
|
caseParentDirWarningLabel.setVisible(true);
|
||||||
if(PlatformUtil.isWindowsOS()){
|
if(PlatformUtil.isWindowsOS()){
|
||||||
caseParentDirWarningLabel.setText(NbBundle.getMessage(this.getClass(), "NewCaseVisualPanel1.CaseFolderOnInternalDriveWindowsError.text" ));
|
caseParentDirWarningLabel.setText(NbBundle.getMessage(this.getClass(), "NewCaseVisualPanel1.CaseFolderOnInternalDriveWindowsError.text" ));
|
||||||
|
@ -32,7 +32,7 @@ public final class PathValidator {
|
|||||||
private static final Pattern driveLetterPattern = Pattern.compile("^[Cc]:.*$");
|
private static final Pattern driveLetterPattern = Pattern.compile("^[Cc]:.*$");
|
||||||
private static final Pattern unixMediaDrivePattern = Pattern.compile("^\\/(media|mnt)\\/.*$");
|
private static final Pattern unixMediaDrivePattern = Pattern.compile("^\\/(media|mnt)\\/.*$");
|
||||||
|
|
||||||
public static boolean isValid(String path, Case.CaseType caseType) {
|
public static boolean isValidForMultiUserCase(String path, Case.CaseType caseType) {
|
||||||
|
|
||||||
if (caseType == Case.CaseType.MULTI_USER_CASE) {
|
if (caseType == Case.CaseType.MULTI_USER_CASE) {
|
||||||
// check that path is not on "C:" drive
|
// check that path is not on "C:" drive
|
||||||
@ -46,7 +46,7 @@ public final class PathValidator {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isCasedataPersistable(String path) {
|
public static boolean isValidForRunningOnTarget(String path) {
|
||||||
if(checkForLiveAutopsy()) {
|
if(checkForLiveAutopsy()) {
|
||||||
if(PlatformUtil.isWindowsOS()) {
|
if(PlatformUtil.isWindowsOS()) {
|
||||||
if(pathOnCDrive(path)){
|
if(pathOnCDrive(path)){
|
||||||
|
@ -305,7 +305,7 @@ final class RawDSInputPanel extends JPanel implements DocumentListener {
|
|||||||
"RawDSInputPanel.noOpenCase.errMsg=Exception while getting open case."})
|
"RawDSInputPanel.noOpenCase.errMsg=Exception while getting open case."})
|
||||||
private void warnIfPathIsInvalid(String path) {
|
private void warnIfPathIsInvalid(String path) {
|
||||||
try {
|
try {
|
||||||
if (!PathValidator.isValid(path, Case.getCurrentCaseThrows().getCaseType())) {
|
if (!PathValidator.isValidForMultiUserCase(path, Case.getCurrentCaseThrows().getCaseType())) {
|
||||||
errorLabel.setVisible(true);
|
errorLabel.setVisible(true);
|
||||||
errorLabel.setText(Bundle.RawDSInputPanel_error_text());
|
errorLabel.setText(Bundle.RawDSInputPanel_error_text());
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ class ArchiveFilePanel extends JPanel implements DocumentListener {
|
|||||||
|
|
||||||
// display warning if there is one (but don't disable "next" button)
|
// display warning if there is one (but don't disable "next" button)
|
||||||
try {
|
try {
|
||||||
if (false == PathValidator.isValid(path, Case.getCurrentCaseThrows().getCaseType())) {
|
if (false == PathValidator.isValidForMultiUserCase(path, Case.getCurrentCaseThrows().getCaseType())) {
|
||||||
errorLabel.setVisible(true);
|
errorLabel.setVisible(true);
|
||||||
errorLabel.setText(Bundle.DataSourceOnCDriveError_text());
|
errorLabel.setText(Bundle.DataSourceOnCDriveError_text());
|
||||||
}
|
}
|
||||||
|
@ -421,7 +421,7 @@ final class MemoryDSInputPanel extends JPanel implements DocumentListener {
|
|||||||
})
|
})
|
||||||
private void warnIfPathIsInvalid(String path) {
|
private void warnIfPathIsInvalid(String path) {
|
||||||
try {
|
try {
|
||||||
if (!PathValidator.isValid(path, Case.getCurrentCaseThrows().getCaseType())) {
|
if (!PathValidator.isValidForMultiUserCase(path, Case.getCurrentCaseThrows().getCaseType())) {
|
||||||
errorLabel.setVisible(true);
|
errorLabel.setVisible(true);
|
||||||
errorLabel.setText(Bundle.MemoryDSInputPanel_errorMsg_dataSourcePathOnCdrive());
|
errorLabel.setText(Bundle.MemoryDSInputPanel_errorMsg_dataSourcePathOnCdrive());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user