From cee932b37cd0df37e1c877e36293a344f24236c6 Mon Sep 17 00:00:00 2001 From: Daniel Duan Date: Thu, 3 Oct 2024 11:56:31 +0800 Subject: [PATCH] [Fix] Upload Flink App jar got "flink app jar must exist" error on windows (#4052) (#4053) * fix Upload Flink App jar got "flink app jar must exist" error on windows --- .../org/apache/streampark/console/core/entity/Resource.java | 4 ++-- .../console/core/service/impl/ResourceServiceImpl.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Resource.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Resource.java index 95b59e1f4e..887c77454d 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Resource.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Resource.java @@ -83,7 +83,7 @@ public void setResourcePath(String resourcePath) { if (StringUtils.isBlank(resourcePath)) { throw new IllegalArgumentException("resource path cannot be null."); } - String[] namePath = resourcePath.split(":"); + String[] namePath = resourcePath.split(":", 2); if (namePath.length != 2) { throw new IllegalArgumentException("resource path invalid, format: $name:$path"); } @@ -101,6 +101,6 @@ public String getFilePath() { if (StringUtils.isBlank(this.resourcePath)) { return null; } - return resourcePath.split(":")[1]; + return resourcePath.split(":", 2)[1]; } } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ResourceServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ResourceServiceImpl.java index 95e6ed6a51..9ca1ea7750 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ResourceServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ResourceServiceImpl.java @@ -153,7 +153,7 @@ public void addResource(Resource resource) throws Exception { String resourcePath = jars.get(0); resource.setResourcePath(resourcePath); // copy jar to team upload directory - String upFile = resourcePath.split(":")[1]; + String upFile = resourcePath.split(":", 2)[1]; transferTeamResource(resource.getTeamId(), upFile); } @@ -207,7 +207,7 @@ public void updateResource(Resource resource) { Dependency dependency = Dependency.toDependency(resource.getResource()); if (!dependency.getJar().isEmpty()) { - String jarFile = dependency.getJar().get(0).split(":")[1]; + String jarFile = dependency.getJar().get(0).split(":", 2)[1]; transferTeamResource(findResource.getTeamId(), jarFile); } } @@ -446,7 +446,7 @@ private File getResourceJar(Resource resource) throws Exception { return null; } if (!dependency.getJar().isEmpty()) { - String jar = dependency.getJar().get(0).split(":")[1]; + String jar = dependency.getJar().get(0).split(":", 2)[1]; return new File(jar); } else { Artifact artifact = dependency.toArtifact().get(0);