From 083e18d882ff775d1dda8dbc9ddd939aa899e523 Mon Sep 17 00:00:00 2001 From: "fusheng.zhang" <15210147315@163.com> Date: Mon, 3 Dec 2018 16:57:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/paoding/rose/load/ResourceRef.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/paoding-rose-load/src/main/java/net/paoding/rose/load/ResourceRef.java b/paoding-rose-load/src/main/java/net/paoding/rose/load/ResourceRef.java index 0eea989..8c4abf8 100644 --- a/paoding-rose-load/src/main/java/net/paoding/rose/load/ResourceRef.java +++ b/paoding-rose-load/src/main/java/net/paoding/rose/load/ResourceRef.java @@ -81,19 +81,21 @@ public static ResourceRef toResourceRef(Resource folder) throws IOException { + Arrays.toString(modifiers)); } } else { - JarFile jarFile = new JarFile(rr.getResource().getFile()); - Manifest manifest = jarFile.getManifest(); - if (manifest != null) { - Attributes attributes = manifest.getMainAttributes(); - String attrValue = attributes.getValue("rose"); - if (attrValue == null) { - attrValue = attributes.getValue("Rose"); - } - if (attrValue != null) { - modifiers = StringUtils.split(attrValue, ", ;\n\r\t"); - if (logger.isDebugEnabled()) { - logger.debug("modifiers[by manifest.mf][" + rr.getResource().getURI() - + "]=" + Arrays.toString(modifiers)); + if(rr.getResource().getFile().exists()){ + JarFile jarFile = new JarFile(rr.getResource().getFile()); + Manifest manifest = jarFile.getManifest(); + if (manifest != null) { + Attributes attributes = manifest.getMainAttributes(); + String attrValue = attributes.getValue("rose"); + if (attrValue == null) { + attrValue = attributes.getValue("Rose"); + } + if (attrValue != null) { + modifiers = StringUtils.split(attrValue, ", ;\n\r\t"); + if (logger.isDebugEnabled()) { + logger.debug("modifiers[by manifest.mf][" + rr.getResource().getURI() + + "]=" + Arrays.toString(modifiers)); + } } } } From db1723c553ab1c4232dc3d4b6e9e3f47f31682f0 Mon Sep 17 00:00:00 2001 From: "fusheng.zhang" <17610759700@163.com> Date: Fri, 22 Mar 2019 12:55:04 +0800 Subject: [PATCH 2/2] ..... --- .../net/paoding/rose/load/ResourceRef.java | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/paoding-rose-load/src/main/java/net/paoding/rose/load/ResourceRef.java b/paoding-rose-load/src/main/java/net/paoding/rose/load/ResourceRef.java index 8c4abf8..2d9da5b 100644 --- a/paoding-rose-load/src/main/java/net/paoding/rose/load/ResourceRef.java +++ b/paoding-rose-load/src/main/java/net/paoding/rose/load/ResourceRef.java @@ -74,32 +74,7 @@ public static ResourceRef toResourceRef(Resource folder) throws IOException { } // if (modifiers == null) { - if (!"jar".equals(rr.getProtocol())) { - modifiers = new String[] { "**" }; - if (logger.isDebugEnabled()) { - logger.debug("modifiers[by default][" + rr.getResource().getURI() + "]=" - + Arrays.toString(modifiers)); - } - } else { - if(rr.getResource().getFile().exists()){ - JarFile jarFile = new JarFile(rr.getResource().getFile()); - Manifest manifest = jarFile.getManifest(); - if (manifest != null) { - Attributes attributes = manifest.getMainAttributes(); - String attrValue = attributes.getValue("rose"); - if (attrValue == null) { - attrValue = attributes.getValue("Rose"); - } - if (attrValue != null) { - modifiers = StringUtils.split(attrValue, ", ;\n\r\t"); - if (logger.isDebugEnabled()) { - logger.debug("modifiers[by manifest.mf][" + rr.getResource().getURI() - + "]=" + Arrays.toString(modifiers)); - } - } - } - } - } + modifiers = new String[] { "**" }; } rr.setModifiers(modifiers); return rr;