From f3d3a0a1603a63b1f723082f17f74c07142ce302 Mon Sep 17 00:00:00 2001 From: Matthew Tambara Date: Tue, 4 Feb 2020 12:01:54 -0800 Subject: [PATCH 1/2] LPS-107983 Only strip separator when it exists --- .../jsp/compiler/internal/JspJavaFileObjectResolver.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/apps/static/portal-osgi-web/portal-osgi-web-servlet-jsp-compiler/src/main/java/com/liferay/portal/osgi/web/servlet/jsp/compiler/internal/JspJavaFileObjectResolver.java b/modules/apps/static/portal-osgi-web/portal-osgi-web-servlet-jsp-compiler/src/main/java/com/liferay/portal/osgi/web/servlet/jsp/compiler/internal/JspJavaFileObjectResolver.java index 6c9dd34166e2fe..0d2f57c39d0006 100644 --- a/modules/apps/static/portal-osgi-web/portal-osgi-web-servlet-jsp-compiler/src/main/java/com/liferay/portal/osgi/web/servlet/jsp/compiler/internal/JspJavaFileObjectResolver.java +++ b/modules/apps/static/portal-osgi-web/portal-osgi-web-servlet-jsp-compiler/src/main/java/com/liferay/portal/osgi/web/servlet/jsp/compiler/internal/JspJavaFileObjectResolver.java @@ -254,7 +254,9 @@ public boolean accept(Path entryPath) { String entryPathString = entryPath.toString(); - entryPathString = entryPathString.substring(1); + if (entryPathString.startsWith(File.separator)) { + entryPathString = entryPathString.substring(1); + } javaFileObjects.add( new JarJavaFileObject( From ce891d68a9e5734dae7d59ec2b06ed5ded4a5cec Mon Sep 17 00:00:00 2001 From: shuyangzhou Date: Wed, 5 Feb 2020 10:39:08 -0800 Subject: [PATCH 2/2] LPS-107983 entryPathString is never empty --- .../jsp/compiler/internal/JspJavaFileObjectResolver.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/apps/static/portal-osgi-web/portal-osgi-web-servlet-jsp-compiler/src/main/java/com/liferay/portal/osgi/web/servlet/jsp/compiler/internal/JspJavaFileObjectResolver.java b/modules/apps/static/portal-osgi-web/portal-osgi-web-servlet-jsp-compiler/src/main/java/com/liferay/portal/osgi/web/servlet/jsp/compiler/internal/JspJavaFileObjectResolver.java index 0d2f57c39d0006..f488284ace291e 100644 --- a/modules/apps/static/portal-osgi-web/portal-osgi-web-servlet-jsp-compiler/src/main/java/com/liferay/portal/osgi/web/servlet/jsp/compiler/internal/JspJavaFileObjectResolver.java +++ b/modules/apps/static/portal-osgi-web/portal-osgi-web-servlet-jsp-compiler/src/main/java/com/liferay/portal/osgi/web/servlet/jsp/compiler/internal/JspJavaFileObjectResolver.java @@ -254,7 +254,9 @@ public boolean accept(Path entryPath) { String entryPathString = entryPath.toString(); - if (entryPathString.startsWith(File.separator)) { + if (entryPathString.charAt(0) == + File.separatorChar) { + entryPathString = entryPathString.substring(1); }