mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-11 09:20:30 +08:00
chore: 工作区反编译与 Maven/文档/脚本同步到发布分支
- artifacts/decompiled 树与相关源码变更 - maven-cw-elevator-application 业务 docs 与 package-info - scripts 下 formatter 校验与辅助脚本 - 其他子工程/接口与发布线一并纳入版本控制 Made-with: Cursor Former-commit-id: e102e8cab64e575bcd23c9a66a598aa1892bb492
This commit is contained in:
+56
-60
@@ -1,60 +1,56 @@
|
||||
/* */ package cn.cloudwalk;
|
||||
/* */
|
||||
/* */ import cn.cloudwalk.event.EnableCloudwalkEvent;
|
||||
/* */ import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
|
||||
/* */ import io.micrometer.core.instrument.MeterRegistry;
|
||||
/* */ import io.micrometer.spring.autoconfigure.MeterRegistryCustomizer;
|
||||
/* */ import org.mybatis.spring.annotation.MapperScan;
|
||||
/* */ import org.springframework.beans.factory.annotation.Value;
|
||||
/* */ import org.springframework.boot.Banner;
|
||||
/* */ import org.springframework.boot.SpringApplication;
|
||||
/* */ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
/* */ import org.springframework.cloud.netflix.feign.EnableFeignClients;
|
||||
/* */ import org.springframework.context.annotation.Bean;
|
||||
/* */ import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
/* */ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ @SpringBootApplication(exclude = {PageHelperAutoConfiguration.class})
|
||||
/* */ @EnableFeignClients
|
||||
/* */ @MapperScan({"cn.cloudwalk.data.**.mapper", "cn.cloudwalk.task.data.mapper"})
|
||||
/* */ @EnableAsync
|
||||
/* */ @EnableCloudwalkEvent
|
||||
/* */ @EnableAspectJAutoProxy(exposeProxy = true)
|
||||
/* */ public class Application
|
||||
/* */ {
|
||||
/* */ public static void main(String[] args) {
|
||||
/* 41 */ System.out.println("[标准GPU服务器-出入口版]- 开始启动...");
|
||||
/* */
|
||||
/* 43 */ SpringApplication app = new SpringApplication(new Object[] { Application.class });
|
||||
/* 44 */ app.setBannerMode(Banner.Mode.OFF);
|
||||
/* 45 */ app.run(args);
|
||||
/* */
|
||||
/* 47 */ System.out.println("[标准GPU服务器-出入口版]- 启动完成...");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ @Bean
|
||||
/* */ MeterRegistryCustomizer<MeterRegistry> configurer(@Value("${spring.application.name}") String applicationName) {
|
||||
/* 52 */ return meterRegistry -> meterRegistry.config().commonTags(new String[] { "application", applicationName });
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\cn\cloudwalk\Application.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package cn.cloudwalk;
|
||||
|
||||
import cn.cloudwalk.event.EnableCloudwalkEvent;
|
||||
import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import io.micrometer.spring.autoconfigure.MeterRegistryCustomizer;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.Banner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.netflix.feign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@SpringBootApplication(exclude = {PageHelperAutoConfiguration.class})
|
||||
@EnableFeignClients
|
||||
@MapperScan({"cn.cloudwalk.data.**.mapper", "cn.cloudwalk.task.data.mapper"})
|
||||
@EnableAsync
|
||||
@EnableCloudwalkEvent
|
||||
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||
public class Application
|
||||
{
|
||||
public static void main(String[] args) {
|
||||
System.out.println("[标准GPU服务器-出入口版]- 开始启动...");
|
||||
|
||||
SpringApplication app = new SpringApplication(new Object[] { Application.class });
|
||||
app.setBannerMode(Banner.Mode.OFF);
|
||||
app.run(args);
|
||||
|
||||
System.out.println("[标准GPU服务器-出入口版]- 启动完成...");
|
||||
}
|
||||
|
||||
@Bean
|
||||
MeterRegistryCustomizer<MeterRegistry> configurer(@Value("${spring.application.name}") String applicationName) {
|
||||
return meterRegistry -> meterRegistry.config().commonTags(new String[] { "application", applicationName });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+144
-148
@@ -1,148 +1,144 @@
|
||||
/* */ package org.springframework.boot.loader;
|
||||
/* */
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.net.URLClassLoader;
|
||||
/* */ import java.util.ArrayList;
|
||||
/* */ import java.util.Collections;
|
||||
/* */ import java.util.LinkedHashSet;
|
||||
/* */ import java.util.List;
|
||||
/* */ import java.util.Set;
|
||||
/* */ import org.springframework.boot.loader.archive.Archive;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public abstract class ExecutableArchiveLauncher
|
||||
/* */ extends Launcher
|
||||
/* */ {
|
||||
/* */ private final Archive archive;
|
||||
/* */ private final JavaAgentDetector javaAgentDetector;
|
||||
/* */
|
||||
/* */ public ExecutableArchiveLauncher() {
|
||||
/* 45 */ this(new InputArgumentsJavaAgentDetector());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public ExecutableArchiveLauncher(JavaAgentDetector javaAgentDetector) {
|
||||
/* */ try {
|
||||
/* 50 */ this.archive = createArchive();
|
||||
/* */ }
|
||||
/* 52 */ catch (Exception ex) {
|
||||
/* 53 */ throw new IllegalStateException(ex);
|
||||
/* */ }
|
||||
/* 55 */ this.javaAgentDetector = javaAgentDetector;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ protected ExecutableArchiveLauncher(Archive archive) {
|
||||
/* 59 */ this.javaAgentDetector = new InputArgumentsJavaAgentDetector();
|
||||
/* 60 */ this.archive = archive;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ protected final Archive getArchive() {
|
||||
/* 64 */ return this.archive;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected String getMainClass() throws Exception {
|
||||
/* 69 */ return this.archive.getMainClass();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected List<Archive> getClassPathArchives() throws Exception {
|
||||
/* 75 */ List<Archive> archives = new ArrayList<Archive>(this.archive.getNestedArchives(new Archive.EntryFilter()
|
||||
/* */ {
|
||||
/* */ public boolean matches(Archive.Entry entry) {
|
||||
/* 78 */ return ExecutableArchiveLauncher.this.isNestedArchive(entry);
|
||||
/* */ }
|
||||
/* */ }));
|
||||
/* 81 */ postProcessClassPathArchives(archives);
|
||||
/* 82 */ return archives;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected ClassLoader createClassLoader(URL[] urls) throws Exception {
|
||||
/* 87 */ Set<URL> copy = new LinkedHashSet<URL>(urls.length);
|
||||
/* 88 */ ClassLoader loader = getDefaultClassLoader();
|
||||
/* 89 */ if (loader instanceof URLClassLoader) {
|
||||
/* 90 */ for (URL url : ((URLClassLoader)loader).getURLs()) {
|
||||
/* 91 */ if (addDefaultClassloaderUrl(urls, url)) {
|
||||
/* 92 */ copy.add(url);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 96 */ Collections.addAll(copy, urls);
|
||||
/* 97 */ return super.createClassLoader(copy.<URL>toArray(new URL[copy.size()]));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private boolean addDefaultClassloaderUrl(URL[] urls, URL url) {
|
||||
/* 101 */ String jarUrl = "jar:" + url + "!/";
|
||||
/* 102 */ for (URL nestedUrl : urls) {
|
||||
/* 103 */ if (nestedUrl.equals(url) || nestedUrl.toString().equals(jarUrl)) {
|
||||
/* 104 */ return false;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 107 */ return !this.javaAgentDetector.isJavaAgentJar(url);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected abstract boolean isNestedArchive(Archive.Entry paramEntry);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected void postProcessClassPathArchives(List<Archive> archives) throws Exception {}
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static ClassLoader getDefaultClassLoader() {
|
||||
/* 128 */ ClassLoader classloader = null;
|
||||
/* */ try {
|
||||
/* 130 */ classloader = Thread.currentThread().getContextClassLoader();
|
||||
/* */ }
|
||||
/* 132 */ catch (Throwable throwable) {}
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 136 */ if (classloader == null)
|
||||
/* */ {
|
||||
/* 138 */ classloader = ExecutableArchiveLauncher.class.getClassLoader();
|
||||
/* */ }
|
||||
/* 140 */ return classloader;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\ExecutableArchiveLauncher.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.springframework.boot.loader.archive.Archive;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public abstract class ExecutableArchiveLauncher
|
||||
extends Launcher
|
||||
{
|
||||
private final Archive archive;
|
||||
private final JavaAgentDetector javaAgentDetector;
|
||||
|
||||
public ExecutableArchiveLauncher() {
|
||||
this(new InputArgumentsJavaAgentDetector());
|
||||
}
|
||||
|
||||
public ExecutableArchiveLauncher(JavaAgentDetector javaAgentDetector) {
|
||||
try {
|
||||
this.archive = createArchive();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
this.javaAgentDetector = javaAgentDetector;
|
||||
}
|
||||
|
||||
protected ExecutableArchiveLauncher(Archive archive) {
|
||||
this.javaAgentDetector = new InputArgumentsJavaAgentDetector();
|
||||
this.archive = archive;
|
||||
}
|
||||
|
||||
protected final Archive getArchive() {
|
||||
return this.archive;
|
||||
}
|
||||
|
||||
|
||||
protected String getMainClass() throws Exception {
|
||||
return this.archive.getMainClass();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected List<Archive> getClassPathArchives() throws Exception {
|
||||
List<Archive> archives = new ArrayList<Archive>(this.archive.getNestedArchives(new Archive.EntryFilter()
|
||||
{
|
||||
public boolean matches(Archive.Entry entry) {
|
||||
return ExecutableArchiveLauncher.this.isNestedArchive(entry);
|
||||
}
|
||||
}));
|
||||
postProcessClassPathArchives(archives);
|
||||
return archives;
|
||||
}
|
||||
|
||||
|
||||
protected ClassLoader createClassLoader(URL[] urls) throws Exception {
|
||||
Set<URL> copy = new LinkedHashSet<URL>(urls.length);
|
||||
ClassLoader loader = getDefaultClassLoader();
|
||||
if (loader instanceof URLClassLoader) {
|
||||
for (URL url : ((URLClassLoader)loader).getURLs()) {
|
||||
if (addDefaultClassloaderUrl(urls, url)) {
|
||||
copy.add(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.addAll(copy, urls);
|
||||
return super.createClassLoader(copy.<URL>toArray(new URL[copy.size()]));
|
||||
}
|
||||
|
||||
private boolean addDefaultClassloaderUrl(URL[] urls, URL url) {
|
||||
String jarUrl = "jar:" + url + "!/";
|
||||
for (URL nestedUrl : urls) {
|
||||
if (nestedUrl.equals(url) || nestedUrl.toString().equals(jarUrl)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return !this.javaAgentDetector.isJavaAgentJar(url);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected abstract boolean isNestedArchive(Archive.Entry paramEntry);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected void postProcessClassPathArchives(List<Archive> archives) throws Exception {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static ClassLoader getDefaultClassLoader() {
|
||||
ClassLoader classloader = null;
|
||||
try {
|
||||
classloader = Thread.currentThread().getContextClassLoader();
|
||||
}
|
||||
catch (Throwable throwable) {}
|
||||
|
||||
|
||||
|
||||
if (classloader == null)
|
||||
{
|
||||
classloader = ExecutableArchiveLauncher.class.getClassLoader();
|
||||
}
|
||||
return classloader;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+101
-105
@@ -1,105 +1,101 @@
|
||||
/* */ package org.springframework.boot.loader;
|
||||
/* */
|
||||
/* */ import java.io.File;
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.lang.management.ManagementFactory;
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.security.AccessController;
|
||||
/* */ import java.security.PrivilegedAction;
|
||||
/* */ import java.util.Collections;
|
||||
/* */ import java.util.HashSet;
|
||||
/* */ import java.util.List;
|
||||
/* */ import java.util.Set;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class InputArgumentsJavaAgentDetector
|
||||
/* */ implements JavaAgentDetector
|
||||
/* */ {
|
||||
/* */ private static final String JAVA_AGENT_PREFIX = "-javaagent:";
|
||||
/* */ private final Set<URL> javaAgentJars;
|
||||
/* */
|
||||
/* */ public InputArgumentsJavaAgentDetector() {
|
||||
/* 44 */ this(getInputArguments());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ InputArgumentsJavaAgentDetector(List<String> inputArguments) {
|
||||
/* 48 */ this.javaAgentJars = getJavaAgentJars(inputArguments);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private static List<String> getInputArguments() {
|
||||
/* */ try {
|
||||
/* 53 */ return AccessController.<List<String>>doPrivileged(new PrivilegedAction<List<String>>()
|
||||
/* */ {
|
||||
/* */ public List<String> run() {
|
||||
/* 56 */ return ManagementFactory.getRuntimeMXBean().getInputArguments();
|
||||
/* */ }
|
||||
/* */ });
|
||||
/* */ }
|
||||
/* 60 */ catch (Exception ex) {
|
||||
/* 61 */ return Collections.emptyList();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private Set<URL> getJavaAgentJars(List<String> inputArguments) {
|
||||
/* 66 */ Set<URL> javaAgentJars = new HashSet<URL>();
|
||||
/* 67 */ for (String argument : inputArguments) {
|
||||
/* 68 */ String path = getJavaAgentJarPath(argument);
|
||||
/* 69 */ if (path != null) {
|
||||
/* */ try {
|
||||
/* 71 */ javaAgentJars.add((new File(path)).getCanonicalFile().toURI().toURL());
|
||||
/* */ }
|
||||
/* 73 */ catch (IOException ex) {
|
||||
/* 74 */ throw new IllegalStateException("Failed to determine canonical path of Java agent at path '" + path + "'");
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 80 */ return javaAgentJars;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private String getJavaAgentJarPath(String arg) {
|
||||
/* 84 */ if (arg.startsWith("-javaagent:")) {
|
||||
/* 85 */ String path = arg.substring("-javaagent:".length());
|
||||
/* 86 */ int equalsIndex = path.indexOf('=');
|
||||
/* 87 */ if (equalsIndex > -1) {
|
||||
/* 88 */ path = path.substring(0, equalsIndex);
|
||||
/* */ }
|
||||
/* 90 */ return path;
|
||||
/* */ }
|
||||
/* 92 */ return null;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public boolean isJavaAgentJar(URL url) {
|
||||
/* 97 */ return this.javaAgentJars.contains(url);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\InputArgumentsJavaAgentDetector.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.net.URL;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class InputArgumentsJavaAgentDetector
|
||||
implements JavaAgentDetector
|
||||
{
|
||||
private static final String JAVA_AGENT_PREFIX = "-javaagent:";
|
||||
private final Set<URL> javaAgentJars;
|
||||
|
||||
public InputArgumentsJavaAgentDetector() {
|
||||
this(getInputArguments());
|
||||
}
|
||||
|
||||
InputArgumentsJavaAgentDetector(List<String> inputArguments) {
|
||||
this.javaAgentJars = getJavaAgentJars(inputArguments);
|
||||
}
|
||||
|
||||
private static List<String> getInputArguments() {
|
||||
try {
|
||||
return AccessController.<List<String>>doPrivileged(new PrivilegedAction<List<String>>()
|
||||
{
|
||||
public List<String> run() {
|
||||
return ManagementFactory.getRuntimeMXBean().getInputArguments();
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
private Set<URL> getJavaAgentJars(List<String> inputArguments) {
|
||||
Set<URL> javaAgentJars = new HashSet<URL>();
|
||||
for (String argument : inputArguments) {
|
||||
String path = getJavaAgentJarPath(argument);
|
||||
if (path != null) {
|
||||
try {
|
||||
javaAgentJars.add((new File(path)).getCanonicalFile().toURI().toURL());
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IllegalStateException("Failed to determine canonical path of Java agent at path '" + path + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return javaAgentJars;
|
||||
}
|
||||
|
||||
private String getJavaAgentJarPath(String arg) {
|
||||
if (arg.startsWith("-javaagent:")) {
|
||||
String path = arg.substring("-javaagent:".length());
|
||||
int equalsIndex = path.indexOf('=');
|
||||
if (equalsIndex > -1) {
|
||||
path = path.substring(0, equalsIndex);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public boolean isJavaAgentJar(URL url) {
|
||||
return this.javaAgentJars.contains(url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+56
-60
@@ -1,60 +1,56 @@
|
||||
/* */ package org.springframework.boot.loader;
|
||||
/* */
|
||||
/* */ import java.util.List;
|
||||
/* */ import org.springframework.boot.loader.archive.Archive;
|
||||
/* */ import org.springframework.boot.loader.util.AsciiBytes;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class JarLauncher
|
||||
/* */ extends ExecutableArchiveLauncher
|
||||
/* */ {
|
||||
/* 32 */ private static final AsciiBytes LIB = new AsciiBytes("lib/");
|
||||
/* */
|
||||
/* */
|
||||
/* */ public JarLauncher() {}
|
||||
/* */
|
||||
/* */ protected JarLauncher(Archive archive) {
|
||||
/* 38 */ super(archive);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected boolean isNestedArchive(Archive.Entry entry) {
|
||||
/* 43 */ return (!entry.isDirectory() && entry.getName().startsWith(LIB));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected void postProcessClassPathArchives(List<Archive> archives) throws Exception {
|
||||
/* 48 */ archives.add(0, getArchive());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static void main(String[] args) {
|
||||
/* 52 */ (new JarLauncher()).launch(args);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\JarLauncher.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.boot.loader.archive.Archive;
|
||||
import org.springframework.boot.loader.util.AsciiBytes;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class JarLauncher
|
||||
extends ExecutableArchiveLauncher
|
||||
{
|
||||
private static final AsciiBytes LIB = new AsciiBytes("lib/");
|
||||
|
||||
|
||||
public JarLauncher() {}
|
||||
|
||||
protected JarLauncher(Archive archive) {
|
||||
super(archive);
|
||||
}
|
||||
|
||||
|
||||
protected boolean isNestedArchive(Archive.Entry entry) {
|
||||
return (!entry.isDirectory() && entry.getName().startsWith(LIB));
|
||||
}
|
||||
|
||||
|
||||
protected void postProcessClassPathArchives(List<Archive> archives) throws Exception {
|
||||
archives.add(0, getArchive());
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
(new JarLauncher()).launch(args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+9
-13
@@ -1,13 +1,9 @@
|
||||
package org.springframework.boot.loader;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
public interface JavaAgentDetector {
|
||||
boolean isJavaAgentJar(URL paramURL);
|
||||
}
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\JavaAgentDetector.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
public interface JavaAgentDetector {
|
||||
boolean isJavaAgentJar(URL paramURL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+308
-312
@@ -1,312 +1,308 @@
|
||||
/* */ package org.springframework.boot.loader;
|
||||
/* */
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.net.URLClassLoader;
|
||||
/* */ import java.security.AccessController;
|
||||
/* */ import java.security.PrivilegedActionException;
|
||||
/* */ import java.security.PrivilegedExceptionAction;
|
||||
/* */ import java.util.Arrays;
|
||||
/* */ import java.util.Collections;
|
||||
/* */ import java.util.Enumeration;
|
||||
/* */ import java.util.jar.Manifest;
|
||||
/* */ import org.springframework.boot.loader.jar.Handler;
|
||||
/* */ import org.springframework.boot.loader.jar.JarFile;
|
||||
/* */ import org.springframework.lang.UsesJava7;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class LaunchedURLClassLoader
|
||||
/* */ extends URLClassLoader
|
||||
/* */ {
|
||||
/* 41 */ private static LockProvider LOCK_PROVIDER = setupLockProvider();
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final ClassLoader rootClassLoader;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public LaunchedURLClassLoader(URL[] urls, ClassLoader parent) {
|
||||
/* 51 */ super(urls, parent);
|
||||
/* 52 */ this.rootClassLoader = findRootClassLoader(parent);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private ClassLoader findRootClassLoader(ClassLoader classLoader) {
|
||||
/* 56 */ while (classLoader != null) {
|
||||
/* 57 */ if (classLoader.getParent() == null) {
|
||||
/* 58 */ return classLoader;
|
||||
/* */ }
|
||||
/* 60 */ classLoader = classLoader.getParent();
|
||||
/* */ }
|
||||
/* 62 */ return null;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public URL getResource(String name) {
|
||||
/* 72 */ URL url = null;
|
||||
/* 73 */ if (this.rootClassLoader != null) {
|
||||
/* 74 */ url = this.rootClassLoader.getResource(name);
|
||||
/* */ }
|
||||
/* 76 */ return (url == null) ? findResource(name) : url;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public URL findResource(String name) {
|
||||
/* */ try {
|
||||
/* 82 */ if (name.equals("") && hasURLs()) {
|
||||
/* 83 */ return getURLs()[0];
|
||||
/* */ }
|
||||
/* 85 */ Handler.setUseFastConnectionExceptions(true);
|
||||
/* */ try {
|
||||
/* 87 */ return super.findResource(name);
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* 90 */ Handler.setUseFastConnectionExceptions(false);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 93 */ } catch (IllegalArgumentException ex) {
|
||||
/* 94 */ return null;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Enumeration<URL> findResources(String name) throws IOException {
|
||||
/* 100 */ if (name.equals("") && hasURLs()) {
|
||||
/* 101 */ return Collections.enumeration(Arrays.asList(getURLs()));
|
||||
/* */ }
|
||||
/* 103 */ Handler.setUseFastConnectionExceptions(true);
|
||||
/* */ try {
|
||||
/* 105 */ return super.findResources(name);
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* 108 */ Handler.setUseFastConnectionExceptions(false);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private boolean hasURLs() {
|
||||
/* 113 */ return ((getURLs()).length > 0);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Enumeration<URL> getResources(String name) throws IOException {
|
||||
/* 124 */ if (this.rootClassLoader == null) {
|
||||
/* 125 */ return findResources(name);
|
||||
/* */ }
|
||||
/* 127 */ return new ResourceEnumeration(this.rootClassLoader.getResources(name),
|
||||
/* 128 */ findResources(name));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
|
||||
/* 137 */ synchronized (LOCK_PROVIDER.getLock(this, name)) {
|
||||
/* 138 */ Class<?> loadedClass = findLoadedClass(name);
|
||||
/* 139 */ if (loadedClass == null) {
|
||||
/* 140 */ Handler.setUseFastConnectionExceptions(true);
|
||||
/* */ try {
|
||||
/* 142 */ loadedClass = doLoadClass(name);
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* 145 */ Handler.setUseFastConnectionExceptions(false);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 148 */ if (resolve) {
|
||||
/* 149 */ resolveClass(loadedClass);
|
||||
/* */ }
|
||||
/* 151 */ return loadedClass;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private Class<?> doLoadClass(String name) throws ClassNotFoundException {
|
||||
/* */ try {
|
||||
/* 159 */ if (this.rootClassLoader != null) {
|
||||
/* 160 */ return this.rootClassLoader.loadClass(name);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 163 */ catch (Exception exception) {}
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 169 */ findPackage(name);
|
||||
/* 170 */ Class<?> cls = findClass(name);
|
||||
/* 171 */ return cls;
|
||||
/* */ }
|
||||
/* 173 */ catch (Exception exception) {
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 178 */ return super.loadClass(name, false);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ private void findPackage(String name) throws ClassNotFoundException {
|
||||
/* 182 */ int lastDot = name.lastIndexOf('.');
|
||||
/* 183 */ if (lastDot != -1) {
|
||||
/* 184 */ String packageName = name.substring(0, lastDot);
|
||||
/* 185 */ if (getPackage(packageName) == null) {
|
||||
/* */ try {
|
||||
/* 187 */ definePackageForFindClass(name, packageName);
|
||||
/* */ }
|
||||
/* 189 */ catch (Exception exception) {}
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private void definePackageForFindClass(final String name, final String packageName) {
|
||||
/* */ try {
|
||||
/* 204 */ AccessController.doPrivileged(new PrivilegedExceptionAction()
|
||||
/* */ {
|
||||
/* */ public Object run() throws ClassNotFoundException {
|
||||
/* 207 */ String path = name.replace('.', '/').concat(".class");
|
||||
/* 208 */ for (URL url : LaunchedURLClassLoader.this.getURLs()) {
|
||||
/* */ try {
|
||||
/* 210 */ if (url.getContent() instanceof JarFile) {
|
||||
/* 211 */ JarFile jarFile = (JarFile)url.getContent();
|
||||
/* */
|
||||
/* */
|
||||
/* 214 */ if (jarFile.getJarEntryData(path) != null && jarFile
|
||||
/* 215 */ .getManifest() != null) {
|
||||
/* 216 */ LaunchedURLClassLoader.this.definePackage(packageName, jarFile.getManifest(), url);
|
||||
/* */
|
||||
/* 218 */ return null;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ }
|
||||
/* */
|
||||
/* 223 */ } catch (IOException iOException) {}
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 227 */ return null;
|
||||
/* */ }
|
||||
/* 229 */ }AccessController.getContext());
|
||||
/* */ }
|
||||
/* 231 */ catch (PrivilegedActionException privilegedActionException) {}
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ @UsesJava7
|
||||
/* */ private static LockProvider setupLockProvider() {
|
||||
/* */ try {
|
||||
/* 239 */ ClassLoader.registerAsParallelCapable();
|
||||
/* 240 */ return new Java7LockProvider();
|
||||
/* */ }
|
||||
/* 242 */ catch (NoSuchMethodError ex) {
|
||||
/* 243 */ return new LockProvider();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static class LockProvider
|
||||
/* */ {
|
||||
/* */ private LockProvider() {}
|
||||
/* */
|
||||
/* */ public Object getLock(LaunchedURLClassLoader classLoader, String className) {
|
||||
/* 253 */ return classLoader;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ @UsesJava7
|
||||
/* */ private static class Java7LockProvider
|
||||
/* */ extends LockProvider
|
||||
/* */ {
|
||||
/* */ private Java7LockProvider() {}
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Object getLock(LaunchedURLClassLoader classLoader, String className) {
|
||||
/* 266 */ return classLoader.getClassLoadingLock(className);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static class ResourceEnumeration
|
||||
/* */ implements Enumeration<URL>
|
||||
/* */ {
|
||||
/* */ private final Enumeration<URL> rootResources;
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final Enumeration<URL> localResources;
|
||||
/* */
|
||||
/* */
|
||||
/* */ ResourceEnumeration(Enumeration<URL> rootResources, Enumeration<URL> localResources) {
|
||||
/* 282 */ this.rootResources = rootResources;
|
||||
/* 283 */ this.localResources = localResources;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public boolean hasMoreElements() {
|
||||
/* */ try {
|
||||
/* 289 */ Handler.setUseFastConnectionExceptions(true);
|
||||
/* 290 */ return (this.rootResources.hasMoreElements() || this.localResources
|
||||
/* 291 */ .hasMoreElements());
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* 294 */ Handler.setUseFastConnectionExceptions(false);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public URL nextElement() {
|
||||
/* 300 */ if (this.rootResources.hasMoreElements()) {
|
||||
/* 301 */ return this.rootResources.nextElement();
|
||||
/* */ }
|
||||
/* 303 */ return this.localResources.nextElement();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\LaunchedURLClassLoader.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.jar.Manifest;
|
||||
import org.springframework.boot.loader.jar.Handler;
|
||||
import org.springframework.boot.loader.jar.JarFile;
|
||||
import org.springframework.lang.UsesJava7;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class LaunchedURLClassLoader
|
||||
extends URLClassLoader
|
||||
{
|
||||
private static LockProvider LOCK_PROVIDER = setupLockProvider();
|
||||
|
||||
|
||||
|
||||
private final ClassLoader rootClassLoader;
|
||||
|
||||
|
||||
|
||||
|
||||
public LaunchedURLClassLoader(URL[] urls, ClassLoader parent) {
|
||||
super(urls, parent);
|
||||
this.rootClassLoader = findRootClassLoader(parent);
|
||||
}
|
||||
|
||||
private ClassLoader findRootClassLoader(ClassLoader classLoader) {
|
||||
while (classLoader != null) {
|
||||
if (classLoader.getParent() == null) {
|
||||
return classLoader;
|
||||
}
|
||||
classLoader = classLoader.getParent();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public URL getResource(String name) {
|
||||
URL url = null;
|
||||
if (this.rootClassLoader != null) {
|
||||
url = this.rootClassLoader.getResource(name);
|
||||
}
|
||||
return (url == null) ? findResource(name) : url;
|
||||
}
|
||||
|
||||
|
||||
public URL findResource(String name) {
|
||||
try {
|
||||
if (name.equals("") && hasURLs()) {
|
||||
return getURLs()[0];
|
||||
}
|
||||
Handler.setUseFastConnectionExceptions(true);
|
||||
try {
|
||||
return super.findResource(name);
|
||||
} finally {
|
||||
|
||||
Handler.setUseFastConnectionExceptions(false);
|
||||
}
|
||||
|
||||
} catch (IllegalArgumentException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Enumeration<URL> findResources(String name) throws IOException {
|
||||
if (name.equals("") && hasURLs()) {
|
||||
return Collections.enumeration(Arrays.asList(getURLs()));
|
||||
}
|
||||
Handler.setUseFastConnectionExceptions(true);
|
||||
try {
|
||||
return super.findResources(name);
|
||||
} finally {
|
||||
|
||||
Handler.setUseFastConnectionExceptions(false);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasURLs() {
|
||||
return ((getURLs()).length > 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Enumeration<URL> getResources(String name) throws IOException {
|
||||
if (this.rootClassLoader == null) {
|
||||
return findResources(name);
|
||||
}
|
||||
return new ResourceEnumeration(this.rootClassLoader.getResources(name),
|
||||
findResources(name));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
|
||||
synchronized (LOCK_PROVIDER.getLock(this, name)) {
|
||||
Class<?> loadedClass = findLoadedClass(name);
|
||||
if (loadedClass == null) {
|
||||
Handler.setUseFastConnectionExceptions(true);
|
||||
try {
|
||||
loadedClass = doLoadClass(name);
|
||||
} finally {
|
||||
|
||||
Handler.setUseFastConnectionExceptions(false);
|
||||
}
|
||||
}
|
||||
if (resolve) {
|
||||
resolveClass(loadedClass);
|
||||
}
|
||||
return loadedClass;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Class<?> doLoadClass(String name) throws ClassNotFoundException {
|
||||
try {
|
||||
if (this.rootClassLoader != null) {
|
||||
return this.rootClassLoader.loadClass(name);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
findPackage(name);
|
||||
Class<?> cls = findClass(name);
|
||||
return cls;
|
||||
}
|
||||
catch (Exception exception) {
|
||||
|
||||
|
||||
|
||||
|
||||
return super.loadClass(name, false);
|
||||
}
|
||||
}
|
||||
private void findPackage(String name) throws ClassNotFoundException {
|
||||
int lastDot = name.lastIndexOf('.');
|
||||
if (lastDot != -1) {
|
||||
String packageName = name.substring(0, lastDot);
|
||||
if (getPackage(packageName) == null) {
|
||||
try {
|
||||
definePackageForFindClass(name, packageName);
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void definePackageForFindClass(final String name, final String packageName) {
|
||||
try {
|
||||
AccessController.doPrivileged(new PrivilegedExceptionAction()
|
||||
{
|
||||
public Object run() throws ClassNotFoundException {
|
||||
String path = name.replace('.', '/').concat(".class");
|
||||
for (URL url : LaunchedURLClassLoader.this.getURLs()) {
|
||||
try {
|
||||
if (url.getContent() instanceof JarFile) {
|
||||
JarFile jarFile = (JarFile)url.getContent();
|
||||
|
||||
|
||||
if (jarFile.getJarEntryData(path) != null && jarFile
|
||||
.getManifest() != null) {
|
||||
LaunchedURLClassLoader.this.definePackage(packageName, jarFile.getManifest(), url);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (IOException iOException) {}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}AccessController.getContext());
|
||||
}
|
||||
catch (PrivilegedActionException privilegedActionException) {}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@UsesJava7
|
||||
private static LockProvider setupLockProvider() {
|
||||
try {
|
||||
ClassLoader.registerAsParallelCapable();
|
||||
return new Java7LockProvider();
|
||||
}
|
||||
catch (NoSuchMethodError ex) {
|
||||
return new LockProvider();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class LockProvider
|
||||
{
|
||||
private LockProvider() {}
|
||||
|
||||
public Object getLock(LaunchedURLClassLoader classLoader, String className) {
|
||||
return classLoader;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@UsesJava7
|
||||
private static class Java7LockProvider
|
||||
extends LockProvider
|
||||
{
|
||||
private Java7LockProvider() {}
|
||||
|
||||
|
||||
public Object getLock(LaunchedURLClassLoader classLoader, String className) {
|
||||
return classLoader.getClassLoadingLock(className);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class ResourceEnumeration
|
||||
implements Enumeration<URL>
|
||||
{
|
||||
private final Enumeration<URL> rootResources;
|
||||
|
||||
|
||||
private final Enumeration<URL> localResources;
|
||||
|
||||
|
||||
ResourceEnumeration(Enumeration<URL> rootResources, Enumeration<URL> localResources) {
|
||||
this.rootResources = rootResources;
|
||||
this.localResources = localResources;
|
||||
}
|
||||
|
||||
|
||||
public boolean hasMoreElements() {
|
||||
try {
|
||||
Handler.setUseFastConnectionExceptions(true);
|
||||
return (this.rootResources.hasMoreElements() || this.localResources
|
||||
.hasMoreElements());
|
||||
} finally {
|
||||
|
||||
Handler.setUseFastConnectionExceptions(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public URL nextElement() {
|
||||
if (this.rootResources.hasMoreElements()) {
|
||||
return this.rootResources.nextElement();
|
||||
}
|
||||
return this.localResources.nextElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+156
-160
@@ -1,160 +1,156 @@
|
||||
/* */ package org.springframework.boot.loader;
|
||||
/* */
|
||||
/* */ import java.io.File;
|
||||
/* */ import java.lang.reflect.Constructor;
|
||||
/* */ import java.net.URI;
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.security.CodeSource;
|
||||
/* */ import java.security.ProtectionDomain;
|
||||
/* */ import java.util.ArrayList;
|
||||
/* */ import java.util.List;
|
||||
/* */ import java.util.logging.Logger;
|
||||
/* */ import org.springframework.boot.loader.archive.Archive;
|
||||
/* */ import org.springframework.boot.loader.archive.ExplodedArchive;
|
||||
/* */ import org.springframework.boot.loader.archive.JarFileArchive;
|
||||
/* */ import org.springframework.boot.loader.jar.JarFile;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public abstract class Launcher
|
||||
/* */ {
|
||||
/* 43 */ protected Logger logger = Logger.getLogger(Launcher.class.getName());
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 49 */ private static final String RUNNER_CLASS = Launcher.class.getPackage().getName() + ".MainMethodRunner";
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected void launch(String[] args) {
|
||||
/* */ try {
|
||||
/* 59 */ JarFile.registerUrlProtocolHandler();
|
||||
/* 60 */ ClassLoader classLoader = createClassLoader(getClassPathArchives());
|
||||
/* 61 */ launch(args, getMainClass(), classLoader);
|
||||
/* */ }
|
||||
/* 63 */ catch (Exception ex) {
|
||||
/* 64 */ ex.printStackTrace();
|
||||
/* 65 */ System.exit(1);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected ClassLoader createClassLoader(List<Archive> archives) throws Exception {
|
||||
/* 76 */ List<URL> urls = new ArrayList<URL>(archives.size());
|
||||
/* 77 */ for (Archive archive : archives) {
|
||||
/* 78 */ urls.add(archive.getUrl());
|
||||
/* */ }
|
||||
/* 80 */ return createClassLoader(urls.<URL>toArray(new URL[urls.size()]));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected ClassLoader createClassLoader(URL[] urls) throws Exception {
|
||||
/* 90 */ return new LaunchedURLClassLoader(urls, getClass().getClassLoader());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected void launch(String[] args, String mainClass, ClassLoader classLoader) throws Exception {
|
||||
/* 102 */ Runnable runner = createMainMethodRunner(mainClass, args, classLoader);
|
||||
/* 103 */ Thread runnerThread = new Thread(runner);
|
||||
/* 104 */ runnerThread.setContextClassLoader(classLoader);
|
||||
/* 105 */ runnerThread.setName(Thread.currentThread().getName());
|
||||
/* 106 */ runnerThread.start();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected Runnable createMainMethodRunner(String mainClass, String[] args, ClassLoader classLoader) throws Exception {
|
||||
/* 119 */ Class<?> runnerClass = classLoader.loadClass(RUNNER_CLASS);
|
||||
/* 120 */ Constructor<?> constructor = runnerClass.getConstructor(new Class[] { String.class, String[].class });
|
||||
/* */
|
||||
/* 122 */ return (Runnable)constructor.newInstance(new Object[] { mainClass, args });
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected abstract String getMainClass() throws Exception;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected abstract List<Archive> getClassPathArchives() throws Exception;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected final Archive createArchive() throws Exception {
|
||||
/* 140 */ ProtectionDomain protectionDomain = getClass().getProtectionDomain();
|
||||
/* 141 */ CodeSource codeSource = protectionDomain.getCodeSource();
|
||||
/* 142 */ URI location = (codeSource == null) ? null : codeSource.getLocation().toURI();
|
||||
/* 143 */ String path = (location == null) ? null : location.getSchemeSpecificPart();
|
||||
/* 144 */ if (path == null) {
|
||||
/* 145 */ throw new IllegalStateException("Unable to determine code source archive");
|
||||
/* */ }
|
||||
/* 147 */ File root = new File(path);
|
||||
/* 148 */ if (!root.exists()) {
|
||||
/* 149 */ throw new IllegalStateException("Unable to determine code source archive from " + root);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 152 */ return root.isDirectory() ? (Archive)new ExplodedArchive(root) : (Archive)new JarFileArchive(root);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\Launcher.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.security.CodeSource;
|
||||
import java.security.ProtectionDomain;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
import org.springframework.boot.loader.archive.Archive;
|
||||
import org.springframework.boot.loader.archive.ExplodedArchive;
|
||||
import org.springframework.boot.loader.archive.JarFileArchive;
|
||||
import org.springframework.boot.loader.jar.JarFile;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public abstract class Launcher
|
||||
{
|
||||
protected Logger logger = Logger.getLogger(Launcher.class.getName());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static final String RUNNER_CLASS = Launcher.class.getPackage().getName() + ".MainMethodRunner";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected void launch(String[] args) {
|
||||
try {
|
||||
JarFile.registerUrlProtocolHandler();
|
||||
ClassLoader classLoader = createClassLoader(getClassPathArchives());
|
||||
launch(args, getMainClass(), classLoader);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected ClassLoader createClassLoader(List<Archive> archives) throws Exception {
|
||||
List<URL> urls = new ArrayList<URL>(archives.size());
|
||||
for (Archive archive : archives) {
|
||||
urls.add(archive.getUrl());
|
||||
}
|
||||
return createClassLoader(urls.<URL>toArray(new URL[urls.size()]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected ClassLoader createClassLoader(URL[] urls) throws Exception {
|
||||
return new LaunchedURLClassLoader(urls, getClass().getClassLoader());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected void launch(String[] args, String mainClass, ClassLoader classLoader) throws Exception {
|
||||
Runnable runner = createMainMethodRunner(mainClass, args, classLoader);
|
||||
Thread runnerThread = new Thread(runner);
|
||||
runnerThread.setContextClassLoader(classLoader);
|
||||
runnerThread.setName(Thread.currentThread().getName());
|
||||
runnerThread.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected Runnable createMainMethodRunner(String mainClass, String[] args, ClassLoader classLoader) throws Exception {
|
||||
Class<?> runnerClass = classLoader.loadClass(RUNNER_CLASS);
|
||||
Constructor<?> constructor = runnerClass.getConstructor(new Class[] { String.class, String[].class });
|
||||
|
||||
return (Runnable)constructor.newInstance(new Object[] { mainClass, args });
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected abstract String getMainClass() throws Exception;
|
||||
|
||||
|
||||
|
||||
|
||||
protected abstract List<Archive> getClassPathArchives() throws Exception;
|
||||
|
||||
|
||||
|
||||
|
||||
protected final Archive createArchive() throws Exception {
|
||||
ProtectionDomain protectionDomain = getClass().getProtectionDomain();
|
||||
CodeSource codeSource = protectionDomain.getCodeSource();
|
||||
URI location = (codeSource == null) ? null : codeSource.getLocation().toURI();
|
||||
String path = (location == null) ? null : location.getSchemeSpecificPart();
|
||||
if (path == null) {
|
||||
throw new IllegalStateException("Unable to determine code source archive");
|
||||
}
|
||||
File root = new File(path);
|
||||
if (!root.exists()) {
|
||||
throw new IllegalStateException("Unable to determine code source archive from " + root);
|
||||
}
|
||||
|
||||
return root.isDirectory() ? (Archive)new ExplodedArchive(root) : (Archive)new JarFileArchive(root);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+67
-71
@@ -1,71 +1,67 @@
|
||||
/* */ package org.springframework.boot.loader;
|
||||
/* */
|
||||
/* */ import java.lang.reflect.Method;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class MainMethodRunner
|
||||
/* */ implements Runnable
|
||||
/* */ {
|
||||
/* */ private final String mainClassName;
|
||||
/* */ private final String[] args;
|
||||
/* */
|
||||
/* */ public MainMethodRunner(String mainClass, String[] args) {
|
||||
/* 40 */ this.mainClassName = mainClass;
|
||||
/* 41 */ this.args = (args == null) ? null : (String[])args.clone();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public void run() {
|
||||
/* */ try {
|
||||
/* 48 */ Class<?> mainClass = Thread.currentThread().getContextClassLoader().loadClass(this.mainClassName);
|
||||
/* 49 */ Method mainMethod = mainClass.getDeclaredMethod("main", new Class[] { String[].class });
|
||||
/* 50 */ if (mainMethod == null) {
|
||||
/* 51 */ throw new IllegalStateException(this.mainClassName + " does not have a main method");
|
||||
/* */ }
|
||||
/* */
|
||||
/* 54 */ mainMethod.invoke(null, new Object[] { this.args });
|
||||
/* */ }
|
||||
/* 56 */ catch (Exception ex) {
|
||||
/* */
|
||||
/* 58 */ Thread.UncaughtExceptionHandler handler = Thread.currentThread().getUncaughtExceptionHandler();
|
||||
/* 59 */ if (handler != null) {
|
||||
/* 60 */ handler.uncaughtException(Thread.currentThread(), ex);
|
||||
/* */ }
|
||||
/* 62 */ throw new RuntimeException(ex);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\MainMethodRunner.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class MainMethodRunner
|
||||
implements Runnable
|
||||
{
|
||||
private final String mainClassName;
|
||||
private final String[] args;
|
||||
|
||||
public MainMethodRunner(String mainClass, String[] args) {
|
||||
this.mainClassName = mainClass;
|
||||
this.args = (args == null) ? null : (String[])args.clone();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
Class<?> mainClass = Thread.currentThread().getContextClassLoader().loadClass(this.mainClassName);
|
||||
Method mainMethod = mainClass.getDeclaredMethod("main", new Class[] { String[].class });
|
||||
if (mainMethod == null) {
|
||||
throw new IllegalStateException(this.mainClassName + " does not have a main method");
|
||||
}
|
||||
|
||||
mainMethod.invoke(null, new Object[] { this.args });
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
||||
Thread.UncaughtExceptionHandler handler = Thread.currentThread().getUncaughtExceptionHandler();
|
||||
if (handler != null) {
|
||||
handler.uncaughtException(Thread.currentThread(), ex);
|
||||
}
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+683
-687
File diff suppressed because it is too large
Load Diff
+65
-69
@@ -1,69 +1,65 @@
|
||||
/* */ package org.springframework.boot.loader;
|
||||
/* */
|
||||
/* */ import org.springframework.boot.loader.archive.Archive;
|
||||
/* */ import org.springframework.boot.loader.util.AsciiBytes;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class WarLauncher
|
||||
/* */ extends ExecutableArchiveLauncher
|
||||
/* */ {
|
||||
/* 32 */ private static final AsciiBytes WEB_INF = new AsciiBytes("WEB-INF/");
|
||||
/* */
|
||||
/* 34 */ private static final AsciiBytes WEB_INF_CLASSES = WEB_INF.append("classes/");
|
||||
/* */
|
||||
/* 36 */ private static final AsciiBytes WEB_INF_LIB = WEB_INF.append("lib/");
|
||||
/* */
|
||||
/* 38 */ private static final AsciiBytes WEB_INF_LIB_PROVIDED = WEB_INF
|
||||
/* 39 */ .append("lib-provided/");
|
||||
/* */
|
||||
/* */
|
||||
/* */ public WarLauncher() {}
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected WarLauncher(Archive archive) {
|
||||
/* 46 */ super(archive);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public boolean isNestedArchive(Archive.Entry entry) {
|
||||
/* 51 */ if (entry.isDirectory()) {
|
||||
/* 52 */ return entry.getName().equals(WEB_INF_CLASSES);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 55 */ return (entry.getName().startsWith(WEB_INF_LIB) || entry
|
||||
/* 56 */ .getName().startsWith(WEB_INF_LIB_PROVIDED));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void main(String[] args) {
|
||||
/* 61 */ (new WarLauncher()).launch(args);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\WarLauncher.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader;
|
||||
|
||||
import org.springframework.boot.loader.archive.Archive;
|
||||
import org.springframework.boot.loader.util.AsciiBytes;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class WarLauncher
|
||||
extends ExecutableArchiveLauncher
|
||||
{
|
||||
private static final AsciiBytes WEB_INF = new AsciiBytes("WEB-INF/");
|
||||
|
||||
private static final AsciiBytes WEB_INF_CLASSES = WEB_INF.append("classes/");
|
||||
|
||||
private static final AsciiBytes WEB_INF_LIB = WEB_INF.append("lib/");
|
||||
|
||||
private static final AsciiBytes WEB_INF_LIB_PROVIDED = WEB_INF
|
||||
.append("lib-provided/");
|
||||
|
||||
|
||||
public WarLauncher() {}
|
||||
|
||||
|
||||
protected WarLauncher(Archive archive) {
|
||||
super(archive);
|
||||
}
|
||||
|
||||
|
||||
public boolean isNestedArchive(Archive.Entry entry) {
|
||||
if (entry.isDirectory()) {
|
||||
return entry.getName().equals(WEB_INF_CLASSES);
|
||||
}
|
||||
|
||||
return (entry.getName().startsWith(WEB_INF_LIB) || entry
|
||||
.getName().startsWith(WEB_INF_LIB_PROVIDED));
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
(new WarLauncher()).launch(args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+96
-100
@@ -1,100 +1,96 @@
|
||||
/* */ package org.springframework.boot.loader.archive;
|
||||
/* */
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.net.MalformedURLException;
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.util.Collection;
|
||||
/* */ import java.util.List;
|
||||
/* */ import java.util.jar.Manifest;
|
||||
/* */ import org.springframework.boot.loader.util.AsciiBytes;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public abstract class Archive
|
||||
/* */ {
|
||||
/* */ public abstract URL getUrl() throws MalformedURLException;
|
||||
/* */
|
||||
/* */ public String getMainClass() throws Exception {
|
||||
/* 51 */ Manifest manifest = getManifest();
|
||||
/* 52 */ String mainClass = null;
|
||||
/* 53 */ if (manifest != null) {
|
||||
/* 54 */ mainClass = manifest.getMainAttributes().getValue("Start-Class");
|
||||
/* */ }
|
||||
/* 56 */ if (mainClass == null) {
|
||||
/* 57 */ throw new IllegalStateException("No 'Start-Class' manifest entry specified in " + this);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 60 */ return mainClass;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String toString() {
|
||||
/* */ try {
|
||||
/* 66 */ return getUrl().toString();
|
||||
/* */ }
|
||||
/* 68 */ catch (Exception ex) {
|
||||
/* 69 */ return "archive";
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public abstract Manifest getManifest() throws IOException;
|
||||
/* */
|
||||
/* */ public abstract Collection<Entry> getEntries();
|
||||
/* */
|
||||
/* */ public abstract List<Archive> getNestedArchives(EntryFilter paramEntryFilter) throws IOException;
|
||||
/* */
|
||||
/* */ public abstract Archive getFilteredArchive(EntryRenameFilter paramEntryRenameFilter) throws IOException;
|
||||
/* */
|
||||
/* */ public static interface EntryRenameFilter {
|
||||
/* */ AsciiBytes apply(AsciiBytes param1AsciiBytes, Archive.Entry param1Entry);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static interface EntryFilter {
|
||||
/* */ boolean matches(Archive.Entry param1Entry);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static interface Entry {
|
||||
/* */ boolean isDirectory();
|
||||
/* */
|
||||
/* */ AsciiBytes getName();
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\archive\Archive.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.archive;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.jar.Manifest;
|
||||
import org.springframework.boot.loader.util.AsciiBytes;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public abstract class Archive
|
||||
{
|
||||
public abstract URL getUrl() throws MalformedURLException;
|
||||
|
||||
public String getMainClass() throws Exception {
|
||||
Manifest manifest = getManifest();
|
||||
String mainClass = null;
|
||||
if (manifest != null) {
|
||||
mainClass = manifest.getMainAttributes().getValue("Start-Class");
|
||||
}
|
||||
if (mainClass == null) {
|
||||
throw new IllegalStateException("No 'Start-Class' manifest entry specified in " + this);
|
||||
}
|
||||
|
||||
return mainClass;
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
try {
|
||||
return getUrl().toString();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return "archive";
|
||||
}
|
||||
}
|
||||
|
||||
public abstract Manifest getManifest() throws IOException;
|
||||
|
||||
public abstract Collection<Entry> getEntries();
|
||||
|
||||
public abstract List<Archive> getNestedArchives(EntryFilter paramEntryFilter) throws IOException;
|
||||
|
||||
public abstract Archive getFilteredArchive(EntryRenameFilter paramEntryRenameFilter) throws IOException;
|
||||
|
||||
public static interface EntryRenameFilter {
|
||||
AsciiBytes apply(AsciiBytes param1AsciiBytes, Archive.Entry param1Entry);
|
||||
}
|
||||
|
||||
public static interface EntryFilter {
|
||||
boolean matches(Archive.Entry param1Entry);
|
||||
}
|
||||
|
||||
public static interface Entry {
|
||||
boolean isDirectory();
|
||||
|
||||
AsciiBytes getName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+233
-237
@@ -1,237 +1,233 @@
|
||||
/* */ package org.springframework.boot.loader.archive;
|
||||
/* */
|
||||
/* */ import java.io.File;
|
||||
/* */ import java.io.FileInputStream;
|
||||
/* */ import java.io.FileNotFoundException;
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.net.MalformedURLException;
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.net.URLConnection;
|
||||
/* */ import java.net.URLStreamHandler;
|
||||
/* */ import java.util.ArrayList;
|
||||
/* */ import java.util.Arrays;
|
||||
/* */ import java.util.Collection;
|
||||
/* */ import java.util.Collections;
|
||||
/* */ import java.util.HashSet;
|
||||
/* */ import java.util.LinkedHashMap;
|
||||
/* */ import java.util.List;
|
||||
/* */ import java.util.Map;
|
||||
/* */ import java.util.Set;
|
||||
/* */ import java.util.jar.Manifest;
|
||||
/* */ import org.springframework.boot.loader.util.AsciiBytes;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class ExplodedArchive
|
||||
/* */ extends Archive
|
||||
/* */ {
|
||||
/* 47 */ private static final Set<String> SKIPPED_NAMES = new HashSet<String>(
|
||||
/* 48 */ Arrays.asList(new String[] { ".", ".." }));
|
||||
/* */
|
||||
/* 50 */ private static final AsciiBytes MANIFEST_ENTRY_NAME = new AsciiBytes("META-INF/MANIFEST.MF");
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final File root;
|
||||
/* */
|
||||
/* 55 */ private Map<AsciiBytes, Archive.Entry> entries = new LinkedHashMap<AsciiBytes, Archive.Entry>();
|
||||
/* */
|
||||
/* */
|
||||
/* */ private Manifest manifest;
|
||||
/* */
|
||||
/* */
|
||||
/* */ private boolean filtered = false;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public ExplodedArchive(File root) {
|
||||
/* 66 */ this(root, true);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public ExplodedArchive(File root, boolean recursive) {
|
||||
/* 77 */ if (!root.exists() || !root.isDirectory()) {
|
||||
/* 78 */ throw new IllegalArgumentException("Invalid source folder " + root);
|
||||
/* */ }
|
||||
/* 80 */ this.root = root;
|
||||
/* 81 */ buildEntries(root, recursive);
|
||||
/* 82 */ this.entries = Collections.unmodifiableMap(this.entries);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private ExplodedArchive(File root, Map<AsciiBytes, Archive.Entry> entries) {
|
||||
/* 86 */ this.root = root;
|
||||
/* */
|
||||
/* 88 */ this.filtered = true;
|
||||
/* 89 */ this.entries = Collections.unmodifiableMap(entries);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private void buildEntries(File file, boolean recursive) {
|
||||
/* 93 */ if (!file.equals(this.root)) {
|
||||
/* */
|
||||
/* 95 */ String name = file.toURI().getPath().substring(this.root.toURI().getPath().length());
|
||||
/* 96 */ FileEntry entry = new FileEntry(new AsciiBytes(name), file);
|
||||
/* 97 */ this.entries.put(entry.getName(), entry);
|
||||
/* */ }
|
||||
/* 99 */ if (file.isDirectory()) {
|
||||
/* 100 */ File[] files = file.listFiles();
|
||||
/* 101 */ if (files == null) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 104 */ for (File child : files) {
|
||||
/* 105 */ if (!SKIPPED_NAMES.contains(child.getName()) && (
|
||||
/* 106 */ file.equals(this.root) || recursive || file
|
||||
/* 107 */ .getName().equals("META-INF"))) {
|
||||
/* 108 */ buildEntries(child, recursive);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public URL getUrl() throws MalformedURLException {
|
||||
/* 117 */ FilteredURLStreamHandler handler = this.filtered ? new FilteredURLStreamHandler() : null;
|
||||
/* */
|
||||
/* 119 */ return new URL("file", "", -1, this.root.toURI().getPath(), handler);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Manifest getManifest() throws IOException {
|
||||
/* 124 */ if (this.manifest == null && this.entries.containsKey(MANIFEST_ENTRY_NAME)) {
|
||||
/* 125 */ FileEntry entry = (FileEntry)this.entries.get(MANIFEST_ENTRY_NAME);
|
||||
/* 126 */ FileInputStream inputStream = new FileInputStream(entry.getFile());
|
||||
/* */ try {
|
||||
/* 128 */ this.manifest = new Manifest(inputStream);
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* 131 */ inputStream.close();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 134 */ return this.manifest;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public List<Archive> getNestedArchives(Archive.EntryFilter filter) throws IOException {
|
||||
/* 139 */ List<Archive> nestedArchives = new ArrayList<Archive>();
|
||||
/* 140 */ for (Archive.Entry entry : getEntries()) {
|
||||
/* 141 */ if (filter.matches(entry)) {
|
||||
/* 142 */ nestedArchives.add(getNestedArchive(entry));
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 145 */ return Collections.unmodifiableList(nestedArchives);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Collection<Archive.Entry> getEntries() {
|
||||
/* 150 */ return Collections.unmodifiableCollection(this.entries.values());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ protected Archive getNestedArchive(Archive.Entry entry) throws IOException {
|
||||
/* 154 */ File file = ((FileEntry)entry).getFile();
|
||||
/* 155 */ return file.isDirectory() ? new ExplodedArchive(file) : new JarFileArchive(file);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Archive getFilteredArchive(Archive.EntryRenameFilter filter) throws IOException {
|
||||
/* 161 */ Map<AsciiBytes, Archive.Entry> filteredEntries = new LinkedHashMap<AsciiBytes, Archive.Entry>();
|
||||
/* 162 */ for (Map.Entry<AsciiBytes, Archive.Entry> entry : this.entries.entrySet()) {
|
||||
/* 163 */ AsciiBytes filteredName = filter.apply(entry.getKey(), entry.getValue());
|
||||
/* 164 */ if (filteredName != null) {
|
||||
/* 165 */ filteredEntries.put(filteredName, new FileEntry(filteredName, ((FileEntry)entry
|
||||
/* 166 */ .getValue()).getFile()));
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 169 */ return new ExplodedArchive(this.root, filteredEntries);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private class FileEntry
|
||||
/* */ implements Archive.Entry
|
||||
/* */ {
|
||||
/* */ private final AsciiBytes name;
|
||||
/* */ private final File file;
|
||||
/* */
|
||||
/* */ FileEntry(AsciiBytes name, File file) {
|
||||
/* 179 */ this.name = name;
|
||||
/* 180 */ this.file = file;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public File getFile() {
|
||||
/* 184 */ return this.file;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public boolean isDirectory() {
|
||||
/* 189 */ return this.file.isDirectory();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public AsciiBytes getName() {
|
||||
/* 194 */ return this.name;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private class FilteredURLStreamHandler
|
||||
/* */ extends URLStreamHandler
|
||||
/* */ {
|
||||
/* */ private FilteredURLStreamHandler() {}
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected URLConnection openConnection(URL url) throws IOException {
|
||||
/* 206 */ String name = url.getPath().substring(ExplodedArchive.this.root.toURI().getPath().length());
|
||||
/* 207 */ if (ExplodedArchive.this.entries.containsKey(new AsciiBytes(name))) {
|
||||
/* 208 */ return (new URL(url.toString())).openConnection();
|
||||
/* */ }
|
||||
/* 210 */ return new ExplodedArchive.FileNotFoundURLConnection(url, name);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static class FileNotFoundURLConnection
|
||||
/* */ extends URLConnection
|
||||
/* */ {
|
||||
/* */ private final String name;
|
||||
/* */
|
||||
/* */
|
||||
/* */ FileNotFoundURLConnection(URL url, String name) {
|
||||
/* 222 */ super(url);
|
||||
/* 223 */ this.name = name;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public void connect() throws IOException {
|
||||
/* 228 */ throw new FileNotFoundException(this.name);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\archive\ExplodedArchive.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.archive;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLStreamHandler;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.jar.Manifest;
|
||||
import org.springframework.boot.loader.util.AsciiBytes;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class ExplodedArchive
|
||||
extends Archive
|
||||
{
|
||||
private static final Set<String> SKIPPED_NAMES = new HashSet<String>(
|
||||
Arrays.asList(new String[] { ".", ".." }));
|
||||
|
||||
private static final AsciiBytes MANIFEST_ENTRY_NAME = new AsciiBytes("META-INF/MANIFEST.MF");
|
||||
|
||||
|
||||
private final File root;
|
||||
|
||||
private Map<AsciiBytes, Archive.Entry> entries = new LinkedHashMap<AsciiBytes, Archive.Entry>();
|
||||
|
||||
|
||||
private Manifest manifest;
|
||||
|
||||
|
||||
private boolean filtered = false;
|
||||
|
||||
|
||||
|
||||
public ExplodedArchive(File root) {
|
||||
this(root, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public ExplodedArchive(File root, boolean recursive) {
|
||||
if (!root.exists() || !root.isDirectory()) {
|
||||
throw new IllegalArgumentException("Invalid source folder " + root);
|
||||
}
|
||||
this.root = root;
|
||||
buildEntries(root, recursive);
|
||||
this.entries = Collections.unmodifiableMap(this.entries);
|
||||
}
|
||||
|
||||
private ExplodedArchive(File root, Map<AsciiBytes, Archive.Entry> entries) {
|
||||
this.root = root;
|
||||
|
||||
this.filtered = true;
|
||||
this.entries = Collections.unmodifiableMap(entries);
|
||||
}
|
||||
|
||||
private void buildEntries(File file, boolean recursive) {
|
||||
if (!file.equals(this.root)) {
|
||||
|
||||
String name = file.toURI().getPath().substring(this.root.toURI().getPath().length());
|
||||
FileEntry entry = new FileEntry(new AsciiBytes(name), file);
|
||||
this.entries.put(entry.getName(), entry);
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
File[] files = file.listFiles();
|
||||
if (files == null) {
|
||||
return;
|
||||
}
|
||||
for (File child : files) {
|
||||
if (!SKIPPED_NAMES.contains(child.getName()) && (
|
||||
file.equals(this.root) || recursive || file
|
||||
.getName().equals("META-INF"))) {
|
||||
buildEntries(child, recursive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public URL getUrl() throws MalformedURLException {
|
||||
FilteredURLStreamHandler handler = this.filtered ? new FilteredURLStreamHandler() : null;
|
||||
|
||||
return new URL("file", "", -1, this.root.toURI().getPath(), handler);
|
||||
}
|
||||
|
||||
|
||||
public Manifest getManifest() throws IOException {
|
||||
if (this.manifest == null && this.entries.containsKey(MANIFEST_ENTRY_NAME)) {
|
||||
FileEntry entry = (FileEntry)this.entries.get(MANIFEST_ENTRY_NAME);
|
||||
FileInputStream inputStream = new FileInputStream(entry.getFile());
|
||||
try {
|
||||
this.manifest = new Manifest(inputStream);
|
||||
} finally {
|
||||
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
return this.manifest;
|
||||
}
|
||||
|
||||
|
||||
public List<Archive> getNestedArchives(Archive.EntryFilter filter) throws IOException {
|
||||
List<Archive> nestedArchives = new ArrayList<Archive>();
|
||||
for (Archive.Entry entry : getEntries()) {
|
||||
if (filter.matches(entry)) {
|
||||
nestedArchives.add(getNestedArchive(entry));
|
||||
}
|
||||
}
|
||||
return Collections.unmodifiableList(nestedArchives);
|
||||
}
|
||||
|
||||
|
||||
public Collection<Archive.Entry> getEntries() {
|
||||
return Collections.unmodifiableCollection(this.entries.values());
|
||||
}
|
||||
|
||||
protected Archive getNestedArchive(Archive.Entry entry) throws IOException {
|
||||
File file = ((FileEntry)entry).getFile();
|
||||
return file.isDirectory() ? new ExplodedArchive(file) : new JarFileArchive(file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Archive getFilteredArchive(Archive.EntryRenameFilter filter) throws IOException {
|
||||
Map<AsciiBytes, Archive.Entry> filteredEntries = new LinkedHashMap<AsciiBytes, Archive.Entry>();
|
||||
for (Map.Entry<AsciiBytes, Archive.Entry> entry : this.entries.entrySet()) {
|
||||
AsciiBytes filteredName = filter.apply(entry.getKey(), entry.getValue());
|
||||
if (filteredName != null) {
|
||||
filteredEntries.put(filteredName, new FileEntry(filteredName, ((FileEntry)entry
|
||||
.getValue()).getFile()));
|
||||
}
|
||||
}
|
||||
return new ExplodedArchive(this.root, filteredEntries);
|
||||
}
|
||||
|
||||
private class FileEntry
|
||||
implements Archive.Entry
|
||||
{
|
||||
private final AsciiBytes name;
|
||||
private final File file;
|
||||
|
||||
FileEntry(AsciiBytes name, File file) {
|
||||
this.name = name;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return this.file;
|
||||
}
|
||||
|
||||
|
||||
public boolean isDirectory() {
|
||||
return this.file.isDirectory();
|
||||
}
|
||||
|
||||
|
||||
public AsciiBytes getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class FilteredURLStreamHandler
|
||||
extends URLStreamHandler
|
||||
{
|
||||
private FilteredURLStreamHandler() {}
|
||||
|
||||
|
||||
protected URLConnection openConnection(URL url) throws IOException {
|
||||
String name = url.getPath().substring(ExplodedArchive.this.root.toURI().getPath().length());
|
||||
if (ExplodedArchive.this.entries.containsKey(new AsciiBytes(name))) {
|
||||
return (new URL(url.toString())).openConnection();
|
||||
}
|
||||
return new ExplodedArchive.FileNotFoundURLConnection(url, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class FileNotFoundURLConnection
|
||||
extends URLConnection
|
||||
{
|
||||
private final String name;
|
||||
|
||||
|
||||
FileNotFoundURLConnection(URL url, String name) {
|
||||
super(url);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public void connect() throws IOException {
|
||||
throw new FileNotFoundException(this.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+95
-99
@@ -1,99 +1,95 @@
|
||||
/* */ package org.springframework.boot.loader.archive;
|
||||
/* */
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.net.MalformedURLException;
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.util.ArrayList;
|
||||
/* */ import java.util.Collection;
|
||||
/* */ import java.util.Collections;
|
||||
/* */ import java.util.List;
|
||||
/* */ import java.util.jar.Manifest;
|
||||
/* */ import org.springframework.boot.loader.util.AsciiBytes;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class FilteredArchive
|
||||
/* */ extends Archive
|
||||
/* */ {
|
||||
/* */ private final Archive parent;
|
||||
/* */ private final Archive.EntryFilter filter;
|
||||
/* */
|
||||
/* */ public FilteredArchive(Archive parent, Archive.EntryFilter filter) {
|
||||
/* 42 */ this.parent = parent;
|
||||
/* 43 */ this.filter = filter;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public URL getUrl() throws MalformedURLException {
|
||||
/* 48 */ return this.parent.getUrl();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String getMainClass() throws Exception {
|
||||
/* 53 */ return this.parent.getMainClass();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Manifest getManifest() throws IOException {
|
||||
/* 58 */ return this.parent.getManifest();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Collection<Archive.Entry> getEntries() {
|
||||
/* 63 */ List<Archive.Entry> nested = new ArrayList<Archive.Entry>();
|
||||
/* 64 */ for (Archive.Entry entry : this.parent.getEntries()) {
|
||||
/* 65 */ if (this.filter.matches(entry)) {
|
||||
/* 66 */ nested.add(entry);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 69 */ return Collections.unmodifiableList(nested);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public List<Archive> getNestedArchives(final Archive.EntryFilter filter) throws IOException {
|
||||
/* 74 */ return this.parent.getNestedArchives(new Archive.EntryFilter()
|
||||
/* */ {
|
||||
/* */ public boolean matches(Archive.Entry entry) {
|
||||
/* 77 */ return (FilteredArchive.this.filter.matches(entry) && filter
|
||||
/* 78 */ .matches(entry));
|
||||
/* */ }
|
||||
/* */ });
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Archive getFilteredArchive(final Archive.EntryRenameFilter filter) throws IOException {
|
||||
/* 85 */ return this.parent.getFilteredArchive(new Archive.EntryRenameFilter()
|
||||
/* */ {
|
||||
/* */ public AsciiBytes apply(AsciiBytes entryName, Archive.Entry entry) {
|
||||
/* 88 */ return FilteredArchive.this.filter.matches(entry) ? filter
|
||||
/* 89 */ .apply(entryName, entry) : null;
|
||||
/* */ }
|
||||
/* */ });
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\archive\FilteredArchive.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.archive;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.jar.Manifest;
|
||||
import org.springframework.boot.loader.util.AsciiBytes;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class FilteredArchive
|
||||
extends Archive
|
||||
{
|
||||
private final Archive parent;
|
||||
private final Archive.EntryFilter filter;
|
||||
|
||||
public FilteredArchive(Archive parent, Archive.EntryFilter filter) {
|
||||
this.parent = parent;
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
|
||||
public URL getUrl() throws MalformedURLException {
|
||||
return this.parent.getUrl();
|
||||
}
|
||||
|
||||
|
||||
public String getMainClass() throws Exception {
|
||||
return this.parent.getMainClass();
|
||||
}
|
||||
|
||||
|
||||
public Manifest getManifest() throws IOException {
|
||||
return this.parent.getManifest();
|
||||
}
|
||||
|
||||
|
||||
public Collection<Archive.Entry> getEntries() {
|
||||
List<Archive.Entry> nested = new ArrayList<Archive.Entry>();
|
||||
for (Archive.Entry entry : this.parent.getEntries()) {
|
||||
if (this.filter.matches(entry)) {
|
||||
nested.add(entry);
|
||||
}
|
||||
}
|
||||
return Collections.unmodifiableList(nested);
|
||||
}
|
||||
|
||||
|
||||
public List<Archive> getNestedArchives(final Archive.EntryFilter filter) throws IOException {
|
||||
return this.parent.getNestedArchives(new Archive.EntryFilter()
|
||||
{
|
||||
public boolean matches(Archive.Entry entry) {
|
||||
return (FilteredArchive.this.filter.matches(entry) && filter
|
||||
.matches(entry));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public Archive getFilteredArchive(final Archive.EntryRenameFilter filter) throws IOException {
|
||||
return this.parent.getFilteredArchive(new Archive.EntryRenameFilter()
|
||||
{
|
||||
public AsciiBytes apply(AsciiBytes entryName, Archive.Entry entry) {
|
||||
return FilteredArchive.this.filter.matches(entry) ? filter
|
||||
.apply(entryName, entry) : null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+209
-213
@@ -1,213 +1,209 @@
|
||||
/* */ package org.springframework.boot.loader.archive;
|
||||
/* */
|
||||
/* */ import java.io.File;
|
||||
/* */ import java.io.FileOutputStream;
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.io.InputStream;
|
||||
/* */ import java.io.OutputStream;
|
||||
/* */ import java.net.MalformedURLException;
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.util.ArrayList;
|
||||
/* */ import java.util.Collection;
|
||||
/* */ import java.util.Collections;
|
||||
/* */ import java.util.List;
|
||||
/* */ import java.util.UUID;
|
||||
/* */ import java.util.jar.Manifest;
|
||||
/* */ import org.springframework.boot.loader.data.RandomAccessData;
|
||||
/* */ import org.springframework.boot.loader.jar.JarEntryData;
|
||||
/* */ import org.springframework.boot.loader.jar.JarEntryFilter;
|
||||
/* */ import org.springframework.boot.loader.jar.JarFile;
|
||||
/* */ import org.springframework.boot.loader.util.AsciiBytes;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class JarFileArchive
|
||||
/* */ extends Archive
|
||||
/* */ {
|
||||
/* 48 */ private static final AsciiBytes UNPACK_MARKER = new AsciiBytes("UNPACK:");
|
||||
/* */
|
||||
/* */ private static final int BUFFER_SIZE = 32768;
|
||||
/* */
|
||||
/* */ private final JarFile jarFile;
|
||||
/* */
|
||||
/* */ private final List<Archive.Entry> entries;
|
||||
/* */
|
||||
/* */ private URL url;
|
||||
/* */
|
||||
/* */ private File tempUnpackFolder;
|
||||
/* */
|
||||
/* */ public JarFileArchive(File file) throws IOException {
|
||||
/* 61 */ this(file, null);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public JarFileArchive(File file, URL url) throws IOException {
|
||||
/* 65 */ this(new JarFile(file));
|
||||
/* 66 */ this.url = url;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public JarFileArchive(JarFile jarFile) {
|
||||
/* 70 */ this.jarFile = jarFile;
|
||||
/* 71 */ ArrayList<Archive.Entry> jarFileEntries = new ArrayList<Archive.Entry>();
|
||||
/* 72 */ for (JarEntryData data : jarFile) {
|
||||
/* 73 */ jarFileEntries.add(new JarFileEntry(data));
|
||||
/* */ }
|
||||
/* 75 */ this.entries = Collections.unmodifiableList(jarFileEntries);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public URL getUrl() throws MalformedURLException {
|
||||
/* 80 */ if (this.url != null) {
|
||||
/* 81 */ return this.url;
|
||||
/* */ }
|
||||
/* 83 */ return this.jarFile.getUrl();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Manifest getManifest() throws IOException {
|
||||
/* 88 */ return this.jarFile.getManifest();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public List<Archive> getNestedArchives(Archive.EntryFilter filter) throws IOException {
|
||||
/* 93 */ List<Archive> nestedArchives = new ArrayList<Archive>();
|
||||
/* 94 */ for (Archive.Entry entry : getEntries()) {
|
||||
/* 95 */ if (filter.matches(entry)) {
|
||||
/* 96 */ nestedArchives.add(getNestedArchive(entry));
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 99 */ return Collections.unmodifiableList(nestedArchives);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Collection<Archive.Entry> getEntries() {
|
||||
/* 104 */ return Collections.unmodifiableCollection(this.entries);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ protected Archive getNestedArchive(Archive.Entry entry) throws IOException {
|
||||
/* 108 */ JarEntryData data = ((JarFileEntry)entry).getJarEntryData();
|
||||
/* 109 */ if (data.getComment().startsWith(UNPACK_MARKER)) {
|
||||
/* 110 */ return getUnpackedNestedArchive(data);
|
||||
/* */ }
|
||||
/* 112 */ JarFile jarFile = this.jarFile.getNestedJarFile(data);
|
||||
/* 113 */ return new JarFileArchive(jarFile);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private Archive getUnpackedNestedArchive(JarEntryData data) throws IOException {
|
||||
/* 117 */ String name = data.getName().toString();
|
||||
/* 118 */ if (name.lastIndexOf("/") != -1) {
|
||||
/* 119 */ name = name.substring(name.lastIndexOf("/") + 1);
|
||||
/* */ }
|
||||
/* 121 */ File file = new File(getTempUnpackFolder(), name);
|
||||
/* 122 */ if (!file.exists() || file.length() != data.getSize()) {
|
||||
/* 123 */ unpack(data, file);
|
||||
/* */ }
|
||||
/* 125 */ return new JarFileArchive(file, file.toURI().toURL());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private File getTempUnpackFolder() {
|
||||
/* 129 */ if (this.tempUnpackFolder == null) {
|
||||
/* 130 */ File tempFolder = new File(System.getProperty("java.io.tmpdir"));
|
||||
/* 131 */ this.tempUnpackFolder = createUnpackFolder(tempFolder);
|
||||
/* */ }
|
||||
/* 133 */ return this.tempUnpackFolder;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private File createUnpackFolder(File parent) {
|
||||
/* 137 */ int attempts = 0;
|
||||
/* 138 */ while (attempts++ < 1000) {
|
||||
/* 139 */ String fileName = (new File(this.jarFile.getName())).getName();
|
||||
/* */
|
||||
/* 141 */ File unpackFolder = new File(parent, fileName + "-spring-boot-libs-" + UUID.randomUUID());
|
||||
/* 142 */ if (unpackFolder.mkdirs()) {
|
||||
/* 143 */ return unpackFolder;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 146 */ throw new IllegalStateException("Failed to create unpack folder in directory '" + parent + "'");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private void unpack(JarEntryData data, File file) throws IOException {
|
||||
/* 151 */ InputStream inputStream = data.getData().getInputStream(RandomAccessData.ResourceAccess.ONCE);
|
||||
/* */ try {
|
||||
/* 153 */ OutputStream outputStream = new FileOutputStream(file);
|
||||
/* */ try {
|
||||
/* 155 */ byte[] buffer = new byte[32768];
|
||||
/* 156 */ int bytesRead = -1;
|
||||
/* 157 */ while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
/* 158 */ outputStream.write(buffer, 0, bytesRead);
|
||||
/* */ }
|
||||
/* 160 */ outputStream.flush();
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* 163 */ outputStream.close();
|
||||
/* */ }
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* 167 */ inputStream.close();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Archive getFilteredArchive(final Archive.EntryRenameFilter filter) throws IOException {
|
||||
/* 173 */ JarFile filteredJar = this.jarFile.getFilteredJarFile(new JarEntryFilter[] { new JarEntryFilter()
|
||||
/* */ {
|
||||
/* */ public AsciiBytes apply(AsciiBytes name, JarEntryData entryData) {
|
||||
/* 176 */ return filter.apply(name, new JarFileArchive.JarFileEntry(entryData));
|
||||
/* */ }
|
||||
/* */ } });
|
||||
/* 179 */ return new JarFileArchive(filteredJar);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static class JarFileEntry
|
||||
/* */ implements Archive.Entry
|
||||
/* */ {
|
||||
/* */ private final JarEntryData entryData;
|
||||
/* */
|
||||
/* */
|
||||
/* */ JarFileEntry(JarEntryData entryData) {
|
||||
/* 190 */ this.entryData = entryData;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public JarEntryData getJarEntryData() {
|
||||
/* 194 */ return this.entryData;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public boolean isDirectory() {
|
||||
/* 199 */ return this.entryData.isDirectory();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public AsciiBytes getName() {
|
||||
/* 204 */ return this.entryData.getName();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\archive\JarFileArchive.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.archive;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.jar.Manifest;
|
||||
import org.springframework.boot.loader.data.RandomAccessData;
|
||||
import org.springframework.boot.loader.jar.JarEntryData;
|
||||
import org.springframework.boot.loader.jar.JarEntryFilter;
|
||||
import org.springframework.boot.loader.jar.JarFile;
|
||||
import org.springframework.boot.loader.util.AsciiBytes;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class JarFileArchive
|
||||
extends Archive
|
||||
{
|
||||
private static final AsciiBytes UNPACK_MARKER = new AsciiBytes("UNPACK:");
|
||||
|
||||
private static final int BUFFER_SIZE = 32768;
|
||||
|
||||
private final JarFile jarFile;
|
||||
|
||||
private final List<Archive.Entry> entries;
|
||||
|
||||
private URL url;
|
||||
|
||||
private File tempUnpackFolder;
|
||||
|
||||
public JarFileArchive(File file) throws IOException {
|
||||
this(file, null);
|
||||
}
|
||||
|
||||
public JarFileArchive(File file, URL url) throws IOException {
|
||||
this(new JarFile(file));
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public JarFileArchive(JarFile jarFile) {
|
||||
this.jarFile = jarFile;
|
||||
ArrayList<Archive.Entry> jarFileEntries = new ArrayList<Archive.Entry>();
|
||||
for (JarEntryData data : jarFile) {
|
||||
jarFileEntries.add(new JarFileEntry(data));
|
||||
}
|
||||
this.entries = Collections.unmodifiableList(jarFileEntries);
|
||||
}
|
||||
|
||||
|
||||
public URL getUrl() throws MalformedURLException {
|
||||
if (this.url != null) {
|
||||
return this.url;
|
||||
}
|
||||
return this.jarFile.getUrl();
|
||||
}
|
||||
|
||||
|
||||
public Manifest getManifest() throws IOException {
|
||||
return this.jarFile.getManifest();
|
||||
}
|
||||
|
||||
|
||||
public List<Archive> getNestedArchives(Archive.EntryFilter filter) throws IOException {
|
||||
List<Archive> nestedArchives = new ArrayList<Archive>();
|
||||
for (Archive.Entry entry : getEntries()) {
|
||||
if (filter.matches(entry)) {
|
||||
nestedArchives.add(getNestedArchive(entry));
|
||||
}
|
||||
}
|
||||
return Collections.unmodifiableList(nestedArchives);
|
||||
}
|
||||
|
||||
|
||||
public Collection<Archive.Entry> getEntries() {
|
||||
return Collections.unmodifiableCollection(this.entries);
|
||||
}
|
||||
|
||||
protected Archive getNestedArchive(Archive.Entry entry) throws IOException {
|
||||
JarEntryData data = ((JarFileEntry)entry).getJarEntryData();
|
||||
if (data.getComment().startsWith(UNPACK_MARKER)) {
|
||||
return getUnpackedNestedArchive(data);
|
||||
}
|
||||
JarFile jarFile = this.jarFile.getNestedJarFile(data);
|
||||
return new JarFileArchive(jarFile);
|
||||
}
|
||||
|
||||
private Archive getUnpackedNestedArchive(JarEntryData data) throws IOException {
|
||||
String name = data.getName().toString();
|
||||
if (name.lastIndexOf("/") != -1) {
|
||||
name = name.substring(name.lastIndexOf("/") + 1);
|
||||
}
|
||||
File file = new File(getTempUnpackFolder(), name);
|
||||
if (!file.exists() || file.length() != data.getSize()) {
|
||||
unpack(data, file);
|
||||
}
|
||||
return new JarFileArchive(file, file.toURI().toURL());
|
||||
}
|
||||
|
||||
private File getTempUnpackFolder() {
|
||||
if (this.tempUnpackFolder == null) {
|
||||
File tempFolder = new File(System.getProperty("java.io.tmpdir"));
|
||||
this.tempUnpackFolder = createUnpackFolder(tempFolder);
|
||||
}
|
||||
return this.tempUnpackFolder;
|
||||
}
|
||||
|
||||
private File createUnpackFolder(File parent) {
|
||||
int attempts = 0;
|
||||
while (attempts++ < 1000) {
|
||||
String fileName = (new File(this.jarFile.getName())).getName();
|
||||
|
||||
File unpackFolder = new File(parent, fileName + "-spring-boot-libs-" + UUID.randomUUID());
|
||||
if (unpackFolder.mkdirs()) {
|
||||
return unpackFolder;
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("Failed to create unpack folder in directory '" + parent + "'");
|
||||
}
|
||||
|
||||
|
||||
private void unpack(JarEntryData data, File file) throws IOException {
|
||||
InputStream inputStream = data.getData().getInputStream(RandomAccessData.ResourceAccess.ONCE);
|
||||
try {
|
||||
OutputStream outputStream = new FileOutputStream(file);
|
||||
try {
|
||||
byte[] buffer = new byte[32768];
|
||||
int bytesRead = -1;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
outputStream.flush();
|
||||
} finally {
|
||||
|
||||
outputStream.close();
|
||||
}
|
||||
} finally {
|
||||
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Archive getFilteredArchive(final Archive.EntryRenameFilter filter) throws IOException {
|
||||
JarFile filteredJar = this.jarFile.getFilteredJarFile(new JarEntryFilter[] { new JarEntryFilter()
|
||||
{
|
||||
public AsciiBytes apply(AsciiBytes name, JarEntryData entryData) {
|
||||
return filter.apply(name, new JarFileArchive.JarFileEntry(entryData));
|
||||
}
|
||||
} });
|
||||
return new JarFileArchive(filteredJar);
|
||||
}
|
||||
|
||||
|
||||
private static class JarFileEntry
|
||||
implements Archive.Entry
|
||||
{
|
||||
private final JarEntryData entryData;
|
||||
|
||||
|
||||
JarFileEntry(JarEntryData entryData) {
|
||||
this.entryData = entryData;
|
||||
}
|
||||
|
||||
public JarEntryData getJarEntryData() {
|
||||
return this.entryData;
|
||||
}
|
||||
|
||||
|
||||
public boolean isDirectory() {
|
||||
return this.entryData.isDirectory();
|
||||
}
|
||||
|
||||
|
||||
public AsciiBytes getName() {
|
||||
return this.entryData.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+61
-65
@@ -1,65 +1,61 @@
|
||||
/* */ package org.springframework.boot.loader.data;
|
||||
/* */
|
||||
/* */ import java.io.ByteArrayInputStream;
|
||||
/* */ import java.io.InputStream;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class ByteArrayRandomAccessData
|
||||
/* */ implements RandomAccessData
|
||||
/* */ {
|
||||
/* */ private final byte[] bytes;
|
||||
/* */ private final long offset;
|
||||
/* */ private final long length;
|
||||
/* */
|
||||
/* */ public ByteArrayRandomAccessData(byte[] bytes) {
|
||||
/* 36 */ this(bytes, 0L, ((bytes == null) ? 0L : bytes.length));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public ByteArrayRandomAccessData(byte[] bytes, long offset, long length) {
|
||||
/* 40 */ this.bytes = (bytes == null) ? new byte[0] : bytes;
|
||||
/* 41 */ this.offset = offset;
|
||||
/* 42 */ this.length = length;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public InputStream getInputStream(RandomAccessData.ResourceAccess access) {
|
||||
/* 47 */ return new ByteArrayInputStream(this.bytes, (int)this.offset, (int)this.length);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public RandomAccessData getSubsection(long offset, long length) {
|
||||
/* 52 */ return new ByteArrayRandomAccessData(this.bytes, this.offset + offset, length);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public long getSize() {
|
||||
/* 57 */ return this.length;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\data\ByteArrayRandomAccessData.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.data;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class ByteArrayRandomAccessData
|
||||
implements RandomAccessData
|
||||
{
|
||||
private final byte[] bytes;
|
||||
private final long offset;
|
||||
private final long length;
|
||||
|
||||
public ByteArrayRandomAccessData(byte[] bytes) {
|
||||
this(bytes, 0L, ((bytes == null) ? 0L : bytes.length));
|
||||
}
|
||||
|
||||
public ByteArrayRandomAccessData(byte[] bytes, long offset, long length) {
|
||||
this.bytes = (bytes == null) ? new byte[0] : bytes;
|
||||
this.offset = offset;
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
|
||||
public InputStream getInputStream(RandomAccessData.ResourceAccess access) {
|
||||
return new ByteArrayInputStream(this.bytes, (int)this.offset, (int)this.length);
|
||||
}
|
||||
|
||||
|
||||
public RandomAccessData getSubsection(long offset, long length) {
|
||||
return new ByteArrayRandomAccessData(this.bytes, this.offset + offset, length);
|
||||
}
|
||||
|
||||
|
||||
public long getSize() {
|
||||
return this.length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+71
-75
@@ -1,75 +1,71 @@
|
||||
/* */ package org.springframework.boot.loader.data;
|
||||
/* */
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.io.InputStream;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public interface RandomAccessData
|
||||
/* */ {
|
||||
/* */ InputStream getInputStream(ResourceAccess paramResourceAccess) throws IOException;
|
||||
/* */
|
||||
/* */ RandomAccessData getSubsection(long paramLong1, long paramLong2);
|
||||
/* */
|
||||
/* */ long getSize();
|
||||
/* */
|
||||
/* */ public enum ResourceAccess
|
||||
/* */ {
|
||||
/* 62 */ ONCE,
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 67 */ PER_READ;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\data\RandomAccessData.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.data;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public interface RandomAccessData
|
||||
{
|
||||
InputStream getInputStream(ResourceAccess paramResourceAccess) throws IOException;
|
||||
|
||||
RandomAccessData getSubsection(long paramLong1, long paramLong2);
|
||||
|
||||
long getSize();
|
||||
|
||||
public enum ResourceAccess
|
||||
{
|
||||
ONCE,
|
||||
|
||||
|
||||
|
||||
|
||||
PER_READ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+285
-289
@@ -1,289 +1,285 @@
|
||||
/* */ package org.springframework.boot.loader.data;
|
||||
/* */
|
||||
/* */ import java.io.File;
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.io.InputStream;
|
||||
/* */ import java.io.RandomAccessFile;
|
||||
/* */ import java.util.Queue;
|
||||
/* */ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
/* */ import java.util.concurrent.Semaphore;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class RandomAccessDataFile
|
||||
/* */ implements RandomAccessData
|
||||
/* */ {
|
||||
/* */ private static final int DEFAULT_CONCURRENT_READS = 4;
|
||||
/* */ private final File file;
|
||||
/* */ private final FilePool filePool;
|
||||
/* */ private final long offset;
|
||||
/* */ private final long length;
|
||||
/* */
|
||||
/* */ public RandomAccessDataFile(File file) {
|
||||
/* 51 */ this(file, 4);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public RandomAccessDataFile(File file, int concurrentReads) {
|
||||
/* 63 */ if (file == null) {
|
||||
/* 64 */ throw new IllegalArgumentException("File must not be null");
|
||||
/* */ }
|
||||
/* 66 */ if (!file.exists()) {
|
||||
/* 67 */ throw new IllegalArgumentException("File must exist");
|
||||
/* */ }
|
||||
/* 69 */ this.file = file;
|
||||
/* 70 */ this.filePool = new FilePool(concurrentReads);
|
||||
/* 71 */ this.offset = 0L;
|
||||
/* 72 */ this.length = file.length();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private RandomAccessDataFile(File file, FilePool pool, long offset, long length) {
|
||||
/* 83 */ this.file = file;
|
||||
/* 84 */ this.filePool = pool;
|
||||
/* 85 */ this.offset = offset;
|
||||
/* 86 */ this.length = length;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public File getFile() {
|
||||
/* 94 */ return this.file;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public InputStream getInputStream(RandomAccessData.ResourceAccess access) throws IOException {
|
||||
/* 99 */ return new DataInputStream(access);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public RandomAccessData getSubsection(long offset, long length) {
|
||||
/* 104 */ if (offset < 0L || length < 0L || offset + length > this.length) {
|
||||
/* 105 */ throw new IndexOutOfBoundsException();
|
||||
/* */ }
|
||||
/* 107 */ return new RandomAccessDataFile(this.file, this.filePool, this.offset + offset, length);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public long getSize() {
|
||||
/* 113 */ return this.length;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public void close() throws IOException {
|
||||
/* 117 */ this.filePool.close();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private class DataInputStream
|
||||
/* */ extends InputStream
|
||||
/* */ {
|
||||
/* */ private RandomAccessFile file;
|
||||
/* */
|
||||
/* */ private int position;
|
||||
/* */
|
||||
/* */
|
||||
/* */ DataInputStream(RandomAccessData.ResourceAccess access) throws IOException {
|
||||
/* 131 */ if (access == RandomAccessData.ResourceAccess.ONCE) {
|
||||
/* 132 */ this.file = new RandomAccessFile(RandomAccessDataFile.this.file, "r");
|
||||
/* 133 */ this.file.seek(RandomAccessDataFile.this.offset);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public int read() throws IOException {
|
||||
/* 139 */ return doRead(null, 0, 1);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public int read(byte[] b) throws IOException {
|
||||
/* 144 */ return read(b, 0, (b == null) ? 0 : b.length);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public int read(byte[] b, int off, int len) throws IOException {
|
||||
/* 149 */ if (b == null) {
|
||||
/* 150 */ throw new NullPointerException("Bytes must not be null");
|
||||
/* */ }
|
||||
/* 152 */ return doRead(b, off, len);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public int doRead(byte[] b, int off, int len) throws IOException {
|
||||
/* 165 */ if (len == 0) {
|
||||
/* 166 */ return 0;
|
||||
/* */ }
|
||||
/* 168 */ int cappedLen = cap(len);
|
||||
/* 169 */ if (cappedLen <= 0) {
|
||||
/* 170 */ return -1;
|
||||
/* */ }
|
||||
/* 172 */ RandomAccessFile file = this.file;
|
||||
/* 173 */ if (file == null) {
|
||||
/* 174 */ file = RandomAccessDataFile.this.filePool.acquire();
|
||||
/* 175 */ file.seek(RandomAccessDataFile.this.offset + this.position);
|
||||
/* */ }
|
||||
/* */ try {
|
||||
/* 178 */ if (b == null) {
|
||||
/* 179 */ int rtn = file.read();
|
||||
/* 180 */ moveOn((rtn == -1) ? 0 : 1);
|
||||
/* 181 */ return rtn;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 184 */ return (int)moveOn(file.read(b, off, cappedLen));
|
||||
/* */ }
|
||||
/* */ finally {
|
||||
/* */
|
||||
/* 188 */ if (this.file == null) {
|
||||
/* 189 */ RandomAccessDataFile.this.filePool.release(file);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public long skip(long n) throws IOException {
|
||||
/* 196 */ return (n <= 0L) ? 0L : moveOn(cap(n));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public void close() throws IOException {
|
||||
/* 201 */ if (this.file != null) {
|
||||
/* 202 */ this.file.close();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private int cap(long n) {
|
||||
/* 213 */ return (int)Math.min(RandomAccessDataFile.this.length - this.position, n);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private long moveOn(int amount) {
|
||||
/* 222 */ this.position += amount;
|
||||
/* 223 */ return amount;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private class FilePool
|
||||
/* */ {
|
||||
/* */ private final int size;
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final Semaphore available;
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final Queue<RandomAccessFile> files;
|
||||
/* */
|
||||
/* */
|
||||
/* */ FilePool(int size) {
|
||||
/* 241 */ this.size = size;
|
||||
/* 242 */ this.available = new Semaphore(size);
|
||||
/* 243 */ this.files = new ConcurrentLinkedQueue<RandomAccessFile>();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public RandomAccessFile acquire() throws IOException {
|
||||
/* */ try {
|
||||
/* 248 */ this.available.acquire();
|
||||
/* 249 */ RandomAccessFile file = this.files.poll();
|
||||
/* 250 */ return (file == null) ? new RandomAccessFile(RandomAccessDataFile.this
|
||||
/* 251 */ .file, "r") : file;
|
||||
/* */
|
||||
/* */ }
|
||||
/* 254 */ catch (InterruptedException ex) {
|
||||
/* 255 */ throw new IOException(ex);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public void release(RandomAccessFile file) {
|
||||
/* 260 */ this.files.add(file);
|
||||
/* 261 */ this.available.release();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public void close() throws IOException {
|
||||
/* */ try {
|
||||
/* 266 */ this.available.acquire(this.size);
|
||||
/* */ try {
|
||||
/* 268 */ RandomAccessFile file = this.files.poll();
|
||||
/* 269 */ while (file != null) {
|
||||
/* 270 */ file.close();
|
||||
/* 271 */ file = this.files.poll();
|
||||
/* */ }
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* 275 */ this.available.release(this.size);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 278 */ } catch (InterruptedException ex) {
|
||||
/* 279 */ throw new IOException(ex);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\data\RandomAccessDataFile.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.data;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class RandomAccessDataFile
|
||||
implements RandomAccessData
|
||||
{
|
||||
private static final int DEFAULT_CONCURRENT_READS = 4;
|
||||
private final File file;
|
||||
private final FilePool filePool;
|
||||
private final long offset;
|
||||
private final long length;
|
||||
|
||||
public RandomAccessDataFile(File file) {
|
||||
this(file, 4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public RandomAccessDataFile(File file, int concurrentReads) {
|
||||
if (file == null) {
|
||||
throw new IllegalArgumentException("File must not be null");
|
||||
}
|
||||
if (!file.exists()) {
|
||||
throw new IllegalArgumentException("File must exist");
|
||||
}
|
||||
this.file = file;
|
||||
this.filePool = new FilePool(concurrentReads);
|
||||
this.offset = 0L;
|
||||
this.length = file.length();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private RandomAccessDataFile(File file, FilePool pool, long offset, long length) {
|
||||
this.file = file;
|
||||
this.filePool = pool;
|
||||
this.offset = offset;
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public File getFile() {
|
||||
return this.file;
|
||||
}
|
||||
|
||||
|
||||
public InputStream getInputStream(RandomAccessData.ResourceAccess access) throws IOException {
|
||||
return new DataInputStream(access);
|
||||
}
|
||||
|
||||
|
||||
public RandomAccessData getSubsection(long offset, long length) {
|
||||
if (offset < 0L || length < 0L || offset + length > this.length) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
return new RandomAccessDataFile(this.file, this.filePool, this.offset + offset, length);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public long getSize() {
|
||||
return this.length;
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
this.filePool.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private class DataInputStream
|
||||
extends InputStream
|
||||
{
|
||||
private RandomAccessFile file;
|
||||
|
||||
private int position;
|
||||
|
||||
|
||||
DataInputStream(RandomAccessData.ResourceAccess access) throws IOException {
|
||||
if (access == RandomAccessData.ResourceAccess.ONCE) {
|
||||
this.file = new RandomAccessFile(RandomAccessDataFile.this.file, "r");
|
||||
this.file.seek(RandomAccessDataFile.this.offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int read() throws IOException {
|
||||
return doRead(null, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
public int read(byte[] b) throws IOException {
|
||||
return read(b, 0, (b == null) ? 0 : b.length);
|
||||
}
|
||||
|
||||
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
if (b == null) {
|
||||
throw new NullPointerException("Bytes must not be null");
|
||||
}
|
||||
return doRead(b, off, len);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public int doRead(byte[] b, int off, int len) throws IOException {
|
||||
if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
int cappedLen = cap(len);
|
||||
if (cappedLen <= 0) {
|
||||
return -1;
|
||||
}
|
||||
RandomAccessFile file = this.file;
|
||||
if (file == null) {
|
||||
file = RandomAccessDataFile.this.filePool.acquire();
|
||||
file.seek(RandomAccessDataFile.this.offset + this.position);
|
||||
}
|
||||
try {
|
||||
if (b == null) {
|
||||
int rtn = file.read();
|
||||
moveOn((rtn == -1) ? 0 : 1);
|
||||
return rtn;
|
||||
}
|
||||
|
||||
return (int)moveOn(file.read(b, off, cappedLen));
|
||||
}
|
||||
finally {
|
||||
|
||||
if (this.file == null) {
|
||||
RandomAccessDataFile.this.filePool.release(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public long skip(long n) throws IOException {
|
||||
return (n <= 0L) ? 0L : moveOn(cap(n));
|
||||
}
|
||||
|
||||
|
||||
public void close() throws IOException {
|
||||
if (this.file != null) {
|
||||
this.file.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private int cap(long n) {
|
||||
return (int)Math.min(RandomAccessDataFile.this.length - this.position, n);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private long moveOn(int amount) {
|
||||
this.position += amount;
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private class FilePool
|
||||
{
|
||||
private final int size;
|
||||
|
||||
|
||||
private final Semaphore available;
|
||||
|
||||
|
||||
private final Queue<RandomAccessFile> files;
|
||||
|
||||
|
||||
FilePool(int size) {
|
||||
this.size = size;
|
||||
this.available = new Semaphore(size);
|
||||
this.files = new ConcurrentLinkedQueue<RandomAccessFile>();
|
||||
}
|
||||
|
||||
public RandomAccessFile acquire() throws IOException {
|
||||
try {
|
||||
this.available.acquire();
|
||||
RandomAccessFile file = this.files.poll();
|
||||
return (file == null) ? new RandomAccessFile(RandomAccessDataFile.this
|
||||
.file, "r") : file;
|
||||
|
||||
}
|
||||
catch (InterruptedException ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void release(RandomAccessFile file) {
|
||||
this.files.add(file);
|
||||
this.available.release();
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
try {
|
||||
this.available.acquire(this.size);
|
||||
try {
|
||||
RandomAccessFile file = this.files.poll();
|
||||
while (file != null) {
|
||||
file.close();
|
||||
file = this.files.poll();
|
||||
}
|
||||
} finally {
|
||||
|
||||
this.available.release(this.size);
|
||||
}
|
||||
|
||||
} catch (InterruptedException ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+84
-88
@@ -1,88 +1,84 @@
|
||||
/* */ package org.springframework.boot.loader.jar;
|
||||
/* */
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.io.InputStream;
|
||||
/* */ import org.springframework.boot.loader.data.RandomAccessData;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ final class Bytes
|
||||
/* */ {
|
||||
/* 32 */ private static final byte[] EMPTY_BYTES = new byte[0];
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static byte[] get(RandomAccessData data) throws IOException {
|
||||
/* 38 */ InputStream inputStream = data.getInputStream(RandomAccessData.ResourceAccess.ONCE);
|
||||
/* */ try {
|
||||
/* 40 */ return get(inputStream, data.getSize());
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* 43 */ inputStream.close();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static byte[] get(InputStream inputStream, long length) throws IOException {
|
||||
/* 48 */ if (length == 0L) {
|
||||
/* 49 */ return EMPTY_BYTES;
|
||||
/* */ }
|
||||
/* 51 */ byte[] bytes = new byte[(int)length];
|
||||
/* 52 */ if (!fill(inputStream, bytes)) {
|
||||
/* 53 */ throw new IOException("Unable to read bytes");
|
||||
/* */ }
|
||||
/* 55 */ return bytes;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static boolean fill(InputStream inputStream, byte[] bytes) throws IOException {
|
||||
/* 59 */ return fill(inputStream, bytes, 0, bytes.length);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static boolean fill(InputStream inputStream, byte[] bytes, int offset, int length) throws IOException {
|
||||
/* 64 */ while (length > 0) {
|
||||
/* 65 */ int read = inputStream.read(bytes, offset, length);
|
||||
/* 66 */ if (read == -1) {
|
||||
/* 67 */ return false;
|
||||
/* */ }
|
||||
/* 69 */ offset += read;
|
||||
/* 70 */ length = -read;
|
||||
/* */ }
|
||||
/* 72 */ return true;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static long littleEndianValue(byte[] bytes, int offset, int length) {
|
||||
/* 76 */ long value = 0L;
|
||||
/* 77 */ for (int i = length - 1; i >= 0; i--) {
|
||||
/* 78 */ value = value << 8L | (bytes[offset + i] & 0xFF);
|
||||
/* */ }
|
||||
/* 80 */ return value;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\jar\Bytes.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.jar;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import org.springframework.boot.loader.data.RandomAccessData;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
final class Bytes
|
||||
{
|
||||
private static final byte[] EMPTY_BYTES = new byte[0];
|
||||
|
||||
|
||||
|
||||
|
||||
public static byte[] get(RandomAccessData data) throws IOException {
|
||||
InputStream inputStream = data.getInputStream(RandomAccessData.ResourceAccess.ONCE);
|
||||
try {
|
||||
return get(inputStream, data.getSize());
|
||||
} finally {
|
||||
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] get(InputStream inputStream, long length) throws IOException {
|
||||
if (length == 0L) {
|
||||
return EMPTY_BYTES;
|
||||
}
|
||||
byte[] bytes = new byte[(int)length];
|
||||
if (!fill(inputStream, bytes)) {
|
||||
throw new IOException("Unable to read bytes");
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static boolean fill(InputStream inputStream, byte[] bytes) throws IOException {
|
||||
return fill(inputStream, bytes, 0, bytes.length);
|
||||
}
|
||||
|
||||
|
||||
private static boolean fill(InputStream inputStream, byte[] bytes, int offset, int length) throws IOException {
|
||||
while (length > 0) {
|
||||
int read = inputStream.read(bytes, offset, length);
|
||||
if (read == -1) {
|
||||
return false;
|
||||
}
|
||||
offset += read;
|
||||
length = -read;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static long littleEndianValue(byte[] bytes, int offset, int length) {
|
||||
long value = 0L;
|
||||
for (int i = length - 1; i >= 0; i--) {
|
||||
value = value << 8L | (bytes[offset + i] & 0xFF);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+125
-129
@@ -1,129 +1,125 @@
|
||||
/* */ package org.springframework.boot.loader.jar;
|
||||
/* */
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import org.springframework.boot.loader.data.RandomAccessData;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ class CentralDirectoryEndRecord
|
||||
/* */ {
|
||||
/* */ private static final int MINIMUM_SIZE = 22;
|
||||
/* */ private static final int MAXIMUM_COMMENT_LENGTH = 65535;
|
||||
/* */ private static final int MAXIMUM_SIZE = 65557;
|
||||
/* */ private static final int SIGNATURE = 101010256;
|
||||
/* */ private static final int COMMENT_LENGTH_OFFSET = 20;
|
||||
/* */ private static final int READ_BLOCK_SIZE = 256;
|
||||
/* */ private byte[] block;
|
||||
/* */ private int offset;
|
||||
/* */ private int size;
|
||||
/* */
|
||||
/* */ CentralDirectoryEndRecord(RandomAccessData data) throws IOException {
|
||||
/* 57 */ this.block = createBlockFromEndOfData(data, 256);
|
||||
/* 58 */ this.size = 22;
|
||||
/* 59 */ this.offset = this.block.length - this.size;
|
||||
/* 60 */ while (!isValid()) {
|
||||
/* 61 */ this.size++;
|
||||
/* 62 */ if (this.size > this.block.length) {
|
||||
/* 63 */ if (this.size >= 65557 || this.size > data.getSize()) {
|
||||
/* 64 */ throw new IOException("Unable to find ZIP central directory records after reading " + this.size + " bytes");
|
||||
/* */ }
|
||||
/* */
|
||||
/* 67 */ this.block = createBlockFromEndOfData(data, this.size + 256);
|
||||
/* */ }
|
||||
/* 69 */ this.offset = this.block.length - this.size;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private byte[] createBlockFromEndOfData(RandomAccessData data, int size) throws IOException {
|
||||
/* 75 */ int length = (int)Math.min(data.getSize(), size);
|
||||
/* 76 */ return Bytes.get(data.getSubsection(data.getSize() - length, length));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private boolean isValid() {
|
||||
/* 80 */ if (this.block.length < 22 ||
|
||||
/* 81 */ Bytes.littleEndianValue(this.block, this.offset + 0, 4) != 101010256L) {
|
||||
/* 82 */ return false;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 85 */ long commentLength = Bytes.littleEndianValue(this.block, this.offset + 20, 2);
|
||||
/* */
|
||||
/* 87 */ return (this.size == 22L + commentLength);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public long getStartOfArchive(RandomAccessData data) {
|
||||
/* 98 */ long length = Bytes.littleEndianValue(this.block, this.offset + 12, 4);
|
||||
/* 99 */ long specifiedOffset = Bytes.littleEndianValue(this.block, this.offset + 16, 4);
|
||||
/* 100 */ long actualOffset = data.getSize() - this.size - length;
|
||||
/* 101 */ return actualOffset - specifiedOffset;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public RandomAccessData getCentralDirectory(RandomAccessData data) {
|
||||
/* 111 */ long offset = Bytes.littleEndianValue(this.block, this.offset + 16, 4);
|
||||
/* 112 */ long length = Bytes.littleEndianValue(this.block, this.offset + 12, 4);
|
||||
/* 113 */ return data.getSubsection(offset, length);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public int getNumberOfRecords() {
|
||||
/* 121 */ return (int)Bytes.littleEndianValue(this.block, this.offset + 10, 2);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\jar\CentralDirectoryEndRecord.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.jar;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.springframework.boot.loader.data.RandomAccessData;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CentralDirectoryEndRecord
|
||||
{
|
||||
private static final int MINIMUM_SIZE = 22;
|
||||
private static final int MAXIMUM_COMMENT_LENGTH = 65535;
|
||||
private static final int MAXIMUM_SIZE = 65557;
|
||||
private static final int SIGNATURE = 101010256;
|
||||
private static final int COMMENT_LENGTH_OFFSET = 20;
|
||||
private static final int READ_BLOCK_SIZE = 256;
|
||||
private byte[] block;
|
||||
private int offset;
|
||||
private int size;
|
||||
|
||||
CentralDirectoryEndRecord(RandomAccessData data) throws IOException {
|
||||
this.block = createBlockFromEndOfData(data, 256);
|
||||
this.size = 22;
|
||||
this.offset = this.block.length - this.size;
|
||||
while (!isValid()) {
|
||||
this.size++;
|
||||
if (this.size > this.block.length) {
|
||||
if (this.size >= 65557 || this.size > data.getSize()) {
|
||||
throw new IOException("Unable to find ZIP central directory records after reading " + this.size + " bytes");
|
||||
}
|
||||
|
||||
this.block = createBlockFromEndOfData(data, this.size + 256);
|
||||
}
|
||||
this.offset = this.block.length - this.size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private byte[] createBlockFromEndOfData(RandomAccessData data, int size) throws IOException {
|
||||
int length = (int)Math.min(data.getSize(), size);
|
||||
return Bytes.get(data.getSubsection(data.getSize() - length, length));
|
||||
}
|
||||
|
||||
private boolean isValid() {
|
||||
if (this.block.length < 22 ||
|
||||
Bytes.littleEndianValue(this.block, this.offset + 0, 4) != 101010256L) {
|
||||
return false;
|
||||
}
|
||||
|
||||
long commentLength = Bytes.littleEndianValue(this.block, this.offset + 20, 2);
|
||||
|
||||
return (this.size == 22L + commentLength);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public long getStartOfArchive(RandomAccessData data) {
|
||||
long length = Bytes.littleEndianValue(this.block, this.offset + 12, 4);
|
||||
long specifiedOffset = Bytes.littleEndianValue(this.block, this.offset + 16, 4);
|
||||
long actualOffset = data.getSize() - this.size - length;
|
||||
return actualOffset - specifiedOffset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public RandomAccessData getCentralDirectory(RandomAccessData data) {
|
||||
long offset = Bytes.littleEndianValue(this.block, this.offset + 16, 4);
|
||||
long length = Bytes.littleEndianValue(this.block, this.offset + 12, 4);
|
||||
return data.getSubsection(offset, length);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public int getNumberOfRecords() {
|
||||
return (int)Bytes.littleEndianValue(this.block, this.offset + 10, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+199
-203
@@ -1,203 +1,199 @@
|
||||
/* */ package org.springframework.boot.loader.jar;
|
||||
/* */
|
||||
/* */ import java.io.File;
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.lang.ref.SoftReference;
|
||||
/* */ import java.lang.reflect.Method;
|
||||
/* */ import java.net.MalformedURLException;
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.net.URLConnection;
|
||||
/* */ import java.net.URLDecoder;
|
||||
/* */ import java.net.URLStreamHandler;
|
||||
/* */ import java.util.Map;
|
||||
/* */ import java.util.concurrent.ConcurrentHashMap;
|
||||
/* */ import java.util.logging.Level;
|
||||
/* */ import java.util.logging.Logger;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class Handler
|
||||
/* */ extends URLStreamHandler
|
||||
/* */ {
|
||||
/* */ private static final String FILE_PROTOCOL = "file:";
|
||||
/* */ private static final String SEPARATOR = "!/";
|
||||
/* 48 */ private static final String[] FALLBACK_HANDLERS = new String[] { "sun.net.www.protocol.jar.Handler" };
|
||||
/* */
|
||||
/* */ private static final Method OPEN_CONNECTION_METHOD;
|
||||
/* */
|
||||
/* */
|
||||
/* */ static {
|
||||
/* 54 */ Method method = null;
|
||||
/* */ try {
|
||||
/* 56 */ method = URLStreamHandler.class.getDeclaredMethod("openConnection", new Class[] { URL.class });
|
||||
/* */
|
||||
/* */ }
|
||||
/* 59 */ catch (Exception exception) {}
|
||||
/* */
|
||||
/* */
|
||||
/* 62 */ OPEN_CONNECTION_METHOD = method;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 68 */ private static SoftReference<Map<File, JarFile>> rootFileCache = new SoftReference<Map<File, JarFile>>(null);
|
||||
/* */
|
||||
/* */
|
||||
/* 71 */ private final Logger logger = Logger.getLogger(getClass().getName());
|
||||
/* */
|
||||
/* */ private final JarFile jarFile;
|
||||
/* */
|
||||
/* */ private URLStreamHandler fallbackHandler;
|
||||
/* */
|
||||
/* */ public Handler() {
|
||||
/* 78 */ this(null);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public Handler(JarFile jarFile) {
|
||||
/* 82 */ this.jarFile = jarFile;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected URLConnection openConnection(URL url) throws IOException {
|
||||
/* 87 */ if (this.jarFile != null) {
|
||||
/* 88 */ return new JarURLConnection(url, this.jarFile);
|
||||
/* */ }
|
||||
/* */ try {
|
||||
/* 91 */ return new JarURLConnection(url, getRootJarFileFromUrl(url));
|
||||
/* */ }
|
||||
/* 93 */ catch (Exception ex) {
|
||||
/* 94 */ return openFallbackConnection(url, ex);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private URLConnection openFallbackConnection(URL url, Exception reason) throws IOException {
|
||||
/* */ try {
|
||||
/* 101 */ return openConnection(getFallbackHandler(), url);
|
||||
/* */ }
|
||||
/* 103 */ catch (Exception ex) {
|
||||
/* 104 */ if (reason instanceof IOException) {
|
||||
/* 105 */ this.logger.log(Level.FINEST, "Unable to open fallback handler", ex);
|
||||
/* 106 */ throw (IOException)reason;
|
||||
/* */ }
|
||||
/* 108 */ this.logger.log(Level.WARNING, "Unable to open fallback handler", ex);
|
||||
/* 109 */ if (reason instanceof RuntimeException) {
|
||||
/* 110 */ throw (RuntimeException)reason;
|
||||
/* */ }
|
||||
/* 112 */ throw new IllegalStateException(reason);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private URLStreamHandler getFallbackHandler() {
|
||||
/* 117 */ if (this.fallbackHandler != null) {
|
||||
/* 118 */ return this.fallbackHandler;
|
||||
/* */ }
|
||||
/* 120 */ for (String handlerClassName : FALLBACK_HANDLERS) {
|
||||
/* */ try {
|
||||
/* 122 */ Class<?> handlerClass = Class.forName(handlerClassName);
|
||||
/* 123 */ this.fallbackHandler = (URLStreamHandler)handlerClass.newInstance();
|
||||
/* 124 */ return this.fallbackHandler;
|
||||
/* */ }
|
||||
/* 126 */ catch (Exception exception) {}
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 130 */ throw new IllegalStateException("Unable to find fallback handler");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private URLConnection openConnection(URLStreamHandler handler, URL url) throws Exception {
|
||||
/* 135 */ if (OPEN_CONNECTION_METHOD == null) {
|
||||
/* 136 */ throw new IllegalStateException("Unable to invoke fallback open connection method");
|
||||
/* */ }
|
||||
/* */
|
||||
/* 139 */ OPEN_CONNECTION_METHOD.setAccessible(true);
|
||||
/* 140 */ return (URLConnection)OPEN_CONNECTION_METHOD.invoke(handler, new Object[] { url });
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public JarFile getRootJarFileFromUrl(URL url) throws IOException {
|
||||
/* 144 */ String spec = url.getFile();
|
||||
/* 145 */ int separatorIndex = spec.indexOf("!/");
|
||||
/* 146 */ if (separatorIndex == -1) {
|
||||
/* 147 */ throw new MalformedURLException("Jar URL does not contain !/ separator");
|
||||
/* */ }
|
||||
/* 149 */ String name = spec.substring(0, separatorIndex);
|
||||
/* 150 */ return getRootJarFile(name);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private JarFile getRootJarFile(String name) throws IOException {
|
||||
/* */ try {
|
||||
/* 155 */ if (!name.startsWith("file:")) {
|
||||
/* 156 */ throw new IllegalStateException("Not a file URL");
|
||||
/* */ }
|
||||
/* 158 */ String path = name.substring("file:".length());
|
||||
/* 159 */ File file = new File(URLDecoder.decode(path, "UTF-8"));
|
||||
/* 160 */ Map<File, JarFile> cache = rootFileCache.get();
|
||||
/* 161 */ JarFile jarFile = (cache == null) ? null : cache.get(file);
|
||||
/* 162 */ if (jarFile == null) {
|
||||
/* 163 */ jarFile = new JarFile(file);
|
||||
/* 164 */ addToRootFileCache(file, jarFile);
|
||||
/* */ }
|
||||
/* 166 */ return jarFile;
|
||||
/* */ }
|
||||
/* 168 */ catch (Exception ex) {
|
||||
/* 169 */ throw new IOException("Unable to open root Jar file '" + name + "'", ex);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ static void addToRootFileCache(File sourceFile, JarFile jarFile) {
|
||||
/* 179 */ Map<File, JarFile> cache = rootFileCache.get();
|
||||
/* 180 */ if (cache == null) {
|
||||
/* 181 */ cache = new ConcurrentHashMap<File, JarFile>();
|
||||
/* 182 */ rootFileCache = new SoftReference<Map<File, JarFile>>(cache);
|
||||
/* */ }
|
||||
/* 184 */ cache.put(sourceFile, jarFile);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void setUseFastConnectionExceptions(boolean useFastConnectionExceptions) {
|
||||
/* 195 */ JarURLConnection.setUseFastExceptions(useFastConnectionExceptions);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\jar\Handler.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.jar;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLStreamHandler;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class Handler
|
||||
extends URLStreamHandler
|
||||
{
|
||||
private static final String FILE_PROTOCOL = "file:";
|
||||
private static final String SEPARATOR = "!/";
|
||||
private static final String[] FALLBACK_HANDLERS = new String[] { "sun.net.www.protocol.jar.Handler" };
|
||||
|
||||
private static final Method OPEN_CONNECTION_METHOD;
|
||||
|
||||
|
||||
static {
|
||||
Method method = null;
|
||||
try {
|
||||
method = URLStreamHandler.class.getDeclaredMethod("openConnection", new Class[] { URL.class });
|
||||
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
|
||||
|
||||
OPEN_CONNECTION_METHOD = method;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static SoftReference<Map<File, JarFile>> rootFileCache = new SoftReference<Map<File, JarFile>>(null);
|
||||
|
||||
|
||||
private final Logger logger = Logger.getLogger(getClass().getName());
|
||||
|
||||
private final JarFile jarFile;
|
||||
|
||||
private URLStreamHandler fallbackHandler;
|
||||
|
||||
public Handler() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public Handler(JarFile jarFile) {
|
||||
this.jarFile = jarFile;
|
||||
}
|
||||
|
||||
|
||||
protected URLConnection openConnection(URL url) throws IOException {
|
||||
if (this.jarFile != null) {
|
||||
return new JarURLConnection(url, this.jarFile);
|
||||
}
|
||||
try {
|
||||
return new JarURLConnection(url, getRootJarFileFromUrl(url));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return openFallbackConnection(url, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private URLConnection openFallbackConnection(URL url, Exception reason) throws IOException {
|
||||
try {
|
||||
return openConnection(getFallbackHandler(), url);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
if (reason instanceof IOException) {
|
||||
this.logger.log(Level.FINEST, "Unable to open fallback handler", ex);
|
||||
throw (IOException)reason;
|
||||
}
|
||||
this.logger.log(Level.WARNING, "Unable to open fallback handler", ex);
|
||||
if (reason instanceof RuntimeException) {
|
||||
throw (RuntimeException)reason;
|
||||
}
|
||||
throw new IllegalStateException(reason);
|
||||
}
|
||||
}
|
||||
|
||||
private URLStreamHandler getFallbackHandler() {
|
||||
if (this.fallbackHandler != null) {
|
||||
return this.fallbackHandler;
|
||||
}
|
||||
for (String handlerClassName : FALLBACK_HANDLERS) {
|
||||
try {
|
||||
Class<?> handlerClass = Class.forName(handlerClassName);
|
||||
this.fallbackHandler = (URLStreamHandler)handlerClass.newInstance();
|
||||
return this.fallbackHandler;
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
|
||||
|
||||
throw new IllegalStateException("Unable to find fallback handler");
|
||||
}
|
||||
|
||||
|
||||
private URLConnection openConnection(URLStreamHandler handler, URL url) throws Exception {
|
||||
if (OPEN_CONNECTION_METHOD == null) {
|
||||
throw new IllegalStateException("Unable to invoke fallback open connection method");
|
||||
}
|
||||
|
||||
OPEN_CONNECTION_METHOD.setAccessible(true);
|
||||
return (URLConnection)OPEN_CONNECTION_METHOD.invoke(handler, new Object[] { url });
|
||||
}
|
||||
|
||||
public JarFile getRootJarFileFromUrl(URL url) throws IOException {
|
||||
String spec = url.getFile();
|
||||
int separatorIndex = spec.indexOf("!/");
|
||||
if (separatorIndex == -1) {
|
||||
throw new MalformedURLException("Jar URL does not contain !/ separator");
|
||||
}
|
||||
String name = spec.substring(0, separatorIndex);
|
||||
return getRootJarFile(name);
|
||||
}
|
||||
|
||||
private JarFile getRootJarFile(String name) throws IOException {
|
||||
try {
|
||||
if (!name.startsWith("file:")) {
|
||||
throw new IllegalStateException("Not a file URL");
|
||||
}
|
||||
String path = name.substring("file:".length());
|
||||
File file = new File(URLDecoder.decode(path, "UTF-8"));
|
||||
Map<File, JarFile> cache = rootFileCache.get();
|
||||
JarFile jarFile = (cache == null) ? null : cache.get(file);
|
||||
if (jarFile == null) {
|
||||
jarFile = new JarFile(file);
|
||||
addToRootFileCache(file, jarFile);
|
||||
}
|
||||
return jarFile;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IOException("Unable to open root Jar file '" + name + "'", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void addToRootFileCache(File sourceFile, JarFile jarFile) {
|
||||
Map<File, JarFile> cache = rootFileCache.get();
|
||||
if (cache == null) {
|
||||
cache = new ConcurrentHashMap<File, JarFile>();
|
||||
rootFileCache = new SoftReference<Map<File, JarFile>>(cache);
|
||||
}
|
||||
cache.put(sourceFile, jarFile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void setUseFastConnectionExceptions(boolean useFastConnectionExceptions) {
|
||||
JarURLConnection.setUseFastExceptions(useFastConnectionExceptions);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+90
-94
@@ -1,94 +1,90 @@
|
||||
/* */ package org.springframework.boot.loader.jar;
|
||||
/* */
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.net.MalformedURLException;
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.security.CodeSigner;
|
||||
/* */ import java.security.cert.Certificate;
|
||||
/* */ import java.util.jar.Attributes;
|
||||
/* */ import java.util.jar.JarEntry;
|
||||
/* */ import java.util.jar.Manifest;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class JarEntry
|
||||
/* */ extends JarEntry
|
||||
/* */ {
|
||||
/* */ private final JarEntryData source;
|
||||
/* */ private Certificate[] certificates;
|
||||
/* */ private CodeSigner[] codeSigners;
|
||||
/* */
|
||||
/* */ public JarEntry(JarEntryData source) {
|
||||
/* 41 */ super(source.getName().toString());
|
||||
/* 42 */ this.source = source;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public JarEntryData getSource() {
|
||||
/* 50 */ return this.source;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public URL getUrl() throws MalformedURLException {
|
||||
/* 59 */ return new URL(this.source.getSource().getUrl(), getName());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Attributes getAttributes() throws IOException {
|
||||
/* 64 */ Manifest manifest = this.source.getSource().getManifest();
|
||||
/* 65 */ return (manifest == null) ? null : manifest.getAttributes(getName());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Certificate[] getCertificates() {
|
||||
/* 70 */ if (this.source.getSource().isSigned() && this.certificates == null) {
|
||||
/* 71 */ this.source.getSource().setupEntryCertificates();
|
||||
/* */ }
|
||||
/* 73 */ return this.certificates;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public CodeSigner[] getCodeSigners() {
|
||||
/* 78 */ if (this.source.getSource().isSigned() && this.codeSigners == null) {
|
||||
/* 79 */ this.source.getSource().setupEntryCertificates();
|
||||
/* */ }
|
||||
/* 81 */ return this.codeSigners;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ void setupCertificates(JarEntry entry) {
|
||||
/* 85 */ this.certificates = entry.getCertificates();
|
||||
/* 86 */ this.codeSigners = entry.getCodeSigners();
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\jar\JarEntry.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.jar;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.security.CodeSigner;
|
||||
import java.security.cert.Certificate;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class JarEntry
|
||||
extends JarEntry
|
||||
{
|
||||
private final JarEntryData source;
|
||||
private Certificate[] certificates;
|
||||
private CodeSigner[] codeSigners;
|
||||
|
||||
public JarEntry(JarEntryData source) {
|
||||
super(source.getName().toString());
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public JarEntryData getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public URL getUrl() throws MalformedURLException {
|
||||
return new URL(this.source.getSource().getUrl(), getName());
|
||||
}
|
||||
|
||||
|
||||
public Attributes getAttributes() throws IOException {
|
||||
Manifest manifest = this.source.getSource().getManifest();
|
||||
return (manifest == null) ? null : manifest.getAttributes(getName());
|
||||
}
|
||||
|
||||
|
||||
public Certificate[] getCertificates() {
|
||||
if (this.source.getSource().isSigned() && this.certificates == null) {
|
||||
this.source.getSource().setupEntryCertificates();
|
||||
}
|
||||
return this.certificates;
|
||||
}
|
||||
|
||||
|
||||
public CodeSigner[] getCodeSigners() {
|
||||
if (this.source.getSource().isSigned() && this.codeSigners == null) {
|
||||
this.source.getSource().setupEntryCertificates();
|
||||
}
|
||||
return this.codeSigners;
|
||||
}
|
||||
|
||||
void setupCertificates(JarEntry entry) {
|
||||
this.certificates = entry.getCertificates();
|
||||
this.codeSigners = entry.getCodeSigners();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+216
-220
@@ -1,220 +1,216 @@
|
||||
/* */ package org.springframework.boot.loader.jar;
|
||||
/* */
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.io.InputStream;
|
||||
/* */ import java.lang.ref.SoftReference;
|
||||
/* */ import java.util.Calendar;
|
||||
/* */ import java.util.GregorianCalendar;
|
||||
/* */ import org.springframework.boot.loader.data.RandomAccessData;
|
||||
/* */ import org.springframework.boot.loader.util.AsciiBytes;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public final class JarEntryData
|
||||
/* */ {
|
||||
/* */ private static final long LOCAL_FILE_HEADER_SIZE = 30L;
|
||||
/* 41 */ private static final AsciiBytes SLASH = new AsciiBytes("/");
|
||||
/* */
|
||||
/* */ private final JarFile source;
|
||||
/* */
|
||||
/* */ private final byte[] header;
|
||||
/* */
|
||||
/* */ private AsciiBytes name;
|
||||
/* */
|
||||
/* */ private final byte[] extra;
|
||||
/* */
|
||||
/* */ private final AsciiBytes comment;
|
||||
/* */
|
||||
/* */ private final long localHeaderOffset;
|
||||
/* */
|
||||
/* */ private RandomAccessData data;
|
||||
/* */
|
||||
/* */ private SoftReference<JarEntry> entry;
|
||||
/* */
|
||||
/* */ JarFile nestedJar;
|
||||
/* */
|
||||
/* */
|
||||
/* */ public JarEntryData(JarFile source, byte[] header, InputStream inputStream) throws IOException {
|
||||
/* 63 */ this.source = source;
|
||||
/* 64 */ this.header = header;
|
||||
/* 65 */ long nameLength = Bytes.littleEndianValue(header, 28, 2);
|
||||
/* 66 */ long extraLength = Bytes.littleEndianValue(header, 30, 2);
|
||||
/* 67 */ long commentLength = Bytes.littleEndianValue(header, 32, 2);
|
||||
/* 68 */ this.name = new AsciiBytes(Bytes.get(inputStream, nameLength));
|
||||
/* 69 */ this.extra = Bytes.get(inputStream, extraLength);
|
||||
/* 70 */ this.comment = new AsciiBytes(Bytes.get(inputStream, commentLength));
|
||||
/* 71 */ this.localHeaderOffset = Bytes.littleEndianValue(header, 42, 4);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private JarEntryData(JarEntryData master, JarFile source, AsciiBytes name) {
|
||||
/* 75 */ this.header = master.header;
|
||||
/* 76 */ this.extra = master.extra;
|
||||
/* 77 */ this.comment = master.comment;
|
||||
/* 78 */ this.localHeaderOffset = master.localHeaderOffset;
|
||||
/* 79 */ this.source = source;
|
||||
/* 80 */ this.name = name;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ void setName(AsciiBytes name) {
|
||||
/* 84 */ this.name = name;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ JarFile getSource() {
|
||||
/* 88 */ return this.source;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ InputStream getInputStream() throws IOException {
|
||||
/* 92 */ InputStream inputStream = getData().getInputStream(RandomAccessData.ResourceAccess.PER_READ);
|
||||
/* 93 */ if (getMethod() == 8) {
|
||||
/* 94 */ inputStream = new ZipInflaterInputStream(inputStream, getSize());
|
||||
/* */ }
|
||||
/* 96 */ return inputStream;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public RandomAccessData getData() throws IOException {
|
||||
/* 107 */ if (this.data == null) {
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 111 */ byte[] localHeader = Bytes.get(this.source.getData()
|
||||
/* 112 */ .getSubsection(this.localHeaderOffset, 30L));
|
||||
/* 113 */ long nameLength = Bytes.littleEndianValue(localHeader, 26, 2);
|
||||
/* 114 */ long extraLength = Bytes.littleEndianValue(localHeader, 28, 2);
|
||||
/* 115 */ this.data = this.source.getData().getSubsection(this.localHeaderOffset + 30L + nameLength + extraLength,
|
||||
/* */
|
||||
/* 117 */ getCompressedSize());
|
||||
/* */ }
|
||||
/* 119 */ return this.data;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ JarEntry asJarEntry() {
|
||||
/* 123 */ JarEntry entry = (this.entry == null) ? null : this.entry.get();
|
||||
/* 124 */ if (entry == null) {
|
||||
/* 125 */ entry = new JarEntry(this);
|
||||
/* 126 */ entry.setCompressedSize(getCompressedSize());
|
||||
/* 127 */ entry.setMethod(getMethod());
|
||||
/* 128 */ entry.setCrc(getCrc());
|
||||
/* 129 */ entry.setSize(getSize());
|
||||
/* 130 */ entry.setExtra(getExtra());
|
||||
/* 131 */ entry.setComment(getComment().toString());
|
||||
/* 132 */ entry.setSize(getSize());
|
||||
/* 133 */ entry.setTime(getTime());
|
||||
/* 134 */ this.entry = new SoftReference<JarEntry>(entry);
|
||||
/* */ }
|
||||
/* 136 */ return entry;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public AsciiBytes getName() {
|
||||
/* 140 */ return this.name;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public boolean isDirectory() {
|
||||
/* 144 */ return this.name.endsWith(SLASH);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public int getMethod() {
|
||||
/* 148 */ return (int)Bytes.littleEndianValue(this.header, 10, 2);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public long getTime() {
|
||||
/* 152 */ long date = Bytes.littleEndianValue(this.header, 14, 2);
|
||||
/* 153 */ long time = Bytes.littleEndianValue(this.header, 12, 2);
|
||||
/* 154 */ return decodeMsDosFormatDateTime(date, time).getTimeInMillis();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private Calendar decodeMsDosFormatDateTime(long date, long time) {
|
||||
/* 166 */ int year = (int)(date >> 9L & 0x7FL) + 1980;
|
||||
/* 167 */ int month = (int)(date >> 5L & 0xFL) - 1;
|
||||
/* 168 */ int day = (int)(date & 0x1FL);
|
||||
/* 169 */ int hours = (int)(time >> 11L & 0x1FL);
|
||||
/* 170 */ int minutes = (int)(time >> 5L & 0x3FL);
|
||||
/* 171 */ int seconds = (int)(time << 1L & 0x3EL);
|
||||
/* 172 */ return new GregorianCalendar(year, month, day, hours, minutes, seconds);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public long getCrc() {
|
||||
/* 176 */ return Bytes.littleEndianValue(this.header, 16, 4);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public int getCompressedSize() {
|
||||
/* 180 */ return (int)Bytes.littleEndianValue(this.header, 20, 4);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public int getSize() {
|
||||
/* 184 */ return (int)Bytes.littleEndianValue(this.header, 24, 4);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public byte[] getExtra() {
|
||||
/* 188 */ return this.extra;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public AsciiBytes getComment() {
|
||||
/* 192 */ return this.comment;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ JarEntryData createFilteredCopy(JarFile jarFile, AsciiBytes name) {
|
||||
/* 196 */ return new JarEntryData(this, jarFile, name);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ static JarEntryData fromInputStream(JarFile source, InputStream inputStream) throws IOException {
|
||||
/* 208 */ byte[] header = new byte[46];
|
||||
/* 209 */ if (!Bytes.fill(inputStream, header)) {
|
||||
/* 210 */ return null;
|
||||
/* */ }
|
||||
/* 212 */ return new JarEntryData(source, header, inputStream);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\jar\JarEntryData.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.jar;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import org.springframework.boot.loader.data.RandomAccessData;
|
||||
import org.springframework.boot.loader.util.AsciiBytes;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public final class JarEntryData
|
||||
{
|
||||
private static final long LOCAL_FILE_HEADER_SIZE = 30L;
|
||||
private static final AsciiBytes SLASH = new AsciiBytes("/");
|
||||
|
||||
private final JarFile source;
|
||||
|
||||
private final byte[] header;
|
||||
|
||||
private AsciiBytes name;
|
||||
|
||||
private final byte[] extra;
|
||||
|
||||
private final AsciiBytes comment;
|
||||
|
||||
private final long localHeaderOffset;
|
||||
|
||||
private RandomAccessData data;
|
||||
|
||||
private SoftReference<JarEntry> entry;
|
||||
|
||||
JarFile nestedJar;
|
||||
|
||||
|
||||
public JarEntryData(JarFile source, byte[] header, InputStream inputStream) throws IOException {
|
||||
this.source = source;
|
||||
this.header = header;
|
||||
long nameLength = Bytes.littleEndianValue(header, 28, 2);
|
||||
long extraLength = Bytes.littleEndianValue(header, 30, 2);
|
||||
long commentLength = Bytes.littleEndianValue(header, 32, 2);
|
||||
this.name = new AsciiBytes(Bytes.get(inputStream, nameLength));
|
||||
this.extra = Bytes.get(inputStream, extraLength);
|
||||
this.comment = new AsciiBytes(Bytes.get(inputStream, commentLength));
|
||||
this.localHeaderOffset = Bytes.littleEndianValue(header, 42, 4);
|
||||
}
|
||||
|
||||
private JarEntryData(JarEntryData master, JarFile source, AsciiBytes name) {
|
||||
this.header = master.header;
|
||||
this.extra = master.extra;
|
||||
this.comment = master.comment;
|
||||
this.localHeaderOffset = master.localHeaderOffset;
|
||||
this.source = source;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
void setName(AsciiBytes name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
JarFile getSource() {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
InputStream getInputStream() throws IOException {
|
||||
InputStream inputStream = getData().getInputStream(RandomAccessData.ResourceAccess.PER_READ);
|
||||
if (getMethod() == 8) {
|
||||
inputStream = new ZipInflaterInputStream(inputStream, getSize());
|
||||
}
|
||||
return inputStream;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public RandomAccessData getData() throws IOException {
|
||||
if (this.data == null) {
|
||||
|
||||
|
||||
|
||||
byte[] localHeader = Bytes.get(this.source.getData()
|
||||
.getSubsection(this.localHeaderOffset, 30L));
|
||||
long nameLength = Bytes.littleEndianValue(localHeader, 26, 2);
|
||||
long extraLength = Bytes.littleEndianValue(localHeader, 28, 2);
|
||||
this.data = this.source.getData().getSubsection(this.localHeaderOffset + 30L + nameLength + extraLength,
|
||||
|
||||
getCompressedSize());
|
||||
}
|
||||
return this.data;
|
||||
}
|
||||
|
||||
JarEntry asJarEntry() {
|
||||
JarEntry entry = (this.entry == null) ? null : this.entry.get();
|
||||
if (entry == null) {
|
||||
entry = new JarEntry(this);
|
||||
entry.setCompressedSize(getCompressedSize());
|
||||
entry.setMethod(getMethod());
|
||||
entry.setCrc(getCrc());
|
||||
entry.setSize(getSize());
|
||||
entry.setExtra(getExtra());
|
||||
entry.setComment(getComment().toString());
|
||||
entry.setSize(getSize());
|
||||
entry.setTime(getTime());
|
||||
this.entry = new SoftReference<JarEntry>(entry);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
public AsciiBytes getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean isDirectory() {
|
||||
return this.name.endsWith(SLASH);
|
||||
}
|
||||
|
||||
public int getMethod() {
|
||||
return (int)Bytes.littleEndianValue(this.header, 10, 2);
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
long date = Bytes.littleEndianValue(this.header, 14, 2);
|
||||
long time = Bytes.littleEndianValue(this.header, 12, 2);
|
||||
return decodeMsDosFormatDateTime(date, time).getTimeInMillis();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private Calendar decodeMsDosFormatDateTime(long date, long time) {
|
||||
int year = (int)(date >> 9L & 0x7FL) + 1980;
|
||||
int month = (int)(date >> 5L & 0xFL) - 1;
|
||||
int day = (int)(date & 0x1FL);
|
||||
int hours = (int)(time >> 11L & 0x1FL);
|
||||
int minutes = (int)(time >> 5L & 0x3FL);
|
||||
int seconds = (int)(time << 1L & 0x3EL);
|
||||
return new GregorianCalendar(year, month, day, hours, minutes, seconds);
|
||||
}
|
||||
|
||||
public long getCrc() {
|
||||
return Bytes.littleEndianValue(this.header, 16, 4);
|
||||
}
|
||||
|
||||
public int getCompressedSize() {
|
||||
return (int)Bytes.littleEndianValue(this.header, 20, 4);
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return (int)Bytes.littleEndianValue(this.header, 24, 4);
|
||||
}
|
||||
|
||||
public byte[] getExtra() {
|
||||
return this.extra;
|
||||
}
|
||||
|
||||
public AsciiBytes getComment() {
|
||||
return this.comment;
|
||||
}
|
||||
|
||||
JarEntryData createFilteredCopy(JarFile jarFile, AsciiBytes name) {
|
||||
return new JarEntryData(this, jarFile, name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static JarEntryData fromInputStream(JarFile source, InputStream inputStream) throws IOException {
|
||||
byte[] header = new byte[46];
|
||||
if (!Bytes.fill(inputStream, header)) {
|
||||
return null;
|
||||
}
|
||||
return new JarEntryData(source, header, inputStream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+9
-13
@@ -1,13 +1,9 @@
|
||||
package org.springframework.boot.loader.jar;
|
||||
|
||||
import org.springframework.boot.loader.util.AsciiBytes;
|
||||
|
||||
public interface JarEntryFilter {
|
||||
AsciiBytes apply(AsciiBytes paramAsciiBytes, JarEntryData paramJarEntryData);
|
||||
}
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\jar\JarEntryFilter.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.jar;
|
||||
|
||||
import org.springframework.boot.loader.util.AsciiBytes;
|
||||
|
||||
public interface JarEntryFilter {
|
||||
AsciiBytes apply(AsciiBytes paramAsciiBytes, JarEntryData paramJarEntryData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+471
-475
@@ -1,475 +1,471 @@
|
||||
/* */ package org.springframework.boot.loader.jar;
|
||||
/* */
|
||||
/* */ import java.io.File;
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.io.InputStream;
|
||||
/* */ import java.lang.ref.SoftReference;
|
||||
/* */ import java.net.MalformedURLException;
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.util.ArrayList;
|
||||
/* */ import java.util.Enumeration;
|
||||
/* */ import java.util.HashMap;
|
||||
/* */ import java.util.Iterator;
|
||||
/* */ import java.util.List;
|
||||
/* */ import java.util.Map;
|
||||
/* */ import java.util.jar.JarEntry;
|
||||
/* */ import java.util.jar.JarFile;
|
||||
/* */ import java.util.jar.JarInputStream;
|
||||
/* */ import java.util.jar.Manifest;
|
||||
/* */ import java.util.zip.ZipEntry;
|
||||
/* */ import org.springframework.boot.loader.data.RandomAccessData;
|
||||
/* */ import org.springframework.boot.loader.data.RandomAccessDataFile;
|
||||
/* */ import org.springframework.boot.loader.util.AsciiBytes;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class JarFile
|
||||
/* */ extends JarFile
|
||||
/* */ implements Iterable<JarEntryData>
|
||||
/* */ {
|
||||
/* 59 */ private static final AsciiBytes META_INF = new AsciiBytes("META-INF/");
|
||||
/* */
|
||||
/* 61 */ private static final AsciiBytes MANIFEST_MF = new AsciiBytes("META-INF/MANIFEST.MF");
|
||||
/* */
|
||||
/* 63 */ private static final AsciiBytes SIGNATURE_FILE_EXTENSION = new AsciiBytes(".SF");
|
||||
/* */
|
||||
/* */ private static final String PROTOCOL_HANDLER = "java.protocol.handler.pkgs";
|
||||
/* */
|
||||
/* */ private static final String HANDLERS_PACKAGE = "org.springframework.boot.loader";
|
||||
/* */
|
||||
/* 69 */ private static final AsciiBytes SLASH = new AsciiBytes("/");
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final RandomAccessDataFile rootFile;
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final String pathFromRoot;
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final RandomAccessData data;
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final List<JarEntryData> entries;
|
||||
/* */
|
||||
/* */ private SoftReference<Map<AsciiBytes, JarEntryData>> entriesByName;
|
||||
/* */
|
||||
/* */ private boolean signed;
|
||||
/* */
|
||||
/* */ private JarEntryData manifestEntry;
|
||||
/* */
|
||||
/* */ private SoftReference<Manifest> manifest;
|
||||
/* */
|
||||
/* */ private URL url;
|
||||
/* */
|
||||
/* */
|
||||
/* */ public JarFile(File file) throws IOException {
|
||||
/* 95 */ this(new RandomAccessDataFile(file));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ JarFile(RandomAccessDataFile file) throws IOException {
|
||||
/* 104 */ this(file, "", (RandomAccessData)file);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private JarFile(RandomAccessDataFile rootFile, String pathFromRoot, RandomAccessData data) throws IOException {
|
||||
/* 117 */ super(rootFile.getFile());
|
||||
/* 118 */ CentralDirectoryEndRecord endRecord = new CentralDirectoryEndRecord(data);
|
||||
/* 119 */ this.rootFile = rootFile;
|
||||
/* 120 */ this.pathFromRoot = pathFromRoot;
|
||||
/* 121 */ this.data = getArchiveData(endRecord, data);
|
||||
/* 122 */ this.entries = loadJarEntries(endRecord);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private JarFile(RandomAccessDataFile rootFile, String pathFromRoot, RandomAccessData data, List<JarEntryData> entries, JarEntryFilter... filters) throws IOException {
|
||||
/* 128 */ super(rootFile.getFile());
|
||||
/* 129 */ this.rootFile = rootFile;
|
||||
/* 130 */ this.pathFromRoot = pathFromRoot;
|
||||
/* 131 */ this.data = data;
|
||||
/* 132 */ this.entries = filterEntries(entries, filters);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private RandomAccessData getArchiveData(CentralDirectoryEndRecord endRecord, RandomAccessData data) {
|
||||
/* 137 */ long offset = endRecord.getStartOfArchive(data);
|
||||
/* 138 */ if (offset == 0L) {
|
||||
/* 139 */ return data;
|
||||
/* */ }
|
||||
/* 141 */ return data.getSubsection(offset, data.getSize() - offset);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private List<JarEntryData> loadJarEntries(CentralDirectoryEndRecord endRecord) throws IOException {
|
||||
/* 146 */ RandomAccessData centralDirectory = endRecord.getCentralDirectory(this.data);
|
||||
/* 147 */ int numberOfRecords = endRecord.getNumberOfRecords();
|
||||
/* 148 */ List<JarEntryData> entries = new ArrayList<JarEntryData>(numberOfRecords);
|
||||
/* 149 */ InputStream inputStream = centralDirectory.getInputStream(RandomAccessData.ResourceAccess.ONCE);
|
||||
/* */ try {
|
||||
/* 151 */ JarEntryData entry = JarEntryData.fromInputStream(this, inputStream);
|
||||
/* 152 */ while (entry != null) {
|
||||
/* 153 */ entries.add(entry);
|
||||
/* 154 */ processEntry(entry);
|
||||
/* 155 */ entry = JarEntryData.fromInputStream(this, inputStream);
|
||||
/* */ }
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* 159 */ inputStream.close();
|
||||
/* */ }
|
||||
/* 161 */ return entries;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private List<JarEntryData> filterEntries(List<JarEntryData> entries, JarEntryFilter[] filters) {
|
||||
/* 166 */ List<JarEntryData> filteredEntries = new ArrayList<JarEntryData>(entries.size());
|
||||
/* 167 */ for (JarEntryData entry : entries) {
|
||||
/* 168 */ AsciiBytes name = entry.getName();
|
||||
/* 169 */ for (JarEntryFilter filter : filters)
|
||||
/* */ {
|
||||
/* 171 */ name = (filter == null || name == null) ? name : filter.apply(name, entry);
|
||||
/* */ }
|
||||
/* 173 */ if (name != null) {
|
||||
/* 174 */ JarEntryData filteredCopy = entry.createFilteredCopy(this, name);
|
||||
/* 175 */ filteredEntries.add(filteredCopy);
|
||||
/* 176 */ processEntry(filteredCopy);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 179 */ return filteredEntries;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private void processEntry(JarEntryData entry) {
|
||||
/* 183 */ AsciiBytes name = entry.getName();
|
||||
/* 184 */ if (name.startsWith(META_INF)) {
|
||||
/* 185 */ processMetaInfEntry(name, entry);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private void processMetaInfEntry(AsciiBytes name, JarEntryData entry) {
|
||||
/* 190 */ if (name.equals(MANIFEST_MF)) {
|
||||
/* 191 */ this.manifestEntry = entry;
|
||||
/* */ }
|
||||
/* 193 */ if (name.endsWith(SIGNATURE_FILE_EXTENSION)) {
|
||||
/* 194 */ this.signed = true;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ protected final RandomAccessDataFile getRootJarFile() {
|
||||
/* 199 */ return this.rootFile;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ RandomAccessData getData() {
|
||||
/* 203 */ return this.data;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Manifest getManifest() throws IOException {
|
||||
/* 208 */ if (this.manifestEntry == null) {
|
||||
/* 209 */ return null;
|
||||
/* */ }
|
||||
/* 211 */ Manifest manifest = (this.manifest == null) ? null : this.manifest.get();
|
||||
/* 212 */ if (manifest == null) {
|
||||
/* 213 */ InputStream inputStream = this.manifestEntry.getInputStream();
|
||||
/* */ try {
|
||||
/* 215 */ manifest = new Manifest(inputStream);
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* 218 */ inputStream.close();
|
||||
/* */ }
|
||||
/* 220 */ this.manifest = new SoftReference<Manifest>(manifest);
|
||||
/* */ }
|
||||
/* 222 */ return manifest;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Enumeration<JarEntry> entries() {
|
||||
/* 227 */ final Iterator<JarEntryData> iterator = iterator();
|
||||
/* 228 */ return new Enumeration<JarEntry>()
|
||||
/* */ {
|
||||
/* */ public boolean hasMoreElements()
|
||||
/* */ {
|
||||
/* 232 */ return iterator.hasNext();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public JarEntry nextElement() {
|
||||
/* 237 */ return ((JarEntryData)iterator.next()).asJarEntry();
|
||||
/* */ }
|
||||
/* */ };
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Iterator<JarEntryData> iterator() {
|
||||
/* 244 */ return this.entries.iterator();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public JarEntry getJarEntry(String name) {
|
||||
/* 249 */ return (JarEntry)getEntry(name);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public ZipEntry getEntry(String name) {
|
||||
/* 254 */ JarEntryData jarEntryData = getJarEntryData(name);
|
||||
/* 255 */ return (jarEntryData == null) ? null : jarEntryData.asJarEntry();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public JarEntryData getJarEntryData(String name) {
|
||||
/* 259 */ if (name == null) {
|
||||
/* 260 */ return null;
|
||||
/* */ }
|
||||
/* 262 */ return getJarEntryData(new AsciiBytes(name));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public JarEntryData getJarEntryData(AsciiBytes name) {
|
||||
/* 266 */ if (name == null) {
|
||||
/* 267 */ return null;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 270 */ Map<AsciiBytes, JarEntryData> entriesByName = (this.entriesByName == null) ? null : this.entriesByName.get();
|
||||
/* 271 */ if (entriesByName == null) {
|
||||
/* 272 */ entriesByName = new HashMap<AsciiBytes, JarEntryData>();
|
||||
/* 273 */ for (JarEntryData entry : this.entries) {
|
||||
/* 274 */ entriesByName.put(entry.getName(), entry);
|
||||
/* */ }
|
||||
/* 276 */ this.entriesByName = new SoftReference<Map<AsciiBytes, JarEntryData>>(entriesByName);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 280 */ JarEntryData entryData = entriesByName.get(name);
|
||||
/* 281 */ if (entryData == null && !name.endsWith(SLASH)) {
|
||||
/* 282 */ entryData = entriesByName.get(name.append(SLASH));
|
||||
/* */ }
|
||||
/* 284 */ return entryData;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ boolean isSigned() {
|
||||
/* 288 */ return this.signed;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ void setupEntryCertificates() {
|
||||
/* */ try {
|
||||
/* 296 */ JarInputStream inputStream = new JarInputStream(getData().getInputStream(RandomAccessData.ResourceAccess.ONCE));
|
||||
/* */ try {
|
||||
/* 298 */ JarEntry entry = inputStream.getNextJarEntry();
|
||||
/* 299 */ while (entry != null) {
|
||||
/* 300 */ inputStream.closeEntry();
|
||||
/* 301 */ JarEntry jarEntry = getJarEntry(entry.getName());
|
||||
/* 302 */ if (jarEntry != null) {
|
||||
/* 303 */ jarEntry.setupCertificates(entry);
|
||||
/* */ }
|
||||
/* 305 */ entry = inputStream.getNextJarEntry();
|
||||
/* */ }
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* 309 */ inputStream.close();
|
||||
/* */ }
|
||||
/* */
|
||||
/* 312 */ } catch (IOException ex) {
|
||||
/* 313 */ throw new IllegalStateException(ex);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public synchronized InputStream getInputStream(ZipEntry ze) throws IOException {
|
||||
/* 319 */ return getContainedEntry(ze).getSource().getInputStream();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public synchronized JarFile getNestedJarFile(ZipEntry entry) throws IOException {
|
||||
/* 330 */ return getNestedJarFile(getContainedEntry(entry).getSource());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public synchronized JarFile getNestedJarFile(JarEntryData sourceEntry) throws IOException {
|
||||
/* */ try {
|
||||
/* 342 */ if (sourceEntry.nestedJar == null) {
|
||||
/* 343 */ sourceEntry.nestedJar = createJarFileFromEntry(sourceEntry);
|
||||
/* */ }
|
||||
/* 345 */ return sourceEntry.nestedJar;
|
||||
/* */ }
|
||||
/* 347 */ catch (IOException ex) {
|
||||
/* 348 */ throw new IOException("Unable to open nested jar file '" + sourceEntry
|
||||
/* 349 */ .getName() + "'", ex);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private JarFile createJarFileFromEntry(JarEntryData sourceEntry) throws IOException {
|
||||
/* 354 */ if (sourceEntry.isDirectory()) {
|
||||
/* 355 */ return createJarFileFromDirectoryEntry(sourceEntry);
|
||||
/* */ }
|
||||
/* 357 */ return createJarFileFromFileEntry(sourceEntry);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private JarFile createJarFileFromDirectoryEntry(JarEntryData sourceEntry) throws IOException {
|
||||
/* 362 */ final AsciiBytes sourceName = sourceEntry.getName();
|
||||
/* 363 */ JarEntryFilter filter = new JarEntryFilter()
|
||||
/* */ {
|
||||
/* */ public AsciiBytes apply(AsciiBytes name, JarEntryData entryData) {
|
||||
/* 366 */ if (name.startsWith(sourceName) && !name.equals(sourceName)) {
|
||||
/* 367 */ return name.substring(sourceName.length());
|
||||
/* */ }
|
||||
/* 369 */ return null;
|
||||
/* */ }
|
||||
/* */ };
|
||||
/* 372 */ return new JarFile(this.rootFile, this.pathFromRoot + "!/" + sourceEntry
|
||||
/* */
|
||||
/* 374 */ .getName().substring(0, sourceName.length() - 1), this.data, this.entries, new JarEntryFilter[] { filter });
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private JarFile createJarFileFromFileEntry(JarEntryData sourceEntry) throws IOException {
|
||||
/* 380 */ if (sourceEntry.getMethod() != 0) {
|
||||
/* 381 */ throw new IllegalStateException("Unable to open nested entry '" + sourceEntry
|
||||
/* 382 */ .getName() + "'. It has been compressed and nested " + "jar files must be stored without compression. Please check the " + "mechanism used to create your executable jar file");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 386 */ return new JarFile(this.rootFile, this.pathFromRoot + "!/" + sourceEntry
|
||||
/* 387 */ .getName(), sourceEntry.getData());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public synchronized JarFile getFilteredJarFile(JarEntryFilter... filters) throws IOException {
|
||||
/* 398 */ return new JarFile(this.rootFile, this.pathFromRoot, this.data, this.entries, filters);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private JarEntry getContainedEntry(ZipEntry zipEntry) throws IOException {
|
||||
/* 403 */ if (zipEntry instanceof JarEntry && ((JarEntry)zipEntry)
|
||||
/* 404 */ .getSource().getSource() == this) {
|
||||
/* 405 */ return (JarEntry)zipEntry;
|
||||
/* */ }
|
||||
/* 407 */ throw new IllegalArgumentException("ZipEntry must be contained in this file");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public int size() {
|
||||
/* 412 */ return (int)this.data.getSize();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public void close() throws IOException {
|
||||
/* 417 */ this.rootFile.close();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public URL getUrl() throws MalformedURLException {
|
||||
/* 427 */ if (this.url == null) {
|
||||
/* 428 */ Handler handler = new Handler(this);
|
||||
/* 429 */ String file = this.rootFile.getFile().toURI() + this.pathFromRoot + "!/";
|
||||
/* 430 */ file = file.replace("file:////", "file://");
|
||||
/* 431 */ this.url = new URL("jar", "", -1, file, handler);
|
||||
/* */ }
|
||||
/* 433 */ return this.url;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String toString() {
|
||||
/* 438 */ return getName();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String getName() {
|
||||
/* 443 */ String path = this.pathFromRoot;
|
||||
/* 444 */ return this.rootFile.getFile() + path;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void registerUrlProtocolHandler() {
|
||||
/* 452 */ String handlers = System.getProperty("java.protocol.handler.pkgs");
|
||||
/* 453 */ System.setProperty("java.protocol.handler.pkgs", "".equals(handlers) ? "org.springframework.boot.loader" : (handlers + "|" + "org.springframework.boot.loader"));
|
||||
/* */
|
||||
/* 455 */ resetCachedUrlHandlers();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static void resetCachedUrlHandlers() {
|
||||
/* */ try {
|
||||
/* 465 */ URL.setURLStreamHandlerFactory(null);
|
||||
/* */ }
|
||||
/* 467 */ catch (Error error) {}
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\jar\JarFile.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.jar;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.JarInputStream;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.zip.ZipEntry;
|
||||
import org.springframework.boot.loader.data.RandomAccessData;
|
||||
import org.springframework.boot.loader.data.RandomAccessDataFile;
|
||||
import org.springframework.boot.loader.util.AsciiBytes;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class JarFile
|
||||
extends JarFile
|
||||
implements Iterable<JarEntryData>
|
||||
{
|
||||
private static final AsciiBytes META_INF = new AsciiBytes("META-INF/");
|
||||
|
||||
private static final AsciiBytes MANIFEST_MF = new AsciiBytes("META-INF/MANIFEST.MF");
|
||||
|
||||
private static final AsciiBytes SIGNATURE_FILE_EXTENSION = new AsciiBytes(".SF");
|
||||
|
||||
private static final String PROTOCOL_HANDLER = "java.protocol.handler.pkgs";
|
||||
|
||||
private static final String HANDLERS_PACKAGE = "org.springframework.boot.loader";
|
||||
|
||||
private static final AsciiBytes SLASH = new AsciiBytes("/");
|
||||
|
||||
|
||||
private final RandomAccessDataFile rootFile;
|
||||
|
||||
|
||||
private final String pathFromRoot;
|
||||
|
||||
|
||||
private final RandomAccessData data;
|
||||
|
||||
|
||||
private final List<JarEntryData> entries;
|
||||
|
||||
private SoftReference<Map<AsciiBytes, JarEntryData>> entriesByName;
|
||||
|
||||
private boolean signed;
|
||||
|
||||
private JarEntryData manifestEntry;
|
||||
|
||||
private SoftReference<Manifest> manifest;
|
||||
|
||||
private URL url;
|
||||
|
||||
|
||||
public JarFile(File file) throws IOException {
|
||||
this(new RandomAccessDataFile(file));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JarFile(RandomAccessDataFile file) throws IOException {
|
||||
this(file, "", (RandomAccessData)file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private JarFile(RandomAccessDataFile rootFile, String pathFromRoot, RandomAccessData data) throws IOException {
|
||||
super(rootFile.getFile());
|
||||
CentralDirectoryEndRecord endRecord = new CentralDirectoryEndRecord(data);
|
||||
this.rootFile = rootFile;
|
||||
this.pathFromRoot = pathFromRoot;
|
||||
this.data = getArchiveData(endRecord, data);
|
||||
this.entries = loadJarEntries(endRecord);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private JarFile(RandomAccessDataFile rootFile, String pathFromRoot, RandomAccessData data, List<JarEntryData> entries, JarEntryFilter... filters) throws IOException {
|
||||
super(rootFile.getFile());
|
||||
this.rootFile = rootFile;
|
||||
this.pathFromRoot = pathFromRoot;
|
||||
this.data = data;
|
||||
this.entries = filterEntries(entries, filters);
|
||||
}
|
||||
|
||||
|
||||
private RandomAccessData getArchiveData(CentralDirectoryEndRecord endRecord, RandomAccessData data) {
|
||||
long offset = endRecord.getStartOfArchive(data);
|
||||
if (offset == 0L) {
|
||||
return data;
|
||||
}
|
||||
return data.getSubsection(offset, data.getSize() - offset);
|
||||
}
|
||||
|
||||
|
||||
private List<JarEntryData> loadJarEntries(CentralDirectoryEndRecord endRecord) throws IOException {
|
||||
RandomAccessData centralDirectory = endRecord.getCentralDirectory(this.data);
|
||||
int numberOfRecords = endRecord.getNumberOfRecords();
|
||||
List<JarEntryData> entries = new ArrayList<JarEntryData>(numberOfRecords);
|
||||
InputStream inputStream = centralDirectory.getInputStream(RandomAccessData.ResourceAccess.ONCE);
|
||||
try {
|
||||
JarEntryData entry = JarEntryData.fromInputStream(this, inputStream);
|
||||
while (entry != null) {
|
||||
entries.add(entry);
|
||||
processEntry(entry);
|
||||
entry = JarEntryData.fromInputStream(this, inputStream);
|
||||
}
|
||||
} finally {
|
||||
|
||||
inputStream.close();
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
|
||||
private List<JarEntryData> filterEntries(List<JarEntryData> entries, JarEntryFilter[] filters) {
|
||||
List<JarEntryData> filteredEntries = new ArrayList<JarEntryData>(entries.size());
|
||||
for (JarEntryData entry : entries) {
|
||||
AsciiBytes name = entry.getName();
|
||||
for (JarEntryFilter filter : filters)
|
||||
{
|
||||
name = (filter == null || name == null) ? name : filter.apply(name, entry);
|
||||
}
|
||||
if (name != null) {
|
||||
JarEntryData filteredCopy = entry.createFilteredCopy(this, name);
|
||||
filteredEntries.add(filteredCopy);
|
||||
processEntry(filteredCopy);
|
||||
}
|
||||
}
|
||||
return filteredEntries;
|
||||
}
|
||||
|
||||
private void processEntry(JarEntryData entry) {
|
||||
AsciiBytes name = entry.getName();
|
||||
if (name.startsWith(META_INF)) {
|
||||
processMetaInfEntry(name, entry);
|
||||
}
|
||||
}
|
||||
|
||||
private void processMetaInfEntry(AsciiBytes name, JarEntryData entry) {
|
||||
if (name.equals(MANIFEST_MF)) {
|
||||
this.manifestEntry = entry;
|
||||
}
|
||||
if (name.endsWith(SIGNATURE_FILE_EXTENSION)) {
|
||||
this.signed = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected final RandomAccessDataFile getRootJarFile() {
|
||||
return this.rootFile;
|
||||
}
|
||||
|
||||
RandomAccessData getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
|
||||
public Manifest getManifest() throws IOException {
|
||||
if (this.manifestEntry == null) {
|
||||
return null;
|
||||
}
|
||||
Manifest manifest = (this.manifest == null) ? null : this.manifest.get();
|
||||
if (manifest == null) {
|
||||
InputStream inputStream = this.manifestEntry.getInputStream();
|
||||
try {
|
||||
manifest = new Manifest(inputStream);
|
||||
} finally {
|
||||
|
||||
inputStream.close();
|
||||
}
|
||||
this.manifest = new SoftReference<Manifest>(manifest);
|
||||
}
|
||||
return manifest;
|
||||
}
|
||||
|
||||
|
||||
public Enumeration<JarEntry> entries() {
|
||||
final Iterator<JarEntryData> iterator = iterator();
|
||||
return new Enumeration<JarEntry>()
|
||||
{
|
||||
public boolean hasMoreElements()
|
||||
{
|
||||
return iterator.hasNext();
|
||||
}
|
||||
|
||||
|
||||
public JarEntry nextElement() {
|
||||
return ((JarEntryData)iterator.next()).asJarEntry();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public Iterator<JarEntryData> iterator() {
|
||||
return this.entries.iterator();
|
||||
}
|
||||
|
||||
|
||||
public JarEntry getJarEntry(String name) {
|
||||
return (JarEntry)getEntry(name);
|
||||
}
|
||||
|
||||
|
||||
public ZipEntry getEntry(String name) {
|
||||
JarEntryData jarEntryData = getJarEntryData(name);
|
||||
return (jarEntryData == null) ? null : jarEntryData.asJarEntry();
|
||||
}
|
||||
|
||||
public JarEntryData getJarEntryData(String name) {
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
return getJarEntryData(new AsciiBytes(name));
|
||||
}
|
||||
|
||||
public JarEntryData getJarEntryData(AsciiBytes name) {
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<AsciiBytes, JarEntryData> entriesByName = (this.entriesByName == null) ? null : this.entriesByName.get();
|
||||
if (entriesByName == null) {
|
||||
entriesByName = new HashMap<AsciiBytes, JarEntryData>();
|
||||
for (JarEntryData entry : this.entries) {
|
||||
entriesByName.put(entry.getName(), entry);
|
||||
}
|
||||
this.entriesByName = new SoftReference<Map<AsciiBytes, JarEntryData>>(entriesByName);
|
||||
}
|
||||
|
||||
|
||||
JarEntryData entryData = entriesByName.get(name);
|
||||
if (entryData == null && !name.endsWith(SLASH)) {
|
||||
entryData = entriesByName.get(name.append(SLASH));
|
||||
}
|
||||
return entryData;
|
||||
}
|
||||
|
||||
boolean isSigned() {
|
||||
return this.signed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void setupEntryCertificates() {
|
||||
try {
|
||||
JarInputStream inputStream = new JarInputStream(getData().getInputStream(RandomAccessData.ResourceAccess.ONCE));
|
||||
try {
|
||||
JarEntry entry = inputStream.getNextJarEntry();
|
||||
while (entry != null) {
|
||||
inputStream.closeEntry();
|
||||
JarEntry jarEntry = getJarEntry(entry.getName());
|
||||
if (jarEntry != null) {
|
||||
jarEntry.setupCertificates(entry);
|
||||
}
|
||||
entry = inputStream.getNextJarEntry();
|
||||
}
|
||||
} finally {
|
||||
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
} catch (IOException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public synchronized InputStream getInputStream(ZipEntry ze) throws IOException {
|
||||
return getContainedEntry(ze).getSource().getInputStream();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public synchronized JarFile getNestedJarFile(ZipEntry entry) throws IOException {
|
||||
return getNestedJarFile(getContainedEntry(entry).getSource());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public synchronized JarFile getNestedJarFile(JarEntryData sourceEntry) throws IOException {
|
||||
try {
|
||||
if (sourceEntry.nestedJar == null) {
|
||||
sourceEntry.nestedJar = createJarFileFromEntry(sourceEntry);
|
||||
}
|
||||
return sourceEntry.nestedJar;
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IOException("Unable to open nested jar file '" + sourceEntry
|
||||
.getName() + "'", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private JarFile createJarFileFromEntry(JarEntryData sourceEntry) throws IOException {
|
||||
if (sourceEntry.isDirectory()) {
|
||||
return createJarFileFromDirectoryEntry(sourceEntry);
|
||||
}
|
||||
return createJarFileFromFileEntry(sourceEntry);
|
||||
}
|
||||
|
||||
|
||||
private JarFile createJarFileFromDirectoryEntry(JarEntryData sourceEntry) throws IOException {
|
||||
final AsciiBytes sourceName = sourceEntry.getName();
|
||||
JarEntryFilter filter = new JarEntryFilter()
|
||||
{
|
||||
public AsciiBytes apply(AsciiBytes name, JarEntryData entryData) {
|
||||
if (name.startsWith(sourceName) && !name.equals(sourceName)) {
|
||||
return name.substring(sourceName.length());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
return new JarFile(this.rootFile, this.pathFromRoot + "!/" + sourceEntry
|
||||
|
||||
.getName().substring(0, sourceName.length() - 1), this.data, this.entries, new JarEntryFilter[] { filter });
|
||||
}
|
||||
|
||||
|
||||
|
||||
private JarFile createJarFileFromFileEntry(JarEntryData sourceEntry) throws IOException {
|
||||
if (sourceEntry.getMethod() != 0) {
|
||||
throw new IllegalStateException("Unable to open nested entry '" + sourceEntry
|
||||
.getName() + "'. It has been compressed and nested " + "jar files must be stored without compression. Please check the " + "mechanism used to create your executable jar file");
|
||||
}
|
||||
|
||||
|
||||
return new JarFile(this.rootFile, this.pathFromRoot + "!/" + sourceEntry
|
||||
.getName(), sourceEntry.getData());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public synchronized JarFile getFilteredJarFile(JarEntryFilter... filters) throws IOException {
|
||||
return new JarFile(this.rootFile, this.pathFromRoot, this.data, this.entries, filters);
|
||||
}
|
||||
|
||||
|
||||
private JarEntry getContainedEntry(ZipEntry zipEntry) throws IOException {
|
||||
if (zipEntry instanceof JarEntry && ((JarEntry)zipEntry)
|
||||
.getSource().getSource() == this) {
|
||||
return (JarEntry)zipEntry;
|
||||
}
|
||||
throw new IllegalArgumentException("ZipEntry must be contained in this file");
|
||||
}
|
||||
|
||||
|
||||
public int size() {
|
||||
return (int)this.data.getSize();
|
||||
}
|
||||
|
||||
|
||||
public void close() throws IOException {
|
||||
this.rootFile.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public URL getUrl() throws MalformedURLException {
|
||||
if (this.url == null) {
|
||||
Handler handler = new Handler(this);
|
||||
String file = this.rootFile.getFile().toURI() + this.pathFromRoot + "!/";
|
||||
file = file.replace("file:////", "file://");
|
||||
this.url = new URL("jar", "", -1, file, handler);
|
||||
}
|
||||
return this.url;
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
String path = this.pathFromRoot;
|
||||
return this.rootFile.getFile() + path;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void registerUrlProtocolHandler() {
|
||||
String handlers = System.getProperty("java.protocol.handler.pkgs");
|
||||
System.setProperty("java.protocol.handler.pkgs", "".equals(handlers) ? "org.springframework.boot.loader" : (handlers + "|" + "org.springframework.boot.loader"));
|
||||
|
||||
resetCachedUrlHandlers();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static void resetCachedUrlHandlers() {
|
||||
try {
|
||||
URL.setURLStreamHandlerFactory(null);
|
||||
}
|
||||
catch (Error error) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+286
-290
@@ -1,290 +1,286 @@
|
||||
/* */ package org.springframework.boot.loader.jar;
|
||||
/* */
|
||||
/* */ import java.io.ByteArrayOutputStream;
|
||||
/* */ import java.io.FileNotFoundException;
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.io.InputStream;
|
||||
/* */ import java.net.JarURLConnection;
|
||||
/* */ import java.net.MalformedURLException;
|
||||
/* */ import java.net.URL;
|
||||
/* */ import java.net.URLConnection;
|
||||
/* */ import java.net.URLStreamHandler;
|
||||
/* */ import java.util.jar.JarEntry;
|
||||
/* */ import java.util.jar.JarFile;
|
||||
/* */ import java.util.jar.Manifest;
|
||||
/* */ import org.springframework.boot.loader.util.AsciiBytes;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ class JarURLConnection
|
||||
/* */ extends JarURLConnection
|
||||
/* */ {
|
||||
/* 38 */ private static final FileNotFoundException FILE_NOT_FOUND_EXCEPTION = new FileNotFoundException();
|
||||
/* */
|
||||
/* */ private static final String SEPARATOR = "!/";
|
||||
/* */
|
||||
/* */ private static final URL EMPTY_JAR_URL;
|
||||
/* */
|
||||
/* */ static {
|
||||
/* */ try {
|
||||
/* 46 */ EMPTY_JAR_URL = new URL("jar:", null, 0, "file:!/", new URLStreamHandler()
|
||||
/* */ {
|
||||
/* */
|
||||
/* */ protected URLConnection openConnection(URL u) throws IOException
|
||||
/* */ {
|
||||
/* 51 */ return null;
|
||||
/* */ }
|
||||
/* */ });
|
||||
/* */ }
|
||||
/* 55 */ catch (MalformedURLException ex) {
|
||||
/* 56 */ throw new IllegalStateException(ex);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* 60 */ private static final JarEntryName EMPTY_JAR_ENTRY_NAME = new JarEntryName("");
|
||||
/* */
|
||||
/* 62 */ private static ThreadLocal<Boolean> useFastExceptions = new ThreadLocal<Boolean>();
|
||||
/* */
|
||||
/* */ private final JarFile jarFile;
|
||||
/* */
|
||||
/* */ private JarEntryData jarEntryData;
|
||||
/* */
|
||||
/* */ private URL jarFileUrl;
|
||||
/* */
|
||||
/* */ private JarEntryName jarEntryName;
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected JarURLConnection(URL url, JarFile jarFile) throws IOException {
|
||||
/* 74 */ super(EMPTY_JAR_URL);
|
||||
/* 75 */ this.url = url;
|
||||
/* 76 */ String spec = url.getFile().substring(jarFile.getUrl().getFile().length());
|
||||
/* */ int separator;
|
||||
/* 78 */ while ((separator = spec.indexOf("!/")) > 0) {
|
||||
/* 79 */ jarFile = getNestedJarFile(jarFile, spec.substring(0, separator));
|
||||
/* 80 */ spec = spec.substring(separator + "!/".length());
|
||||
/* */ }
|
||||
/* 82 */ this.jarFile = jarFile;
|
||||
/* 83 */ this.jarEntryName = getJarEntryName(spec);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private JarFile getNestedJarFile(JarFile jarFile, String name) throws IOException {
|
||||
/* 87 */ JarEntry jarEntry = jarFile.getJarEntry(name);
|
||||
/* 88 */ if (jarEntry == null) {
|
||||
/* 89 */ throwFileNotFound(jarEntry, jarFile);
|
||||
/* */ }
|
||||
/* 91 */ return jarFile.getNestedJarFile(jarEntry);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private JarEntryName getJarEntryName(String spec) {
|
||||
/* 95 */ if (spec.length() == 0) {
|
||||
/* 96 */ return EMPTY_JAR_ENTRY_NAME;
|
||||
/* */ }
|
||||
/* 98 */ return new JarEntryName(spec);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public void connect() throws IOException {
|
||||
/* 103 */ if (!this.jarEntryName.isEmpty()) {
|
||||
/* 104 */ this
|
||||
/* 105 */ .jarEntryData = this.jarFile.getJarEntryData(this.jarEntryName.asAsciiBytes());
|
||||
/* 106 */ if (this.jarEntryData == null) {
|
||||
/* 107 */ throwFileNotFound(this.jarEntryName, this.jarFile);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 110 */ this.connected = true;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private void throwFileNotFound(Object entry, JarFile jarFile) throws FileNotFoundException {
|
||||
/* 115 */ if (Boolean.TRUE.equals(useFastExceptions.get())) {
|
||||
/* 116 */ throw FILE_NOT_FOUND_EXCEPTION;
|
||||
/* */ }
|
||||
/* 118 */ throw new FileNotFoundException("JAR entry " + entry + " not found in " + jarFile
|
||||
/* 119 */ .getName());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Manifest getManifest() throws IOException {
|
||||
/* */ try {
|
||||
/* 125 */ return super.getManifest();
|
||||
/* */ } finally {
|
||||
/* */
|
||||
/* 128 */ this.connected = false;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public JarFile getJarFile() throws IOException {
|
||||
/* 134 */ connect();
|
||||
/* 135 */ return this.jarFile;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public URL getJarFileURL() {
|
||||
/* 140 */ if (this.jarFileUrl == null) {
|
||||
/* 141 */ this.jarFileUrl = buildJarFileUrl();
|
||||
/* */ }
|
||||
/* 143 */ return this.jarFileUrl;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private URL buildJarFileUrl() {
|
||||
/* */ try {
|
||||
/* 148 */ String spec = this.jarFile.getUrl().getFile();
|
||||
/* 149 */ if (spec.endsWith("!/")) {
|
||||
/* 150 */ spec = spec.substring(0, spec.length() - "!/".length());
|
||||
/* */ }
|
||||
/* 152 */ if (spec.indexOf("!/") == -1) {
|
||||
/* 153 */ return new URL(spec);
|
||||
/* */ }
|
||||
/* 155 */ return new URL("jar:" + spec);
|
||||
/* */ }
|
||||
/* 157 */ catch (MalformedURLException ex) {
|
||||
/* 158 */ throw new IllegalStateException(ex);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public JarEntry getJarEntry() throws IOException {
|
||||
/* 164 */ connect();
|
||||
/* 165 */ return (this.jarEntryData == null) ? null : this.jarEntryData.asJarEntry();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String getEntryName() {
|
||||
/* 170 */ return this.jarEntryName.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public InputStream getInputStream() throws IOException {
|
||||
/* 175 */ connect();
|
||||
/* 176 */ if (this.jarEntryName.isEmpty()) {
|
||||
/* 177 */ throw new IOException("no entry name specified");
|
||||
/* */ }
|
||||
/* 179 */ return this.jarEntryData.getInputStream();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public int getContentLength() {
|
||||
/* */ try {
|
||||
/* 185 */ connect();
|
||||
/* 186 */ if (this.jarEntryData != null) {
|
||||
/* 187 */ return this.jarEntryData.getSize();
|
||||
/* */ }
|
||||
/* 189 */ return this.jarFile.size();
|
||||
/* */ }
|
||||
/* 191 */ catch (IOException ex) {
|
||||
/* 192 */ return -1;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Object getContent() throws IOException {
|
||||
/* 198 */ connect();
|
||||
/* 199 */ return (this.jarEntryData == null) ? this.jarFile : super.getContent();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String getContentType() {
|
||||
/* 204 */ return this.jarEntryName.getContentType();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ static void setUseFastExceptions(boolean useFastExceptions) {
|
||||
/* 208 */ JarURLConnection.useFastExceptions.set(Boolean.valueOf(useFastExceptions));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static class JarEntryName
|
||||
/* */ {
|
||||
/* */ private final AsciiBytes name;
|
||||
/* */
|
||||
/* */ private String contentType;
|
||||
/* */
|
||||
/* */
|
||||
/* */ JarEntryName(String spec) {
|
||||
/* 221 */ this.name = decode(spec);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private AsciiBytes decode(String source) {
|
||||
/* 225 */ int length = (source == null) ? 0 : source.length();
|
||||
/* 226 */ if (length == 0 || source.indexOf('%') < 0) {
|
||||
/* 227 */ return new AsciiBytes(source);
|
||||
/* */ }
|
||||
/* 229 */ ByteArrayOutputStream bos = new ByteArrayOutputStream(length);
|
||||
/* 230 */ for (int i = 0; i < length; i++) {
|
||||
/* 231 */ int ch = source.charAt(i);
|
||||
/* 232 */ if (ch == 37) {
|
||||
/* 233 */ if (i + 2 >= length) {
|
||||
/* 234 */ throw new IllegalArgumentException("Invalid encoded sequence \"" + source
|
||||
/* 235 */ .substring(i) + "\"");
|
||||
/* */ }
|
||||
/* 237 */ ch = decodeEscapeSequence(source, i);
|
||||
/* 238 */ i += 2;
|
||||
/* */ }
|
||||
/* 240 */ bos.write(ch);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 243 */ return new AsciiBytes(bos.toByteArray());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private char decodeEscapeSequence(String source, int i) {
|
||||
/* 247 */ int hi = Character.digit(source.charAt(i + 1), 16);
|
||||
/* 248 */ int lo = Character.digit(source.charAt(i + 2), 16);
|
||||
/* 249 */ if (hi == -1 || lo == -1) {
|
||||
/* 250 */ throw new IllegalArgumentException("Invalid encoded sequence \"" + source
|
||||
/* 251 */ .substring(i) + "\"");
|
||||
/* */ }
|
||||
/* 253 */ return (char)((hi << 4) + lo);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String toString() {
|
||||
/* 258 */ return this.name.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public AsciiBytes asAsciiBytes() {
|
||||
/* 262 */ return this.name;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public boolean isEmpty() {
|
||||
/* 266 */ return (this.name.length() == 0);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public String getContentType() {
|
||||
/* 270 */ if (this.contentType == null) {
|
||||
/* 271 */ this.contentType = deduceContentType();
|
||||
/* */ }
|
||||
/* 273 */ return this.contentType;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private String deduceContentType() {
|
||||
/* 278 */ String type = isEmpty() ? "x-java/jar" : null;
|
||||
/* 279 */ type = (type != null) ? type : URLConnection.guessContentTypeFromName(toString());
|
||||
/* 280 */ type = (type != null) ? type : "content/unknown";
|
||||
/* 281 */ return type;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\jar\JarURLConnection.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.jar;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.JarURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLStreamHandler;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
import org.springframework.boot.loader.util.AsciiBytes;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class JarURLConnection
|
||||
extends JarURLConnection
|
||||
{
|
||||
private static final FileNotFoundException FILE_NOT_FOUND_EXCEPTION = new FileNotFoundException();
|
||||
|
||||
private static final String SEPARATOR = "!/";
|
||||
|
||||
private static final URL EMPTY_JAR_URL;
|
||||
|
||||
static {
|
||||
try {
|
||||
EMPTY_JAR_URL = new URL("jar:", null, 0, "file:!/", new URLStreamHandler()
|
||||
{
|
||||
|
||||
protected URLConnection openConnection(URL u) throws IOException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (MalformedURLException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static final JarEntryName EMPTY_JAR_ENTRY_NAME = new JarEntryName("");
|
||||
|
||||
private static ThreadLocal<Boolean> useFastExceptions = new ThreadLocal<Boolean>();
|
||||
|
||||
private final JarFile jarFile;
|
||||
|
||||
private JarEntryData jarEntryData;
|
||||
|
||||
private URL jarFileUrl;
|
||||
|
||||
private JarEntryName jarEntryName;
|
||||
|
||||
|
||||
protected JarURLConnection(URL url, JarFile jarFile) throws IOException {
|
||||
super(EMPTY_JAR_URL);
|
||||
this.url = url;
|
||||
String spec = url.getFile().substring(jarFile.getUrl().getFile().length());
|
||||
int separator;
|
||||
while ((separator = spec.indexOf("!/")) > 0) {
|
||||
jarFile = getNestedJarFile(jarFile, spec.substring(0, separator));
|
||||
spec = spec.substring(separator + "!/".length());
|
||||
}
|
||||
this.jarFile = jarFile;
|
||||
this.jarEntryName = getJarEntryName(spec);
|
||||
}
|
||||
|
||||
private JarFile getNestedJarFile(JarFile jarFile, String name) throws IOException {
|
||||
JarEntry jarEntry = jarFile.getJarEntry(name);
|
||||
if (jarEntry == null) {
|
||||
throwFileNotFound(jarEntry, jarFile);
|
||||
}
|
||||
return jarFile.getNestedJarFile(jarEntry);
|
||||
}
|
||||
|
||||
private JarEntryName getJarEntryName(String spec) {
|
||||
if (spec.length() == 0) {
|
||||
return EMPTY_JAR_ENTRY_NAME;
|
||||
}
|
||||
return new JarEntryName(spec);
|
||||
}
|
||||
|
||||
|
||||
public void connect() throws IOException {
|
||||
if (!this.jarEntryName.isEmpty()) {
|
||||
this
|
||||
.jarEntryData = this.jarFile.getJarEntryData(this.jarEntryName.asAsciiBytes());
|
||||
if (this.jarEntryData == null) {
|
||||
throwFileNotFound(this.jarEntryName, this.jarFile);
|
||||
}
|
||||
}
|
||||
this.connected = true;
|
||||
}
|
||||
|
||||
|
||||
private void throwFileNotFound(Object entry, JarFile jarFile) throws FileNotFoundException {
|
||||
if (Boolean.TRUE.equals(useFastExceptions.get())) {
|
||||
throw FILE_NOT_FOUND_EXCEPTION;
|
||||
}
|
||||
throw new FileNotFoundException("JAR entry " + entry + " not found in " + jarFile
|
||||
.getName());
|
||||
}
|
||||
|
||||
|
||||
public Manifest getManifest() throws IOException {
|
||||
try {
|
||||
return super.getManifest();
|
||||
} finally {
|
||||
|
||||
this.connected = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public JarFile getJarFile() throws IOException {
|
||||
connect();
|
||||
return this.jarFile;
|
||||
}
|
||||
|
||||
|
||||
public URL getJarFileURL() {
|
||||
if (this.jarFileUrl == null) {
|
||||
this.jarFileUrl = buildJarFileUrl();
|
||||
}
|
||||
return this.jarFileUrl;
|
||||
}
|
||||
|
||||
private URL buildJarFileUrl() {
|
||||
try {
|
||||
String spec = this.jarFile.getUrl().getFile();
|
||||
if (spec.endsWith("!/")) {
|
||||
spec = spec.substring(0, spec.length() - "!/".length());
|
||||
}
|
||||
if (spec.indexOf("!/") == -1) {
|
||||
return new URL(spec);
|
||||
}
|
||||
return new URL("jar:" + spec);
|
||||
}
|
||||
catch (MalformedURLException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public JarEntry getJarEntry() throws IOException {
|
||||
connect();
|
||||
return (this.jarEntryData == null) ? null : this.jarEntryData.asJarEntry();
|
||||
}
|
||||
|
||||
|
||||
public String getEntryName() {
|
||||
return this.jarEntryName.toString();
|
||||
}
|
||||
|
||||
|
||||
public InputStream getInputStream() throws IOException {
|
||||
connect();
|
||||
if (this.jarEntryName.isEmpty()) {
|
||||
throw new IOException("no entry name specified");
|
||||
}
|
||||
return this.jarEntryData.getInputStream();
|
||||
}
|
||||
|
||||
|
||||
public int getContentLength() {
|
||||
try {
|
||||
connect();
|
||||
if (this.jarEntryData != null) {
|
||||
return this.jarEntryData.getSize();
|
||||
}
|
||||
return this.jarFile.size();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Object getContent() throws IOException {
|
||||
connect();
|
||||
return (this.jarEntryData == null) ? this.jarFile : super.getContent();
|
||||
}
|
||||
|
||||
|
||||
public String getContentType() {
|
||||
return this.jarEntryName.getContentType();
|
||||
}
|
||||
|
||||
static void setUseFastExceptions(boolean useFastExceptions) {
|
||||
JarURLConnection.useFastExceptions.set(Boolean.valueOf(useFastExceptions));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class JarEntryName
|
||||
{
|
||||
private final AsciiBytes name;
|
||||
|
||||
private String contentType;
|
||||
|
||||
|
||||
JarEntryName(String spec) {
|
||||
this.name = decode(spec);
|
||||
}
|
||||
|
||||
private AsciiBytes decode(String source) {
|
||||
int length = (source == null) ? 0 : source.length();
|
||||
if (length == 0 || source.indexOf('%') < 0) {
|
||||
return new AsciiBytes(source);
|
||||
}
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
int ch = source.charAt(i);
|
||||
if (ch == 37) {
|
||||
if (i + 2 >= length) {
|
||||
throw new IllegalArgumentException("Invalid encoded sequence \"" + source
|
||||
.substring(i) + "\"");
|
||||
}
|
||||
ch = decodeEscapeSequence(source, i);
|
||||
i += 2;
|
||||
}
|
||||
bos.write(ch);
|
||||
}
|
||||
|
||||
return new AsciiBytes(bos.toByteArray());
|
||||
}
|
||||
|
||||
private char decodeEscapeSequence(String source, int i) {
|
||||
int hi = Character.digit(source.charAt(i + 1), 16);
|
||||
int lo = Character.digit(source.charAt(i + 2), 16);
|
||||
if (hi == -1 || lo == -1) {
|
||||
throw new IllegalArgumentException("Invalid encoded sequence \"" + source
|
||||
.substring(i) + "\"");
|
||||
}
|
||||
return (char)((hi << 4) + lo);
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
return this.name.toString();
|
||||
}
|
||||
|
||||
public AsciiBytes asAsciiBytes() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return (this.name.length() == 0);
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
if (this.contentType == null) {
|
||||
this.contentType = deduceContentType();
|
||||
}
|
||||
return this.contentType;
|
||||
}
|
||||
|
||||
|
||||
private String deduceContentType() {
|
||||
String type = isEmpty() ? "x-java/jar" : null;
|
||||
type = (type != null) ? type : URLConnection.guessContentTypeFromName(toString());
|
||||
type = (type != null) ? type : "content/unknown";
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+83
-87
@@ -1,87 +1,83 @@
|
||||
/* */ package org.springframework.boot.loader.jar;
|
||||
/* */
|
||||
/* */ import java.io.EOFException;
|
||||
/* */ import java.io.IOException;
|
||||
/* */ import java.io.InputStream;
|
||||
/* */ import java.util.zip.Inflater;
|
||||
/* */ import java.util.zip.InflaterInputStream;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ class ZipInflaterInputStream
|
||||
/* */ extends InflaterInputStream
|
||||
/* */ {
|
||||
/* */ private boolean extraBytesWritten;
|
||||
/* */ private int available;
|
||||
/* */
|
||||
/* */ ZipInflaterInputStream(InputStream inputStream, int size) {
|
||||
/* 38 */ super(inputStream, new Inflater(true), getInflaterBufferSize(size));
|
||||
/* 39 */ this.available = size;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public int available() throws IOException {
|
||||
/* 44 */ if (this.available < 0) {
|
||||
/* 45 */ return super.available();
|
||||
/* */ }
|
||||
/* 47 */ return this.available;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public int read(byte[] b, int off, int len) throws IOException {
|
||||
/* 52 */ int result = super.read(b, off, len);
|
||||
/* 53 */ if (result != -1) {
|
||||
/* 54 */ this.available -= result;
|
||||
/* */ }
|
||||
/* 56 */ return result;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ protected void fill() throws IOException {
|
||||
/* */ try {
|
||||
/* 62 */ super.fill();
|
||||
/* */ }
|
||||
/* 64 */ catch (EOFException ex) {
|
||||
/* 65 */ if (this.extraBytesWritten) {
|
||||
/* 66 */ throw ex;
|
||||
/* */ }
|
||||
/* 68 */ this.len = 1;
|
||||
/* 69 */ this.buf[0] = 0;
|
||||
/* 70 */ this.extraBytesWritten = true;
|
||||
/* 71 */ this.inf.setInput(this.buf, 0, this.len);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private static int getInflaterBufferSize(long size) {
|
||||
/* 76 */ size += 2L;
|
||||
/* 77 */ size = (size > 65536L) ? 8192L : size;
|
||||
/* 78 */ size = (size <= 0L) ? 4096L : size;
|
||||
/* 79 */ return (int)size;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loader\jar\ZipInflaterInputStream.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.jar;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.zip.Inflater;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class ZipInflaterInputStream
|
||||
extends InflaterInputStream
|
||||
{
|
||||
private boolean extraBytesWritten;
|
||||
private int available;
|
||||
|
||||
ZipInflaterInputStream(InputStream inputStream, int size) {
|
||||
super(inputStream, new Inflater(true), getInflaterBufferSize(size));
|
||||
this.available = size;
|
||||
}
|
||||
|
||||
|
||||
public int available() throws IOException {
|
||||
if (this.available < 0) {
|
||||
return super.available();
|
||||
}
|
||||
return this.available;
|
||||
}
|
||||
|
||||
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
int result = super.read(b, off, len);
|
||||
if (result != -1) {
|
||||
this.available -= result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
protected void fill() throws IOException {
|
||||
try {
|
||||
super.fill();
|
||||
}
|
||||
catch (EOFException ex) {
|
||||
if (this.extraBytesWritten) {
|
||||
throw ex;
|
||||
}
|
||||
this.len = 1;
|
||||
this.buf[0] = 0;
|
||||
this.extraBytesWritten = true;
|
||||
this.inf.setInput(this.buf, 0, this.len);
|
||||
}
|
||||
}
|
||||
|
||||
private static int getInflaterBufferSize(long size) {
|
||||
size += 2L;
|
||||
size = (size > 65536L) ? 8192L : size;
|
||||
size = (size <= 0L) ? 4096L : size;
|
||||
return (int)size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+189
-193
@@ -1,193 +1,189 @@
|
||||
/* */ package org.springframework.boot.loader.util;
|
||||
/* */
|
||||
/* */ import java.nio.charset.Charset;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public final class AsciiBytes
|
||||
/* */ {
|
||||
/* 29 */ private static final Charset UTF_8 = Charset.forName("UTF-8");
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static final int INITIAL_HASH = 7;
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static final int MULTIPLIER = 31;
|
||||
/* */
|
||||
/* */
|
||||
/* */ private final byte[] bytes;
|
||||
/* */
|
||||
/* */ private final int offset;
|
||||
/* */
|
||||
/* */ private final int length;
|
||||
/* */
|
||||
/* */ private String string;
|
||||
/* */
|
||||
/* */
|
||||
/* */ public AsciiBytes(String string) {
|
||||
/* 48 */ this(string.getBytes(UTF_8));
|
||||
/* 49 */ this.string = string;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public AsciiBytes(byte[] bytes) {
|
||||
/* 58 */ this(bytes, 0, bytes.length);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public AsciiBytes(byte[] bytes, int offset, int length) {
|
||||
/* 69 */ if (offset < 0 || length < 0 || offset + length > bytes.length) {
|
||||
/* 70 */ throw new IndexOutOfBoundsException();
|
||||
/* */ }
|
||||
/* 72 */ this.bytes = bytes;
|
||||
/* 73 */ this.offset = offset;
|
||||
/* 74 */ this.length = length;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public int length() {
|
||||
/* 78 */ return this.length;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public boolean startsWith(AsciiBytes prefix) {
|
||||
/* 82 */ if (this == prefix) {
|
||||
/* 83 */ return true;
|
||||
/* */ }
|
||||
/* 85 */ if (prefix.length > this.length) {
|
||||
/* 86 */ return false;
|
||||
/* */ }
|
||||
/* 88 */ for (int i = 0; i < prefix.length; i++) {
|
||||
/* 89 */ if (this.bytes[i + this.offset] != prefix.bytes[i + prefix.offset]) {
|
||||
/* 90 */ return false;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 93 */ return true;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public boolean endsWith(AsciiBytes postfix) {
|
||||
/* 97 */ if (this == postfix) {
|
||||
/* 98 */ return true;
|
||||
/* */ }
|
||||
/* 100 */ if (postfix.length > this.length) {
|
||||
/* 101 */ return false;
|
||||
/* */ }
|
||||
/* 103 */ for (int i = 0; i < postfix.length; i++) {
|
||||
/* 104 */ if (this.bytes[this.offset + this.length - 1 - i] != postfix.bytes[postfix.offset + postfix.length - 1 - i])
|
||||
/* */ {
|
||||
/* 106 */ return false;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 109 */ return true;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public AsciiBytes substring(int beginIndex) {
|
||||
/* 113 */ return substring(beginIndex, this.length);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public AsciiBytes substring(int beginIndex, int endIndex) {
|
||||
/* 117 */ int length = endIndex - beginIndex;
|
||||
/* 118 */ if (this.offset + length > this.length) {
|
||||
/* 119 */ throw new IndexOutOfBoundsException();
|
||||
/* */ }
|
||||
/* 121 */ return new AsciiBytes(this.bytes, this.offset + beginIndex, length);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public AsciiBytes append(String string) {
|
||||
/* 125 */ if (string == null || string.length() == 0) {
|
||||
/* 126 */ return this;
|
||||
/* */ }
|
||||
/* 128 */ return append(string.getBytes(UTF_8));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public AsciiBytes append(AsciiBytes asciiBytes) {
|
||||
/* 132 */ if (asciiBytes == null || asciiBytes.length() == 0) {
|
||||
/* 133 */ return this;
|
||||
/* */ }
|
||||
/* 135 */ return append(asciiBytes.bytes);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public AsciiBytes append(byte[] bytes) {
|
||||
/* 139 */ if (bytes == null || bytes.length == 0) {
|
||||
/* 140 */ return this;
|
||||
/* */ }
|
||||
/* 142 */ byte[] combined = new byte[this.length + bytes.length];
|
||||
/* 143 */ System.arraycopy(this.bytes, this.offset, combined, 0, this.length);
|
||||
/* 144 */ System.arraycopy(bytes, 0, combined, this.length, bytes.length);
|
||||
/* 145 */ return new AsciiBytes(combined);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public String toString() {
|
||||
/* 150 */ if (this.string == null) {
|
||||
/* 151 */ this.string = new String(this.bytes, this.offset, this.length, UTF_8);
|
||||
/* */ }
|
||||
/* 153 */ return this.string;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public int hashCode() {
|
||||
/* 158 */ int hash = 7;
|
||||
/* 159 */ for (int i = 0; i < this.length; i++) {
|
||||
/* 160 */ hash = 31 * hash + this.bytes[this.offset + i];
|
||||
/* */ }
|
||||
/* 162 */ return hash;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public boolean equals(Object obj) {
|
||||
/* 168 */ if (obj == null) {
|
||||
/* 169 */ return false;
|
||||
/* */ }
|
||||
/* 171 */ if (this == obj) {
|
||||
/* 172 */ return true;
|
||||
/* */ }
|
||||
/* 174 */ if (obj.getClass().equals(AsciiBytes.class)) {
|
||||
/* 175 */ AsciiBytes other = (AsciiBytes)obj;
|
||||
/* 176 */ if (this.length == other.length) {
|
||||
/* 177 */ for (int i = 0; i < this.length; i++) {
|
||||
/* 178 */ if (this.bytes[this.offset + i] != other.bytes[other.offset + i]) {
|
||||
/* 179 */ return false;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 182 */ return true;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 185 */ return false;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loade\\util\AsciiBytes.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.util;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public final class AsciiBytes
|
||||
{
|
||||
private static final Charset UTF_8 = Charset.forName("UTF-8");
|
||||
|
||||
|
||||
private static final int INITIAL_HASH = 7;
|
||||
|
||||
|
||||
private static final int MULTIPLIER = 31;
|
||||
|
||||
|
||||
private final byte[] bytes;
|
||||
|
||||
private final int offset;
|
||||
|
||||
private final int length;
|
||||
|
||||
private String string;
|
||||
|
||||
|
||||
public AsciiBytes(String string) {
|
||||
this(string.getBytes(UTF_8));
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public AsciiBytes(byte[] bytes) {
|
||||
this(bytes, 0, bytes.length);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public AsciiBytes(byte[] bytes, int offset, int length) {
|
||||
if (offset < 0 || length < 0 || offset + length > bytes.length) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
this.bytes = bytes;
|
||||
this.offset = offset;
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public int length() {
|
||||
return this.length;
|
||||
}
|
||||
|
||||
public boolean startsWith(AsciiBytes prefix) {
|
||||
if (this == prefix) {
|
||||
return true;
|
||||
}
|
||||
if (prefix.length > this.length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < prefix.length; i++) {
|
||||
if (this.bytes[i + this.offset] != prefix.bytes[i + prefix.offset]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean endsWith(AsciiBytes postfix) {
|
||||
if (this == postfix) {
|
||||
return true;
|
||||
}
|
||||
if (postfix.length > this.length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < postfix.length; i++) {
|
||||
if (this.bytes[this.offset + this.length - 1 - i] != postfix.bytes[postfix.offset + postfix.length - 1 - i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public AsciiBytes substring(int beginIndex) {
|
||||
return substring(beginIndex, this.length);
|
||||
}
|
||||
|
||||
public AsciiBytes substring(int beginIndex, int endIndex) {
|
||||
int length = endIndex - beginIndex;
|
||||
if (this.offset + length > this.length) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
return new AsciiBytes(this.bytes, this.offset + beginIndex, length);
|
||||
}
|
||||
|
||||
public AsciiBytes append(String string) {
|
||||
if (string == null || string.length() == 0) {
|
||||
return this;
|
||||
}
|
||||
return append(string.getBytes(UTF_8));
|
||||
}
|
||||
|
||||
public AsciiBytes append(AsciiBytes asciiBytes) {
|
||||
if (asciiBytes == null || asciiBytes.length() == 0) {
|
||||
return this;
|
||||
}
|
||||
return append(asciiBytes.bytes);
|
||||
}
|
||||
|
||||
public AsciiBytes append(byte[] bytes) {
|
||||
if (bytes == null || bytes.length == 0) {
|
||||
return this;
|
||||
}
|
||||
byte[] combined = new byte[this.length + bytes.length];
|
||||
System.arraycopy(this.bytes, this.offset, combined, 0, this.length);
|
||||
System.arraycopy(bytes, 0, combined, this.length, bytes.length);
|
||||
return new AsciiBytes(combined);
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
if (this.string == null) {
|
||||
this.string = new String(this.bytes, this.offset, this.length, UTF_8);
|
||||
}
|
||||
return this.string;
|
||||
}
|
||||
|
||||
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
for (int i = 0; i < this.length; i++) {
|
||||
hash = 31 * hash + this.bytes[this.offset + i];
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj.getClass().equals(AsciiBytes.class)) {
|
||||
AsciiBytes other = (AsciiBytes)obj;
|
||||
if (this.length == other.length) {
|
||||
for (int i = 0; i < this.length; i++) {
|
||||
if (this.bytes[this.offset + i] != other.bytes[other.offset + i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+241
-245
@@ -1,245 +1,241 @@
|
||||
/* */ package org.springframework.boot.loader.util;
|
||||
/* */
|
||||
/* */ import java.util.HashSet;
|
||||
/* */ import java.util.Properties;
|
||||
/* */ import java.util.Set;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public abstract class SystemPropertyUtils
|
||||
/* */ {
|
||||
/* */ public static final String PLACEHOLDER_PREFIX = "${";
|
||||
/* */ public static final String PLACEHOLDER_SUFFIX = "}";
|
||||
/* */ public static final String VALUE_SEPARATOR = ":";
|
||||
/* 55 */ private static final String SIMPLE_PREFIX = "${".substring(1);
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String resolvePlaceholders(String text) {
|
||||
/* 67 */ if (text == null) {
|
||||
/* 68 */ return text;
|
||||
/* */ }
|
||||
/* 70 */ return parseStringValue(null, text, text, new HashSet<String>());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String resolvePlaceholders(Properties properties, String text) {
|
||||
/* 84 */ if (text == null) {
|
||||
/* 85 */ return text;
|
||||
/* */ }
|
||||
/* 87 */ return parseStringValue(properties, text, text, new HashSet<String>());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static String parseStringValue(Properties properties, String value, String current, Set<String> visitedPlaceholders) {
|
||||
/* 93 */ StringBuilder buf = new StringBuilder(current);
|
||||
/* */
|
||||
/* 95 */ int startIndex = current.indexOf("${");
|
||||
/* 96 */ while (startIndex != -1) {
|
||||
/* 97 */ int endIndex = findPlaceholderEndIndex(buf, startIndex);
|
||||
/* 98 */ if (endIndex != -1) {
|
||||
/* */
|
||||
/* 100 */ String placeholder = buf.substring(startIndex + "${".length(), endIndex);
|
||||
/* 101 */ String originalPlaceholder = placeholder;
|
||||
/* 102 */ if (!visitedPlaceholders.add(originalPlaceholder)) {
|
||||
/* 103 */ throw new IllegalArgumentException("Circular placeholder reference '" + originalPlaceholder + "' in property definitions");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 109 */ placeholder = parseStringValue(properties, value, placeholder, visitedPlaceholders);
|
||||
/* */
|
||||
/* */
|
||||
/* 112 */ String propVal = resolvePlaceholder(properties, value, placeholder);
|
||||
/* 113 */ if (propVal == null && ":" != null) {
|
||||
/* 114 */ int separatorIndex = placeholder.indexOf(":");
|
||||
/* 115 */ if (separatorIndex != -1) {
|
||||
/* 116 */ String actualPlaceholder = placeholder.substring(0, separatorIndex);
|
||||
/* */
|
||||
/* */
|
||||
/* 119 */ String defaultValue = placeholder.substring(separatorIndex + ":".length());
|
||||
/* 120 */ propVal = resolvePlaceholder(properties, value, actualPlaceholder);
|
||||
/* */
|
||||
/* 122 */ if (propVal == null) {
|
||||
/* 123 */ propVal = defaultValue;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 127 */ if (propVal != null) {
|
||||
/* */
|
||||
/* */
|
||||
/* 130 */ propVal = parseStringValue(properties, value, propVal, visitedPlaceholders);
|
||||
/* */
|
||||
/* 132 */ buf.replace(startIndex, endIndex + "}".length(), propVal);
|
||||
/* */
|
||||
/* 134 */ startIndex = buf.indexOf("${", startIndex + propVal
|
||||
/* 135 */ .length());
|
||||
/* */ }
|
||||
/* */ else {
|
||||
/* */
|
||||
/* 139 */ startIndex = buf.indexOf("${", endIndex + "}"
|
||||
/* 140 */ .length());
|
||||
/* */ }
|
||||
/* 142 */ visitedPlaceholders.remove(originalPlaceholder);
|
||||
/* */ continue;
|
||||
/* */ }
|
||||
/* 145 */ startIndex = -1;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 149 */ return buf.toString();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static String resolvePlaceholder(Properties properties, String text, String placeholderName) {
|
||||
/* 154 */ String propVal = getProperty(placeholderName, null, text);
|
||||
/* 155 */ if (propVal != null) {
|
||||
/* 156 */ return propVal;
|
||||
/* */ }
|
||||
/* 158 */ return (properties == null) ? null : properties.getProperty(placeholderName);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static String getProperty(String key) {
|
||||
/* 162 */ return getProperty(key, null, "");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static String getProperty(String key, String defaultValue) {
|
||||
/* 166 */ return getProperty(key, defaultValue, "");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static String getProperty(String key, String defaultValue, String text) {
|
||||
/* */ try {
|
||||
/* 181 */ String propVal = System.getProperty(key);
|
||||
/* 182 */ if (propVal == null)
|
||||
/* */ {
|
||||
/* 184 */ propVal = System.getenv(key);
|
||||
/* */ }
|
||||
/* 186 */ if (propVal == null)
|
||||
/* */ {
|
||||
/* 188 */ propVal = System.getenv(key.replace(".", "_"));
|
||||
/* */ }
|
||||
/* 190 */ if (propVal == null)
|
||||
/* */ {
|
||||
/* 192 */ propVal = System.getenv(key.toUpperCase().replace(".", "_"));
|
||||
/* */ }
|
||||
/* 194 */ if (propVal != null) {
|
||||
/* 195 */ return propVal;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 198 */ catch (Throwable ex) {
|
||||
/* 199 */ System.err.println("Could not resolve key '" + key + "' in '" + text + "' as system property or in environment: " + ex);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 202 */ return defaultValue;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private static int findPlaceholderEndIndex(CharSequence buf, int startIndex) {
|
||||
/* 206 */ int index = startIndex + "${".length();
|
||||
/* 207 */ int withinNestedPlaceholder = 0;
|
||||
/* 208 */ while (index < buf.length()) {
|
||||
/* 209 */ if (substringMatch(buf, index, "}")) {
|
||||
/* 210 */ if (withinNestedPlaceholder > 0) {
|
||||
/* 211 */ withinNestedPlaceholder--;
|
||||
/* 212 */ index += "}".length();
|
||||
/* */ continue;
|
||||
/* */ }
|
||||
/* 215 */ return index;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 218 */ if (substringMatch(buf, index, SIMPLE_PREFIX)) {
|
||||
/* 219 */ withinNestedPlaceholder++;
|
||||
/* 220 */ index += SIMPLE_PREFIX.length();
|
||||
/* */ continue;
|
||||
/* */ }
|
||||
/* 223 */ index++;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 226 */ return -1;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static boolean substringMatch(CharSequence str, int index, CharSequence substring) {
|
||||
/* 231 */ for (int j = 0; j < substring.length(); j++) {
|
||||
/* 232 */ int i = index + j;
|
||||
/* 233 */ if (i >= str.length() || str.charAt(i) != substring.charAt(j)) {
|
||||
/* 234 */ return false;
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 237 */ return true;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: D:\星中心\ninca-crk-std-backend-V2.9.1_20210630.jar!\org\springframework\boot\loade\\util\SystemPropertyUtils.class
|
||||
* Java compiler version: 6 (50.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
||||
package org.springframework.boot.loader.util;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public abstract class SystemPropertyUtils
|
||||
{
|
||||
public static final String PLACEHOLDER_PREFIX = "${";
|
||||
public static final String PLACEHOLDER_SUFFIX = "}";
|
||||
public static final String VALUE_SEPARATOR = ":";
|
||||
private static final String SIMPLE_PREFIX = "${".substring(1);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static String resolvePlaceholders(String text) {
|
||||
if (text == null) {
|
||||
return text;
|
||||
}
|
||||
return parseStringValue(null, text, text, new HashSet<String>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static String resolvePlaceholders(Properties properties, String text) {
|
||||
if (text == null) {
|
||||
return text;
|
||||
}
|
||||
return parseStringValue(properties, text, text, new HashSet<String>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static String parseStringValue(Properties properties, String value, String current, Set<String> visitedPlaceholders) {
|
||||
StringBuilder buf = new StringBuilder(current);
|
||||
|
||||
int startIndex = current.indexOf("${");
|
||||
while (startIndex != -1) {
|
||||
int endIndex = findPlaceholderEndIndex(buf, startIndex);
|
||||
if (endIndex != -1) {
|
||||
|
||||
String placeholder = buf.substring(startIndex + "${".length(), endIndex);
|
||||
String originalPlaceholder = placeholder;
|
||||
if (!visitedPlaceholders.add(originalPlaceholder)) {
|
||||
throw new IllegalArgumentException("Circular placeholder reference '" + originalPlaceholder + "' in property definitions");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
placeholder = parseStringValue(properties, value, placeholder, visitedPlaceholders);
|
||||
|
||||
|
||||
String propVal = resolvePlaceholder(properties, value, placeholder);
|
||||
if (propVal == null && ":" != null) {
|
||||
int separatorIndex = placeholder.indexOf(":");
|
||||
if (separatorIndex != -1) {
|
||||
String actualPlaceholder = placeholder.substring(0, separatorIndex);
|
||||
|
||||
|
||||
String defaultValue = placeholder.substring(separatorIndex + ":".length());
|
||||
propVal = resolvePlaceholder(properties, value, actualPlaceholder);
|
||||
|
||||
if (propVal == null) {
|
||||
propVal = defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (propVal != null) {
|
||||
|
||||
|
||||
propVal = parseStringValue(properties, value, propVal, visitedPlaceholders);
|
||||
|
||||
buf.replace(startIndex, endIndex + "}".length(), propVal);
|
||||
|
||||
startIndex = buf.indexOf("${", startIndex + propVal
|
||||
.length());
|
||||
}
|
||||
else {
|
||||
|
||||
startIndex = buf.indexOf("${", endIndex + "}"
|
||||
.length());
|
||||
}
|
||||
visitedPlaceholders.remove(originalPlaceholder);
|
||||
continue;
|
||||
}
|
||||
startIndex = -1;
|
||||
}
|
||||
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
private static String resolvePlaceholder(Properties properties, String text, String placeholderName) {
|
||||
String propVal = getProperty(placeholderName, null, text);
|
||||
if (propVal != null) {
|
||||
return propVal;
|
||||
}
|
||||
return (properties == null) ? null : properties.getProperty(placeholderName);
|
||||
}
|
||||
|
||||
public static String getProperty(String key) {
|
||||
return getProperty(key, null, "");
|
||||
}
|
||||
|
||||
public static String getProperty(String key, String defaultValue) {
|
||||
return getProperty(key, defaultValue, "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static String getProperty(String key, String defaultValue, String text) {
|
||||
try {
|
||||
String propVal = System.getProperty(key);
|
||||
if (propVal == null)
|
||||
{
|
||||
propVal = System.getenv(key);
|
||||
}
|
||||
if (propVal == null)
|
||||
{
|
||||
propVal = System.getenv(key.replace(".", "_"));
|
||||
}
|
||||
if (propVal == null)
|
||||
{
|
||||
propVal = System.getenv(key.toUpperCase().replace(".", "_"));
|
||||
}
|
||||
if (propVal != null) {
|
||||
return propVal;
|
||||
}
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
System.err.println("Could not resolve key '" + key + "' in '" + text + "' as system property or in environment: " + ex);
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
private static int findPlaceholderEndIndex(CharSequence buf, int startIndex) {
|
||||
int index = startIndex + "${".length();
|
||||
int withinNestedPlaceholder = 0;
|
||||
while (index < buf.length()) {
|
||||
if (substringMatch(buf, index, "}")) {
|
||||
if (withinNestedPlaceholder > 0) {
|
||||
withinNestedPlaceholder--;
|
||||
index += "}".length();
|
||||
continue;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
if (substringMatch(buf, index, SIMPLE_PREFIX)) {
|
||||
withinNestedPlaceholder++;
|
||||
index += SIMPLE_PREFIX.length();
|
||||
continue;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
private static boolean substringMatch(CharSequence str, int index, CharSequence substring) {
|
||||
for (int j = 0; j < substring.length(); j++) {
|
||||
int i = index + j;
|
||||
if (i >= str.length() || str.charAt(i) != substring.charAt(j)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user