This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev by this push:
new c032163d4 [Refactor] Refactor ObjectUtils and CommonUtils (#3201)
c032163d4 is described below
commit c032163d467fd593d066cc85cc674f6cd30e9ff1
Author: gongzhongqiang <[email protected]>
AuthorDate: Wed Sep 27 21:49:26 2023 +0800
[Refactor] Refactor ObjectUtils and CommonUtils (#3201)
Co-authored-by: gongzhongqiang <[email protected]>
---
.../streampark/console/base/util/CommonUtils.java | 662 ---------------
.../streampark/console/base/util/ObjectUtils.java | 889 +--------------------
.../streampark/console/core/entity/Project.java | 9 +-
.../impl/ApplicationManageServiceImpl.java | 9 +-
.../core/service/impl/SavePointServiceImpl.java | 3 +-
5 files changed, 15 insertions(+), 1557 deletions(-)
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/CommonUtils.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/CommonUtils.java
deleted file mode 100644
index 757e8a335..000000000
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/CommonUtils.java
+++ /dev/null
@@ -1,662 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.streampark.console.base.util;
-
-import org.apache.streampark.common.util.Utils;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.cglib.beans.BeanMap;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Serializable;
-import java.lang.management.ManagementFactory;
-import java.lang.management.RuntimeMXBean;
-import java.net.URI;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-@Slf4j
-public final class CommonUtils implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private static final String OS_NAME = "os.name";
- private static final String LINUX = "linux";
- private static final String MAC = "mac";
- private static final String WINDOWS = "windows";
- private static final String MAC_OS = "os";
- private static final String OS2 = "os/2";
- private static final String SOLARIS = "solaris";
- private static final String SUNOS = "sunos";
- private static final String MPE_IX = "mpe/ix";
- private static final String HP_UX = "hp-ux";
- private static final String AIX = "aix";
- private static final String OS_390 = "os/390";
- private static final String FREEBSD = "freebsd";
- private static final String IRIX = "irix";
- private static final String DIGITAL = "digital";
- private static final String UNIX = "unix";
- private static final String NETWARE = "netware";
- private static final String OSF1 = "osf1";
- private static final String OPENVMS = "openvms";
-
- private static final String OS = System.getProperty(OS_NAME).toLowerCase();
-
- private CommonUtils() {}
-
- /**
- * is empty
- *
- * @param objs handle obj
- * @return Boolean
- * @see <b>Returns true if the object is Null, returns true if the size of
the collection is 0,
- * and returns true if the iterator has no next</b>
- * @since 1.0
- */
- public static Boolean isEmpty(Object... objs) {
- if (objs == null) {
- return Boolean.TRUE;
- }
-
- if (objs.length == 0) {
- return Boolean.TRUE;
- }
-
- for (Object obj : objs) {
- if (obj == null) {
- return true;
- }
-
- // char sequence
- if ((obj instanceof CharSequence) && obj.toString().trim().isEmpty()) {
- return true;
- }
- // collection
- if (obj instanceof Collection) {
- if (((Collection<?>) obj).isEmpty()) {
- return true;
- }
- }
- // map
- if (obj instanceof Map) {
- if (((Map<?, ?>) obj).isEmpty()) {
- return true;
- }
- }
-
- if (obj instanceof Iterable) {
- if (((Iterable<?>) obj).iterator() == null || !((Iterable<?>)
obj).iterator().hasNext()) {
- return true;
- }
- }
-
- // iterator
- if (obj instanceof Iterator) {
- if (!((Iterator<?>) obj).hasNext()) {
- return true;
- }
- }
-
- // file
- if (obj instanceof File) {
- if (!((File) obj).exists()) {
- return true;
- }
- }
-
- if ((obj instanceof Object[]) && ((Object[]) obj).length == 0) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * non-empty
- *
- * @param obj handle obj
- * @return Boolean
- * @since 1.0
- */
- public static Boolean notEmpty(Object... obj) {
- return !isEmpty(obj);
- }
-
- public static Long toLong(Object val, Long defVal) {
- if (isEmpty(val)) {
- return defVal;
- }
- try {
- return Long.parseLong(val.toString());
- } catch (NumberFormatException e) {
- return defVal;
- }
- }
-
- public static Long toLong(Object val) {
- return toLong(val, null);
- }
-
- public static Integer toInt(Object val, Integer defVal) {
- if (isEmpty(val)) {
- return defVal;
- }
- try {
- return Integer.parseInt(val.toString());
- } catch (NumberFormatException e) {
- return defVal;
- }
- }
-
- public static float toFloat(Object val, float defVal) {
- if (isEmpty(val)) {
- return defVal;
- }
- try {
- return Float.parseFloat(val.toString());
- } catch (NumberFormatException e) {
- return defVal;
- }
- }
-
- public static Boolean toBoolean(String text, Boolean defVal) {
- if (isEmpty(text)) {
- return false;
- }
- try {
- return Boolean.parseBoolean(text);
- } catch (NumberFormatException e) {
- return defVal;
- }
- }
-
- public static Boolean toBoolean(String text) {
- return toBoolean(text, false);
- }
-
- public static Integer toInt(Object val) {
- return toInt(val, null);
- }
-
- public static Float toFloat(Object val) {
- return toFloat(val, 0f);
- }
-
- public static List arrayToList(Object source) {
- return Arrays.asList(ObjectUtils.toObjectArray(source));
- }
-
- public static boolean contains(Iterator iterator, Object element) {
- if (iterator != null) {
- while (iterator.hasNext()) {
- Object candidate = iterator.next();
- if (ObjectUtils.equals(candidate, element)) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Check whether the given Enumeration contains the given element.
- *
- * @param enumeration the Enumeration to check
- * @param element the element to look for
- * @return <code>true</code> if found, <code>false</code> else
- */
- public static boolean contains(Enumeration enumeration, Object element) {
- if (enumeration != null) {
- while (enumeration.hasMoreElements()) {
- Object candidate = enumeration.nextElement();
- if (ObjectUtils.equals(candidate, element)) {
- return true;
- }
- }
- }
- return false;
- }
-
- public static boolean deleteFile(File dir) {
- if (!dir.exists()) {
- return false;
- }
- if (dir.isDirectory()) {
- for (File file : dir.listFiles()) {
- if (!deleteFile(file)) {
- return false;
- }
- }
- }
- return dir.delete();
- }
-
- /**
- * Check whether the given Collection contains the given element instance.
- *
- * <p>Enforces the given instance to be present, rather than returning
<code>true</code> for an
- * equal element as well.
- *
- * @param collection the Collection to check
- * @param element the element to look for
- * @return <code>true</code> if found, <code>false</code> else
- */
- public static boolean containsInstance(Collection collection, Object
element) {
- if (collection != null) {
- for (Object candidate : collection) {
- if (candidate == element) {
- return true;
- }
- }
- }
- return false;
- }
-
- public static <A, E extends A> A[] toArray(Enumeration<E> enumeration, A[]
array) {
- List<A> elements = new ArrayList<>();
- while (enumeration.hasMoreElements()) {
- elements.add(enumeration.nextElement());
- }
- return elements.toArray(array);
- }
-
- /**
- * Adapt an enumeration to an iterator.
- *
- * @param enumeration the enumeration
- * @return the iterator
- */
- public static <E> Iterator<E> toIterator(Enumeration<E> enumeration) {
- @SuppressWarnings("hiding")
- class EnumerationIterator<E> implements Iterator<E> {
- private final Enumeration<E> enumeration;
-
- public EnumerationIterator(Enumeration<E> enumeration) {
- this.enumeration = enumeration;
- }
-
- @Override
- public boolean hasNext() {
- return this.enumeration.hasMoreElements();
- }
-
- @Override
- public E next() {
- return this.enumeration.nextElement();
- }
-
- @Override
- public void remove() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Not supported");
- }
- }
-
- return new EnumerationIterator<E>(enumeration);
- }
-
- public static String getOsName() {
- return OS;
- }
-
- public static boolean isLinux() {
- return OS.contains(LINUX);
- }
-
- public static boolean isMacOS() {
- return OS.contains(MAC) && OS.indexOf(MAC_OS) > 0 && !OS.contains("x");
- }
-
- public static boolean isMacOSX() {
- return OS.contains(MAC) && OS.indexOf(MAC_OS) > 0 && OS.indexOf("x") > 0;
- }
-
- public static boolean isWindows() {
- return OS.contains(WINDOWS);
- }
-
- public static boolean isOS2() {
- return OS.contains(OS2);
- }
-
- public static boolean isSolaris() {
- return OS.contains(SOLARIS);
- }
-
- public static boolean isSunOS() {
- return OS.contains(SUNOS);
- }
-
- public static boolean isMPEiX() {
- return OS.contains(MPE_IX);
- }
-
- public static boolean isHPUX() {
- return OS.contains(HP_UX);
- }
-
- public static boolean isAix() {
- return OS.contains(AIX);
- }
-
- public static boolean isOS390() {
- return OS.contains(OS_390);
- }
-
- public static boolean isFreeBSD() {
- return OS.contains(FREEBSD);
- }
-
- public static boolean isIrix() {
- return OS.contains(IRIX);
- }
-
- public static boolean isDigitalUnix() {
- return OS.contains(DIGITAL) && OS.indexOf(UNIX) > 0;
- }
-
- public static boolean isNetWare() {
- return OS.contains(NETWARE);
- }
-
- public static boolean isOSF1() {
- return OS.contains(OSF1);
- }
-
- public static boolean isOpenVMS() {
- return OS.contains(OPENVMS);
- }
-
- public static boolean isUnix() {
- boolean isUnix = isLinux();
- if (!isUnix) {
- isUnix = isMacOS();
- }
- if (!isUnix) {
- isUnix = isMacOSX();
- }
- if (!isUnix) {
- isUnix = isLinux();
- }
- if (!isUnix) {
- isUnix = isDigitalUnix();
- }
- if (!isUnix) {
- isUnix = isAix();
- }
- if (!isUnix) {
- isUnix = isFreeBSD();
- }
- if (!isUnix) {
- isUnix = isHPUX();
- }
- if (!isUnix) {
- isUnix = isIrix();
- }
- if (!isUnix) {
- isUnix = isMPEiX();
- }
- if (!isUnix) {
- isUnix = isNetWare();
- }
- if (!isUnix) {
- isUnix = isOpenVMS();
- }
- if (!isUnix) {
- isUnix = isOS2();
- }
- if (!isUnix) {
- isUnix = isOS390();
- }
- if (!isUnix) {
- isUnix = isOSF1();
- }
- if (!isUnix) {
- isUnix = isSunOS();
- }
- if (!isUnix) {
- isUnix = isSolaris();
- }
- return isUnix;
- }
-
- /** linux kernel platform 1 window: 2 other platforms 0 */
- public static int getPlatform() {
- int platform = 0;
- if (CommonUtils.isUnix()) {
- platform = 1;
- }
- if (CommonUtils.isWindows()) {
- platform = 2;
- }
- return platform;
- }
-
- public static <K, V extends Comparable<? super V>> Map<K, V>
sortMapByValue(Map<K, V> map) {
- List<Map.Entry<K, V>> list = new LinkedList<>(map.entrySet());
- list.sort(Map.Entry.comparingByValue());
- Map<K, V> result = new LinkedHashMap<>();
- for (Map.Entry<K, V> entry : list) {
- result.put(entry.getKey(), entry.getValue());
- }
- return result;
- }
-
- public static <T> T[] arrayRemoveElements(T[] array, T... elem) {
- Utils.notNull(array);
- List<T> arrayList = new ArrayList<>(0);
- Collections.addAll(arrayList, array);
- if (isEmpty(elem)) {
- return array;
- }
- for (T el : elem) {
- arrayList.remove(el);
- }
- return Arrays.copyOf(arrayList.toArray(array), arrayList.size());
- }
-
- public static <T> T[] arrayRemoveIndex(T[] array, int... index) {
- Utils.notNull(array);
- for (int j : index) {
- if (j < 0 || j > array.length - 1) {
- throw new IndexOutOfBoundsException("index error.@" + j);
- }
- }
- List<T> arrayList = new ArrayList<>(0);
- Collections.addAll(arrayList, array);
- int i = 0;
- for (int j : index) {
- arrayList.remove(j - i);
- ++i;
- }
- return Arrays.copyOf(arrayList.toArray(array), arrayList.size());
- }
-
- public static <T> T[] arrayInsertIndex(T[] array, int index, T t) {
- Utils.notNull(array);
- List<T> arrayList = new ArrayList<>(array.length + 1);
- if (index == 0) {
- arrayList.add(t);
- Collections.addAll(arrayList, array);
- } else {
- T[] before = Arrays.copyOfRange(array, 0, index);
- T[] after = Arrays.copyOfRange(array, index, array.length);
- Collections.addAll(arrayList, before);
- arrayList.add(t);
- Collections.addAll(arrayList, after);
- }
- return arrayList.toArray(array);
- }
-
- public static String uuid() {
- return UUID.randomUUID().toString().replaceAll("-", "");
- }
-
- /**
- * generate specific length uuid
- *
- * @param len len
- * @return uuid
- */
- public static String uuid(int len) {
- StringBuffer sb = new StringBuffer();
- while (sb.length() < len) {
- sb.append(uuid());
- }
- return sb.substring(0, len);
- }
-
- public static Double fixedNum(Number number) {
- return fixedNum(number, 2);
- }
-
- public static Double fixedNum(Number number, int offset) {
- if (number.doubleValue() == 0.00) {
- return 0D;
- }
- StringBuilder prefix = new StringBuilder();
- while (offset > 0) {
- prefix.append("0");
- offset -= 1;
- }
-
- DecimalFormat df = new DecimalFormat("#." + prefix);
- try {
- return Double.parseDouble(df.format(number));
- } catch (NumberFormatException e) {
- log.error(e.getMessage(), e);
- return 0.0;
- }
- }
-
- public static String toPercent(Number number) {
- return toPercent(number, 0);
- }
-
- public static String toPercent(Number number, int offset) {
- offset += 2;
- Double num = fixedNum(number, offset);
- return (num * 100) + "%";
- }
-
- /**
- * convert bean to map
- *
- * @param bean bean
- * @return map
- */
- public static <T> Map<String, Object> beanToMap(T bean) {
- Map<String, Object> map = new HashMap<>();
- if (bean != null) {
- BeanMap beanMap = BeanMap.create(bean);
- for (Object key : beanMap.keySet()) {
- map.put(String.valueOf(key), beanMap.get(key));
- }
- }
- return map;
- }
-
- /**
- * convert map to bean
- *
- * @param map map
- * @param bean bean class
- * @return bean
- */
- public static <T> T mapToBean(Map<String, Object> map, T bean) {
- BeanMap beanMap = BeanMap.create(bean);
- beanMap.putAll(map);
- return bean;
- }
-
- /**
- * convert List<T> to List<Map<String, Object>>
- *
- * @param objList
- * @return
- * @throws IOException
- */
- public static <T> List<Map<String, Object>> objectsToMaps(List<T> objList) {
- List<Map<String, Object>> list = new ArrayList<>();
- if (objList != null && !objList.isEmpty()) {
- Map<String, Object> map = null;
- T bean = null;
- for (T t : objList) {
- bean = t;
- map = beanToMap(bean);
- list.add(map);
- }
- }
- return list;
- }
-
- /**
- * convert List<Map<String,Object>> to List<T>
- *
- * @param maps maps
- * @param clazz element class
- * @return
- * @throws InstantiationException
- * @throws IllegalAccessException
- */
- public static <T> List<T> mapsToObjects(List<Map<String, Object>> maps,
Class<T> clazz)
- throws InstantiationException, IllegalAccessException {
- List<T> list = new ArrayList<>();
- if (maps != null && !maps.isEmpty()) {
- Map<String, Object> map;
- T bean;
- for (Map<String, Object> stringObjectMap : maps) {
- map = stringObjectMap;
- bean = clazz.newInstance();
- mapToBean(map, bean);
- list.add(bean);
- }
- }
- return list;
- }
-
- public static Integer getPid() {
- RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
- String name = runtime.getName();
- try {
- return Integer.parseInt(name.substring(0, name.indexOf('@')));
- } catch (Exception e) {
- return -1;
- }
- }
-
- public static boolean isLegalUrl(String url) {
- try {
- new URI(url);
- return true;
- } catch (Exception ignored) {
- return false;
- }
- }
-}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/ObjectUtils.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/ObjectUtils.java
index c16d2a42f..dc8a7b2a3 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/ObjectUtils.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/ObjectUtils.java
@@ -17,278 +17,17 @@
package org.apache.streampark.console.base.util;
-import java.lang.reflect.Array;
-import java.util.Arrays;
+import java.util.Objects;
public final class ObjectUtils {
private ObjectUtils() {}
- private static final int INITIAL_HASH = 7;
- private static final int MULTIPLIER = 31;
-
- private static final String EMPTY_STRING = "";
- private static final String NULL_STRING = "null";
- private static final String ARRAY_START = "{";
- private static final String ARRAY_END = "}";
- private static final String EMPTY_ARRAY = ARRAY_START + ARRAY_END;
- private static final String ARRAY_ELEMENT_SEPARATOR = ", ";
-
- /**
- * Return whether the given throwable is a checked exception: that is,
neither a RuntimeException
- * nor an Error.
- *
- * @param ex the throwable to check
- * @return whether the throwable is a checked exception
- * @see Exception
- * @see RuntimeException
- * @see Error
- */
- public static boolean isCheckedException(Throwable ex) {
- return !(ex instanceof RuntimeException || ex instanceof Error);
- }
-
- /**
- * Check whether the given exception is compatible with the exceptions
declared in a throws
- * clause.
- *
- * @param ex the exception to checked
- * @param declaredExceptions the exceptions declared in the throws clause
- * @return whether the given exception is compatible
- */
- @SuppressWarnings({"unchecked", "rawtypes"})
- public static boolean isCompatibleWithThrowsClause(Throwable ex, Class[]
declaredExceptions) {
- if (!isCheckedException(ex)) {
- return true;
- }
- if (declaredExceptions != null) {
- int i = 0;
- while (i < declaredExceptions.length) {
- if (declaredExceptions[i].isAssignableFrom(ex.getClass())) {
- return true;
- }
- i++;
- }
- }
- return false;
- }
-
- /**
- * Determine whether the given object is an array: either an Object array or
a primitive array.
- *
- * @param obj the object to check
- */
- public static boolean isArray(Object obj) {
- return (obj != null && obj.getClass().isArray());
- }
-
- /**
- * Determine whether the given array is empty: i.e. <code>null</code> or of
zero length.
- *
- * @param array the array to check
- */
- public static boolean isEmpty(Object[] array) {
- return (array == null || array.length == 0);
- }
-
- /**
- * Check whether the given array contains the given element.
- *
- * @param array the array to check (may be <code>null</code>, in which case
the return value will
- * always be <code>false</code>)
- * @param element the element to check for
- * @return whether the element has been found in the given array
- */
- public static boolean containsElement(Object[] array, Object element) {
- if (array == null) {
- return false;
- }
- for (Object arrayEle : array) {
- if (equals(arrayEle, element)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Check whether the given array of enum constants contains a constant with
the given name,
- * ignoring case when determining a match.
- *
- * @param enumValues the enum values to check, typically the product of a
call to MyEnum.values()
- * @param constant the constant name to find (must not be null or empty
string)
- * @return whether the constant has been found in the given array
- */
- public static boolean containsConstant(Enum<?>[] enumValues, String
constant) {
- return containsConstant(enumValues, constant, false);
- }
-
- /**
- * Check whether the given array of enum constants contains a constant with
the given name.
- *
- * @param enumValues the enum values to check, typically the product of a
call to MyEnum.values()
- * @param constant the constant name to find (must not be null or empty
string)
- * @param caseSensitive whether case is significant in determining a match
- * @return whether the constant has been found in the given array
- */
- public static boolean containsConstant(
- Enum<?>[] enumValues, String constant, boolean caseSensitive) {
- for (Enum<?> candidate : enumValues) {
- if (caseSensitive
- ? candidate.toString().equals(constant)
- : candidate.toString().equalsIgnoreCase(constant)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Case insensitive alternative to {@link Enum#valueOf(Class, String)}.
- *
- * @param <E> the concrete Enum type
- * @param enumValues the array of all Enum constants in question, usually
per Enum.values()
- * @param constant the constant to get the enum value of
- * @throws IllegalArgumentException if the given constant is not found in
the given array of enum
- * values. Use {@link #containsConstant(Enum[], String)} as a guard to
avoid this exception.
- */
- public static <E extends Enum<?>> E caseInsensitiveValueOf(E[] enumValues,
String constant) {
- for (E candidate : enumValues) {
- if (candidate.toString().equalsIgnoreCase(constant)) {
- return candidate;
- }
- }
- throw new IllegalArgumentException(
- String.format(
- "constant [%s] does not exist in enum type %s",
- constant, enumValues.getClass().getComponentType().getName()));
- }
-
- /**
- * Append the given object to the given array, returning a new array
consisting of the input array
- * contents plus the given object.
- *
- * @param array the array to append to (can be <code>null</code>)
- * @param obj the object to append
- * @return the new array (of the same component type; never
<code>null</code>)
- */
- public static <A, O extends A> A[] addObjectToArray(A[] array, O obj) {
- Class<?> compType = Object.class;
- if (array != null) {
- compType = array.getClass().getComponentType();
- } else if (obj != null) {
- compType = obj.getClass();
- }
- int newArrLength = (array != null ? array.length + 1 : 1);
- @SuppressWarnings("unchecked")
- A[] newArr = (A[]) Array.newInstance(compType, newArrLength);
- if (array != null) {
- System.arraycopy(array, 0, newArr, 0, array.length);
- }
- newArr[newArr.length - 1] = obj;
- return newArr;
- }
-
- /**
- * Convert the given array (which may be a primitive array) to an object
array (if necessary of
- * primitive wrapper objects).
- *
- * <p>A <code>null</code> source value will be converted to an empty Object
array.
- *
- * @param source the (potentially primitive) array
- * @return the corresponding object array (never <code>null</code>)
- * @throws IllegalArgumentException if the parameter is not an array
- */
- public static Object[] toObjectArray(Object source) {
- if (source instanceof Object[]) {
- return (Object[]) source;
- }
- if (source == null) {
- return new Object[0];
- }
- if (!source.getClass().isArray()) {
- throw new IllegalArgumentException("Source is not an array: " + source);
- }
- int length = Array.getLength(source);
- if (length == 0) {
- return new Object[0];
- }
- @SuppressWarnings("rawtypes")
- Class wrapperType = Array.get(source, 0).getClass();
- Object[] newArray = (Object[]) Array.newInstance(wrapperType, length);
- for (int i = 0; i < length; i++) {
- newArray[i] = Array.get(source, i);
- }
- return newArray;
- }
-
- // ---------------------------------------------------------------------
- // Convenience methods for content-based equality/hash-code handling
- // ---------------------------------------------------------------------
-
- /**
- * Determine if the given objects are equal, returning <code>true</code> if
both are <code>null
- * </code> or <code>false</code> if only one is <code>null</code>.
- *
- * <p>Compares arrays with <code>Arrays.equals</code>, performing an
equality check based on the
- * array elements rather than the array reference.
- *
- * @param o1 first Object to compare
- * @param o2 second Object to compare
- * @return whether the given objects are equal
- * @see Arrays#equals
- */
- public static boolean equals(Object o1, Object o2) {
- if (o1 == null || o2 == null) {
- return false;
- }
-
- if (o1 == o2) {
- return true;
- }
-
- if (o1.equals(o2)) {
- return true;
- }
- if (o1.getClass().isArray() && o2.getClass().isArray()) {
- if (o1 instanceof Object[] && o2 instanceof Object[]) {
- return Arrays.equals((Object[]) o1, (Object[]) o2);
- }
- if (o1 instanceof boolean[] && o2 instanceof boolean[]) {
- return Arrays.equals((boolean[]) o1, (boolean[]) o2);
- }
- if (o1 instanceof byte[] && o2 instanceof byte[]) {
- return Arrays.equals((byte[]) o1, (byte[]) o2);
- }
- if (o1 instanceof char[] && o2 instanceof char[]) {
- return Arrays.equals((char[]) o1, (char[]) o2);
- }
- if (o1 instanceof double[] && o2 instanceof double[]) {
- return Arrays.equals((double[]) o1, (double[]) o2);
- }
- if (o1 instanceof float[] && o2 instanceof float[]) {
- return Arrays.equals((float[]) o1, (float[]) o2);
- }
- if (o1 instanceof int[] && o2 instanceof int[]) {
- return Arrays.equals((int[]) o1, (int[]) o2);
- }
- if (o1 instanceof long[] && o2 instanceof long[]) {
- return Arrays.equals((long[]) o1, (long[]) o2);
- }
- if (o1 instanceof short[] && o2 instanceof short[]) {
- return Arrays.equals((short[]) o1, (short[]) o2);
- }
- }
- return false;
- }
-
public static boolean trimEquals(Object o1, Object o2) {
- boolean equals = equals(o1, o2);
+ boolean equals = Objects.deepEquals(o1, o2);
if (!equals) {
- if (o1 != null && o2 != null) {
- if (o1 instanceof String && o2 instanceof String) {
- return o1.toString().trim().equals(o2.toString().trim());
- }
+ if (o1 instanceof String && o2 instanceof String) {
+ return o1.toString().trim().equals(o2.toString().trim());
}
}
return equals;
@@ -297,624 +36,4 @@ public final class ObjectUtils {
public static boolean trimNoEquals(Object o1, Object o2) {
return !trimEquals(o1, o2);
}
-
- /**
- * Return as hash code for the given object; typically the value of <code>
- * {@link Object#hashCode()}</code>. If the object is an array, this method
will delegate to any
- * of the <code>safeHashCode</code> methods for arrays in this class. If the
object is <code>null
- * </code>, this method returns 0.
- *
- * @see #safeHashCode(Object[])
- * @see #safeHashCode(boolean[])
- * @see #safeHashCode(byte[])
- * @see #safeHashCode(char[])
- * @see #safeHashCode(double[])
- * @see #safeHashCode(float[])
- * @see #safeHashCode(int[])
- * @see #safeHashCode(long[])
- * @see #safeHashCode(short[])
- */
- public static int safeHashCode(Object obj) {
- if (obj == null) {
- return 0;
- }
- if (obj.getClass().isArray()) {
- if (obj instanceof Object[]) {
- return safeHashCode((Object[]) obj);
- }
- if (obj instanceof boolean[]) {
- return safeHashCode((boolean[]) obj);
- }
- if (obj instanceof byte[]) {
- return safeHashCode((byte[]) obj);
- }
- if (obj instanceof char[]) {
- return safeHashCode((char[]) obj);
- }
- if (obj instanceof double[]) {
- return safeHashCode((double[]) obj);
- }
- if (obj instanceof float[]) {
- return safeHashCode((float[]) obj);
- }
- if (obj instanceof int[]) {
- return safeHashCode((int[]) obj);
- }
- if (obj instanceof long[]) {
- return safeHashCode((long[]) obj);
- }
- if (obj instanceof short[]) {
- return safeHashCode((short[]) obj);
- }
- }
- return obj.hashCode();
- }
-
- /**
- * Return a hash code based on the contents of the specified array. If
<code>array</code> is
- * <code>null</code>, this method returns 0.
- */
- public static int safeHashCode(Object[] array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- for (Object anArray : array) {
- hash = MULTIPLIER * hash + safeHashCode(anArray);
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array. If
<code>array</code> is
- * <code>null</code>, this method returns 0.
- */
- public static int safeHashCode(boolean[] array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- for (boolean anArray : array) {
- hash = MULTIPLIER * hash + hashCode(anArray);
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array. If
<code>array</code> is
- * <code>null</code>, this method returns 0.
- */
- public static int safeHashCode(byte[] array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- for (byte anArray : array) {
- hash = MULTIPLIER * hash + anArray;
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array. If
<code>array</code> is
- * <code>null</code>, this method returns 0.
- */
- public static int safeHashCode(char[] array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- for (char anArray : array) {
- hash = MULTIPLIER * hash + anArray;
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array. If
<code>array</code> is
- * <code>null</code>, this method returns 0.
- */
- public static int safeHashCode(double[] array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- for (double anArray : array) {
- hash = MULTIPLIER * hash + hashCode(anArray);
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array. If
<code>array</code> is
- * <code>null</code>, this method returns 0.
- */
- public static int safeHashCode(float[] array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- for (float anArray : array) {
- hash = MULTIPLIER * hash + hashCode(anArray);
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array. If
<code>array</code> is
- * <code>null</code>, this method returns 0.
- */
- public static int safeHashCode(int[] array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- for (int anArray : array) {
- hash = MULTIPLIER * hash + anArray;
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array. If
<code>array</code> is
- * <code>null</code>, this method returns 0.
- */
- public static int safeHashCode(long[] array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- for (long anArray : array) {
- hash = MULTIPLIER * hash + hashCode(anArray);
- }
- return hash;
- }
-
- /**
- * Return a hash code based on the contents of the specified array. If
<code>array</code> is
- * <code>null</code>, this method returns 0.
- */
- public static int safeHashCode(short[] array) {
- if (array == null) {
- return 0;
- }
- int hash = INITIAL_HASH;
- for (short anArray : array) {
- hash = MULTIPLIER * hash + anArray;
- }
- return hash;
- }
-
- /**
- * Return the same value as <code>{@link Boolean#hashCode()}</code>.
- *
- * @see Boolean#hashCode()
- */
- public static int hashCode(boolean bool) {
- return bool ? 1231 : 1237;
- }
-
- /**
- * Return the same value as <code>{@link Double#hashCode()}</code>.
- *
- * @see Double#hashCode()
- */
- public static int hashCode(double dbl) {
- long bits = Double.doubleToLongBits(dbl);
- return hashCode(bits);
- }
-
- /**
- * Return the same value as <code>{@link Float#hashCode()}</code>.
- *
- * @see Float#hashCode()
- */
- public static int hashCode(float flt) {
- return Float.floatToIntBits(flt);
- }
-
- /**
- * Return the same value as <code>{@link Long#hashCode()}</code>.
- *
- * @see Long#hashCode()
- */
- public static int hashCode(long lng) {
- return (int) (lng ^ (lng >>> 32));
- }
-
- // ---------------------------------------------------------------------
- // Convenience methods for toString output
- // ---------------------------------------------------------------------
-
- /**
- * Return a String representation of an object's overall identity.
- *
- * @param obj the object (may be <code>null</code>)
- * @return the object's identity as String representation, or an empty
String if the object was
- * <code>null</code>
- */
- public static String identityToString(Object obj) {
- if (obj == null) {
- return EMPTY_STRING;
- }
- return obj.getClass().getName() + "@" + getIdentityHexString(obj);
- }
-
- /**
- * Return a hex String form of an object's identity hash code.
- *
- * @param obj the object
- * @return the object's identity code in hex notation
- */
- public static String getIdentityHexString(Object obj) {
- return Integer.toHexString(System.identityHashCode(obj));
- }
-
- /**
- * Return a content-based String representation if <code>obj</code> is not
<code>null</code>;
- * otherwise returns an empty String.
- *
- * <p>Differs from {@link #safeToString(Object)} in that it returns an empty
String rather than
- * "null" for a <code>null</code> value.
- *
- * @param obj the object to build a display String for
- * @return a display String representation of <code>obj</code>
- * @see #safeToString(Object)
- */
- public static String getDisplayString(Object obj) {
- if (obj == null) {
- return EMPTY_STRING;
- }
- return safeToString(obj);
- }
-
- /**
- * Determine the class name for the given object.
- *
- * <p>Returns <code>"null"</code> if <code>obj</code> is <code>null</code>.
- *
- * @param obj the object to introspect (may be <code>null</code>)
- * @return the corresponding class name
- */
- public static String safeClassName(Object obj) {
- return (obj != null ? obj.getClass().getName() : NULL_STRING);
- }
-
- /**
- * Return a String representation of the specified Object.
- *
- * <p>Builds a String representation of the contents in case of an array.
Returns <code>"null"
- * </code> if <code>obj</code> is <code>null</code>.
- *
- * @param obj the object to build a String representation for
- * @return a String representation of <code>obj</code>
- */
- public static String safeToString(Object obj) {
- if (obj == null) {
- return NULL_STRING;
- }
- if (obj instanceof String) {
- return (String) obj;
- }
- if (obj instanceof Object[]) {
- return safeToString((Object[]) obj);
- }
- if (obj instanceof boolean[]) {
- return safeToString((boolean[]) obj);
- }
- if (obj instanceof byte[]) {
- return safeToString((byte[]) obj);
- }
- if (obj instanceof char[]) {
- return safeToString((char[]) obj);
- }
- if (obj instanceof double[]) {
- return safeToString((double[]) obj);
- }
- if (obj instanceof float[]) {
- return safeToString((float[]) obj);
- }
- if (obj instanceof int[]) {
- return safeToString((int[]) obj);
- }
- if (obj instanceof long[]) {
- return safeToString((long[]) obj);
- }
- if (obj instanceof short[]) {
- return safeToString((short[]) obj);
- }
- String str = obj.toString();
- return (str != null ? str : EMPTY_STRING);
- }
-
- /**
- * Return a String representation of the contents of the specified array.
- *
- * <p>The String representation consists of a list of the array's elements,
enclosed in curly
- * braces (<code>"{}"</code>). Adjacent elements are separated by the
characters <code>", "</code>
- * (a comma followed by a space). Returns <code>"null"</code> if
<code>array</code> is <code>null
- * </code>.
- *
- * @param array the array to build a String representation for
- * @return a String representation of <code>array</code>
- */
- public static String safeToString(Object[] array) {
- if (array == null) {
- return NULL_STRING;
- }
- int length = array.length;
- if (length == 0) {
- return EMPTY_ARRAY;
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < length; i++) {
- if (i == 0) {
- sb.append(ARRAY_START);
- } else {
- sb.append(ARRAY_ELEMENT_SEPARATOR);
- }
- sb.append(array[i]);
- }
- sb.append(ARRAY_END);
- return sb.toString();
- }
-
- /**
- * Return a String representation of the contents of the specified array.
- *
- * <p>The String representation consists of a list of the array's elements,
enclosed in curly
- * braces (<code>"{}"</code>). Adjacent elements are separated by the
characters <code>", "</code>
- * (a comma followed by a space). Returns <code>"null"</code> if
<code>array</code> is <code>null
- * </code>.
- *
- * @param array the array to build a String representation for
- * @return a String representation of <code>array</code>
- */
- public static String safeToString(boolean[] array) {
- if (array == null) {
- return NULL_STRING;
- }
- int length = array.length;
- if (length == 0) {
- return EMPTY_ARRAY;
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < length; i++) {
- if (i == 0) {
- sb.append(ARRAY_START);
- } else {
- sb.append(ARRAY_ELEMENT_SEPARATOR);
- }
-
- sb.append(array[i]);
- }
- sb.append(ARRAY_END);
- return sb.toString();
- }
-
- /**
- * Return a String representation of the contents of the specified array.
- *
- * <p>The String representation consists of a list of the array's elements,
enclosed in curly
- * braces (<code>"{}"</code>). Adjacent elements are separated by the
characters <code>", "</code>
- * (a comma followed by a space). Returns <code>"null"</code> if
<code>array</code> is <code>null
- * </code>.
- *
- * @param array the array to build a String representation for
- * @return a String representation of <code>array</code>
- */
- public static String safeToString(byte[] array) {
- if (array == null) {
- return NULL_STRING;
- }
- int length = array.length;
- if (length == 0) {
- return EMPTY_ARRAY;
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < length; i++) {
- if (i == 0) {
- sb.append(ARRAY_START);
- } else {
- sb.append(ARRAY_ELEMENT_SEPARATOR);
- }
- sb.append(array[i]);
- }
- sb.append(ARRAY_END);
- return sb.toString();
- }
-
- /**
- * Return a String representation of the contents of the specified array.
- *
- * <p>The String representation consists of a list of the array's elements,
enclosed in curly
- * braces (<code>"{}"</code>). Adjacent elements are separated by the
characters <code>", "</code>
- * (a comma followed by a space). Returns <code>"null"</code> if
<code>array</code> is <code>null
- * </code>.
- *
- * @param array the array to build a String representation for
- * @return a String representation of <code>array</code>
- */
- public static String safeToString(char[] array) {
- if (array == null) {
- return NULL_STRING;
- }
- int length = array.length;
- if (length == 0) {
- return EMPTY_ARRAY;
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < length; i++) {
- if (i == 0) {
- sb.append(ARRAY_START);
- } else {
- sb.append(ARRAY_ELEMENT_SEPARATOR);
- }
- sb.append("'").append(array[i]).append("'");
- }
- sb.append(ARRAY_END);
- return sb.toString();
- }
-
- /**
- * Return a String representation of the contents of the specified array.
- *
- * <p>The String representation consists of a list of the array's elements,
enclosed in curly
- * braces (<code>"{}"</code>). Adjacent elements are separated by the
characters <code>", "</code>
- * (a comma followed by a space). Returns <code>"null"</code> if
<code>array</code> is <code>null
- * </code>.
- *
- * @param array the array to build a String representation for
- * @return a String representation of <code>array</code>
- */
- public static String safeToString(double[] array) {
- if (array == null) {
- return NULL_STRING;
- }
- int length = array.length;
- if (length == 0) {
- return EMPTY_ARRAY;
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < length; i++) {
- if (i == 0) {
- sb.append(ARRAY_START);
- } else {
- sb.append(ARRAY_ELEMENT_SEPARATOR);
- }
-
- sb.append(array[i]);
- }
- sb.append(ARRAY_END);
- return sb.toString();
- }
-
- /**
- * Return a String representation of the contents of the specified array.
- *
- * <p>The String representation consists of a list of the array's elements,
enclosed in curly
- * braces (<code>"{}"</code>). Adjacent elements are separated by the
characters <code>", "</code>
- * (a comma followed by a space). Returns <code>"null"</code> if
<code>array</code> is <code>null
- * </code>.
- *
- * @param array the array to build a String representation for
- * @return a String representation of <code>array</code>
- */
- public static String safeToString(float[] array) {
- if (array == null) {
- return NULL_STRING;
- }
- int length = array.length;
- if (length == 0) {
- return EMPTY_ARRAY;
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < length; i++) {
- if (i == 0) {
- sb.append(ARRAY_START);
- } else {
- sb.append(ARRAY_ELEMENT_SEPARATOR);
- }
-
- sb.append(array[i]);
- }
- sb.append(ARRAY_END);
- return sb.toString();
- }
-
- /**
- * Return a String representation of the contents of the specified array.
- *
- * <p>The String representation consists of a list of the array's elements,
enclosed in curly
- * braces (<code>"{}"</code>). Adjacent elements are separated by the
characters <code>", "</code>
- * (a comma followed by a space). Returns <code>"null"</code> if
<code>array</code> is <code>null
- * </code>.
- *
- * @param array the array to build a String representation for
- * @return a String representation of <code>array</code>
- */
- public static String safeToString(int[] array) {
- if (array == null) {
- return NULL_STRING;
- }
- int length = array.length;
- if (length == 0) {
- return EMPTY_ARRAY;
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < length; i++) {
- if (i == 0) {
- sb.append(ARRAY_START);
- } else {
- sb.append(ARRAY_ELEMENT_SEPARATOR);
- }
- sb.append(array[i]);
- }
- sb.append(ARRAY_END);
- return sb.toString();
- }
-
- /**
- * Return a String representation of the contents of the specified array.
- *
- * <p>The String representation consists of a list of the array's elements,
enclosed in curly
- * braces (<code>"{}"</code>). Adjacent elements are separated by the
characters <code>", "</code>
- * (a comma followed by a space). Returns <code>"null"</code> if
<code>array</code> is <code>null
- * </code>.
- *
- * @param array the array to build a String representation for
- * @return a String representation of <code>array</code>
- */
- public static String safeToString(long[] array) {
- if (array == null) {
- return NULL_STRING;
- }
- int length = array.length;
- if (length == 0) {
- return EMPTY_ARRAY;
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < length; i++) {
- if (i == 0) {
- sb.append(ARRAY_START);
- } else {
- sb.append(ARRAY_ELEMENT_SEPARATOR);
- }
- sb.append(array[i]);
- }
- sb.append(ARRAY_END);
- return sb.toString();
- }
-
- /**
- * Return a String representation of the contents of the specified array.
- *
- * <p>The String representation consists of a list of the array's elements,
enclosed in curly
- * braces (<code>"{}"</code>). Adjacent elements are separated by the
characters <code>", "</code>
- * (a comma followed by a space). Returns <code>"null"</code> if
<code>array</code> is <code>null
- * </code>.
- *
- * @param array the array to build a String representation for
- * @return a String representation of <code>array</code>
- */
- public static String safeToString(short[] array) {
- if (array == null) {
- return NULL_STRING;
- }
- int length = array.length;
- if (length == 0) {
- return EMPTY_ARRAY;
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < length; i++) {
- if (i == 0) {
- sb.append(ARRAY_START);
- } else {
- sb.append(ARRAY_ELEMENT_SEPARATOR);
- }
- sb.append(array[i]);
- }
- sb.append(ARRAY_END);
- return sb.toString();
- }
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java
index 453872e80..e9fb75922 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java
@@ -21,8 +21,8 @@ import org.apache.streampark.common.conf.CommonConfig;
import org.apache.streampark.common.conf.InternalConfigHolder;
import org.apache.streampark.common.conf.Workspace;
import org.apache.streampark.common.util.CommandUtils;
+import org.apache.streampark.common.util.Utils;
import org.apache.streampark.console.base.exception.ApiDetailException;
-import org.apache.streampark.console.base.util.CommonUtils;
import org.apache.streampark.console.base.util.GitUtils;
import org.apache.streampark.console.base.util.WebUtils;
import org.apache.streampark.console.core.enums.GitAuthorizedErrorEnum;
@@ -185,14 +185,15 @@ public class Project implements Serializable {
@JsonIgnore
public String getMavenArgs() {
String mvn = "mvn";
+ boolean windows = Utils.isWindows();
try {
- if (CommonUtils.isWindows()) {
+ if (windows) {
CommandUtils.execute("mvn.cmd --version");
} else {
CommandUtils.execute("mvn --version");
}
} catch (Exception e) {
- if (CommonUtils.isWindows()) {
+ if (windows) {
mvn = WebUtils.getAppHome().concat("/bin/mvnw.cmd");
} else {
mvn = WebUtils.getAppHome().concat("/bin/mvnw");
@@ -216,7 +217,7 @@ public class Project implements Serializable {
@JsonIgnore
public String getMavenWorkHome() {
String buildHome = this.getAppSource().getAbsolutePath();
- if (CommonUtils.notEmpty(this.getPom())) {
+ if (StringUtils.isNotEmpty(this.getPom())) {
buildHome =
new
File(buildHome.concat("/").concat(this.getPom())).getParentFile().getAbsolutePath();
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/ApplicationManageServiceImpl.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/ApplicationManageServiceImpl.java
index ddd4ca148..0c61f41c8 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/ApplicationManageServiceImpl.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/application/impl/ApplicationManageServiceImpl.java
@@ -26,7 +26,6 @@ import org.apache.streampark.common.util.DeflaterUtils;
import org.apache.streampark.console.base.domain.RestRequest;
import org.apache.streampark.console.base.exception.ApiAlertException;
import org.apache.streampark.console.base.mybatis.pager.MybatisPager;
-import org.apache.streampark.console.base.util.CommonUtils;
import org.apache.streampark.console.base.util.ObjectUtils;
import org.apache.streampark.console.base.util.WebUtils;
import org.apache.streampark.console.core.bean.AppControl;
@@ -59,6 +58,7 @@ import
org.apache.streampark.console.core.watcher.FlinkK8sObserverStub;
import org.apache.streampark.flink.kubernetes.FlinkK8sWatcher;
import org.apache.streampark.flink.packer.pipeline.PipelineStatusEnum;
+import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -217,13 +217,14 @@ public class ApplicationManageServiceImpl extends
ServiceImpl<ApplicationMapper,
return null;
}
Page<Application> page = new
MybatisPager<Application>().getDefaultPage(request);
- if (CommonUtils.notEmpty(appParam.getStateArray())) {
+
+ if (ArrayUtils.isNotEmpty(appParam.getStateArray())) {
if (Arrays.stream(appParam.getStateArray())
.anyMatch(x -> x == FlinkAppStateEnum.FINISHED.getValue())) {
Integer[] newArray =
- CommonUtils.arrayInsertIndex(
- appParam.getStateArray(),
+ ArrayUtils.insert(
appParam.getStateArray().length,
+ appParam.getStateArray(),
FlinkAppStateEnum.POS_TERMINATED.getValue());
appParam.setStateArray(newArray);
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SavePointServiceImpl.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SavePointServiceImpl.java
index 4ae1000ae..5bf47c286 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SavePointServiceImpl.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/SavePointServiceImpl.java
@@ -27,7 +27,6 @@ import org.apache.streampark.console.base.domain.RestRequest;
import org.apache.streampark.console.base.exception.ApiAlertException;
import org.apache.streampark.console.base.exception.InternalException;
import org.apache.streampark.console.base.mybatis.pager.MybatisPager;
-import org.apache.streampark.console.base.util.CommonUtils;
import org.apache.streampark.console.core.entity.Application;
import org.apache.streampark.console.core.entity.ApplicationConfig;
import org.apache.streampark.console.core.entity.ApplicationLog;
@@ -201,7 +200,7 @@ public class SavePointServiceImpl extends
ServiceImpl<SavePointMapper, SavePoint
public Boolean delete(Long id, Application application) throws
InternalException {
SavePoint savePoint = getById(id);
try {
- if (CommonUtils.notEmpty(savePoint.getPath())) {
+ if (StringUtils.isNotEmpty(savePoint.getPath())) {
application.getFsOperator().delete(savePoint.getPath());
}
return removeById(id);