mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 00:16:16 +00:00
Addressed Codacy comments.
This commit is contained in:
parent
c64cbb351f
commit
ad5106d7d4
@ -102,53 +102,57 @@ final class CallLogNode extends BlackboardArtifactNode {
|
||||
|
||||
/**
|
||||
* Returns the phone number to display in the To/From column. The number is
|
||||
* picked from one the the 3 possible phone number attributes, based on the
|
||||
* picked from one of the 3 possible phone number attributes, based on the
|
||||
* direction of the call.
|
||||
*
|
||||
* @param artifact Call log artifact.
|
||||
*
|
||||
* @return Phone number.
|
||||
* @return Phone number to display.
|
||||
*/
|
||||
private String getPhoneNumber(BlackboardArtifact artifact) {
|
||||
String direction = getAttributeDisplayString(artifact, TSK_DIRECTION);
|
||||
|
||||
String phoneNumberToReturn = "";
|
||||
String phoneNumberToReturn;
|
||||
String fromPhoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_FROM);
|
||||
String toPhoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO);
|
||||
String phoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER);
|
||||
|
||||
switch (direction.toLowerCase()) {
|
||||
case "incoming": // NON-NLS
|
||||
|
||||
if (!StringUtils.isBlank(fromPhoneNumber)) {
|
||||
phoneNumberToReturn = fromPhoneNumber;
|
||||
} else if (!StringUtils.isBlank(phoneNumber)) {
|
||||
phoneNumberToReturn = phoneNumber;
|
||||
} else if (!StringUtils.isBlank(toPhoneNumber)) {
|
||||
phoneNumberToReturn = toPhoneNumber;
|
||||
}
|
||||
phoneNumberToReturn = getFirstNonBlank(fromPhoneNumber, phoneNumber, toPhoneNumber);
|
||||
break;
|
||||
case "outgoing": // NON-NLS
|
||||
if (!StringUtils.isBlank(toPhoneNumber)) {
|
||||
phoneNumberToReturn = toPhoneNumber;
|
||||
} else if (!StringUtils.isBlank(phoneNumber)) {
|
||||
phoneNumberToReturn = phoneNumber;
|
||||
} else if (!StringUtils.isBlank(fromPhoneNumber)) {
|
||||
phoneNumberToReturn = fromPhoneNumber;
|
||||
}
|
||||
phoneNumberToReturn = getFirstNonBlank(toPhoneNumber, phoneNumber, fromPhoneNumber);
|
||||
break;
|
||||
default:
|
||||
if (!StringUtils.isBlank(toPhoneNumber)) {
|
||||
phoneNumberToReturn = toPhoneNumber;
|
||||
} else if (!StringUtils.isBlank(fromPhoneNumber)) {
|
||||
phoneNumberToReturn = fromPhoneNumber;
|
||||
} else if (!StringUtils.isBlank(phoneNumber)) {
|
||||
phoneNumberToReturn = phoneNumber;
|
||||
}
|
||||
phoneNumberToReturn = getFirstNonBlank(toPhoneNumber, fromPhoneNumber, phoneNumber );
|
||||
break;
|
||||
}
|
||||
|
||||
return phoneNumberToReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the given string arguments in order and returns the first non blank string.
|
||||
* Returns a blank string if all the input strings are blank.
|
||||
*
|
||||
* @param string1 First string to check
|
||||
* @param string2 Second string to check
|
||||
* @param string3 Third string to check
|
||||
*
|
||||
* @retunr first non blank string if there is one, blank string otherwise.
|
||||
*
|
||||
*/
|
||||
private String getFirstNonBlank(String string1, String string2, String string3 ) {
|
||||
|
||||
if (!StringUtils.isBlank(string1)) {
|
||||
return string1;
|
||||
} else if (!StringUtils.isBlank(string2)) {
|
||||
return string2;
|
||||
} else if (!StringUtils.isBlank(string3)) {
|
||||
return string3;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
/**
|
||||
* Circumvent DataResultFilterNode's slightly odd delegation to
|
||||
* BlackboardArtifactNode.getSourceName().
|
||||
|
Loading…
x
Reference in New Issue
Block a user