mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 16:36:15 +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
|
* 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.
|
* direction of the call.
|
||||||
*
|
*
|
||||||
* @param artifact Call log artifact.
|
* @param artifact Call log artifact.
|
||||||
*
|
*
|
||||||
* @return Phone number.
|
* @return Phone number to display.
|
||||||
*/
|
*/
|
||||||
private String getPhoneNumber(BlackboardArtifact artifact) {
|
private String getPhoneNumber(BlackboardArtifact artifact) {
|
||||||
String direction = getAttributeDisplayString(artifact, TSK_DIRECTION);
|
String direction = getAttributeDisplayString(artifact, TSK_DIRECTION);
|
||||||
|
|
||||||
String phoneNumberToReturn = "";
|
String phoneNumberToReturn;
|
||||||
String fromPhoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_FROM);
|
String fromPhoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_FROM);
|
||||||
String toPhoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO);
|
String toPhoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO);
|
||||||
String phoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER);
|
String phoneNumber = getAttributeDisplayString(artifact, TSK_PHONE_NUMBER);
|
||||||
|
|
||||||
switch (direction.toLowerCase()) {
|
switch (direction.toLowerCase()) {
|
||||||
case "incoming": // NON-NLS
|
case "incoming": // NON-NLS
|
||||||
|
phoneNumberToReturn = getFirstNonBlank(fromPhoneNumber, phoneNumber, toPhoneNumber);
|
||||||
if (!StringUtils.isBlank(fromPhoneNumber)) {
|
|
||||||
phoneNumberToReturn = fromPhoneNumber;
|
|
||||||
} else if (!StringUtils.isBlank(phoneNumber)) {
|
|
||||||
phoneNumberToReturn = phoneNumber;
|
|
||||||
} else if (!StringUtils.isBlank(toPhoneNumber)) {
|
|
||||||
phoneNumberToReturn = toPhoneNumber;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "outgoing": // NON-NLS
|
case "outgoing": // NON-NLS
|
||||||
if (!StringUtils.isBlank(toPhoneNumber)) {
|
phoneNumberToReturn = getFirstNonBlank(toPhoneNumber, phoneNumber, fromPhoneNumber);
|
||||||
phoneNumberToReturn = toPhoneNumber;
|
|
||||||
} else if (!StringUtils.isBlank(phoneNumber)) {
|
|
||||||
phoneNumberToReturn = phoneNumber;
|
|
||||||
} else if (!StringUtils.isBlank(fromPhoneNumber)) {
|
|
||||||
phoneNumberToReturn = fromPhoneNumber;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!StringUtils.isBlank(toPhoneNumber)) {
|
phoneNumberToReturn = getFirstNonBlank(toPhoneNumber, fromPhoneNumber, phoneNumber );
|
||||||
phoneNumberToReturn = toPhoneNumber;
|
break;
|
||||||
} else if (!StringUtils.isBlank(fromPhoneNumber)) {
|
|
||||||
phoneNumberToReturn = fromPhoneNumber;
|
|
||||||
} else if (!StringUtils.isBlank(phoneNumber)) {
|
|
||||||
phoneNumberToReturn = phoneNumber;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return phoneNumberToReturn;
|
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
|
* Circumvent DataResultFilterNode's slightly odd delegation to
|
||||||
* BlackboardArtifactNode.getSourceName().
|
* BlackboardArtifactNode.getSourceName().
|
||||||
|
Loading…
x
Reference in New Issue
Block a user