Skip to content

Commit

Permalink
[impove] fixed sonar cloud issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrart committed Aug 6, 2024
1 parent 1ae53d7 commit 4385fc6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static FlinkCatalogParams of(FlinkCatalog flinkCatalog) {
}
} catch (JsonProcessingException e) {
log.error("Flink catalog params json read failed", e);
throw new RuntimeException(e);
throw new RuntimeException("Flink catalog params json read failed");
}

return flinkCatalogParams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static FlinkCatalog of(FlinkCatalogParams flinkCatalogParams) {
}
} catch (JsonProcessingException e) {
log.error("Flink catalog json read failed", e);
throw new RuntimeException(e);
throw new RuntimeException("Flink catalog json read failed");
}
return flinkCatalog;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Pattern;

/** catalog manage */
@Service
Expand All @@ -47,6 +48,8 @@ public class CatalogServiceImpl extends ServiceImpl<CatalogMapper, FlinkCatalog>
implements
CatalogService {

private static final String catalog_regex = "^(?:[a-z0-9]+[-\\.]?)*(?:[a-z0-9]+)$";

@Override
public boolean create(FlinkCatalogParams catalog, Long userId) {
AlertException.throwIfNull(
Expand Down Expand Up @@ -115,7 +118,6 @@ public Boolean existsByCatalogName(String catalogName) {

/** validate catalog name */
private boolean validateCatalogName(String catalogName) {
String regex = "^(?:[a-z0-9]+[-\\.]?)*(?:[a-z0-9]+)$";
return catalogName.matches(regex);
return Pattern.compile(catalog_regex).matcher(catalogName).matches();
}
}

0 comments on commit 4385fc6

Please sign in to comment.