Skip to content

Commit

Permalink
Fixed nullpointerexception
Browse files Browse the repository at this point in the history
  • Loading branch information
ck-c8y committed Sep 17, 2024
1 parent aeee970 commit 071d7c0
Show file tree
Hide file tree
Showing 3 changed files with 248 additions and 228 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,58 @@
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;

import javax.validation.constraints.NotNull;
import java.util.Map;

@Slf4j
@Data
@ToString()
@AllArgsConstructor
public class ConnectorSpecification implements Cloneable {

@NotNull
@JsonSetter(nulls = Nulls.SKIP)
public String name;

@NotNull
@JsonSetter(nulls = Nulls.SKIP)
public String description;

@NotNull
@JsonSetter(nulls = Nulls.SKIP)
public ConnectorType connectorType;

@NotNull
@JsonSetter(nulls = Nulls.SKIP)
public Map<String, ConnectorProperty> properties;

@NotNull
@JsonSetter(nulls = Nulls.SKIP)
public boolean supportsMessageContext;

public boolean isPropertySensitive(String property) {
return ConnectorPropertyType.SENSITIVE_STRING_PROPERTY == properties.get(property).type;
}

public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
return null;
}
}
@JsonSetter(nulls = Nulls.SKIP)
public String name;

@NotNull
@JsonSetter(nulls = Nulls.SKIP)
public String description;

@NotNull
@JsonSetter(nulls = Nulls.SKIP)
public ConnectorType connectorType;

@NotNull
@JsonSetter(nulls = Nulls.SKIP)
public Map<String, ConnectorProperty> properties;

@NotNull
@JsonSetter(nulls = Nulls.SKIP)
public boolean supportsMessageContext;

public boolean isPropertySensitive(String property) {
try {
ConnectorProperty propertyType = properties.get(property);
if (propertyType != null) {
return ConnectorPropertyType.SENSITIVE_STRING_PROPERTY == propertyType.type;
} else {
return false;
}
} catch (NullPointerException e) {
log.error("NullPointerException occurred: ({}:{})",
name,
connectorType, e);
return false;
}
}

public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@
# C8Y.bootstrap.password=<BOOTSTRAP_PASSWORD>
# C8Y.bootstrap.tenant=<TENANT_ID>
# C8Y.baseURL=<TENANT_URL>

APP.additionalSubscriptionIdTest=D552
C8Y.bootstrap.user=servicebootstrap_dynamic-mapping-service
C8Y.bootstrap.password=LzGg6yyjGUWfl1prHU999s3Y5ri8n1Xs
C8Y.bootstrap.tenant=t306817378
C8Y.baseURL=https://ck2.eu-latest.cumulocity.com
Loading

0 comments on commit 071d7c0

Please sign in to comment.