refactored method names in pathvalidator

This commit is contained in:
rishwanth1995 2018-08-10 09:45:04 -04:00
parent 6d0419550f
commit 60ee75098f
8 changed files with 10 additions and 10 deletions

View File

@ -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());
} }

View File

@ -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;

View File

@ -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;

View File

@ -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" ));

View File

@ -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)){

View File

@ -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());
} }

View File

@ -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());
} }

View File

@ -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());
} }