Commit 8cb5b3aa authored by Lei Jiang's avatar Lei Jiang Committed by kezhenxu94

[Style] Add curly braces after `if` statements

parent 99a6f5dd
......@@ -47,8 +47,10 @@ public class NamespaceController {
@PathVariable("clusterName") String clusterName,
@PathVariable("namespaceName") String namespaceName, @RequestParam String operator) {
Namespace entity = namespaceService.findOne(appId, clusterName, namespaceName);
if (entity == null) throw new NotFoundException(
if (entity == null) {
throw new NotFoundException(
String.format("namespace not found for %s %s %s", appId, clusterName, namespaceName));
}
namespaceService.deleteNamespace(entity, operator);
}
......@@ -63,8 +65,9 @@ public class NamespaceController {
@GetMapping("/namespaces/{namespaceId}")
public NamespaceDTO get(@PathVariable("namespaceId") Long namespaceId) {
Namespace namespace = namespaceService.findOne(namespaceId);
if (namespace == null)
if (namespace == null) {
throw new NotFoundException(String.format("namespace not found for %s", namespaceId));
}
return BeanUtils.transform(NamespaceDTO.class, namespace);
}
......@@ -73,8 +76,10 @@ public class NamespaceController {
@PathVariable("clusterName") String clusterName,
@PathVariable("namespaceName") String namespaceName) {
Namespace namespace = namespaceService.findOne(appId, clusterName, namespaceName);
if (namespace == null) throw new NotFoundException(
if (namespace == null) {
throw new NotFoundException(
String.format("namespace not found for %s %s %s", appId, clusterName, namespaceName));
}
return BeanUtils.transform(NamespaceDTO.class, namespace);
}
......
......@@ -90,8 +90,12 @@ public abstract class BaseEntity {
@PrePersist
protected void prePersist() {
if (this.dataChangeCreatedTime == null) dataChangeCreatedTime = new Date();
if (this.dataChangeLastModifiedTime == null) dataChangeLastModifiedTime = new Date();
if (this.dataChangeCreatedTime == null) {
dataChangeCreatedTime = new Date();
}
if (this.dataChangeLastModifiedTime == null) {
dataChangeLastModifiedTime = new Date();
}
}
@PreUpdate
......
......@@ -66,7 +66,9 @@ public class BeanUtils {
Set<String> emptyNames = new HashSet<>();
for (PropertyDescriptor pd : pds) {
Object srcValue = src.getPropertyValue(pd.getName());
if (srcValue == null) emptyNames.add(pd.getName());
if (srcValue == null) {
emptyNames.add(pd.getName());
}
}
String[] result = new String[emptyNames.size()];
return emptyNames.toArray(result);
......@@ -91,7 +93,9 @@ public class BeanUtils {
try {
Class<?> clazz = list.get(0).getClass();
Field field = deepFindField(clazz, key);
if (field == null) throw new IllegalArgumentException("Could not find the key");
if (field == null) {
throw new IllegalArgumentException("Could not find the key");
}
field.setAccessible(true);
for (Object o : list) {
map.put((K) field.get(o), (V) o);
......@@ -119,7 +123,9 @@ public class BeanUtils {
try {
Class<?> clazz = list.get(0).getClass();
Field field = deepFindField(clazz, key);
if (field == null) throw new IllegalArgumentException("Could not find the key");
if (field == null) {
throw new IllegalArgumentException("Could not find the key");
}
field.setAccessible(true);
for (Object o : list) {
K k = (K) field.get(o);
......@@ -149,7 +155,9 @@ public class BeanUtils {
try {
Class<?> clazz = list.get(0).getClass();
Field field = deepFindField(clazz, key);
if (field == null) throw new IllegalArgumentException("Could not find the key");
if (field == null) {
throw new IllegalArgumentException("Could not find the key");
}
field.setAccessible(true);
for (Object o : list) {
set.add((K)field.get(o));
......
......@@ -242,8 +242,12 @@ public class InstanceConfigAuditUtil implements InitializingBean {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InstanceConfigAuditModel model = (InstanceConfigAuditModel) o;
return Objects.equals(appId, model.appId) &&
Objects.equals(clusterName, model.clusterName) &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment