Skip to content

Commit

Permalink
Fixing NPE for resource with bad connectorRef reference (MID-3509)
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Dec 13, 2016
1 parent 380846f commit 4815dfd
Showing 1 changed file with 11 additions and 5 deletions.
Expand Up @@ -299,11 +299,17 @@ private InfoBoxPanel createLastAvailabilityStatusInfo(ResourceType resource) {
InfoBoxType infoBoxType = new InfoBoxType(backgroundColor, icon, parentPage.getString(messageKey));

ConnectorType connectorType = resource.getConnector();
String connectorName = StringUtils.substringAfterLast(
WebComponentUtil.getEffectiveName(connectorType, ConnectorType.F_CONNECTOR_TYPE), ".");
String connectorVersion = connectorType.getConnectorVersion();
infoBoxType.setNumber(connectorName);
infoBoxType.setDescription(connectorVersion);
if (connectorType == null) {
// Connector not found. Probably bad connectorRef reference.
infoBoxType.setNumber("--");
infoBoxType.setDescription("--");
} else {
String connectorName = StringUtils.substringAfterLast(
WebComponentUtil.getEffectiveName(connectorType, ConnectorType.F_CONNECTOR_TYPE), ".");
String connectorVersion = connectorType.getConnectorVersion();
infoBoxType.setNumber(connectorName);
infoBoxType.setDescription(connectorVersion);
}

Model<InfoBoxType> boxModel = new Model<InfoBoxType>(infoBoxType);

Expand Down

0 comments on commit 4815dfd

Please sign in to comment.