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:
反编译工作区
2026-04-25 09:35:35 +08:00
parent 1c28fcedfc
commit dee355b4a7
2000 changed files with 133077 additions and 169300 deletions
@@ -1,40 +1,36 @@
/* */ package BOOT-INF.classes.cn.cloudwalk;
/* */
/* */ import org.mybatis.spring.annotation.MapperScan;
/* */ import org.springframework.boot.SpringApplication;
/* */ import org.springframework.boot.autoconfigure.SpringBootApplication;
/* */ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/* */ import org.springframework.cloud.netflix.feign.EnableFeignClients;
/* */ import org.springframework.scheduling.annotation.EnableScheduling;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @MapperScan({"cn.cloudwalk.data.alarm.**.mapper"})
/* */ @EnableFeignClients(basePackages = {"cn.cloudwalk"})
/* */ @EnableDiscoveryClient
/* */ @SpringBootApplication
/* */ @EnableScheduling
/* */ public class AlarmApplication
/* */ {
/* */ public static void main(String[] args) {
/* 31 */ SpringApplication application = new SpringApplication(new Object[] { cn.cloudwalk.AlarmApplication.class });
/* 32 */ application.run(args);
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\BOOT-INF\classes\cn\cloudwalk\AlarmApplication.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package BOOT-INF.classes.cn.cloudwalk;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
@MapperScan({"cn.cloudwalk.data.alarm.**.mapper"})
@EnableFeignClients(basePackages = {"cn.cloudwalk"})
@EnableDiscoveryClient
@SpringBootApplication
@EnableScheduling
public class AlarmApplication
{
public static void main(String[] args) {
SpringApplication application = new SpringApplication(new Object[] { cn.cloudwalk.AlarmApplication.class });
application.run(args);
}
}
@@ -1,129 +1,125 @@
/* */ package org.springframework.boot.loader;
/* */
/* */ import java.io.BufferedReader;
/* */ import java.io.File;
/* */ import java.io.FileInputStream;
/* */ import java.io.IOException;
/* */ import java.io.InputStream;
/* */ import java.io.InputStreamReader;
/* */ import java.net.MalformedURLException;
/* */ import java.net.URISyntaxException;
/* */ import java.net.URL;
/* */ import java.nio.charset.StandardCharsets;
/* */ import java.util.ArrayList;
/* */ import java.util.Collections;
/* */ import java.util.List;
/* */ import java.util.stream.Collectors;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ final class ClassPathIndexFile
/* */ {
/* */ private final File root;
/* */ private final List<String> lines;
/* */
/* */ private ClassPathIndexFile(File root, List<String> lines) {
/* 47 */ this.root = root;
/* 48 */ this.lines = (List<String>)lines.stream().map(this::extractName).collect(Collectors.toList());
/* */ }
/* */
/* */ private String extractName(String line) {
/* 52 */ if (line.startsWith("- \"") && line.endsWith("\"")) {
/* 53 */ return line.substring(3, line.length() - 1);
/* */ }
/* 55 */ throw new IllegalStateException("Malformed classpath index line [" + line + "]");
/* */ }
/* */
/* */ int size() {
/* 59 */ return this.lines.size();
/* */ }
/* */
/* */ boolean containsEntry(String name) {
/* 63 */ if (name == null || name.isEmpty()) {
/* 64 */ return false;
/* */ }
/* 66 */ return this.lines.contains(name);
/* */ }
/* */
/* */ List<URL> getUrls() {
/* 70 */ return Collections.unmodifiableList((List<? extends URL>)this.lines.stream().map(this::asUrl).collect(Collectors.toList()));
/* */ }
/* */
/* */ private URL asUrl(String line) {
/* */ try {
/* 75 */ return (new File(this.root, line)).toURI().toURL();
/* */ }
/* 77 */ catch (MalformedURLException ex) {
/* 78 */ throw new IllegalStateException(ex);
/* */ }
/* */ }
/* */
/* */ static ClassPathIndexFile loadIfPossible(URL root, String location) throws IOException {
/* 83 */ return loadIfPossible(asFile(root), location);
/* */ }
/* */
/* */ private static ClassPathIndexFile loadIfPossible(File root, String location) throws IOException {
/* 87 */ return loadIfPossible(root, new File(root, location));
/* */ }
/* */
/* */ private static ClassPathIndexFile loadIfPossible(File root, File indexFile) throws IOException {
/* 91 */ if (indexFile.exists() && indexFile.isFile()) {
/* 92 */ try (InputStream inputStream = new FileInputStream(indexFile)) {
/* 93 */ return new ClassPathIndexFile(root, loadLines(inputStream));
/* */ }
/* */ }
/* 96 */ return null;
/* */ }
/* */
/* */ private static List<String> loadLines(InputStream inputStream) throws IOException {
/* 100 */ List<String> lines = new ArrayList<>();
/* 101 */ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
/* 102 */ String line = reader.readLine();
/* 103 */ while (line != null) {
/* 104 */ if (!line.trim().isEmpty()) {
/* 105 */ lines.add(line);
/* */ }
/* 107 */ line = reader.readLine();
/* */ }
/* 109 */ return Collections.unmodifiableList(lines);
/* */ }
/* */
/* */ private static File asFile(URL url) {
/* 113 */ if (!"file".equals(url.getProtocol())) {
/* 114 */ throw new IllegalArgumentException("URL does not reference a file");
/* */ }
/* */ try {
/* 117 */ return new File(url.toURI());
/* */ }
/* 119 */ catch (URISyntaxException ex) {
/* 120 */ return new File(url.getPath());
/* */ }
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\ClassPathIndexFile.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
final class ClassPathIndexFile
{
private final File root;
private final List<String> lines;
private ClassPathIndexFile(File root, List<String> lines) {
this.root = root;
this.lines = (List<String>)lines.stream().map(this::extractName).collect(Collectors.toList());
}
private String extractName(String line) {
if (line.startsWith("- \"") && line.endsWith("\"")) {
return line.substring(3, line.length() - 1);
}
throw new IllegalStateException("Malformed classpath index line [" + line + "]");
}
int size() {
return this.lines.size();
}
boolean containsEntry(String name) {
if (name == null || name.isEmpty()) {
return false;
}
return this.lines.contains(name);
}
List<URL> getUrls() {
return Collections.unmodifiableList((List<? extends URL>)this.lines.stream().map(this::asUrl).collect(Collectors.toList()));
}
private URL asUrl(String line) {
try {
return (new File(this.root, line)).toURI().toURL();
}
catch (MalformedURLException ex) {
throw new IllegalStateException(ex);
}
}
static ClassPathIndexFile loadIfPossible(URL root, String location) throws IOException {
return loadIfPossible(asFile(root), location);
}
private static ClassPathIndexFile loadIfPossible(File root, String location) throws IOException {
return loadIfPossible(root, new File(root, location));
}
private static ClassPathIndexFile loadIfPossible(File root, File indexFile) throws IOException {
if (indexFile.exists() && indexFile.isFile()) {
try (InputStream inputStream = new FileInputStream(indexFile)) {
return new ClassPathIndexFile(root, loadLines(inputStream));
}
}
return null;
}
private static List<String> loadLines(InputStream inputStream) throws IOException {
List<String> lines = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
String line = reader.readLine();
while (line != null) {
if (!line.trim().isEmpty()) {
lines.add(line);
}
line = reader.readLine();
}
return Collections.unmodifiableList(lines);
}
private static File asFile(URL url) {
if (!"file".equals(url.getProtocol())) {
throw new IllegalArgumentException("URL does not reference a file");
}
try {
return new File(url.toURI());
}
catch (URISyntaxException ex) {
return new File(url.getPath());
}
}
}
@@ -1,186 +1,182 @@
/* */ package org.springframework.boot.loader;
/* */
/* */ import java.io.IOException;
/* */ import java.net.URL;
/* */ import java.util.ArrayList;
/* */ import java.util.Iterator;
/* */ import java.util.List;
/* */ import java.util.jar.Manifest;
/* */ import org.springframework.boot.loader.archive.Archive;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public abstract class ExecutableArchiveLauncher
/* */ extends Launcher
/* */ {
/* */ private static final String START_CLASS_ATTRIBUTE = "Start-Class";
/* */ protected static final String BOOT_CLASSPATH_INDEX_ATTRIBUTE = "Spring-Boot-Classpath-Index";
/* */ private final Archive archive;
/* */ private final ClassPathIndexFile classPathIndex;
/* */
/* */ public ExecutableArchiveLauncher() {
/* */ try {
/* 48 */ this.archive = createArchive();
/* 49 */ this.classPathIndex = getClassPathIndex(this.archive);
/* */ }
/* 51 */ catch (Exception ex) {
/* 52 */ throw new IllegalStateException(ex);
/* */ }
/* */ }
/* */
/* */ protected ExecutableArchiveLauncher(Archive archive) {
/* */ try {
/* 58 */ this.archive = archive;
/* 59 */ this.classPathIndex = getClassPathIndex(this.archive);
/* */ }
/* 61 */ catch (Exception ex) {
/* 62 */ throw new IllegalStateException(ex);
/* */ }
/* */ }
/* */
/* */ protected ClassPathIndexFile getClassPathIndex(Archive archive) throws IOException {
/* 67 */ return null;
/* */ }
/* */
/* */
/* */ protected String getMainClass() throws Exception {
/* 72 */ Manifest manifest = this.archive.getManifest();
/* 73 */ String mainClass = null;
/* 74 */ if (manifest != null) {
/* 75 */ mainClass = manifest.getMainAttributes().getValue("Start-Class");
/* */ }
/* 77 */ if (mainClass == null) {
/* 78 */ throw new IllegalStateException("No 'Start-Class' manifest entry specified in " + this);
/* */ }
/* 80 */ return mainClass;
/* */ }
/* */
/* */
/* */ protected ClassLoader createClassLoader(Iterator<Archive> archives) throws Exception {
/* 85 */ List<URL> urls = new ArrayList<>(guessClassPathSize());
/* 86 */ while (archives.hasNext()) {
/* 87 */ urls.add(((Archive)archives.next()).getUrl());
/* */ }
/* 89 */ if (this.classPathIndex != null) {
/* 90 */ urls.addAll(this.classPathIndex.getUrls());
/* */ }
/* 92 */ return createClassLoader(urls.<URL>toArray(new URL[0]));
/* */ }
/* */
/* */ private int guessClassPathSize() {
/* 96 */ if (this.classPathIndex != null) {
/* 97 */ return this.classPathIndex.size() + 10;
/* */ }
/* 99 */ return 50;
/* */ }
/* */
/* */
/* */ protected Iterator<Archive> getClassPathArchivesIterator() throws Exception {
/* 104 */ Archive.EntryFilter searchFilter = this::isSearchCandidate;
/* 105 */ Iterator<Archive> archives = this.archive.getNestedArchives(searchFilter, entry ->
/* 106 */ (isNestedArchive(entry) && !isEntryIndexed(entry)));
/* 107 */ if (isPostProcessingClassPathArchives()) {
/* 108 */ archives = applyClassPathArchivePostProcessing(archives);
/* */ }
/* 110 */ return archives;
/* */ }
/* */
/* */ private boolean isEntryIndexed(Archive.Entry entry) {
/* 114 */ if (this.classPathIndex != null) {
/* 115 */ return this.classPathIndex.containsEntry(entry.getName());
/* */ }
/* 117 */ return false;
/* */ }
/* */
/* */ private Iterator<Archive> applyClassPathArchivePostProcessing(Iterator<Archive> archives) throws Exception {
/* 121 */ List<Archive> list = new ArrayList<>();
/* 122 */ while (archives.hasNext()) {
/* 123 */ list.add(archives.next());
/* */ }
/* 125 */ postProcessClassPathArchives(list);
/* 126 */ return list.iterator();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected boolean isSearchCandidate(Archive.Entry entry) {
/* 136 */ return true;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected boolean isPostProcessingClassPathArchives() {
/* 156 */ return true;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected void postProcessClassPathArchives(List<Archive> archives) throws Exception {}
/* */
/* */
/* */
/* */
/* */
/* */ protected boolean isExploded() {
/* 171 */ return this.archive.isExploded();
/* */ }
/* */
/* */
/* */ protected final Archive getArchive() {
/* 176 */ return this.archive;
/* */ }
/* */
/* */ protected abstract boolean isNestedArchive(Archive.Entry paramEntry);
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\ExecutableArchiveLauncher.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.jar.Manifest;
import org.springframework.boot.loader.archive.Archive;
public abstract class ExecutableArchiveLauncher
extends Launcher
{
private static final String START_CLASS_ATTRIBUTE = "Start-Class";
protected static final String BOOT_CLASSPATH_INDEX_ATTRIBUTE = "Spring-Boot-Classpath-Index";
private final Archive archive;
private final ClassPathIndexFile classPathIndex;
public ExecutableArchiveLauncher() {
try {
this.archive = createArchive();
this.classPathIndex = getClassPathIndex(this.archive);
}
catch (Exception ex) {
throw new IllegalStateException(ex);
}
}
protected ExecutableArchiveLauncher(Archive archive) {
try {
this.archive = archive;
this.classPathIndex = getClassPathIndex(this.archive);
}
catch (Exception ex) {
throw new IllegalStateException(ex);
}
}
protected ClassPathIndexFile getClassPathIndex(Archive archive) throws IOException {
return null;
}
protected String getMainClass() throws Exception {
Manifest manifest = this.archive.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;
}
protected ClassLoader createClassLoader(Iterator<Archive> archives) throws Exception {
List<URL> urls = new ArrayList<>(guessClassPathSize());
while (archives.hasNext()) {
urls.add(((Archive)archives.next()).getUrl());
}
if (this.classPathIndex != null) {
urls.addAll(this.classPathIndex.getUrls());
}
return createClassLoader(urls.<URL>toArray(new URL[0]));
}
private int guessClassPathSize() {
if (this.classPathIndex != null) {
return this.classPathIndex.size() + 10;
}
return 50;
}
protected Iterator<Archive> getClassPathArchivesIterator() throws Exception {
Archive.EntryFilter searchFilter = this::isSearchCandidate;
Iterator<Archive> archives = this.archive.getNestedArchives(searchFilter, entry ->
(isNestedArchive(entry) && !isEntryIndexed(entry)));
if (isPostProcessingClassPathArchives()) {
archives = applyClassPathArchivePostProcessing(archives);
}
return archives;
}
private boolean isEntryIndexed(Archive.Entry entry) {
if (this.classPathIndex != null) {
return this.classPathIndex.containsEntry(entry.getName());
}
return false;
}
private Iterator<Archive> applyClassPathArchivePostProcessing(Iterator<Archive> archives) throws Exception {
List<Archive> list = new ArrayList<>();
while (archives.hasNext()) {
list.add(archives.next());
}
postProcessClassPathArchives(list);
return list.iterator();
}
protected boolean isSearchCandidate(Archive.Entry entry) {
return true;
}
protected boolean isPostProcessingClassPathArchives() {
return true;
}
protected void postProcessClassPathArchives(List<Archive> archives) throws Exception {}
protected boolean isExploded() {
return this.archive.isExploded();
}
protected final Archive getArchive() {
return this.archive;
}
protected abstract boolean isNestedArchive(Archive.Entry paramEntry);
}
@@ -1,96 +1,92 @@
/* */ package org.springframework.boot.loader;
/* */
/* */ import java.io.IOException;
/* */ import java.util.jar.Attributes;
/* */ import java.util.jar.Manifest;
/* */ import org.springframework.boot.loader.archive.Archive;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class JarLauncher
/* */ extends ExecutableArchiveLauncher
/* */ {
/* */ private static final String DEFAULT_CLASSPATH_INDEX_LOCATION = "BOOT-INF/classpath.idx";
/* */ static final Archive.EntryFilter NESTED_ARCHIVE_ENTRY_FILTER;
/* */
/* */ static {
/* 41 */ NESTED_ARCHIVE_ENTRY_FILTER = (entry -> entry.isDirectory() ? entry.getName().equals("BOOT-INF/classes/") : entry.getName().startsWith("BOOT-INF/lib/"));
/* */ }
/* */
/* */
/* */
/* */
/* */ public JarLauncher() {}
/* */
/* */
/* */
/* */ protected JarLauncher(Archive archive) {
/* 52 */ super(archive);
/* */ }
/* */
/* */
/* */
/* */ protected ClassPathIndexFile getClassPathIndex(Archive archive) throws IOException {
/* 58 */ if (archive instanceof org.springframework.boot.loader.archive.ExplodedArchive) {
/* 59 */ String location = getClassPathIndexFileLocation(archive);
/* 60 */ return ClassPathIndexFile.loadIfPossible(archive.getUrl(), location);
/* */ }
/* 62 */ return super.getClassPathIndex(archive);
/* */ }
/* */
/* */ private String getClassPathIndexFileLocation(Archive archive) throws IOException {
/* 66 */ Manifest manifest = archive.getManifest();
/* 67 */ Attributes attributes = (manifest != null) ? manifest.getMainAttributes() : null;
/* 68 */ String location = (attributes != null) ? attributes.getValue("Spring-Boot-Classpath-Index") : null;
/* 69 */ return (location != null) ? location : "BOOT-INF/classpath.idx";
/* */ }
/* */
/* */
/* */ protected boolean isPostProcessingClassPathArchives() {
/* 74 */ return false;
/* */ }
/* */
/* */
/* */ protected boolean isSearchCandidate(Archive.Entry entry) {
/* 79 */ return entry.getName().startsWith("BOOT-INF/");
/* */ }
/* */
/* */
/* */ protected boolean isNestedArchive(Archive.Entry entry) {
/* 84 */ return NESTED_ARCHIVE_ENTRY_FILTER.matches(entry);
/* */ }
/* */
/* */ public static void main(String[] args) throws Exception {
/* 88 */ (new JarLauncher()).launch(args);
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\JarLauncher.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader;
import java.io.IOException;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import org.springframework.boot.loader.archive.Archive;
public class JarLauncher
extends ExecutableArchiveLauncher
{
private static final String DEFAULT_CLASSPATH_INDEX_LOCATION = "BOOT-INF/classpath.idx";
static final Archive.EntryFilter NESTED_ARCHIVE_ENTRY_FILTER;
static {
NESTED_ARCHIVE_ENTRY_FILTER = (entry -> entry.isDirectory() ? entry.getName().equals("BOOT-INF/classes/") : entry.getName().startsWith("BOOT-INF/lib/"));
}
public JarLauncher() {}
protected JarLauncher(Archive archive) {
super(archive);
}
protected ClassPathIndexFile getClassPathIndex(Archive archive) throws IOException {
if (archive instanceof org.springframework.boot.loader.archive.ExplodedArchive) {
String location = getClassPathIndexFileLocation(archive);
return ClassPathIndexFile.loadIfPossible(archive.getUrl(), location);
}
return super.getClassPathIndex(archive);
}
private String getClassPathIndexFileLocation(Archive archive) throws IOException {
Manifest manifest = archive.getManifest();
Attributes attributes = (manifest != null) ? manifest.getMainAttributes() : null;
String location = (attributes != null) ? attributes.getValue("Spring-Boot-Classpath-Index") : null;
return (location != null) ? location : "BOOT-INF/classpath.idx";
}
protected boolean isPostProcessingClassPathArchives() {
return false;
}
protected boolean isSearchCandidate(Archive.Entry entry) {
return entry.getName().startsWith("BOOT-INF/");
}
protected boolean isNestedArchive(Archive.Entry entry) {
return NESTED_ARCHIVE_ENTRY_FILTER.matches(entry);
}
public static void main(String[] args) throws Exception {
(new JarLauncher()).launch(args);
}
}
@@ -1,379 +1,375 @@
/* */ package org.springframework.boot.loader;
/* */
/* */ import java.io.ByteArrayOutputStream;
/* */ import java.io.IOException;
/* */ import java.io.InputStream;
/* */ import java.net.JarURLConnection;
/* */ import java.net.URL;
/* */ import java.net.URLClassLoader;
/* */ import java.net.URLConnection;
/* */ import java.security.AccessController;
/* */ import java.security.PrivilegedActionException;
/* */ import java.util.Enumeration;
/* */ import java.util.function.Supplier;
/* */ import java.util.jar.JarFile;
/* */ import java.util.jar.Manifest;
/* */ import org.springframework.boot.loader.archive.Archive;
/* */ import org.springframework.boot.loader.jar.Handler;
/* */ import org.springframework.boot.loader.jar.JarFile;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class LaunchedURLClassLoader
/* */ extends URLClassLoader
/* */ {
/* */ private static final int BUFFER_SIZE = 4096;
/* */ private final boolean exploded;
/* */ private final Archive rootArchive;
/* */
/* */ static {
/* 49 */ ClassLoader.registerAsParallelCapable();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* 56 */ private final Object packageLock = new Object();
/* */
/* */
/* */
/* */ private volatile DefinePackageCallType definePackageCallType;
/* */
/* */
/* */
/* */
/* */ public LaunchedURLClassLoader(URL[] urls, ClassLoader parent) {
/* 66 */ this(false, urls, parent);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public LaunchedURLClassLoader(boolean exploded, URL[] urls, ClassLoader parent) {
/* 76 */ this(exploded, (Archive)null, urls, parent);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public LaunchedURLClassLoader(boolean exploded, Archive rootArchive, URL[] urls, ClassLoader parent) {
/* 88 */ super(urls, parent);
/* 89 */ this.exploded = exploded;
/* 90 */ this.rootArchive = rootArchive;
/* */ }
/* */
/* */
/* */ public URL findResource(String name) {
/* 95 */ if (this.exploded) {
/* 96 */ return super.findResource(name);
/* */ }
/* 98 */ Handler.setUseFastConnectionExceptions(true);
/* */ try {
/* 100 */ return super.findResource(name);
/* */ } finally {
/* */
/* 103 */ Handler.setUseFastConnectionExceptions(false);
/* */ }
/* */ }
/* */
/* */
/* */ public Enumeration<URL> findResources(String name) throws IOException {
/* 109 */ if (this.exploded) {
/* 110 */ return super.findResources(name);
/* */ }
/* 112 */ Handler.setUseFastConnectionExceptions(true);
/* */ try {
/* 114 */ return new UseFastConnectionExceptionsEnumeration(super.findResources(name));
/* */ } finally {
/* */
/* 117 */ Handler.setUseFastConnectionExceptions(false);
/* */ }
/* */ }
/* */
/* */
/* */ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
/* 123 */ if (name.startsWith("org.springframework.boot.loader.jarmode.")) {
/* */ try {
/* 125 */ Class<?> result = loadClassInLaunchedClassLoader(name);
/* 126 */ if (resolve) {
/* 127 */ resolveClass(result);
/* */ }
/* 129 */ return result;
/* */ }
/* 131 */ catch (ClassNotFoundException classNotFoundException) {}
/* */ }
/* */
/* 134 */ if (this.exploded) {
/* 135 */ return super.loadClass(name, resolve);
/* */ }
/* 137 */ Handler.setUseFastConnectionExceptions(true);
/* */ try {
/* */ try {
/* 140 */ definePackageIfNecessary(name);
/* */ }
/* 142 */ catch (IllegalArgumentException ex) {
/* */
/* 144 */ if (getPackage(name) == null)
/* */ {
/* */
/* */
/* 148 */ throw new AssertionError("Package " + name + " has already been defined but it could not be found");
/* */ }
/* */ }
/* 151 */ return super.loadClass(name, resolve);
/* */ } finally {
/* */
/* 154 */ Handler.setUseFastConnectionExceptions(false);
/* */ }
/* */ }
/* */
/* */ private Class<?> loadClassInLaunchedClassLoader(String name) throws ClassNotFoundException {
/* 159 */ String internalName = name.replace('.', '/') + ".class";
/* 160 */ InputStream inputStream = getParent().getResourceAsStream(internalName);
/* 161 */ if (inputStream == null) {
/* 162 */ throw new ClassNotFoundException(name);
/* */ }
/* */ try {
/* */ try {
/* 166 */ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
/* 167 */ byte[] buffer = new byte[4096];
/* 168 */ int bytesRead = -1;
/* 169 */ while ((bytesRead = inputStream.read(buffer)) != -1) {
/* 170 */ outputStream.write(buffer, 0, bytesRead);
/* */ }
/* 172 */ inputStream.close();
/* 173 */ byte[] bytes = outputStream.toByteArray();
/* 174 */ Class<?> definedClass = defineClass(name, bytes, 0, bytes.length);
/* 175 */ definePackageIfNecessary(name);
/* 176 */ return definedClass;
/* */ } finally {
/* */
/* 179 */ inputStream.close();
/* */ }
/* */
/* 182 */ } catch (IOException ex) {
/* 183 */ throw new ClassNotFoundException("Cannot load resource for class [" + name + "]", ex);
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private void definePackageIfNecessary(String className) {
/* 194 */ int lastDot = className.lastIndexOf('.');
/* 195 */ if (lastDot >= 0) {
/* 196 */ String packageName = className.substring(0, lastDot);
/* 197 */ if (getPackage(packageName) == null) {
/* */ try {
/* 199 */ definePackage(className, packageName);
/* */ }
/* 201 */ catch (IllegalArgumentException ex) {
/* */
/* 203 */ if (getPackage(packageName) == null)
/* */ {
/* */
/* */
/* 207 */ throw new AssertionError("Package " + packageName + " has already been defined but it could not be found");
/* */ }
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */ private void definePackage(String className, String packageName) {
/* */ try {
/* 217 */ AccessController.doPrivileged(() -> {
/* */ String packageEntryName = packageName.replace('.', '/') + "/";
/* */
/* */ String classEntryName = className.replace('.', '/') + ".class";
/* */
/* */ for (URL url : getURLs()) {
/* */ try {
/* */ URLConnection connection = url.openConnection();
/* */ if (connection instanceof JarURLConnection) {
/* */ JarFile jarFile = ((JarURLConnection)connection).getJarFile();
/* */ if (jarFile.getEntry(classEntryName) != null && jarFile.getEntry(packageEntryName) != null && jarFile.getManifest() != null) {
/* */ definePackage(packageName, jarFile.getManifest(), url);
/* */ return null;
/* */ }
/* */ }
/* 232 */ } catch (IOException iOException) {}
/* */ }
/* */
/* */
/* */ return null;
/* 237 */ }AccessController.getContext());
/* */ }
/* 239 */ catch (PrivilegedActionException privilegedActionException) {}
/* */ }
/* */
/* */
/* */
/* */
/* */ protected Package definePackage(String name, Manifest man, URL url) throws IllegalArgumentException {
/* 246 */ if (!this.exploded) {
/* 247 */ return super.definePackage(name, man, url);
/* */ }
/* 249 */ synchronized (this.packageLock) {
/* 250 */ return doDefinePackage(DefinePackageCallType.MANIFEST, () -> super.definePackage(name, man, url));
/* */ }
/* */ }
/* */
/* */
/* */
/* */ protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException {
/* 257 */ if (!this.exploded) {
/* 258 */ return super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase);
/* */ }
/* */
/* 261 */ synchronized (this.packageLock) {
/* 262 */ if (this.definePackageCallType == null) {
/* */
/* */
/* */
/* 266 */ Manifest manifest = getManifest(this.rootArchive);
/* 267 */ if (manifest != null) {
/* 268 */ return definePackage(name, manifest, sealBase);
/* */ }
/* */ }
/* 271 */ return doDefinePackage(DefinePackageCallType.ATTRIBUTES, () -> super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase));
/* */ }
/* */ }
/* */
/* */
/* */ private Manifest getManifest(Archive archive) {
/* */ try {
/* 278 */ return (archive != null) ? archive.getManifest() : null;
/* */ }
/* 280 */ catch (IOException ex) {
/* 281 */ return null;
/* */ }
/* */ }
/* */
/* */ private <T> T doDefinePackage(DefinePackageCallType type, Supplier<T> call) {
/* 286 */ DefinePackageCallType existingType = this.definePackageCallType;
/* */ try {
/* 288 */ this.definePackageCallType = type;
/* 289 */ return call.get();
/* */ } finally {
/* */
/* 292 */ this.definePackageCallType = existingType;
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */ public void clearCache() {
/* 300 */ if (this.exploded) {
/* */ return;
/* */ }
/* 303 */ for (URL url : getURLs()) {
/* */ try {
/* 305 */ URLConnection connection = url.openConnection();
/* 306 */ if (connection instanceof JarURLConnection) {
/* 307 */ clearCache(connection);
/* */ }
/* */ }
/* 310 */ catch (IOException iOException) {}
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */ private void clearCache(URLConnection connection) throws IOException {
/* 318 */ Object jarFile = ((JarURLConnection)connection).getJarFile();
/* 319 */ if (jarFile instanceof JarFile)
/* 320 */ ((JarFile)jarFile).clearCache();
/* */ }
/* */
/* */ private static class UseFastConnectionExceptionsEnumeration
/* */ implements Enumeration<URL>
/* */ {
/* */ private final Enumeration<URL> delegate;
/* */
/* */ UseFastConnectionExceptionsEnumeration(Enumeration<URL> delegate) {
/* 329 */ this.delegate = delegate;
/* */ }
/* */
/* */
/* */ public boolean hasMoreElements() {
/* 334 */ Handler.setUseFastConnectionExceptions(true);
/* */ try {
/* 336 */ return this.delegate.hasMoreElements();
/* */ } finally {
/* */
/* 339 */ Handler.setUseFastConnectionExceptions(false);
/* */ }
/* */ }
/* */
/* */
/* */
/* */ public URL nextElement() {
/* 346 */ Handler.setUseFastConnectionExceptions(true);
/* */ try {
/* 348 */ return this.delegate.nextElement();
/* */ } finally {
/* */
/* 351 */ Handler.setUseFastConnectionExceptions(false);
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private enum DefinePackageCallType
/* */ {
/* 366 */ MANIFEST,
/* */
/* */
/* */
/* */
/* 371 */ ATTRIBUTES;
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\LaunchedURLClassLoader.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.JarURLConnection;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLConnection;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.util.Enumeration;
import java.util.function.Supplier;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import org.springframework.boot.loader.archive.Archive;
import org.springframework.boot.loader.jar.Handler;
import org.springframework.boot.loader.jar.JarFile;
public class LaunchedURLClassLoader
extends URLClassLoader
{
private static final int BUFFER_SIZE = 4096;
private final boolean exploded;
private final Archive rootArchive;
static {
ClassLoader.registerAsParallelCapable();
}
private final Object packageLock = new Object();
private volatile DefinePackageCallType definePackageCallType;
public LaunchedURLClassLoader(URL[] urls, ClassLoader parent) {
this(false, urls, parent);
}
public LaunchedURLClassLoader(boolean exploded, URL[] urls, ClassLoader parent) {
this(exploded, (Archive)null, urls, parent);
}
public LaunchedURLClassLoader(boolean exploded, Archive rootArchive, URL[] urls, ClassLoader parent) {
super(urls, parent);
this.exploded = exploded;
this.rootArchive = rootArchive;
}
public URL findResource(String name) {
if (this.exploded) {
return super.findResource(name);
}
Handler.setUseFastConnectionExceptions(true);
try {
return super.findResource(name);
} finally {
Handler.setUseFastConnectionExceptions(false);
}
}
public Enumeration<URL> findResources(String name) throws IOException {
if (this.exploded) {
return super.findResources(name);
}
Handler.setUseFastConnectionExceptions(true);
try {
return new UseFastConnectionExceptionsEnumeration(super.findResources(name));
} finally {
Handler.setUseFastConnectionExceptions(false);
}
}
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
if (name.startsWith("org.springframework.boot.loader.jarmode.")) {
try {
Class<?> result = loadClassInLaunchedClassLoader(name);
if (resolve) {
resolveClass(result);
}
return result;
}
catch (ClassNotFoundException classNotFoundException) {}
}
if (this.exploded) {
return super.loadClass(name, resolve);
}
Handler.setUseFastConnectionExceptions(true);
try {
try {
definePackageIfNecessary(name);
}
catch (IllegalArgumentException ex) {
if (getPackage(name) == null)
{
throw new AssertionError("Package " + name + " has already been defined but it could not be found");
}
}
return super.loadClass(name, resolve);
} finally {
Handler.setUseFastConnectionExceptions(false);
}
}
private Class<?> loadClassInLaunchedClassLoader(String name) throws ClassNotFoundException {
String internalName = name.replace('.', '/') + ".class";
InputStream inputStream = getParent().getResourceAsStream(internalName);
if (inputStream == null) {
throw new ClassNotFoundException(name);
}
try {
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int bytesRead = -1;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
inputStream.close();
byte[] bytes = outputStream.toByteArray();
Class<?> definedClass = defineClass(name, bytes, 0, bytes.length);
definePackageIfNecessary(name);
return definedClass;
} finally {
inputStream.close();
}
} catch (IOException ex) {
throw new ClassNotFoundException("Cannot load resource for class [" + name + "]", ex);
}
}
private void definePackageIfNecessary(String className) {
int lastDot = className.lastIndexOf('.');
if (lastDot >= 0) {
String packageName = className.substring(0, lastDot);
if (getPackage(packageName) == null) {
try {
definePackage(className, packageName);
}
catch (IllegalArgumentException ex) {
if (getPackage(packageName) == null)
{
throw new AssertionError("Package " + packageName + " has already been defined but it could not be found");
}
}
}
}
}
private void definePackage(String className, String packageName) {
try {
AccessController.doPrivileged(() -> {
String packageEntryName = packageName.replace('.', '/') + "/";
String classEntryName = className.replace('.', '/') + ".class";
for (URL url : getURLs()) {
try {
URLConnection connection = url.openConnection();
if (connection instanceof JarURLConnection) {
JarFile jarFile = ((JarURLConnection)connection).getJarFile();
if (jarFile.getEntry(classEntryName) != null && jarFile.getEntry(packageEntryName) != null && jarFile.getManifest() != null) {
definePackage(packageName, jarFile.getManifest(), url);
return null;
}
}
} catch (IOException iOException) {}
}
return null;
}AccessController.getContext());
}
catch (PrivilegedActionException privilegedActionException) {}
}
protected Package definePackage(String name, Manifest man, URL url) throws IllegalArgumentException {
if (!this.exploded) {
return super.definePackage(name, man, url);
}
synchronized (this.packageLock) {
return doDefinePackage(DefinePackageCallType.MANIFEST, () -> super.definePackage(name, man, url));
}
}
protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException {
if (!this.exploded) {
return super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase);
}
synchronized (this.packageLock) {
if (this.definePackageCallType == null) {
Manifest manifest = getManifest(this.rootArchive);
if (manifest != null) {
return definePackage(name, manifest, sealBase);
}
}
return doDefinePackage(DefinePackageCallType.ATTRIBUTES, () -> super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase));
}
}
private Manifest getManifest(Archive archive) {
try {
return (archive != null) ? archive.getManifest() : null;
}
catch (IOException ex) {
return null;
}
}
private <T> T doDefinePackage(DefinePackageCallType type, Supplier<T> call) {
DefinePackageCallType existingType = this.definePackageCallType;
try {
this.definePackageCallType = type;
return call.get();
} finally {
this.definePackageCallType = existingType;
}
}
public void clearCache() {
if (this.exploded) {
return;
}
for (URL url : getURLs()) {
try {
URLConnection connection = url.openConnection();
if (connection instanceof JarURLConnection) {
clearCache(connection);
}
}
catch (IOException iOException) {}
}
}
private void clearCache(URLConnection connection) throws IOException {
Object jarFile = ((JarURLConnection)connection).getJarFile();
if (jarFile instanceof JarFile)
((JarFile)jarFile).clearCache();
}
private static class UseFastConnectionExceptionsEnumeration
implements Enumeration<URL>
{
private final Enumeration<URL> delegate;
UseFastConnectionExceptionsEnumeration(Enumeration<URL> delegate) {
this.delegate = delegate;
}
public boolean hasMoreElements() {
Handler.setUseFastConnectionExceptions(true);
try {
return this.delegate.hasMoreElements();
} finally {
Handler.setUseFastConnectionExceptions(false);
}
}
public URL nextElement() {
Handler.setUseFastConnectionExceptions(true);
try {
return this.delegate.nextElement();
} finally {
Handler.setUseFastConnectionExceptions(false);
}
}
}
private enum DefinePackageCallType
{
MANIFEST,
ATTRIBUTES;
}
}
@@ -1,192 +1,188 @@
/* */ package org.springframework.boot.loader;
/* */
/* */ import java.io.File;
/* */ import java.net.URI;
/* */ import java.net.URL;
/* */ import java.security.CodeSource;
/* */ import java.security.ProtectionDomain;
/* */ import java.util.ArrayList;
/* */ import java.util.Iterator;
/* */ import java.util.List;
/* */ 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
/* */ {
/* */ private static final String JAR_MODE_LAUNCHER = "org.springframework.boot.loader.jarmode.JarModeLauncher";
/* */
/* */ protected void launch(String[] args) throws Exception {
/* 52 */ if (!isExploded()) {
/* 53 */ JarFile.registerUrlProtocolHandler();
/* */ }
/* 55 */ ClassLoader classLoader = createClassLoader(getClassPathArchivesIterator());
/* 56 */ String jarMode = System.getProperty("jarmode");
/* 57 */ String launchClass = (jarMode != null && !jarMode.isEmpty()) ? "org.springframework.boot.loader.jarmode.JarModeLauncher" : getMainClass();
/* 58 */ launch(args, launchClass, classLoader);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Deprecated
/* */ protected ClassLoader createClassLoader(List<Archive> archives) throws Exception {
/* 70 */ return createClassLoader(archives.iterator());
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected ClassLoader createClassLoader(Iterator<Archive> archives) throws Exception {
/* 81 */ List<URL> urls = new ArrayList<>(50);
/* 82 */ while (archives.hasNext()) {
/* 83 */ Archive archive = archives.next();
/* 84 */ urls.add(archive.getUrl());
/* 85 */ archive.close();
/* */ }
/* 87 */ return createClassLoader(urls.<URL>toArray(new URL[0]));
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected ClassLoader createClassLoader(URL[] urls) throws Exception {
/* 97 */ return new LaunchedURLClassLoader(isExploded(), getArchive(), urls, getClass().getClassLoader());
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected void launch(String[] args, String launchClass, ClassLoader classLoader) throws Exception {
/* 108 */ Thread.currentThread().setContextClassLoader(classLoader);
/* 109 */ createMainMethodRunner(launchClass, args, classLoader).run();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected MainMethodRunner createMainMethodRunner(String mainClass, String[] args, ClassLoader classLoader) {
/* 120 */ return new MainMethodRunner(mainClass, args);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected abstract String getMainClass() throws Exception;
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected Iterator<Archive> getClassPathArchivesIterator() throws Exception {
/* 137 */ return getClassPathArchives().iterator();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Deprecated
/* */ protected List<Archive> getClassPathArchives() throws Exception {
/* 149 */ throw new IllegalStateException("Unexpected call to getClassPathArchives()");
/* */ }
/* */
/* */ protected final Archive createArchive() throws Exception {
/* 153 */ ProtectionDomain protectionDomain = getClass().getProtectionDomain();
/* 154 */ CodeSource codeSource = protectionDomain.getCodeSource();
/* 155 */ URI location = (codeSource != null) ? codeSource.getLocation().toURI() : null;
/* 156 */ String path = (location != null) ? location.getSchemeSpecificPart() : null;
/* 157 */ if (path == null) {
/* 158 */ throw new IllegalStateException("Unable to determine code source archive");
/* */ }
/* 160 */ File root = new File(path);
/* 161 */ if (!root.exists()) {
/* 162 */ throw new IllegalStateException("Unable to determine code source archive from " + root);
/* */ }
/* 164 */ return root.isDirectory() ? (Archive)new ExplodedArchive(root) : (Archive)new JarFileArchive(root);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected boolean isExploded() {
/* 175 */ return false;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected Archive getArchive() {
/* 184 */ return null;
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\Launcher.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader;
import java.io.File;
import java.net.URI;
import java.net.URL;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
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
{
private static final String JAR_MODE_LAUNCHER = "org.springframework.boot.loader.jarmode.JarModeLauncher";
protected void launch(String[] args) throws Exception {
if (!isExploded()) {
JarFile.registerUrlProtocolHandler();
}
ClassLoader classLoader = createClassLoader(getClassPathArchivesIterator());
String jarMode = System.getProperty("jarmode");
String launchClass = (jarMode != null && !jarMode.isEmpty()) ? "org.springframework.boot.loader.jarmode.JarModeLauncher" : getMainClass();
launch(args, launchClass, classLoader);
}
@Deprecated
protected ClassLoader createClassLoader(List<Archive> archives) throws Exception {
return createClassLoader(archives.iterator());
}
protected ClassLoader createClassLoader(Iterator<Archive> archives) throws Exception {
List<URL> urls = new ArrayList<>(50);
while (archives.hasNext()) {
Archive archive = archives.next();
urls.add(archive.getUrl());
archive.close();
}
return createClassLoader(urls.<URL>toArray(new URL[0]));
}
protected ClassLoader createClassLoader(URL[] urls) throws Exception {
return new LaunchedURLClassLoader(isExploded(), getArchive(), urls, getClass().getClassLoader());
}
protected void launch(String[] args, String launchClass, ClassLoader classLoader) throws Exception {
Thread.currentThread().setContextClassLoader(classLoader);
createMainMethodRunner(launchClass, args, classLoader).run();
}
protected MainMethodRunner createMainMethodRunner(String mainClass, String[] args, ClassLoader classLoader) {
return new MainMethodRunner(mainClass, args);
}
protected abstract String getMainClass() throws Exception;
protected Iterator<Archive> getClassPathArchivesIterator() throws Exception {
return getClassPathArchives().iterator();
}
@Deprecated
protected List<Archive> getClassPathArchives() throws Exception {
throw new IllegalStateException("Unexpected call to getClassPathArchives()");
}
protected final Archive createArchive() throws Exception {
ProtectionDomain protectionDomain = getClass().getProtectionDomain();
CodeSource codeSource = protectionDomain.getCodeSource();
URI location = (codeSource != null) ? codeSource.getLocation().toURI() : null;
String path = (location != null) ? location.getSchemeSpecificPart() : null;
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);
}
protected boolean isExploded() {
return false;
}
protected Archive getArchive() {
return null;
}
}
@@ -1,57 +1,53 @@
/* */ package org.springframework.boot.loader;
/* */
/* */ import java.lang.reflect.Method;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class MainMethodRunner
/* */ {
/* */ private final String mainClassName;
/* */ private final String[] args;
/* */
/* */ public MainMethodRunner(String mainClass, String[] args) {
/* 41 */ this.mainClassName = mainClass;
/* 42 */ this.args = (args != null) ? (String[])args.clone() : null;
/* */ }
/* */
/* */ public void run() throws Exception {
/* 46 */ Class<?> mainClass = Class.forName(this.mainClassName, false, Thread.currentThread().getContextClassLoader());
/* 47 */ Method mainMethod = mainClass.getDeclaredMethod("main", new Class[] { String[].class });
/* 48 */ mainMethod.setAccessible(true);
/* 49 */ mainMethod.invoke((Object)null, new Object[] { this.args });
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\MainMethodRunner.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader;
import java.lang.reflect.Method;
public class MainMethodRunner
{
private final String mainClassName;
private final String[] args;
public MainMethodRunner(String mainClass, String[] args) {
this.mainClassName = mainClass;
this.args = (args != null) ? (String[])args.clone() : null;
}
public void run() throws Exception {
Class<?> mainClass = Class.forName(this.mainClassName, false, Thread.currentThread().getContextClassLoader());
Method mainMethod = mainClass.getDeclaredMethod("main", new Class[] { String[].class });
mainMethod.setAccessible(true);
mainMethod.invoke((Object)null, new Object[] { this.args });
}
}
@@ -1,67 +1,63 @@
/* */ package org.springframework.boot.loader;
/* */
/* */ import org.springframework.boot.loader.archive.Archive;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class WarLauncher
/* */ extends ExecutableArchiveLauncher
/* */ {
/* */ public WarLauncher() {}
/* */
/* */ protected WarLauncher(Archive archive) {
/* 37 */ super(archive);
/* */ }
/* */
/* */
/* */ protected boolean isPostProcessingClassPathArchives() {
/* 42 */ return false;
/* */ }
/* */
/* */
/* */ protected boolean isSearchCandidate(Archive.Entry entry) {
/* 47 */ return entry.getName().startsWith("WEB-INF/");
/* */ }
/* */
/* */
/* */ public boolean isNestedArchive(Archive.Entry entry) {
/* 52 */ if (entry.isDirectory()) {
/* 53 */ return entry.getName().equals("WEB-INF/classes/");
/* */ }
/* 55 */ return (entry.getName().startsWith("WEB-INF/lib/") || entry.getName().startsWith("WEB-INF/lib-provided/"));
/* */ }
/* */
/* */ public static void main(String[] args) throws Exception {
/* 59 */ (new WarLauncher()).launch(args);
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\WarLauncher.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader;
import org.springframework.boot.loader.archive.Archive;
public class WarLauncher
extends ExecutableArchiveLauncher
{
public WarLauncher() {}
protected WarLauncher(Archive archive) {
super(archive);
}
protected boolean isPostProcessingClassPathArchives() {
return false;
}
protected boolean isSearchCandidate(Archive.Entry entry) {
return entry.getName().startsWith("WEB-INF/");
}
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) throws Exception {
(new WarLauncher()).launch(args);
}
}
@@ -1,161 +1,157 @@
/* */ package org.springframework.boot.loader.archive;
/* */
/* */ import java.io.IOException;
/* */ import java.net.MalformedURLException;
/* */ import java.net.URL;
/* */ import java.util.Iterator;
/* */ import java.util.List;
/* */ import java.util.Objects;
/* */ import java.util.Spliterator;
/* */ import java.util.Spliterators;
/* */ import java.util.function.Consumer;
/* */ import java.util.jar.Manifest;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public interface Archive
/* */ extends Iterable<Archive.Entry>, AutoCloseable
/* */ {
/* */ default Iterator<Archive> getNestedArchives(EntryFilter searchFilter, EntryFilter includeFilter) throws IOException {
/* 67 */ EntryFilter combinedFilter = entry -> ((searchFilter == null || searchFilter.matches(entry)) && (includeFilter == null || includeFilter.matches(entry)));
/* */
/* 69 */ List<Archive> nestedArchives = getNestedArchives(combinedFilter);
/* 70 */ return nestedArchives.iterator();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Deprecated
/* */ default List<Archive> getNestedArchives(EntryFilter filter) throws IOException {
/* 83 */ throw new IllegalStateException("Unexpected call to getNestedArchives(filter)");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Deprecated
/* */ default void forEach(Consumer<? super Entry> action) {
/* 108 */ Objects.requireNonNull(action);
/* 109 */ for (Entry entry : this) {
/* 110 */ action.accept(entry);
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Deprecated
/* */ default Spliterator<Entry> spliterator() {
/* 124 */ return Spliterators.spliteratorUnknownSize(iterator(), 0);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ default boolean isExploded() {
/* 133 */ return false;
/* */ }
/* */
/* */ default void close() throws Exception {}
/* */
/* */ URL getUrl() throws MalformedURLException;
/* */
/* */ Manifest getManifest() throws IOException;
/* */
/* */ @Deprecated
/* */ Iterator<Entry> iterator();
/* */
/* */ @FunctionalInterface
/* */ public static interface EntryFilter {
/* */ boolean matches(Archive.Entry param1Entry);
/* */ }
/* */
/* */ public static interface Entry {
/* */ boolean isDirectory();
/* */
/* */ String getName();
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\archive\Archive.class
* Java compiler version: 8 (52.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.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.function.Consumer;
import java.util.jar.Manifest;
public interface Archive
extends Iterable<Archive.Entry>, AutoCloseable
{
default Iterator<Archive> getNestedArchives(EntryFilter searchFilter, EntryFilter includeFilter) throws IOException {
EntryFilter combinedFilter = entry -> ((searchFilter == null || searchFilter.matches(entry)) && (includeFilter == null || includeFilter.matches(entry)));
List<Archive> nestedArchives = getNestedArchives(combinedFilter);
return nestedArchives.iterator();
}
@Deprecated
default List<Archive> getNestedArchives(EntryFilter filter) throws IOException {
throw new IllegalStateException("Unexpected call to getNestedArchives(filter)");
}
@Deprecated
default void forEach(Consumer<? super Entry> action) {
Objects.requireNonNull(action);
for (Entry entry : this) {
action.accept(entry);
}
}
@Deprecated
default Spliterator<Entry> spliterator() {
return Spliterators.spliteratorUnknownSize(iterator(), 0);
}
default boolean isExploded() {
return false;
}
default void close() throws Exception {}
URL getUrl() throws MalformedURLException;
Manifest getManifest() throws IOException;
@Deprecated
Iterator<Entry> iterator();
@FunctionalInterface
public static interface EntryFilter {
boolean matches(Archive.Entry param1Entry);
}
public static interface Entry {
boolean isDirectory();
String getName();
}
}
@@ -1,344 +1,340 @@
/* */ package org.springframework.boot.loader.archive;
/* */
/* */ import java.io.File;
/* */ import java.io.FileInputStream;
/* */ import java.io.IOException;
/* */ import java.net.MalformedURLException;
/* */ import java.net.URI;
/* */ import java.net.URL;
/* */ import java.util.Arrays;
/* */ import java.util.Collections;
/* */ import java.util.Comparator;
/* */ import java.util.Deque;
/* */ import java.util.HashSet;
/* */ import java.util.Iterator;
/* */ import java.util.LinkedList;
/* */ import java.util.NoSuchElementException;
/* */ import java.util.Set;
/* */ import java.util.jar.Manifest;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class ExplodedArchive
/* */ implements Archive
/* */ {
/* 46 */ private static final Set<String> SKIPPED_NAMES = new HashSet<>(Arrays.asList(new String[] { ".", ".." }));
/* */
/* */
/* */ private final File root;
/* */
/* */
/* */ private final boolean recursive;
/* */
/* */
/* */ private File manifestFile;
/* */
/* */ private Manifest manifest;
/* */
/* */
/* */ public ExplodedArchive(File root) {
/* 61 */ this(root, true);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public ExplodedArchive(File root, boolean recursive) {
/* 72 */ if (!root.exists() || !root.isDirectory()) {
/* 73 */ throw new IllegalArgumentException("Invalid source directory " + root);
/* */ }
/* 75 */ this.root = root;
/* 76 */ this.recursive = recursive;
/* 77 */ this.manifestFile = getManifestFile(root);
/* */ }
/* */
/* */ private File getManifestFile(File root) {
/* 81 */ File metaInf = new File(root, "META-INF");
/* 82 */ return new File(metaInf, "MANIFEST.MF");
/* */ }
/* */
/* */
/* */ public URL getUrl() throws MalformedURLException {
/* 87 */ return this.root.toURI().toURL();
/* */ }
/* */
/* */
/* */ public Manifest getManifest() throws IOException {
/* 92 */ if (this.manifest == null && this.manifestFile.exists()) {
/* 93 */ try (FileInputStream inputStream = new FileInputStream(this.manifestFile)) {
/* 94 */ this.manifest = new Manifest(inputStream);
/* */ }
/* */ }
/* 97 */ return this.manifest;
/* */ }
/* */
/* */
/* */ public Iterator<Archive> getNestedArchives(Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) throws IOException {
/* 102 */ return new ArchiveIterator(this.root, this.recursive, searchFilter, includeFilter);
/* */ }
/* */
/* */
/* */ public Iterator<Archive.Entry> iterator() {
/* 107 */ return new EntryIterator(this.root, this.recursive, null, null);
/* */ }
/* */
/* */ protected Archive getNestedArchive(Archive.Entry entry) throws IOException {
/* 111 */ File file = ((FileEntry)entry).getFile();
/* 112 */ return file.isDirectory() ? new ExplodedArchive(file) : new SimpleJarFileArchive((FileEntry)entry);
/* */ }
/* */
/* */
/* */ public boolean isExploded() {
/* 117 */ return true;
/* */ }
/* */
/* */
/* */ public String toString() {
/* */ try {
/* 123 */ return getUrl().toString();
/* */ }
/* 125 */ catch (Exception ex) {
/* 126 */ return "exploded archive";
/* */ }
/* */ }
/* */
/* */
/* */
/* */ private static abstract class AbstractIterator<T>
/* */ implements Iterator<T>
/* */ {
/* 135 */ private static final Comparator<File> entryComparator = Comparator.comparing(File::getAbsolutePath);
/* */
/* */ private final File root;
/* */
/* */ private final boolean recursive;
/* */
/* */ private final Archive.EntryFilter searchFilter;
/* */
/* */ private final Archive.EntryFilter includeFilter;
/* */
/* 145 */ private final Deque<Iterator<File>> stack = new LinkedList<>();
/* */
/* */ private ExplodedArchive.FileEntry current;
/* */
/* */ private String rootUrl;
/* */
/* */ AbstractIterator(File root, boolean recursive, Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) {
/* 152 */ this.root = root;
/* 153 */ this.rootUrl = this.root.toURI().getPath();
/* 154 */ this.recursive = recursive;
/* 155 */ this.searchFilter = searchFilter;
/* 156 */ this.includeFilter = includeFilter;
/* 157 */ this.stack.add(listFiles(root));
/* 158 */ this.current = poll();
/* */ }
/* */
/* */
/* */ public boolean hasNext() {
/* 163 */ return (this.current != null);
/* */ }
/* */
/* */
/* */ public T next() {
/* 168 */ ExplodedArchive.FileEntry entry = this.current;
/* 169 */ if (entry == null) {
/* 170 */ throw new NoSuchElementException();
/* */ }
/* 172 */ this.current = poll();
/* 173 */ return adapt(entry);
/* */ }
/* */
/* */ private ExplodedArchive.FileEntry poll() {
/* 177 */ while (!this.stack.isEmpty()) {
/* 178 */ while (((Iterator)this.stack.peek()).hasNext()) {
/* 179 */ File file = ((Iterator<File>)this.stack.peek()).next();
/* 180 */ if (ExplodedArchive.SKIPPED_NAMES.contains(file.getName())) {
/* */ continue;
/* */ }
/* 183 */ ExplodedArchive.FileEntry entry = getFileEntry(file);
/* 184 */ if (isListable(entry)) {
/* 185 */ this.stack.addFirst(listFiles(file));
/* */ }
/* 187 */ if (this.includeFilter == null || this.includeFilter.matches(entry)) {
/* 188 */ return entry;
/* */ }
/* */ }
/* 191 */ this.stack.poll();
/* */ }
/* 193 */ return null;
/* */ }
/* */
/* */ private ExplodedArchive.FileEntry getFileEntry(File file) {
/* 197 */ URI uri = file.toURI();
/* 198 */ String name = uri.getPath().substring(this.rootUrl.length());
/* */ try {
/* 200 */ return new ExplodedArchive.FileEntry(name, file, uri.toURL());
/* */ }
/* 202 */ catch (MalformedURLException ex) {
/* 203 */ throw new IllegalStateException(ex);
/* */ }
/* */ }
/* */
/* */ private boolean isListable(ExplodedArchive.FileEntry entry) {
/* 208 */ return (entry.isDirectory() && (this.recursive || entry.getFile().getParentFile().equals(this.root)) && (this.searchFilter == null || this.searchFilter
/* 209 */ .matches(entry)) && (this.includeFilter == null ||
/* 210 */ !this.includeFilter.matches(entry)));
/* */ }
/* */
/* */ private Iterator<File> listFiles(File file) {
/* 214 */ File[] files = file.listFiles();
/* 215 */ if (files == null) {
/* 216 */ return Collections.emptyIterator();
/* */ }
/* 218 */ Arrays.sort(files, entryComparator);
/* 219 */ return Arrays.<File>asList(files).iterator();
/* */ }
/* */
/* */
/* */ public void remove() {
/* 224 */ throw new UnsupportedOperationException("remove");
/* */ }
/* */
/* */ protected abstract T adapt(ExplodedArchive.FileEntry param1FileEntry);
/* */ }
/* */
/* */ private static class EntryIterator
/* */ extends AbstractIterator<Archive.Entry>
/* */ {
/* */ EntryIterator(File root, boolean recursive, Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) {
/* 234 */ super(root, recursive, searchFilter, includeFilter);
/* */ }
/* */
/* */
/* */ protected Archive.Entry adapt(ExplodedArchive.FileEntry entry) {
/* 239 */ return entry;
/* */ }
/* */ }
/* */
/* */ private static class ArchiveIterator
/* */ extends AbstractIterator<Archive>
/* */ {
/* */ ArchiveIterator(File root, boolean recursive, Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) {
/* 247 */ super(root, recursive, searchFilter, includeFilter);
/* */ }
/* */
/* */
/* */ protected Archive adapt(ExplodedArchive.FileEntry entry) {
/* 252 */ File file = entry.getFile();
/* 253 */ return file.isDirectory() ? new ExplodedArchive(file) : new ExplodedArchive.SimpleJarFileArchive(entry);
/* */ }
/* */ }
/* */
/* */
/* */
/* */ private static class FileEntry
/* */ implements Archive.Entry
/* */ {
/* */ private final String name;
/* */
/* */ private final File file;
/* */
/* */ private final URL url;
/* */
/* */
/* */ FileEntry(String name, File file, URL url) {
/* 270 */ this.name = name;
/* 271 */ this.file = file;
/* 272 */ this.url = url;
/* */ }
/* */
/* */ File getFile() {
/* 276 */ return this.file;
/* */ }
/* */
/* */
/* */ public boolean isDirectory() {
/* 281 */ return this.file.isDirectory();
/* */ }
/* */
/* */
/* */ public String getName() {
/* 286 */ return this.name;
/* */ }
/* */
/* */ URL getUrl() {
/* 290 */ return this.url;
/* */ }
/* */ }
/* */
/* */
/* */
/* */ private static class SimpleJarFileArchive
/* */ implements Archive
/* */ {
/* */ private final URL url;
/* */
/* */
/* */
/* */ SimpleJarFileArchive(ExplodedArchive.FileEntry file) {
/* 304 */ this.url = file.getUrl();
/* */ }
/* */
/* */
/* */ public URL getUrl() throws MalformedURLException {
/* 309 */ return this.url;
/* */ }
/* */
/* */
/* */ public Manifest getManifest() throws IOException {
/* 314 */ return null;
/* */ }
/* */
/* */
/* */
/* */ public Iterator<Archive> getNestedArchives(Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) throws IOException {
/* 320 */ return Collections.emptyIterator();
/* */ }
/* */
/* */
/* */ public Iterator<Archive.Entry> iterator() {
/* 325 */ return Collections.emptyIterator();
/* */ }
/* */
/* */
/* */ public String toString() {
/* */ try {
/* 331 */ return getUrl().toString();
/* */ }
/* 333 */ catch (Exception ex) {
/* 334 */ return "jar archive";
/* */ }
/* */ }
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\archive\ExplodedArchive.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.archive;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.jar.Manifest;
public class ExplodedArchive
implements Archive
{
private static final Set<String> SKIPPED_NAMES = new HashSet<>(Arrays.asList(new String[] { ".", ".." }));
private final File root;
private final boolean recursive;
private File manifestFile;
private Manifest manifest;
public ExplodedArchive(File root) {
this(root, true);
}
public ExplodedArchive(File root, boolean recursive) {
if (!root.exists() || !root.isDirectory()) {
throw new IllegalArgumentException("Invalid source directory " + root);
}
this.root = root;
this.recursive = recursive;
this.manifestFile = getManifestFile(root);
}
private File getManifestFile(File root) {
File metaInf = new File(root, "META-INF");
return new File(metaInf, "MANIFEST.MF");
}
public URL getUrl() throws MalformedURLException {
return this.root.toURI().toURL();
}
public Manifest getManifest() throws IOException {
if (this.manifest == null && this.manifestFile.exists()) {
try (FileInputStream inputStream = new FileInputStream(this.manifestFile)) {
this.manifest = new Manifest(inputStream);
}
}
return this.manifest;
}
public Iterator<Archive> getNestedArchives(Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) throws IOException {
return new ArchiveIterator(this.root, this.recursive, searchFilter, includeFilter);
}
public Iterator<Archive.Entry> iterator() {
return new EntryIterator(this.root, this.recursive, null, null);
}
protected Archive getNestedArchive(Archive.Entry entry) throws IOException {
File file = ((FileEntry)entry).getFile();
return file.isDirectory() ? new ExplodedArchive(file) : new SimpleJarFileArchive((FileEntry)entry);
}
public boolean isExploded() {
return true;
}
public String toString() {
try {
return getUrl().toString();
}
catch (Exception ex) {
return "exploded archive";
}
}
private static abstract class AbstractIterator<T>
implements Iterator<T>
{
private static final Comparator<File> entryComparator = Comparator.comparing(File::getAbsolutePath);
private final File root;
private final boolean recursive;
private final Archive.EntryFilter searchFilter;
private final Archive.EntryFilter includeFilter;
private final Deque<Iterator<File>> stack = new LinkedList<>();
private ExplodedArchive.FileEntry current;
private String rootUrl;
AbstractIterator(File root, boolean recursive, Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) {
this.root = root;
this.rootUrl = this.root.toURI().getPath();
this.recursive = recursive;
this.searchFilter = searchFilter;
this.includeFilter = includeFilter;
this.stack.add(listFiles(root));
this.current = poll();
}
public boolean hasNext() {
return (this.current != null);
}
public T next() {
ExplodedArchive.FileEntry entry = this.current;
if (entry == null) {
throw new NoSuchElementException();
}
this.current = poll();
return adapt(entry);
}
private ExplodedArchive.FileEntry poll() {
while (!this.stack.isEmpty()) {
while (((Iterator)this.stack.peek()).hasNext()) {
File file = ((Iterator<File>)this.stack.peek()).next();
if (ExplodedArchive.SKIPPED_NAMES.contains(file.getName())) {
continue;
}
ExplodedArchive.FileEntry entry = getFileEntry(file);
if (isListable(entry)) {
this.stack.addFirst(listFiles(file));
}
if (this.includeFilter == null || this.includeFilter.matches(entry)) {
return entry;
}
}
this.stack.poll();
}
return null;
}
private ExplodedArchive.FileEntry getFileEntry(File file) {
URI uri = file.toURI();
String name = uri.getPath().substring(this.rootUrl.length());
try {
return new ExplodedArchive.FileEntry(name, file, uri.toURL());
}
catch (MalformedURLException ex) {
throw new IllegalStateException(ex);
}
}
private boolean isListable(ExplodedArchive.FileEntry entry) {
return (entry.isDirectory() && (this.recursive || entry.getFile().getParentFile().equals(this.root)) && (this.searchFilter == null || this.searchFilter
.matches(entry)) && (this.includeFilter == null ||
!this.includeFilter.matches(entry)));
}
private Iterator<File> listFiles(File file) {
File[] files = file.listFiles();
if (files == null) {
return Collections.emptyIterator();
}
Arrays.sort(files, entryComparator);
return Arrays.<File>asList(files).iterator();
}
public void remove() {
throw new UnsupportedOperationException("remove");
}
protected abstract T adapt(ExplodedArchive.FileEntry param1FileEntry);
}
private static class EntryIterator
extends AbstractIterator<Archive.Entry>
{
EntryIterator(File root, boolean recursive, Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) {
super(root, recursive, searchFilter, includeFilter);
}
protected Archive.Entry adapt(ExplodedArchive.FileEntry entry) {
return entry;
}
}
private static class ArchiveIterator
extends AbstractIterator<Archive>
{
ArchiveIterator(File root, boolean recursive, Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) {
super(root, recursive, searchFilter, includeFilter);
}
protected Archive adapt(ExplodedArchive.FileEntry entry) {
File file = entry.getFile();
return file.isDirectory() ? new ExplodedArchive(file) : new ExplodedArchive.SimpleJarFileArchive(entry);
}
}
private static class FileEntry
implements Archive.Entry
{
private final String name;
private final File file;
private final URL url;
FileEntry(String name, File file, URL url) {
this.name = name;
this.file = file;
this.url = url;
}
File getFile() {
return this.file;
}
public boolean isDirectory() {
return this.file.isDirectory();
}
public String getName() {
return this.name;
}
URL getUrl() {
return this.url;
}
}
private static class SimpleJarFileArchive
implements Archive
{
private final URL url;
SimpleJarFileArchive(ExplodedArchive.FileEntry file) {
this.url = file.getUrl();
}
public URL getUrl() throws MalformedURLException {
return this.url;
}
public Manifest getManifest() throws IOException {
return null;
}
public Iterator<Archive> getNestedArchives(Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) throws IOException {
return Collections.emptyIterator();
}
public Iterator<Archive.Entry> iterator() {
return Collections.emptyIterator();
}
public String toString() {
try {
return getUrl().toString();
}
catch (Exception ex) {
return "jar archive";
}
}
}
}
@@ -1,276 +1,272 @@
/* */ 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.Iterator;
/* */ import java.util.UUID;
/* */ import java.util.jar.JarEntry;
/* */ import java.util.jar.Manifest;
/* */ import org.springframework.boot.loader.jar.JarFile;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class JarFileArchive
/* */ implements Archive
/* */ {
/* */ private static final String UNPACK_MARKER = "UNPACK:";
/* */ private static final int BUFFER_SIZE = 32768;
/* */ private final JarFile jarFile;
/* */ private URL url;
/* */ private File tempUnpackDirectory;
/* */
/* */ public JarFileArchive(File file) throws IOException {
/* 53 */ this(file, file.toURI().toURL());
/* */ }
/* */
/* */ public JarFileArchive(File file, URL url) throws IOException {
/* 57 */ this(new JarFile(file));
/* 58 */ this.url = url;
/* */ }
/* */
/* */ public JarFileArchive(JarFile jarFile) {
/* 62 */ this.jarFile = jarFile;
/* */ }
/* */
/* */
/* */ public URL getUrl() throws MalformedURLException {
/* 67 */ if (this.url != null) {
/* 68 */ return this.url;
/* */ }
/* 70 */ return this.jarFile.getUrl();
/* */ }
/* */
/* */
/* */ public Manifest getManifest() throws IOException {
/* 75 */ return this.jarFile.getManifest();
/* */ }
/* */
/* */
/* */ public Iterator<Archive> getNestedArchives(Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) throws IOException {
/* 80 */ return new NestedArchiveIterator(this.jarFile.iterator(), searchFilter, includeFilter);
/* */ }
/* */
/* */
/* */ public Iterator<Archive.Entry> iterator() {
/* 85 */ return new EntryIterator(this.jarFile.iterator(), null, null);
/* */ }
/* */
/* */
/* */ public void close() throws IOException {
/* 90 */ this.jarFile.close();
/* */ }
/* */
/* */ protected Archive getNestedArchive(Archive.Entry entry) throws IOException {
/* 94 */ JarEntry jarEntry = ((JarFileEntry)entry).getJarEntry();
/* 95 */ if (jarEntry.getComment().startsWith("UNPACK:")) {
/* 96 */ return getUnpackedNestedArchive(jarEntry);
/* */ }
/* */ try {
/* 99 */ JarFile jarFile = this.jarFile.getNestedJarFile(jarEntry);
/* 100 */ return new JarFileArchive(jarFile);
/* */ }
/* 102 */ catch (Exception ex) {
/* 103 */ throw new IllegalStateException("Failed to get nested archive for entry " + entry.getName(), ex);
/* */ }
/* */ }
/* */
/* */ private Archive getUnpackedNestedArchive(JarEntry jarEntry) throws IOException {
/* 108 */ String name = jarEntry.getName();
/* 109 */ if (name.lastIndexOf('/') != -1) {
/* 110 */ name = name.substring(name.lastIndexOf('/') + 1);
/* */ }
/* 112 */ File file = new File(getTempUnpackDirectory(), name);
/* 113 */ if (!file.exists() || file.length() != jarEntry.getSize()) {
/* 114 */ unpack(jarEntry, file);
/* */ }
/* 116 */ return new JarFileArchive(file, file.toURI().toURL());
/* */ }
/* */
/* */ private File getTempUnpackDirectory() {
/* 120 */ if (this.tempUnpackDirectory == null) {
/* 121 */ File tempDirectory = new File(System.getProperty("java.io.tmpdir"));
/* 122 */ this.tempUnpackDirectory = createUnpackDirectory(tempDirectory);
/* */ }
/* 124 */ return this.tempUnpackDirectory;
/* */ }
/* */
/* */ private File createUnpackDirectory(File parent) {
/* 128 */ int attempts = 0;
/* 129 */ while (attempts++ < 1000) {
/* 130 */ String fileName = (new File(this.jarFile.getName())).getName();
/* 131 */ File unpackDirectory = new File(parent, fileName + "-spring-boot-libs-" + UUID.randomUUID());
/* 132 */ if (unpackDirectory.mkdirs()) {
/* 133 */ return unpackDirectory;
/* */ }
/* */ }
/* 136 */ throw new IllegalStateException("Failed to create unpack directory in directory '" + parent + "'");
/* */ }
/* */
/* */ private void unpack(JarEntry entry, File file) throws IOException {
/* 140 */ try(InputStream inputStream = this.jarFile.getInputStream(entry);
/* 141 */ OutputStream outputStream = new FileOutputStream(file)) {
/* 142 */ byte[] buffer = new byte[32768];
/* */ int bytesRead;
/* 144 */ while ((bytesRead = inputStream.read(buffer)) != -1) {
/* 145 */ outputStream.write(buffer, 0, bytesRead);
/* */ }
/* 147 */ outputStream.flush();
/* */ }
/* */ }
/* */
/* */
/* */ public String toString() {
/* */ try {
/* 154 */ return getUrl().toString();
/* */ }
/* 156 */ catch (Exception ex) {
/* 157 */ return "jar archive";
/* */ }
/* */ }
/* */
/* */
/* */ private static abstract class AbstractIterator<T>
/* */ implements Iterator<T>
/* */ {
/* */ private final Iterator<JarEntry> iterator;
/* */
/* */ private final Archive.EntryFilter searchFilter;
/* */
/* */ private final Archive.EntryFilter includeFilter;
/* */
/* */ private Archive.Entry current;
/* */
/* */
/* */ AbstractIterator(Iterator<JarEntry> iterator, Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) {
/* 175 */ this.iterator = iterator;
/* 176 */ this.searchFilter = searchFilter;
/* 177 */ this.includeFilter = includeFilter;
/* 178 */ this.current = poll();
/* */ }
/* */
/* */
/* */ public boolean hasNext() {
/* 183 */ return (this.current != null);
/* */ }
/* */
/* */
/* */ public T next() {
/* 188 */ T result = adapt(this.current);
/* 189 */ this.current = poll();
/* 190 */ return result;
/* */ }
/* */
/* */ private Archive.Entry poll() {
/* 194 */ while (this.iterator.hasNext()) {
/* 195 */ JarFileArchive.JarFileEntry candidate = new JarFileArchive.JarFileEntry(this.iterator.next());
/* 196 */ if ((this.searchFilter == null || this.searchFilter.matches(candidate)) && (this.includeFilter == null || this.includeFilter
/* 197 */ .matches(candidate))) {
/* 198 */ return candidate;
/* */ }
/* */ }
/* 201 */ return null;
/* */ }
/* */
/* */
/* */
/* */ protected abstract T adapt(Archive.Entry param1Entry);
/* */ }
/* */
/* */
/* */ private static class EntryIterator
/* */ extends AbstractIterator<Archive.Entry>
/* */ {
/* */ EntryIterator(Iterator<JarEntry> iterator, Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) {
/* 214 */ super(iterator, searchFilter, includeFilter);
/* */ }
/* */
/* */
/* */ protected Archive.Entry adapt(Archive.Entry entry) {
/* 219 */ return entry;
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */ private class NestedArchiveIterator
/* */ extends AbstractIterator<Archive>
/* */ {
/* */ NestedArchiveIterator(Iterator<JarEntry> iterator, Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) {
/* 230 */ super(iterator, searchFilter, includeFilter);
/* */ }
/* */
/* */
/* */ protected Archive adapt(Archive.Entry entry) {
/* */ try {
/* 236 */ return JarFileArchive.this.getNestedArchive(entry);
/* */ }
/* 238 */ catch (IOException ex) {
/* 239 */ throw new IllegalStateException(ex);
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */ private static class JarFileEntry
/* */ implements Archive.Entry
/* */ {
/* */ private final JarEntry jarEntry;
/* */
/* */
/* */ JarFileEntry(JarEntry jarEntry) {
/* 253 */ this.jarEntry = jarEntry;
/* */ }
/* */
/* */ JarEntry getJarEntry() {
/* 257 */ return this.jarEntry;
/* */ }
/* */
/* */
/* */ public boolean isDirectory() {
/* 262 */ return this.jarEntry.isDirectory();
/* */ }
/* */
/* */
/* */ public String getName() {
/* 267 */ return this.jarEntry.getName();
/* */ }
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\archive\JarFileArchive.class
* Java compiler version: 8 (52.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.Iterator;
import java.util.UUID;
import java.util.jar.JarEntry;
import java.util.jar.Manifest;
import org.springframework.boot.loader.jar.JarFile;
public class JarFileArchive
implements Archive
{
private static final String UNPACK_MARKER = "UNPACK:";
private static final int BUFFER_SIZE = 32768;
private final JarFile jarFile;
private URL url;
private File tempUnpackDirectory;
public JarFileArchive(File file) throws IOException {
this(file, file.toURI().toURL());
}
public JarFileArchive(File file, URL url) throws IOException {
this(new JarFile(file));
this.url = url;
}
public JarFileArchive(JarFile jarFile) {
this.jarFile = jarFile;
}
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 Iterator<Archive> getNestedArchives(Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) throws IOException {
return new NestedArchiveIterator(this.jarFile.iterator(), searchFilter, includeFilter);
}
public Iterator<Archive.Entry> iterator() {
return new EntryIterator(this.jarFile.iterator(), null, null);
}
public void close() throws IOException {
this.jarFile.close();
}
protected Archive getNestedArchive(Archive.Entry entry) throws IOException {
JarEntry jarEntry = ((JarFileEntry)entry).getJarEntry();
if (jarEntry.getComment().startsWith("UNPACK:")) {
return getUnpackedNestedArchive(jarEntry);
}
try {
JarFile jarFile = this.jarFile.getNestedJarFile(jarEntry);
return new JarFileArchive(jarFile);
}
catch (Exception ex) {
throw new IllegalStateException("Failed to get nested archive for entry " + entry.getName(), ex);
}
}
private Archive getUnpackedNestedArchive(JarEntry jarEntry) throws IOException {
String name = jarEntry.getName();
if (name.lastIndexOf('/') != -1) {
name = name.substring(name.lastIndexOf('/') + 1);
}
File file = new File(getTempUnpackDirectory(), name);
if (!file.exists() || file.length() != jarEntry.getSize()) {
unpack(jarEntry, file);
}
return new JarFileArchive(file, file.toURI().toURL());
}
private File getTempUnpackDirectory() {
if (this.tempUnpackDirectory == null) {
File tempDirectory = new File(System.getProperty("java.io.tmpdir"));
this.tempUnpackDirectory = createUnpackDirectory(tempDirectory);
}
return this.tempUnpackDirectory;
}
private File createUnpackDirectory(File parent) {
int attempts = 0;
while (attempts++ < 1000) {
String fileName = (new File(this.jarFile.getName())).getName();
File unpackDirectory = new File(parent, fileName + "-spring-boot-libs-" + UUID.randomUUID());
if (unpackDirectory.mkdirs()) {
return unpackDirectory;
}
}
throw new IllegalStateException("Failed to create unpack directory in directory '" + parent + "'");
}
private void unpack(JarEntry entry, File file) throws IOException {
try(InputStream inputStream = this.jarFile.getInputStream(entry);
OutputStream outputStream = new FileOutputStream(file)) {
byte[] buffer = new byte[32768];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
outputStream.flush();
}
}
public String toString() {
try {
return getUrl().toString();
}
catch (Exception ex) {
return "jar archive";
}
}
private static abstract class AbstractIterator<T>
implements Iterator<T>
{
private final Iterator<JarEntry> iterator;
private final Archive.EntryFilter searchFilter;
private final Archive.EntryFilter includeFilter;
private Archive.Entry current;
AbstractIterator(Iterator<JarEntry> iterator, Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) {
this.iterator = iterator;
this.searchFilter = searchFilter;
this.includeFilter = includeFilter;
this.current = poll();
}
public boolean hasNext() {
return (this.current != null);
}
public T next() {
T result = adapt(this.current);
this.current = poll();
return result;
}
private Archive.Entry poll() {
while (this.iterator.hasNext()) {
JarFileArchive.JarFileEntry candidate = new JarFileArchive.JarFileEntry(this.iterator.next());
if ((this.searchFilter == null || this.searchFilter.matches(candidate)) && (this.includeFilter == null || this.includeFilter
.matches(candidate))) {
return candidate;
}
}
return null;
}
protected abstract T adapt(Archive.Entry param1Entry);
}
private static class EntryIterator
extends AbstractIterator<Archive.Entry>
{
EntryIterator(Iterator<JarEntry> iterator, Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) {
super(iterator, searchFilter, includeFilter);
}
protected Archive.Entry adapt(Archive.Entry entry) {
return entry;
}
}
private class NestedArchiveIterator
extends AbstractIterator<Archive>
{
NestedArchiveIterator(Iterator<JarEntry> iterator, Archive.EntryFilter searchFilter, Archive.EntryFilter includeFilter) {
super(iterator, searchFilter, includeFilter);
}
protected Archive adapt(Archive.Entry entry) {
try {
return JarFileArchive.this.getNestedArchive(entry);
}
catch (IOException ex) {
throw new IllegalStateException(ex);
}
}
}
private static class JarFileEntry
implements Archive.Entry
{
private final JarEntry jarEntry;
JarFileEntry(JarEntry jarEntry) {
this.jarEntry = jarEntry;
}
JarEntry getJarEntry() {
return this.jarEntry;
}
public boolean isDirectory() {
return this.jarEntry.isDirectory();
}
public String getName() {
return this.jarEntry.getName();
}
}
}
@@ -1,22 +1,18 @@
package org.springframework.boot.loader.data;
import java.io.IOException;
import java.io.InputStream;
public interface RandomAccessData {
InputStream getInputStream() throws IOException;
RandomAccessData getSubsection(long paramLong1, long paramLong2);
byte[] read() throws IOException;
byte[] read(long paramLong1, long paramLong2) throws IOException;
long getSize();
}
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\data\RandomAccessData.class
* Java compiler version: 8 (52.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() throws IOException;
RandomAccessData getSubsection(long paramLong1, long paramLong2);
byte[] read() throws IOException;
byte[] read(long paramLong1, long paramLong2) throws IOException;
long getSize();
}
@@ -1,261 +1,257 @@
/* */ package org.springframework.boot.loader.data;
/* */
/* */ import java.io.EOFException;
/* */ import java.io.File;
/* */ import java.io.FileNotFoundException;
/* */ import java.io.IOException;
/* */ import java.io.InputStream;
/* */ import java.io.RandomAccessFile;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class RandomAccessDataFile
/* */ implements RandomAccessData
/* */ {
/* */ private final FileAccess fileAccess;
/* */ private final long offset;
/* */ private final long length;
/* */
/* */ public RandomAccessDataFile(File file) {
/* 47 */ if (file == null) {
/* 48 */ throw new IllegalArgumentException("File must not be null");
/* */ }
/* 50 */ this.fileAccess = new FileAccess(file);
/* 51 */ this.offset = 0L;
/* 52 */ this.length = file.length();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private RandomAccessDataFile(FileAccess fileAccess, long offset, long length) {
/* 62 */ this.fileAccess = fileAccess;
/* 63 */ this.offset = offset;
/* 64 */ this.length = length;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public File getFile() {
/* 72 */ return this.fileAccess.file;
/* */ }
/* */
/* */
/* */ public InputStream getInputStream() throws IOException {
/* 77 */ return new DataInputStream();
/* */ }
/* */
/* */
/* */ public RandomAccessData getSubsection(long offset, long length) {
/* 82 */ if (offset < 0L || length < 0L || offset + length > this.length) {
/* 83 */ throw new IndexOutOfBoundsException();
/* */ }
/* 85 */ return new RandomAccessDataFile(this.fileAccess, this.offset + offset, length);
/* */ }
/* */
/* */
/* */ public byte[] read() throws IOException {
/* 90 */ return read(0L, this.length);
/* */ }
/* */
/* */
/* */ public byte[] read(long offset, long length) throws IOException {
/* 95 */ if (offset > this.length) {
/* 96 */ throw new IndexOutOfBoundsException();
/* */ }
/* 98 */ if (offset + length > this.length) {
/* 99 */ throw new EOFException();
/* */ }
/* 101 */ byte[] bytes = new byte[(int)length];
/* 102 */ read(bytes, offset, 0, bytes.length);
/* 103 */ return bytes;
/* */ }
/* */
/* */ private int readByte(long position) throws IOException {
/* 107 */ if (position >= this.length) {
/* 108 */ return -1;
/* */ }
/* 110 */ return this.fileAccess.readByte(this.offset + position);
/* */ }
/* */
/* */ private int read(byte[] bytes, long position, int offset, int length) throws IOException {
/* 114 */ if (position > this.length) {
/* 115 */ return -1;
/* */ }
/* 117 */ return this.fileAccess.read(bytes, this.offset + position, offset, length);
/* */ }
/* */
/* */
/* */ public long getSize() {
/* 122 */ return this.length;
/* */ }
/* */
/* */ public void close() throws IOException {
/* 126 */ this.fileAccess.close();
/* */ }
/* */
/* */
/* */ private class DataInputStream
/* */ extends InputStream
/* */ {
/* */ private int position;
/* */
/* */ private DataInputStream() {}
/* */
/* */ public int read() throws IOException {
/* 138 */ int read = RandomAccessDataFile.this.readByte(this.position);
/* 139 */ if (read > -1) {
/* 140 */ moveOn(1);
/* */ }
/* 142 */ return read;
/* */ }
/* */
/* */
/* */ public int read(byte[] b) throws IOException {
/* 147 */ return read(b, 0, (b != null) ? b.length : 0);
/* */ }
/* */
/* */
/* */ public int read(byte[] b, int off, int len) throws IOException {
/* 152 */ if (b == null) {
/* 153 */ throw new NullPointerException("Bytes must not be null");
/* */ }
/* 155 */ return doRead(b, off, len);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ int doRead(byte[] b, int off, int len) throws IOException {
/* 168 */ if (len == 0) {
/* 169 */ return 0;
/* */ }
/* 171 */ int cappedLen = cap(len);
/* 172 */ if (cappedLen <= 0) {
/* 173 */ return -1;
/* */ }
/* 175 */ return (int)moveOn(RandomAccessDataFile.this.read(b, this.position, off, cappedLen));
/* */ }
/* */
/* */
/* */ public long skip(long n) throws IOException {
/* 180 */ return (n <= 0L) ? 0L : moveOn(cap(n));
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private int cap(long n) {
/* 190 */ return (int)Math.min(RandomAccessDataFile.this.length - this.position, n);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private long moveOn(int amount) {
/* 199 */ this.position += amount;
/* 200 */ return amount;
/* */ }
/* */ }
/* */
/* */
/* */ private static final class FileAccess
/* */ {
/* 207 */ private final Object monitor = new Object();
/* */
/* */ private final File file;
/* */
/* */ private RandomAccessFile randomAccessFile;
/* */
/* */ private FileAccess(File file) {
/* 214 */ this.file = file;
/* 215 */ openIfNecessary();
/* */ }
/* */
/* */ private int read(byte[] bytes, long position, int offset, int length) throws IOException {
/* 219 */ synchronized (this.monitor) {
/* 220 */ openIfNecessary();
/* 221 */ this.randomAccessFile.seek(position);
/* 222 */ return this.randomAccessFile.read(bytes, offset, length);
/* */ }
/* */ }
/* */
/* */ private void openIfNecessary() {
/* 227 */ if (this.randomAccessFile == null) {
/* */ try {
/* 229 */ this.randomAccessFile = new RandomAccessFile(this.file, "r");
/* */ }
/* 231 */ catch (FileNotFoundException ex) {
/* 232 */ throw new IllegalArgumentException(
/* 233 */ String.format("File %s must exist", new Object[] { this.file.getAbsolutePath() }));
/* */ }
/* */ }
/* */ }
/* */
/* */ private void close() throws IOException {
/* 239 */ synchronized (this.monitor) {
/* 240 */ if (this.randomAccessFile != null) {
/* 241 */ this.randomAccessFile.close();
/* 242 */ this.randomAccessFile = null;
/* */ }
/* */ }
/* */ }
/* */
/* */ private int readByte(long position) throws IOException {
/* 248 */ synchronized (this.monitor) {
/* 249 */ openIfNecessary();
/* 250 */ this.randomAccessFile.seek(position);
/* 251 */ return this.randomAccessFile.read();
/* */ }
/* */ }
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\data\RandomAccessDataFile.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.data;
import java.io.EOFException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
public class RandomAccessDataFile
implements RandomAccessData
{
private final FileAccess fileAccess;
private final long offset;
private final long length;
public RandomAccessDataFile(File file) {
if (file == null) {
throw new IllegalArgumentException("File must not be null");
}
this.fileAccess = new FileAccess(file);
this.offset = 0L;
this.length = file.length();
}
private RandomAccessDataFile(FileAccess fileAccess, long offset, long length) {
this.fileAccess = fileAccess;
this.offset = offset;
this.length = length;
}
public File getFile() {
return this.fileAccess.file;
}
public InputStream getInputStream() throws IOException {
return new DataInputStream();
}
public RandomAccessData getSubsection(long offset, long length) {
if (offset < 0L || length < 0L || offset + length > this.length) {
throw new IndexOutOfBoundsException();
}
return new RandomAccessDataFile(this.fileAccess, this.offset + offset, length);
}
public byte[] read() throws IOException {
return read(0L, this.length);
}
public byte[] read(long offset, long length) throws IOException {
if (offset > this.length) {
throw new IndexOutOfBoundsException();
}
if (offset + length > this.length) {
throw new EOFException();
}
byte[] bytes = new byte[(int)length];
read(bytes, offset, 0, bytes.length);
return bytes;
}
private int readByte(long position) throws IOException {
if (position >= this.length) {
return -1;
}
return this.fileAccess.readByte(this.offset + position);
}
private int read(byte[] bytes, long position, int offset, int length) throws IOException {
if (position > this.length) {
return -1;
}
return this.fileAccess.read(bytes, this.offset + position, offset, length);
}
public long getSize() {
return this.length;
}
public void close() throws IOException {
this.fileAccess.close();
}
private class DataInputStream
extends InputStream
{
private int position;
private DataInputStream() {}
public int read() throws IOException {
int read = RandomAccessDataFile.this.readByte(this.position);
if (read > -1) {
moveOn(1);
}
return read;
}
public int read(byte[] b) throws IOException {
return read(b, 0, (b != null) ? b.length : 0);
}
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);
}
int doRead(byte[] b, int off, int len) throws IOException {
if (len == 0) {
return 0;
}
int cappedLen = cap(len);
if (cappedLen <= 0) {
return -1;
}
return (int)moveOn(RandomAccessDataFile.this.read(b, this.position, off, cappedLen));
}
public long skip(long n) throws IOException {
return (n <= 0L) ? 0L : moveOn(cap(n));
}
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 static final class FileAccess
{
private final Object monitor = new Object();
private final File file;
private RandomAccessFile randomAccessFile;
private FileAccess(File file) {
this.file = file;
openIfNecessary();
}
private int read(byte[] bytes, long position, int offset, int length) throws IOException {
synchronized (this.monitor) {
openIfNecessary();
this.randomAccessFile.seek(position);
return this.randomAccessFile.read(bytes, offset, length);
}
}
private void openIfNecessary() {
if (this.randomAccessFile == null) {
try {
this.randomAccessFile = new RandomAccessFile(this.file, "r");
}
catch (FileNotFoundException ex) {
throw new IllegalArgumentException(
String.format("File %s must exist", new Object[] { this.file.getAbsolutePath() }));
}
}
}
private void close() throws IOException {
synchronized (this.monitor) {
if (this.randomAccessFile != null) {
this.randomAccessFile.close();
this.randomAccessFile = null;
}
}
}
private int readByte(long position) throws IOException {
synchronized (this.monitor) {
openIfNecessary();
this.randomAccessFile.seek(position);
return this.randomAccessFile.read();
}
}
}
}
@@ -1,260 +1,256 @@
/* */ package org.springframework.boot.loader.jar;
/* */
/* */ import java.nio.charset.StandardCharsets;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ final class AsciiBytes
/* */ {
/* */ private static final String EMPTY_STRING = "";
/* 32 */ private static final int[] INITIAL_BYTE_BITMASK = new int[] { 127, 31, 15, 7 };
/* */
/* */
/* */ private static final int SUBSEQUENT_BYTE_BITMASK = 63;
/* */
/* */
/* */ private final byte[] bytes;
/* */
/* */
/* */ private final int offset;
/* */
/* */ private final int length;
/* */
/* */ private String string;
/* */
/* */ private int hash;
/* */
/* */
/* */ AsciiBytes(String string) {
/* 51 */ this(string.getBytes(StandardCharsets.UTF_8));
/* 52 */ this.string = string;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ AsciiBytes(byte[] bytes) {
/* 61 */ this(bytes, 0, bytes.length);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ AsciiBytes(byte[] bytes, int offset, int length) {
/* 72 */ if (offset < 0 || length < 0 || offset + length > bytes.length) {
/* 73 */ throw new IndexOutOfBoundsException();
/* */ }
/* 75 */ this.bytes = bytes;
/* 76 */ this.offset = offset;
/* 77 */ this.length = length;
/* */ }
/* */
/* */ int length() {
/* 81 */ return this.length;
/* */ }
/* */
/* */ boolean startsWith(AsciiBytes prefix) {
/* 85 */ if (this == prefix) {
/* 86 */ return true;
/* */ }
/* 88 */ if (prefix.length > this.length) {
/* 89 */ return false;
/* */ }
/* 91 */ for (int i = 0; i < prefix.length; i++) {
/* 92 */ if (this.bytes[i + this.offset] != prefix.bytes[i + prefix.offset]) {
/* 93 */ return false;
/* */ }
/* */ }
/* 96 */ return true;
/* */ }
/* */
/* */ boolean endsWith(AsciiBytes postfix) {
/* 100 */ if (this == postfix) {
/* 101 */ return true;
/* */ }
/* 103 */ if (postfix.length > this.length) {
/* 104 */ return false;
/* */ }
/* 106 */ for (int i = 0; i < postfix.length; i++) {
/* 107 */ if (this.bytes[this.offset + this.length - 1 - i] != postfix.bytes[postfix.offset + postfix.length - 1 - i])
/* */ {
/* 109 */ return false;
/* */ }
/* */ }
/* 112 */ return true;
/* */ }
/* */
/* */ AsciiBytes substring(int beginIndex) {
/* 116 */ return substring(beginIndex, this.length);
/* */ }
/* */
/* */ AsciiBytes substring(int beginIndex, int endIndex) {
/* 120 */ int length = endIndex - beginIndex;
/* 121 */ if (this.offset + length > this.bytes.length) {
/* 122 */ throw new IndexOutOfBoundsException();
/* */ }
/* 124 */ return new AsciiBytes(this.bytes, this.offset + beginIndex, length);
/* */ }
/* */
/* */ boolean matches(CharSequence name, char suffix) {
/* 128 */ int charIndex = 0;
/* 129 */ int nameLen = name.length();
/* 130 */ int totalLen = nameLen + ((suffix != '\000') ? 1 : 0);
/* 131 */ for (int i = this.offset; i < this.offset + this.length; i++) {
/* 132 */ int b = this.bytes[i];
/* 133 */ int remainingUtfBytes = getNumberOfUtfBytes(b) - 1;
/* 134 */ b &= INITIAL_BYTE_BITMASK[remainingUtfBytes];
/* 135 */ for (int j = 0; j < remainingUtfBytes; j++) {
/* 136 */ b = (b << 6) + (this.bytes[++i] & 0x3F);
/* */ }
/* 138 */ char c = getChar(name, suffix, charIndex++);
/* 139 */ if (b <= 65535) {
/* 140 */ if (c != b) {
/* 141 */ return false;
/* */ }
/* */ } else {
/* */
/* 145 */ if (c != (b >> 10) + 55232) {
/* 146 */ return false;
/* */ }
/* 148 */ c = getChar(name, suffix, charIndex++);
/* 149 */ if (c != (b & 0x3FF) + 56320) {
/* 150 */ return false;
/* */ }
/* */ }
/* */ }
/* 154 */ return (charIndex == totalLen);
/* */ }
/* */
/* */ private char getChar(CharSequence name, char suffix, int index) {
/* 158 */ if (index < name.length()) {
/* 159 */ return name.charAt(index);
/* */ }
/* 161 */ if (index == name.length()) {
/* 162 */ return suffix;
/* */ }
/* 164 */ return Character.MIN_VALUE;
/* */ }
/* */
/* */ private int getNumberOfUtfBytes(int b) {
/* 168 */ if ((b & 0x80) == 0) {
/* 169 */ return 1;
/* */ }
/* 171 */ int numberOfUtfBytes = 0;
/* 172 */ while ((b & 0x80) != 0) {
/* 173 */ b <<= 1;
/* 174 */ numberOfUtfBytes++;
/* */ }
/* 176 */ return numberOfUtfBytes;
/* */ }
/* */
/* */
/* */ public boolean equals(Object obj) {
/* 181 */ if (obj == null) {
/* 182 */ return false;
/* */ }
/* 184 */ if (this == obj) {
/* 185 */ return true;
/* */ }
/* 187 */ if (obj.getClass() == AsciiBytes.class) {
/* 188 */ AsciiBytes other = (AsciiBytes)obj;
/* 189 */ if (this.length == other.length) {
/* 190 */ for (int i = 0; i < this.length; i++) {
/* 191 */ if (this.bytes[this.offset + i] != other.bytes[other.offset + i]) {
/* 192 */ return false;
/* */ }
/* */ }
/* 195 */ return true;
/* */ }
/* */ }
/* 198 */ return false;
/* */ }
/* */
/* */
/* */ public int hashCode() {
/* 203 */ int hash = this.hash;
/* 204 */ if (hash == 0 && this.bytes.length > 0) {
/* 205 */ for (int i = this.offset; i < this.offset + this.length; i++) {
/* 206 */ int b = this.bytes[i];
/* 207 */ int remainingUtfBytes = getNumberOfUtfBytes(b) - 1;
/* 208 */ b &= INITIAL_BYTE_BITMASK[remainingUtfBytes];
/* 209 */ for (int j = 0; j < remainingUtfBytes; j++) {
/* 210 */ b = (b << 6) + (this.bytes[++i] & 0x3F);
/* */ }
/* 212 */ if (b <= 65535) {
/* 213 */ hash = 31 * hash + b;
/* */ } else {
/* */
/* 216 */ hash = 31 * hash + (b >> 10) + 55232;
/* 217 */ hash = 31 * hash + (b & 0x3FF) + 56320;
/* */ }
/* */ }
/* 220 */ this.hash = hash;
/* */ }
/* 222 */ return hash;
/* */ }
/* */
/* */
/* */ public String toString() {
/* 227 */ if (this.string == null) {
/* 228 */ if (this.length == 0) {
/* 229 */ this.string = "";
/* */ } else {
/* */
/* 232 */ this.string = new String(this.bytes, this.offset, this.length, StandardCharsets.UTF_8);
/* */ }
/* */ }
/* 235 */ return this.string;
/* */ }
/* */
/* */ static String toString(byte[] bytes) {
/* 239 */ return new String(bytes, StandardCharsets.UTF_8);
/* */ }
/* */
/* */
/* */ static int hashCode(CharSequence charSequence) {
/* 244 */ if (charSequence instanceof StringSequence)
/* */ {
/* 246 */ return charSequence.hashCode();
/* */ }
/* 248 */ return charSequence.toString().hashCode();
/* */ }
/* */
/* */ static int hashCode(int hash, char suffix) {
/* 252 */ return (suffix != '\000') ? (31 * hash + suffix) : hash;
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\AsciiBytes.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.jar;
import java.nio.charset.StandardCharsets;
final class AsciiBytes
{
private static final String EMPTY_STRING = "";
private static final int[] INITIAL_BYTE_BITMASK = new int[] { 127, 31, 15, 7 };
private static final int SUBSEQUENT_BYTE_BITMASK = 63;
private final byte[] bytes;
private final int offset;
private final int length;
private String string;
private int hash;
AsciiBytes(String string) {
this(string.getBytes(StandardCharsets.UTF_8));
this.string = string;
}
AsciiBytes(byte[] bytes) {
this(bytes, 0, bytes.length);
}
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;
}
int length() {
return this.length;
}
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;
}
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;
}
AsciiBytes substring(int beginIndex) {
return substring(beginIndex, this.length);
}
AsciiBytes substring(int beginIndex, int endIndex) {
int length = endIndex - beginIndex;
if (this.offset + length > this.bytes.length) {
throw new IndexOutOfBoundsException();
}
return new AsciiBytes(this.bytes, this.offset + beginIndex, length);
}
boolean matches(CharSequence name, char suffix) {
int charIndex = 0;
int nameLen = name.length();
int totalLen = nameLen + ((suffix != '\000') ? 1 : 0);
for (int i = this.offset; i < this.offset + this.length; i++) {
int b = this.bytes[i];
int remainingUtfBytes = getNumberOfUtfBytes(b) - 1;
b &= INITIAL_BYTE_BITMASK[remainingUtfBytes];
for (int j = 0; j < remainingUtfBytes; j++) {
b = (b << 6) + (this.bytes[++i] & 0x3F);
}
char c = getChar(name, suffix, charIndex++);
if (b <= 65535) {
if (c != b) {
return false;
}
} else {
if (c != (b >> 10) + 55232) {
return false;
}
c = getChar(name, suffix, charIndex++);
if (c != (b & 0x3FF) + 56320) {
return false;
}
}
}
return (charIndex == totalLen);
}
private char getChar(CharSequence name, char suffix, int index) {
if (index < name.length()) {
return name.charAt(index);
}
if (index == name.length()) {
return suffix;
}
return Character.MIN_VALUE;
}
private int getNumberOfUtfBytes(int b) {
if ((b & 0x80) == 0) {
return 1;
}
int numberOfUtfBytes = 0;
while ((b & 0x80) != 0) {
b <<= 1;
numberOfUtfBytes++;
}
return numberOfUtfBytes;
}
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (obj.getClass() == 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;
}
public int hashCode() {
int hash = this.hash;
if (hash == 0 && this.bytes.length > 0) {
for (int i = this.offset; i < this.offset + this.length; i++) {
int b = this.bytes[i];
int remainingUtfBytes = getNumberOfUtfBytes(b) - 1;
b &= INITIAL_BYTE_BITMASK[remainingUtfBytes];
for (int j = 0; j < remainingUtfBytes; j++) {
b = (b << 6) + (this.bytes[++i] & 0x3F);
}
if (b <= 65535) {
hash = 31 * hash + b;
} else {
hash = 31 * hash + (b >> 10) + 55232;
hash = 31 * hash + (b & 0x3FF) + 56320;
}
}
this.hash = hash;
}
return hash;
}
public String toString() {
if (this.string == null) {
if (this.length == 0) {
this.string = "";
} else {
this.string = new String(this.bytes, this.offset, this.length, StandardCharsets.UTF_8);
}
}
return this.string;
}
static String toString(byte[] bytes) {
return new String(bytes, StandardCharsets.UTF_8);
}
static int hashCode(CharSequence charSequence) {
if (charSequence instanceof StringSequence)
{
return charSequence.hashCode();
}
return charSequence.toString().hashCode();
}
static int hashCode(int hash, char suffix) {
return (suffix != '\000') ? (31 * hash + suffix) : hash;
}
}
@@ -1,42 +1,38 @@
/* */ package org.springframework.boot.loader.jar;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ final class Bytes
/* */ {
/* */ static long littleEndianValue(byte[] bytes, int offset, int length) {
/* 30 */ long value = 0L;
/* 31 */ for (int i = length - 1; i >= 0; i--) {
/* 32 */ value = value << 8L | (bytes[offset + i] & 0xFF);
/* */ }
/* 34 */ return value;
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\Bytes.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.jar;
final class Bytes
{
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;
}
}
@@ -1,253 +1,249 @@
/* */ 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 ZIP64_MAGICCOUNT = 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 final Zip64End zip64End;
/* */ private byte[] block;
/* */ private int offset;
/* */ private int size;
/* */
/* */ CentralDirectoryEndRecord(RandomAccessData data) throws IOException {
/* 63 */ this.block = createBlockFromEndOfData(data, 256);
/* 64 */ this.size = 22;
/* 65 */ this.offset = this.block.length - this.size;
/* 66 */ while (!isValid()) {
/* 67 */ this.size++;
/* 68 */ if (this.size > this.block.length) {
/* 69 */ if (this.size >= 65557 || this.size > data.getSize()) {
/* 70 */ throw new IOException("Unable to find ZIP central directory records after reading " + this.size + " bytes");
/* */ }
/* */
/* 73 */ this.block = createBlockFromEndOfData(data, this.size + 256);
/* */ }
/* 75 */ this.offset = this.block.length - this.size;
/* */ }
/* 77 */ int startOfCentralDirectoryEndRecord = (int)(data.getSize() - this.size);
/* 78 */ this.zip64End = isZip64() ? new Zip64End(data, startOfCentralDirectoryEndRecord) : null;
/* */ }
/* */
/* */ private byte[] createBlockFromEndOfData(RandomAccessData data, int size) throws IOException {
/* 82 */ int length = (int)Math.min(data.getSize(), size);
/* 83 */ return data.read(data.getSize() - length, length);
/* */ }
/* */
/* */ private boolean isValid() {
/* 87 */ if (this.block.length < 22 || Bytes.littleEndianValue(this.block, this.offset + 0, 4) != 101010256L) {
/* 88 */ return false;
/* */ }
/* */
/* 91 */ long commentLength = Bytes.littleEndianValue(this.block, this.offset + 20, 2);
/* 92 */ return (this.size == 22L + commentLength);
/* */ }
/* */
/* */ private boolean isZip64() {
/* 96 */ return ((int)Bytes.littleEndianValue(this.block, this.offset + 10, 2) == 65535);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ long getStartOfArchive(RandomAccessData data) {
/* 107 */ long length = Bytes.littleEndianValue(this.block, this.offset + 12, 4);
/* 108 */ long specifiedOffset = Bytes.littleEndianValue(this.block, this.offset + 16, 4);
/* 109 */ long zip64EndSize = (this.zip64End != null) ? this.zip64End.getSize() : 0L;
/* 110 */ int zip64LocSize = (this.zip64End != null) ? 20 : 0;
/* 111 */ long actualOffset = data.getSize() - this.size - length - zip64EndSize - zip64LocSize;
/* 112 */ return actualOffset - specifiedOffset;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ RandomAccessData getCentralDirectory(RandomAccessData data) {
/* 122 */ if (this.zip64End != null) {
/* 123 */ return this.zip64End.getCentralDirectory(data);
/* */ }
/* 125 */ long offset = Bytes.littleEndianValue(this.block, this.offset + 16, 4);
/* 126 */ long length = Bytes.littleEndianValue(this.block, this.offset + 12, 4);
/* 127 */ return data.getSubsection(offset, length);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ int getNumberOfRecords() {
/* 135 */ if (this.zip64End != null) {
/* 136 */ return this.zip64End.getNumberOfRecords();
/* */ }
/* 138 */ long numberOfRecords = Bytes.littleEndianValue(this.block, this.offset + 10, 2);
/* 139 */ return (int)numberOfRecords;
/* */ }
/* */
/* */ String getComment() {
/* 143 */ int commentLength = (int)Bytes.littleEndianValue(this.block, this.offset + 20, 2);
/* 144 */ AsciiBytes comment = new AsciiBytes(this.block, this.offset + 20 + 2, commentLength);
/* 145 */ return comment.toString();
/* */ }
/* */
/* */
/* */
/* */ private static final class Zip64End
/* */ {
/* */ private static final int ZIP64_ENDTOT = 32;
/* */
/* */
/* */ private static final int ZIP64_ENDSIZ = 40;
/* */
/* */
/* */ private static final int ZIP64_ENDOFF = 48;
/* */
/* */
/* */ private final CentralDirectoryEndRecord.Zip64Locator locator;
/* */
/* */ private final long centralDirectoryOffset;
/* */
/* */ private final long centralDirectoryLength;
/* */
/* */ private int numberOfRecords;
/* */
/* */
/* */ private Zip64End(RandomAccessData data, int centralDirectoryEndOffset) throws IOException {
/* 171 */ this(data, new CentralDirectoryEndRecord.Zip64Locator(data, centralDirectoryEndOffset, null));
/* */ }
/* */
/* */ private Zip64End(RandomAccessData data, CentralDirectoryEndRecord.Zip64Locator locator) throws IOException {
/* 175 */ this.locator = locator;
/* 176 */ byte[] block = data.read(locator.getZip64EndOffset(), 56L);
/* 177 */ this.centralDirectoryOffset = Bytes.littleEndianValue(block, 48, 8);
/* 178 */ this.centralDirectoryLength = Bytes.littleEndianValue(block, 40, 8);
/* 179 */ this.numberOfRecords = (int)Bytes.littleEndianValue(block, 32, 8);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private long getSize() {
/* 187 */ return this.locator.getZip64EndSize();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private RandomAccessData getCentralDirectory(RandomAccessData data) {
/* 197 */ return data.getSubsection(this.centralDirectoryOffset, this.centralDirectoryLength);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private int getNumberOfRecords() {
/* 205 */ return this.numberOfRecords;
/* */ }
/* */ }
/* */
/* */
/* */
/* */ private static final class Zip64Locator
/* */ {
/* */ static final int ZIP64_LOCSIZE = 20;
/* */
/* */
/* */ static final int ZIP64_LOCOFF = 8;
/* */
/* */
/* */ private final long zip64EndOffset;
/* */
/* */
/* */ private final int offset;
/* */
/* */
/* */ private Zip64Locator(RandomAccessData data, int centralDirectoryEndOffset) throws IOException {
/* 226 */ this.offset = centralDirectoryEndOffset - 20;
/* 227 */ byte[] block = data.read(this.offset, 20L);
/* 228 */ this.zip64EndOffset = Bytes.littleEndianValue(block, 8, 8);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private long getZip64EndSize() {
/* 236 */ return this.offset - this.zip64EndOffset;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private long getZip64EndOffset() {
/* 244 */ return this.zip64EndOffset;
/* */ }
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\CentralDirectoryEndRecord.class
* Java compiler version: 8 (52.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 ZIP64_MAGICCOUNT = 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 final Zip64End zip64End;
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;
}
int startOfCentralDirectoryEndRecord = (int)(data.getSize() - this.size);
this.zip64End = isZip64() ? new Zip64End(data, startOfCentralDirectoryEndRecord) : null;
}
private byte[] createBlockFromEndOfData(RandomAccessData data, int size) throws IOException {
int length = (int)Math.min(data.getSize(), size);
return data.read(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);
}
private boolean isZip64() {
return ((int)Bytes.littleEndianValue(this.block, this.offset + 10, 2) == 65535);
}
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 zip64EndSize = (this.zip64End != null) ? this.zip64End.getSize() : 0L;
int zip64LocSize = (this.zip64End != null) ? 20 : 0;
long actualOffset = data.getSize() - this.size - length - zip64EndSize - zip64LocSize;
return actualOffset - specifiedOffset;
}
RandomAccessData getCentralDirectory(RandomAccessData data) {
if (this.zip64End != null) {
return this.zip64End.getCentralDirectory(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);
}
int getNumberOfRecords() {
if (this.zip64End != null) {
return this.zip64End.getNumberOfRecords();
}
long numberOfRecords = Bytes.littleEndianValue(this.block, this.offset + 10, 2);
return (int)numberOfRecords;
}
String getComment() {
int commentLength = (int)Bytes.littleEndianValue(this.block, this.offset + 20, 2);
AsciiBytes comment = new AsciiBytes(this.block, this.offset + 20 + 2, commentLength);
return comment.toString();
}
private static final class Zip64End
{
private static final int ZIP64_ENDTOT = 32;
private static final int ZIP64_ENDSIZ = 40;
private static final int ZIP64_ENDOFF = 48;
private final CentralDirectoryEndRecord.Zip64Locator locator;
private final long centralDirectoryOffset;
private final long centralDirectoryLength;
private int numberOfRecords;
private Zip64End(RandomAccessData data, int centralDirectoryEndOffset) throws IOException {
this(data, new CentralDirectoryEndRecord.Zip64Locator(data, centralDirectoryEndOffset, null));
}
private Zip64End(RandomAccessData data, CentralDirectoryEndRecord.Zip64Locator locator) throws IOException {
this.locator = locator;
byte[] block = data.read(locator.getZip64EndOffset(), 56L);
this.centralDirectoryOffset = Bytes.littleEndianValue(block, 48, 8);
this.centralDirectoryLength = Bytes.littleEndianValue(block, 40, 8);
this.numberOfRecords = (int)Bytes.littleEndianValue(block, 32, 8);
}
private long getSize() {
return this.locator.getZip64EndSize();
}
private RandomAccessData getCentralDirectory(RandomAccessData data) {
return data.getSubsection(this.centralDirectoryOffset, this.centralDirectoryLength);
}
private int getNumberOfRecords() {
return this.numberOfRecords;
}
}
private static final class Zip64Locator
{
static final int ZIP64_LOCSIZE = 20;
static final int ZIP64_LOCOFF = 8;
private final long zip64EndOffset;
private final int offset;
private Zip64Locator(RandomAccessData data, int centralDirectoryEndOffset) throws IOException {
this.offset = centralDirectoryEndOffset - 20;
byte[] block = data.read(this.offset, 20L);
this.zip64EndOffset = Bytes.littleEndianValue(block, 8, 8);
}
private long getZip64EndSize() {
return this.offset - this.zip64EndOffset;
}
private long getZip64EndOffset() {
return this.zip64EndOffset;
}
}
}
@@ -1,197 +1,193 @@
/* */ package org.springframework.boot.loader.jar;
/* */
/* */ import java.io.IOException;
/* */ import java.time.ZoneId;
/* */ import java.time.ZonedDateTime;
/* */ import java.time.temporal.ChronoField;
/* */ import java.time.temporal.ChronoUnit;
/* */ import java.time.temporal.ValueRange;
/* */ import org.springframework.boot.loader.data.RandomAccessData;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ final class CentralDirectoryFileHeader
/* */ implements FileHeader
/* */ {
/* 39 */ private static final AsciiBytes SLASH = new AsciiBytes("/");
/* */
/* 41 */ private static final byte[] NO_EXTRA = new byte[0];
/* */
/* 43 */ private static final AsciiBytes NO_COMMENT = new AsciiBytes("");
/* */
/* */ private byte[] header;
/* */
/* */ private int headerOffset;
/* */
/* */ private AsciiBytes name;
/* */
/* */ private byte[] extra;
/* */
/* */ private AsciiBytes comment;
/* */
/* */ private long localHeaderOffset;
/* */
/* */
/* */ CentralDirectoryFileHeader() {}
/* */
/* */
/* */ CentralDirectoryFileHeader(byte[] header, int headerOffset, AsciiBytes name, byte[] extra, AsciiBytes comment, long localHeaderOffset) {
/* 62 */ this.header = header;
/* 63 */ this.headerOffset = headerOffset;
/* 64 */ this.name = name;
/* 65 */ this.extra = extra;
/* 66 */ this.comment = comment;
/* 67 */ this.localHeaderOffset = localHeaderOffset;
/* */ }
/* */
/* */
/* */
/* */ void load(byte[] data, int dataOffset, RandomAccessData variableData, int variableOffset, JarEntryFilter filter) throws IOException {
/* 73 */ this.header = data;
/* 74 */ this.headerOffset = dataOffset;
/* 75 */ long nameLength = Bytes.littleEndianValue(data, dataOffset + 28, 2);
/* 76 */ long extraLength = Bytes.littleEndianValue(data, dataOffset + 30, 2);
/* 77 */ long commentLength = Bytes.littleEndianValue(data, dataOffset + 32, 2);
/* 78 */ this.localHeaderOffset = Bytes.littleEndianValue(data, dataOffset + 42, 4);
/* */
/* 80 */ dataOffset += 46;
/* 81 */ if (variableData != null) {
/* 82 */ data = variableData.read((variableOffset + 46), nameLength + extraLength + commentLength);
/* 83 */ dataOffset = 0;
/* */ }
/* 85 */ this.name = new AsciiBytes(data, dataOffset, (int)nameLength);
/* 86 */ if (filter != null) {
/* 87 */ this.name = filter.apply(this.name);
/* */ }
/* 89 */ this.extra = NO_EXTRA;
/* 90 */ this.comment = NO_COMMENT;
/* 91 */ if (extraLength > 0L) {
/* 92 */ this.extra = new byte[(int)extraLength];
/* 93 */ System.arraycopy(data, (int)(dataOffset + nameLength), this.extra, 0, this.extra.length);
/* */ }
/* 95 */ if (commentLength > 0L) {
/* 96 */ this.comment = new AsciiBytes(data, (int)(dataOffset + nameLength + extraLength), (int)commentLength);
/* */ }
/* */ }
/* */
/* */ AsciiBytes getName() {
/* 101 */ return this.name;
/* */ }
/* */
/* */
/* */ public boolean hasName(CharSequence name, char suffix) {
/* 106 */ return this.name.matches(name, suffix);
/* */ }
/* */
/* */ boolean isDirectory() {
/* 110 */ return this.name.endsWith(SLASH);
/* */ }
/* */
/* */
/* */ public int getMethod() {
/* 115 */ return (int)Bytes.littleEndianValue(this.header, this.headerOffset + 10, 2);
/* */ }
/* */
/* */ long getTime() {
/* 119 */ long datetime = Bytes.littleEndianValue(this.header, this.headerOffset + 12, 4);
/* 120 */ return decodeMsDosFormatDateTime(datetime);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private long decodeMsDosFormatDateTime(long datetime) {
/* 131 */ int year = getChronoValue((datetime >> 25L & 0x7FL) + 1980L, ChronoField.YEAR);
/* 132 */ int month = getChronoValue(datetime >> 21L & 0xFL, ChronoField.MONTH_OF_YEAR);
/* 133 */ int day = getChronoValue(datetime >> 16L & 0x1FL, ChronoField.DAY_OF_MONTH);
/* 134 */ int hour = getChronoValue(datetime >> 11L & 0x1FL, ChronoField.HOUR_OF_DAY);
/* 135 */ int minute = getChronoValue(datetime >> 5L & 0x3FL, ChronoField.MINUTE_OF_HOUR);
/* 136 */ int second = getChronoValue(datetime << 1L & 0x3EL, ChronoField.SECOND_OF_MINUTE);
/* 137 */ return ZonedDateTime.of(year, month, day, hour, minute, second, 0, ZoneId.systemDefault()).toInstant()
/* 138 */ .truncatedTo(ChronoUnit.SECONDS).toEpochMilli();
/* */ }
/* */
/* */ long getCrc() {
/* 142 */ return Bytes.littleEndianValue(this.header, this.headerOffset + 16, 4);
/* */ }
/* */
/* */
/* */ public long getCompressedSize() {
/* 147 */ return Bytes.littleEndianValue(this.header, this.headerOffset + 20, 4);
/* */ }
/* */
/* */
/* */ public long getSize() {
/* 152 */ return Bytes.littleEndianValue(this.header, this.headerOffset + 24, 4);
/* */ }
/* */
/* */ byte[] getExtra() {
/* 156 */ return this.extra;
/* */ }
/* */
/* */ boolean hasExtra() {
/* 160 */ return (this.extra.length > 0);
/* */ }
/* */
/* */ AsciiBytes getComment() {
/* 164 */ return this.comment;
/* */ }
/* */
/* */
/* */ public long getLocalHeaderOffset() {
/* 169 */ return this.localHeaderOffset;
/* */ }
/* */
/* */
/* */ public CentralDirectoryFileHeader clone() {
/* 174 */ byte[] header = new byte[46];
/* 175 */ System.arraycopy(this.header, this.headerOffset, header, 0, header.length);
/* 176 */ return new CentralDirectoryFileHeader(header, 0, this.name, header, this.comment, this.localHeaderOffset);
/* */ }
/* */
/* */
/* */ static CentralDirectoryFileHeader fromRandomAccessData(RandomAccessData data, int offset, JarEntryFilter filter) throws IOException {
/* 181 */ CentralDirectoryFileHeader fileHeader = new CentralDirectoryFileHeader();
/* 182 */ byte[] bytes = data.read(offset, 46L);
/* 183 */ fileHeader.load(bytes, 0, data, offset, filter);
/* 184 */ return fileHeader;
/* */ }
/* */
/* */ private static int getChronoValue(long value, ChronoField field) {
/* 188 */ ValueRange range = field.range();
/* 189 */ return Math.toIntExact(Math.min(Math.max(value, range.getMinimum()), range.getMaximum()));
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\CentralDirectoryFileHeader.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.jar;
import java.io.IOException;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit;
import java.time.temporal.ValueRange;
import org.springframework.boot.loader.data.RandomAccessData;
final class CentralDirectoryFileHeader
implements FileHeader
{
private static final AsciiBytes SLASH = new AsciiBytes("/");
private static final byte[] NO_EXTRA = new byte[0];
private static final AsciiBytes NO_COMMENT = new AsciiBytes("");
private byte[] header;
private int headerOffset;
private AsciiBytes name;
private byte[] extra;
private AsciiBytes comment;
private long localHeaderOffset;
CentralDirectoryFileHeader() {}
CentralDirectoryFileHeader(byte[] header, int headerOffset, AsciiBytes name, byte[] extra, AsciiBytes comment, long localHeaderOffset) {
this.header = header;
this.headerOffset = headerOffset;
this.name = name;
this.extra = extra;
this.comment = comment;
this.localHeaderOffset = localHeaderOffset;
}
void load(byte[] data, int dataOffset, RandomAccessData variableData, int variableOffset, JarEntryFilter filter) throws IOException {
this.header = data;
this.headerOffset = dataOffset;
long nameLength = Bytes.littleEndianValue(data, dataOffset + 28, 2);
long extraLength = Bytes.littleEndianValue(data, dataOffset + 30, 2);
long commentLength = Bytes.littleEndianValue(data, dataOffset + 32, 2);
this.localHeaderOffset = Bytes.littleEndianValue(data, dataOffset + 42, 4);
dataOffset += 46;
if (variableData != null) {
data = variableData.read((variableOffset + 46), nameLength + extraLength + commentLength);
dataOffset = 0;
}
this.name = new AsciiBytes(data, dataOffset, (int)nameLength);
if (filter != null) {
this.name = filter.apply(this.name);
}
this.extra = NO_EXTRA;
this.comment = NO_COMMENT;
if (extraLength > 0L) {
this.extra = new byte[(int)extraLength];
System.arraycopy(data, (int)(dataOffset + nameLength), this.extra, 0, this.extra.length);
}
if (commentLength > 0L) {
this.comment = new AsciiBytes(data, (int)(dataOffset + nameLength + extraLength), (int)commentLength);
}
}
AsciiBytes getName() {
return this.name;
}
public boolean hasName(CharSequence name, char suffix) {
return this.name.matches(name, suffix);
}
boolean isDirectory() {
return this.name.endsWith(SLASH);
}
public int getMethod() {
return (int)Bytes.littleEndianValue(this.header, this.headerOffset + 10, 2);
}
long getTime() {
long datetime = Bytes.littleEndianValue(this.header, this.headerOffset + 12, 4);
return decodeMsDosFormatDateTime(datetime);
}
private long decodeMsDosFormatDateTime(long datetime) {
int year = getChronoValue((datetime >> 25L & 0x7FL) + 1980L, ChronoField.YEAR);
int month = getChronoValue(datetime >> 21L & 0xFL, ChronoField.MONTH_OF_YEAR);
int day = getChronoValue(datetime >> 16L & 0x1FL, ChronoField.DAY_OF_MONTH);
int hour = getChronoValue(datetime >> 11L & 0x1FL, ChronoField.HOUR_OF_DAY);
int minute = getChronoValue(datetime >> 5L & 0x3FL, ChronoField.MINUTE_OF_HOUR);
int second = getChronoValue(datetime << 1L & 0x3EL, ChronoField.SECOND_OF_MINUTE);
return ZonedDateTime.of(year, month, day, hour, minute, second, 0, ZoneId.systemDefault()).toInstant()
.truncatedTo(ChronoUnit.SECONDS).toEpochMilli();
}
long getCrc() {
return Bytes.littleEndianValue(this.header, this.headerOffset + 16, 4);
}
public long getCompressedSize() {
return Bytes.littleEndianValue(this.header, this.headerOffset + 20, 4);
}
public long getSize() {
return Bytes.littleEndianValue(this.header, this.headerOffset + 24, 4);
}
byte[] getExtra() {
return this.extra;
}
boolean hasExtra() {
return (this.extra.length > 0);
}
AsciiBytes getComment() {
return this.comment;
}
public long getLocalHeaderOffset() {
return this.localHeaderOffset;
}
public CentralDirectoryFileHeader clone() {
byte[] header = new byte[46];
System.arraycopy(this.header, this.headerOffset, header, 0, header.length);
return new CentralDirectoryFileHeader(header, 0, this.name, header, this.comment, this.localHeaderOffset);
}
static CentralDirectoryFileHeader fromRandomAccessData(RandomAccessData data, int offset, JarEntryFilter filter) throws IOException {
CentralDirectoryFileHeader fileHeader = new CentralDirectoryFileHeader();
byte[] bytes = data.read(offset, 46L);
fileHeader.load(bytes, 0, data, offset, filter);
return fileHeader;
}
private static int getChronoValue(long value, ChronoField field) {
ValueRange range = field.range();
return Math.toIntExact(Math.min(Math.max(value, range.getMinimum()), range.getMaximum()));
}
}
@@ -1,105 +1,101 @@
/* */ package org.springframework.boot.loader.jar;
/* */
/* */ import java.io.IOException;
/* */ import java.util.ArrayList;
/* */ import java.util.List;
/* */ import org.springframework.boot.loader.data.RandomAccessData;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ class CentralDirectoryParser
/* */ {
/* */ private static final int CENTRAL_DIRECTORY_HEADER_BASE_SIZE = 46;
/* 36 */ private final List<CentralDirectoryVisitor> visitors = new ArrayList<>();
/* */
/* */ <T extends CentralDirectoryVisitor> T addVisitor(T visitor) {
/* 39 */ this.visitors.add((CentralDirectoryVisitor)visitor);
/* 40 */ return visitor;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ RandomAccessData parse(RandomAccessData data, boolean skipPrefixBytes) throws IOException {
/* 51 */ CentralDirectoryEndRecord endRecord = new CentralDirectoryEndRecord(data);
/* 52 */ if (skipPrefixBytes) {
/* 53 */ data = getArchiveData(endRecord, data);
/* */ }
/* 55 */ RandomAccessData centralDirectoryData = endRecord.getCentralDirectory(data);
/* 56 */ visitStart(endRecord, centralDirectoryData);
/* 57 */ parseEntries(endRecord, centralDirectoryData);
/* 58 */ visitEnd();
/* 59 */ return data;
/* */ }
/* */
/* */
/* */ private void parseEntries(CentralDirectoryEndRecord endRecord, RandomAccessData centralDirectoryData) throws IOException {
/* 64 */ byte[] bytes = centralDirectoryData.read(0L, centralDirectoryData.getSize());
/* 65 */ CentralDirectoryFileHeader fileHeader = new CentralDirectoryFileHeader();
/* 66 */ int dataOffset = 0;
/* 67 */ for (int i = 0; i < endRecord.getNumberOfRecords(); i++) {
/* 68 */ fileHeader.load(bytes, dataOffset, null, 0, null);
/* 69 */ visitFileHeader(dataOffset, fileHeader);
/* 70 */ dataOffset += 46 + fileHeader.getName().length() + fileHeader
/* 71 */ .getComment().length() + (fileHeader.getExtra()).length;
/* */ }
/* */ }
/* */
/* */ private RandomAccessData getArchiveData(CentralDirectoryEndRecord endRecord, RandomAccessData data) {
/* 76 */ long offset = endRecord.getStartOfArchive(data);
/* 77 */ if (offset == 0L) {
/* 78 */ return data;
/* */ }
/* 80 */ return data.getSubsection(offset, data.getSize() - offset);
/* */ }
/* */
/* */ private void visitStart(CentralDirectoryEndRecord endRecord, RandomAccessData centralDirectoryData) {
/* 84 */ for (CentralDirectoryVisitor visitor : this.visitors) {
/* 85 */ visitor.visitStart(endRecord, centralDirectoryData);
/* */ }
/* */ }
/* */
/* */ private void visitFileHeader(int dataOffset, CentralDirectoryFileHeader fileHeader) {
/* 90 */ for (CentralDirectoryVisitor visitor : this.visitors) {
/* 91 */ visitor.visitFileHeader(fileHeader, dataOffset);
/* */ }
/* */ }
/* */
/* */ private void visitEnd() {
/* 96 */ for (CentralDirectoryVisitor visitor : this.visitors)
/* 97 */ visitor.visitEnd();
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\CentralDirectoryParser.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.jar;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.springframework.boot.loader.data.RandomAccessData;
class CentralDirectoryParser
{
private static final int CENTRAL_DIRECTORY_HEADER_BASE_SIZE = 46;
private final List<CentralDirectoryVisitor> visitors = new ArrayList<>();
<T extends CentralDirectoryVisitor> T addVisitor(T visitor) {
this.visitors.add((CentralDirectoryVisitor)visitor);
return visitor;
}
RandomAccessData parse(RandomAccessData data, boolean skipPrefixBytes) throws IOException {
CentralDirectoryEndRecord endRecord = new CentralDirectoryEndRecord(data);
if (skipPrefixBytes) {
data = getArchiveData(endRecord, data);
}
RandomAccessData centralDirectoryData = endRecord.getCentralDirectory(data);
visitStart(endRecord, centralDirectoryData);
parseEntries(endRecord, centralDirectoryData);
visitEnd();
return data;
}
private void parseEntries(CentralDirectoryEndRecord endRecord, RandomAccessData centralDirectoryData) throws IOException {
byte[] bytes = centralDirectoryData.read(0L, centralDirectoryData.getSize());
CentralDirectoryFileHeader fileHeader = new CentralDirectoryFileHeader();
int dataOffset = 0;
for (int i = 0; i < endRecord.getNumberOfRecords(); i++) {
fileHeader.load(bytes, dataOffset, null, 0, null);
visitFileHeader(dataOffset, fileHeader);
dataOffset += 46 + fileHeader.getName().length() + fileHeader
.getComment().length() + (fileHeader.getExtra()).length;
}
}
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 void visitStart(CentralDirectoryEndRecord endRecord, RandomAccessData centralDirectoryData) {
for (CentralDirectoryVisitor visitor : this.visitors) {
visitor.visitStart(endRecord, centralDirectoryData);
}
}
private void visitFileHeader(int dataOffset, CentralDirectoryFileHeader fileHeader) {
for (CentralDirectoryVisitor visitor : this.visitors) {
visitor.visitFileHeader(fileHeader, dataOffset);
}
}
private void visitEnd() {
for (CentralDirectoryVisitor visitor : this.visitors)
visitor.visitEnd();
}
}
@@ -1,17 +1,13 @@
package org.springframework.boot.loader.jar;
import org.springframework.boot.loader.data.RandomAccessData;
interface CentralDirectoryVisitor {
void visitStart(CentralDirectoryEndRecord paramCentralDirectoryEndRecord, RandomAccessData paramRandomAccessData);
void visitFileHeader(CentralDirectoryFileHeader paramCentralDirectoryFileHeader, int paramInt);
void visitEnd();
}
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\CentralDirectoryVisitor.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.jar;
import org.springframework.boot.loader.data.RandomAccessData;
interface CentralDirectoryVisitor {
void visitStart(CentralDirectoryEndRecord paramCentralDirectoryEndRecord, RandomAccessData paramRandomAccessData);
void visitFileHeader(CentralDirectoryFileHeader paramCentralDirectoryFileHeader, int paramInt);
void visitEnd();
}
@@ -1,19 +1,15 @@
package org.springframework.boot.loader.jar;
interface FileHeader {
boolean hasName(CharSequence paramCharSequence, char paramChar);
long getLocalHeaderOffset();
long getCompressedSize();
long getSize();
int getMethod();
}
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\FileHeader.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.jar;
interface FileHeader {
boolean hasName(CharSequence paramCharSequence, char paramChar);
long getLocalHeaderOffset();
long getCompressedSize();
long getSize();
int getMethod();
}
@@ -1,351 +1,347 @@
/* */ package org.springframework.boot.loader.jar;
/* */
/* */ import java.io.File;
/* */ import java.io.IOException;
/* */ import java.lang.ref.SoftReference;
/* */ import java.net.MalformedURLException;
/* */ import java.net.URI;
/* */ import java.net.URL;
/* */ import java.net.URLConnection;
/* */ import java.net.URLStreamHandler;
/* */ import java.util.Map;
/* */ import java.util.concurrent.ConcurrentHashMap;
/* */ import java.util.logging.Level;
/* */ import java.util.logging.Logger;
/* */ import java.util.regex.Pattern;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class Handler
/* */ extends URLStreamHandler
/* */ {
/* */ private static final String JAR_PROTOCOL = "jar:";
/* */ private static final String FILE_PROTOCOL = "file:";
/* */ private static final String SEPARATOR = "!/";
/* 52 */ private static final Pattern SEPARATOR_PATTERN = Pattern.compile("!/", 16);
/* */
/* */ private static final String CURRENT_DIR = "/./";
/* */
/* 56 */ private static final Pattern CURRENT_DIR_PATTERN = Pattern.compile("/./", 16);
/* */
/* */ private static final String PARENT_DIR = "/../";
/* */
/* 60 */ private static final String[] FALLBACK_HANDLERS = new String[] { "sun.net.www.protocol.jar.Handler" };
/* */
/* */
/* */
/* */
/* 65 */ private static SoftReference<Map<File, JarFile>> rootFileCache = new SoftReference<>(null);
/* */
/* */ private final JarFile jarFile;
/* */
/* */ private URLStreamHandler fallbackHandler;
/* */
/* */
/* */ public Handler() {
/* 73 */ this(null);
/* */ }
/* */
/* */ public Handler(JarFile jarFile) {
/* 77 */ this.jarFile = jarFile;
/* */ }
/* */
/* */
/* */ protected URLConnection openConnection(URL url) throws IOException {
/* 82 */ if (this.jarFile != null && isUrlInJarFile(url, this.jarFile)) {
/* 83 */ return JarURLConnection.get(url, this.jarFile);
/* */ }
/* */ try {
/* 86 */ return JarURLConnection.get(url, getRootJarFileFromUrl(url));
/* */ }
/* 88 */ catch (Exception ex) {
/* 89 */ return openFallbackConnection(url, ex);
/* */ }
/* */ }
/* */
/* */
/* */ private boolean isUrlInJarFile(URL url, JarFile jarFile) throws MalformedURLException {
/* 95 */ return (url.getPath().startsWith(jarFile.getUrl().getPath()) && url
/* 96 */ .toString().startsWith(jarFile.getUrlString()));
/* */ }
/* */
/* */ 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 */ log(false, "Unable to open fallback handler", ex);
/* 106 */ throw (IOException)reason;
/* */ }
/* 108 */ log(true, "Unable to open fallback handler", ex);
/* 109 */ if (reason instanceof RuntimeException) {
/* 110 */ throw (RuntimeException)reason;
/* */ }
/* 112 */ throw new IllegalStateException(reason);
/* */ }
/* */ }
/* */
/* */ private void log(boolean warning, String message, Exception cause) {
/* */ try {
/* 118 */ Level level = warning ? Level.WARNING : Level.FINEST;
/* 119 */ Logger.getLogger(getClass().getName()).log(level, message, cause);
/* */ }
/* 121 */ catch (Exception ex) {
/* 122 */ if (warning) {
/* 123 */ System.err.println("WARNING: " + message);
/* */ }
/* */ }
/* */ }
/* */
/* */ private URLStreamHandler getFallbackHandler() {
/* 129 */ if (this.fallbackHandler != null) {
/* 130 */ return this.fallbackHandler;
/* */ }
/* 132 */ for (String handlerClassName : FALLBACK_HANDLERS) {
/* */ try {
/* 134 */ Class<?> handlerClass = Class.forName(handlerClassName);
/* 135 */ this.fallbackHandler = (URLStreamHandler)handlerClass.newInstance();
/* 136 */ return this.fallbackHandler;
/* */ }
/* 138 */ catch (Exception exception) {}
/* */ }
/* */
/* */
/* 142 */ throw new IllegalStateException("Unable to find fallback handler");
/* */ }
/* */
/* */ private URLConnection openConnection(URLStreamHandler handler, URL url) throws Exception {
/* 146 */ return (new URL(null, url.toExternalForm(), handler)).openConnection();
/* */ }
/* */
/* */
/* */ protected void parseURL(URL context, String spec, int start, int limit) {
/* 151 */ if (spec.regionMatches(true, 0, "jar:", 0, "jar:".length())) {
/* 152 */ setFile(context, getFileFromSpec(spec.substring(start, limit)));
/* */ } else {
/* */
/* 155 */ setFile(context, getFileFromContext(context, spec.substring(start, limit)));
/* */ }
/* */ }
/* */
/* */ private String getFileFromSpec(String spec) {
/* 160 */ int separatorIndex = spec.lastIndexOf("!/");
/* 161 */ if (separatorIndex == -1) {
/* 162 */ throw new IllegalArgumentException("No !/ in spec '" + spec + "'");
/* */ }
/* */ try {
/* 165 */ new URL(spec.substring(0, separatorIndex));
/* 166 */ return spec;
/* */ }
/* 168 */ catch (MalformedURLException ex) {
/* 169 */ throw new IllegalArgumentException("Invalid spec URL '" + spec + "'", ex);
/* */ }
/* */ }
/* */
/* */ private String getFileFromContext(URL context, String spec) {
/* 174 */ String file = context.getFile();
/* 175 */ if (spec.startsWith("/")) {
/* 176 */ return trimToJarRoot(file) + "!/" + spec.substring(1);
/* */ }
/* 178 */ if (file.endsWith("/")) {
/* 179 */ return file + spec;
/* */ }
/* 181 */ int lastSlashIndex = file.lastIndexOf('/');
/* 182 */ if (lastSlashIndex == -1) {
/* 183 */ throw new IllegalArgumentException("No / found in context URL's file '" + file + "'");
/* */ }
/* 185 */ return file.substring(0, lastSlashIndex + 1) + spec;
/* */ }
/* */
/* */ private String trimToJarRoot(String file) {
/* 189 */ int lastSeparatorIndex = file.lastIndexOf("!/");
/* 190 */ if (lastSeparatorIndex == -1) {
/* 191 */ throw new IllegalArgumentException("No !/ found in context URL's file '" + file + "'");
/* */ }
/* 193 */ return file.substring(0, lastSeparatorIndex);
/* */ }
/* */
/* */ private void setFile(URL context, String file) {
/* 197 */ String path = normalize(file);
/* 198 */ String query = null;
/* 199 */ int queryIndex = path.lastIndexOf('?');
/* 200 */ if (queryIndex != -1) {
/* 201 */ query = path.substring(queryIndex + 1);
/* 202 */ path = path.substring(0, queryIndex);
/* */ }
/* 204 */ setURL(context, "jar:", null, -1, null, null, path, query, context.getRef());
/* */ }
/* */
/* */ private String normalize(String file) {
/* 208 */ if (!file.contains("/./") && !file.contains("/../")) {
/* 209 */ return file;
/* */ }
/* 211 */ int afterLastSeparatorIndex = file.lastIndexOf("!/") + "!/".length();
/* 212 */ String afterSeparator = file.substring(afterLastSeparatorIndex);
/* 213 */ afterSeparator = replaceParentDir(afterSeparator);
/* 214 */ afterSeparator = replaceCurrentDir(afterSeparator);
/* 215 */ return file.substring(0, afterLastSeparatorIndex) + afterSeparator;
/* */ }
/* */
/* */ private String replaceParentDir(String file) {
/* */ int parentDirIndex;
/* 220 */ while ((parentDirIndex = file.indexOf("/../")) >= 0) {
/* 221 */ int precedingSlashIndex = file.lastIndexOf('/', parentDirIndex - 1);
/* 222 */ if (precedingSlashIndex >= 0) {
/* 223 */ file = file.substring(0, precedingSlashIndex) + file.substring(parentDirIndex + 3);
/* */ continue;
/* */ }
/* 226 */ file = file.substring(parentDirIndex + 4);
/* */ }
/* */
/* 229 */ return file;
/* */ }
/* */
/* */ private String replaceCurrentDir(String file) {
/* 233 */ return CURRENT_DIR_PATTERN.matcher(file).replaceAll("/");
/* */ }
/* */
/* */
/* */ protected int hashCode(URL u) {
/* 238 */ return hashCode(u.getProtocol(), u.getFile());
/* */ }
/* */
/* */ private int hashCode(String protocol, String file) {
/* 242 */ int result = (protocol != null) ? protocol.hashCode() : 0;
/* 243 */ int separatorIndex = file.indexOf("!/");
/* 244 */ if (separatorIndex == -1) {
/* 245 */ return result + file.hashCode();
/* */ }
/* 247 */ String source = file.substring(0, separatorIndex);
/* 248 */ String entry = canonicalize(file.substring(separatorIndex + 2));
/* */ try {
/* 250 */ result += (new URL(source)).hashCode();
/* */ }
/* 252 */ catch (MalformedURLException ex) {
/* 253 */ result += source.hashCode();
/* */ }
/* 255 */ result += entry.hashCode();
/* 256 */ return result;
/* */ }
/* */
/* */
/* */ protected boolean sameFile(URL u1, URL u2) {
/* 261 */ if (!u1.getProtocol().equals("jar") || !u2.getProtocol().equals("jar")) {
/* 262 */ return false;
/* */ }
/* 264 */ int separator1 = u1.getFile().indexOf("!/");
/* 265 */ int separator2 = u2.getFile().indexOf("!/");
/* 266 */ if (separator1 == -1 || separator2 == -1) {
/* 267 */ return super.sameFile(u1, u2);
/* */ }
/* 269 */ String nested1 = u1.getFile().substring(separator1 + "!/".length());
/* 270 */ String nested2 = u2.getFile().substring(separator2 + "!/".length());
/* 271 */ if (!nested1.equals(nested2)) {
/* 272 */ String canonical1 = canonicalize(nested1);
/* 273 */ String canonical2 = canonicalize(nested2);
/* 274 */ if (!canonical1.equals(canonical2)) {
/* 275 */ return false;
/* */ }
/* */ }
/* 278 */ String root1 = u1.getFile().substring(0, separator1);
/* 279 */ String root2 = u2.getFile().substring(0, separator2);
/* */ try {
/* 281 */ return super.sameFile(new URL(root1), new URL(root2));
/* */ }
/* 283 */ catch (MalformedURLException malformedURLException) {
/* */
/* */
/* 286 */ return super.sameFile(u1, u2);
/* */ }
/* */ }
/* */ private String canonicalize(String path) {
/* 290 */ return SEPARATOR_PATTERN.matcher(path).replaceAll("/");
/* */ }
/* */
/* */ public JarFile getRootJarFileFromUrl(URL url) throws IOException {
/* 294 */ String spec = url.getFile();
/* 295 */ int separatorIndex = spec.indexOf("!/");
/* 296 */ if (separatorIndex == -1) {
/* 297 */ throw new MalformedURLException("Jar URL does not contain !/ separator");
/* */ }
/* 299 */ String name = spec.substring(0, separatorIndex);
/* 300 */ return getRootJarFile(name);
/* */ }
/* */
/* */ private JarFile getRootJarFile(String name) throws IOException {
/* */ try {
/* 305 */ if (!name.startsWith("file:")) {
/* 306 */ throw new IllegalStateException("Not a file URL");
/* */ }
/* 308 */ File file = new File(URI.create(name));
/* 309 */ Map<File, JarFile> cache = rootFileCache.get();
/* 310 */ JarFile result = (cache != null) ? cache.get(file) : null;
/* 311 */ if (result == null) {
/* 312 */ result = new JarFile(file);
/* 313 */ addToRootFileCache(file, result);
/* */ }
/* 315 */ return result;
/* */ }
/* 317 */ catch (Exception ex) {
/* 318 */ throw new IOException("Unable to open root Jar file '" + name + "'", ex);
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ static void addToRootFileCache(File sourceFile, JarFile jarFile) {
/* 328 */ Map<File, JarFile> cache = rootFileCache.get();
/* 329 */ if (cache == null) {
/* 330 */ cache = new ConcurrentHashMap<>();
/* 331 */ rootFileCache = new SoftReference<>(cache);
/* */ }
/* 333 */ cache.put(sourceFile, jarFile);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static void setUseFastConnectionExceptions(boolean useFastConnectionExceptions) {
/* 343 */ JarURLConnection.setUseFastExceptions(useFastConnectionExceptions);
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\Handler.class
* Java compiler version: 8 (52.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.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
public class Handler
extends URLStreamHandler
{
private static final String JAR_PROTOCOL = "jar:";
private static final String FILE_PROTOCOL = "file:";
private static final String SEPARATOR = "!/";
private static final Pattern SEPARATOR_PATTERN = Pattern.compile("!/", 16);
private static final String CURRENT_DIR = "/./";
private static final Pattern CURRENT_DIR_PATTERN = Pattern.compile("/./", 16);
private static final String PARENT_DIR = "/../";
private static final String[] FALLBACK_HANDLERS = new String[] { "sun.net.www.protocol.jar.Handler" };
private static SoftReference<Map<File, JarFile>> rootFileCache = new SoftReference<>(null);
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 && isUrlInJarFile(url, this.jarFile)) {
return JarURLConnection.get(url, this.jarFile);
}
try {
return JarURLConnection.get(url, getRootJarFileFromUrl(url));
}
catch (Exception ex) {
return openFallbackConnection(url, ex);
}
}
private boolean isUrlInJarFile(URL url, JarFile jarFile) throws MalformedURLException {
return (url.getPath().startsWith(jarFile.getUrl().getPath()) && url
.toString().startsWith(jarFile.getUrlString()));
}
private URLConnection openFallbackConnection(URL url, Exception reason) throws IOException {
try {
return openConnection(getFallbackHandler(), url);
}
catch (Exception ex) {
if (reason instanceof IOException) {
log(false, "Unable to open fallback handler", ex);
throw (IOException)reason;
}
log(true, "Unable to open fallback handler", ex);
if (reason instanceof RuntimeException) {
throw (RuntimeException)reason;
}
throw new IllegalStateException(reason);
}
}
private void log(boolean warning, String message, Exception cause) {
try {
Level level = warning ? Level.WARNING : Level.FINEST;
Logger.getLogger(getClass().getName()).log(level, message, cause);
}
catch (Exception ex) {
if (warning) {
System.err.println("WARNING: " + message);
}
}
}
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 {
return (new URL(null, url.toExternalForm(), handler)).openConnection();
}
protected void parseURL(URL context, String spec, int start, int limit) {
if (spec.regionMatches(true, 0, "jar:", 0, "jar:".length())) {
setFile(context, getFileFromSpec(spec.substring(start, limit)));
} else {
setFile(context, getFileFromContext(context, spec.substring(start, limit)));
}
}
private String getFileFromSpec(String spec) {
int separatorIndex = spec.lastIndexOf("!/");
if (separatorIndex == -1) {
throw new IllegalArgumentException("No !/ in spec '" + spec + "'");
}
try {
new URL(spec.substring(0, separatorIndex));
return spec;
}
catch (MalformedURLException ex) {
throw new IllegalArgumentException("Invalid spec URL '" + spec + "'", ex);
}
}
private String getFileFromContext(URL context, String spec) {
String file = context.getFile();
if (spec.startsWith("/")) {
return trimToJarRoot(file) + "!/" + spec.substring(1);
}
if (file.endsWith("/")) {
return file + spec;
}
int lastSlashIndex = file.lastIndexOf('/');
if (lastSlashIndex == -1) {
throw new IllegalArgumentException("No / found in context URL's file '" + file + "'");
}
return file.substring(0, lastSlashIndex + 1) + spec;
}
private String trimToJarRoot(String file) {
int lastSeparatorIndex = file.lastIndexOf("!/");
if (lastSeparatorIndex == -1) {
throw new IllegalArgumentException("No !/ found in context URL's file '" + file + "'");
}
return file.substring(0, lastSeparatorIndex);
}
private void setFile(URL context, String file) {
String path = normalize(file);
String query = null;
int queryIndex = path.lastIndexOf('?');
if (queryIndex != -1) {
query = path.substring(queryIndex + 1);
path = path.substring(0, queryIndex);
}
setURL(context, "jar:", null, -1, null, null, path, query, context.getRef());
}
private String normalize(String file) {
if (!file.contains("/./") && !file.contains("/../")) {
return file;
}
int afterLastSeparatorIndex = file.lastIndexOf("!/") + "!/".length();
String afterSeparator = file.substring(afterLastSeparatorIndex);
afterSeparator = replaceParentDir(afterSeparator);
afterSeparator = replaceCurrentDir(afterSeparator);
return file.substring(0, afterLastSeparatorIndex) + afterSeparator;
}
private String replaceParentDir(String file) {
int parentDirIndex;
while ((parentDirIndex = file.indexOf("/../")) >= 0) {
int precedingSlashIndex = file.lastIndexOf('/', parentDirIndex - 1);
if (precedingSlashIndex >= 0) {
file = file.substring(0, precedingSlashIndex) + file.substring(parentDirIndex + 3);
continue;
}
file = file.substring(parentDirIndex + 4);
}
return file;
}
private String replaceCurrentDir(String file) {
return CURRENT_DIR_PATTERN.matcher(file).replaceAll("/");
}
protected int hashCode(URL u) {
return hashCode(u.getProtocol(), u.getFile());
}
private int hashCode(String protocol, String file) {
int result = (protocol != null) ? protocol.hashCode() : 0;
int separatorIndex = file.indexOf("!/");
if (separatorIndex == -1) {
return result + file.hashCode();
}
String source = file.substring(0, separatorIndex);
String entry = canonicalize(file.substring(separatorIndex + 2));
try {
result += (new URL(source)).hashCode();
}
catch (MalformedURLException ex) {
result += source.hashCode();
}
result += entry.hashCode();
return result;
}
protected boolean sameFile(URL u1, URL u2) {
if (!u1.getProtocol().equals("jar") || !u2.getProtocol().equals("jar")) {
return false;
}
int separator1 = u1.getFile().indexOf("!/");
int separator2 = u2.getFile().indexOf("!/");
if (separator1 == -1 || separator2 == -1) {
return super.sameFile(u1, u2);
}
String nested1 = u1.getFile().substring(separator1 + "!/".length());
String nested2 = u2.getFile().substring(separator2 + "!/".length());
if (!nested1.equals(nested2)) {
String canonical1 = canonicalize(nested1);
String canonical2 = canonicalize(nested2);
if (!canonical1.equals(canonical2)) {
return false;
}
}
String root1 = u1.getFile().substring(0, separator1);
String root2 = u2.getFile().substring(0, separator2);
try {
return super.sameFile(new URL(root1), new URL(root2));
}
catch (MalformedURLException malformedURLException) {
return super.sameFile(u1, u2);
}
}
private String canonicalize(String path) {
return SEPARATOR_PATTERN.matcher(path).replaceAll("/");
}
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");
}
File file = new File(URI.create(name));
Map<File, JarFile> cache = rootFileCache.get();
JarFile result = (cache != null) ? cache.get(file) : null;
if (result == null) {
result = new JarFile(file);
addToRootFileCache(file, result);
}
return result;
}
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<>();
rootFileCache = new SoftReference<>(cache);
}
cache.put(sourceFile, jarFile);
}
public static void setUseFastConnectionExceptions(boolean useFastConnectionExceptions) {
JarURLConnection.setUseFastExceptions(useFastConnectionExceptions);
}
}
@@ -1,119 +1,115 @@
/* */ 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;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ class JarEntry
/* */ extends JarEntry
/* */ implements FileHeader
/* */ {
/* */ private final AsciiBytes name;
/* */ private final AsciiBytes headerName;
/* */ private Certificate[] certificates;
/* */ private CodeSigner[] codeSigners;
/* */ private final JarFile jarFile;
/* */ private long localHeaderOffset;
/* */
/* */ JarEntry(JarFile jarFile, CentralDirectoryFileHeader header, AsciiBytes nameAlias) {
/* 48 */ super((nameAlias != null) ? nameAlias.toString() : header.getName().toString());
/* 49 */ this.name = (nameAlias != null) ? nameAlias : header.getName();
/* 50 */ this.headerName = header.getName();
/* 51 */ this.jarFile = jarFile;
/* 52 */ this.localHeaderOffset = header.getLocalHeaderOffset();
/* 53 */ setCompressedSize(header.getCompressedSize());
/* 54 */ setMethod(header.getMethod());
/* 55 */ setCrc(header.getCrc());
/* 56 */ setComment(header.getComment().toString());
/* 57 */ setSize(header.getSize());
/* 58 */ setTime(header.getTime());
/* 59 */ if (header.hasExtra()) {
/* 60 */ setExtra(header.getExtra());
/* */ }
/* */ }
/* */
/* */ AsciiBytes getAsciiBytesName() {
/* 65 */ return this.name;
/* */ }
/* */
/* */
/* */ public boolean hasName(CharSequence name, char suffix) {
/* 70 */ return this.headerName.matches(name, suffix);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ URL getUrl() throws MalformedURLException {
/* 79 */ return new URL(this.jarFile.getUrl(), getName());
/* */ }
/* */
/* */
/* */ public Attributes getAttributes() throws IOException {
/* 84 */ Manifest manifest = this.jarFile.getManifest();
/* 85 */ return (manifest != null) ? manifest.getAttributes(getName()) : null;
/* */ }
/* */
/* */
/* */ public Certificate[] getCertificates() {
/* 90 */ if (this.jarFile.isSigned() && this.certificates == null) {
/* 91 */ this.jarFile.setupEntryCertificates(this);
/* */ }
/* 93 */ return this.certificates;
/* */ }
/* */
/* */
/* */ public CodeSigner[] getCodeSigners() {
/* 98 */ if (this.jarFile.isSigned() && this.codeSigners == null) {
/* 99 */ this.jarFile.setupEntryCertificates(this);
/* */ }
/* 101 */ return this.codeSigners;
/* */ }
/* */
/* */ void setCertificates(JarEntry entry) {
/* 105 */ this.certificates = entry.getCertificates();
/* 106 */ this.codeSigners = entry.getCodeSigners();
/* */ }
/* */
/* */
/* */ public long getLocalHeaderOffset() {
/* 111 */ return this.localHeaderOffset;
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\JarEntry.class
* Java compiler version: 8 (52.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;
class JarEntry
extends JarEntry
implements FileHeader
{
private final AsciiBytes name;
private final AsciiBytes headerName;
private Certificate[] certificates;
private CodeSigner[] codeSigners;
private final JarFile jarFile;
private long localHeaderOffset;
JarEntry(JarFile jarFile, CentralDirectoryFileHeader header, AsciiBytes nameAlias) {
super((nameAlias != null) ? nameAlias.toString() : header.getName().toString());
this.name = (nameAlias != null) ? nameAlias : header.getName();
this.headerName = header.getName();
this.jarFile = jarFile;
this.localHeaderOffset = header.getLocalHeaderOffset();
setCompressedSize(header.getCompressedSize());
setMethod(header.getMethod());
setCrc(header.getCrc());
setComment(header.getComment().toString());
setSize(header.getSize());
setTime(header.getTime());
if (header.hasExtra()) {
setExtra(header.getExtra());
}
}
AsciiBytes getAsciiBytesName() {
return this.name;
}
public boolean hasName(CharSequence name, char suffix) {
return this.headerName.matches(name, suffix);
}
URL getUrl() throws MalformedURLException {
return new URL(this.jarFile.getUrl(), getName());
}
public Attributes getAttributes() throws IOException {
Manifest manifest = this.jarFile.getManifest();
return (manifest != null) ? manifest.getAttributes(getName()) : null;
}
public Certificate[] getCertificates() {
if (this.jarFile.isSigned() && this.certificates == null) {
this.jarFile.setupEntryCertificates(this);
}
return this.certificates;
}
public CodeSigner[] getCodeSigners() {
if (this.jarFile.isSigned() && this.codeSigners == null) {
this.jarFile.setupEntryCertificates(this);
}
return this.codeSigners;
}
void setCertificates(JarEntry entry) {
this.certificates = entry.getCertificates();
this.codeSigners = entry.getCodeSigners();
}
public long getLocalHeaderOffset() {
return this.localHeaderOffset;
}
}
@@ -1,11 +1,7 @@
package org.springframework.boot.loader.jar;
interface JarEntryFilter {
AsciiBytes apply(AsciiBytes paramAsciiBytes);
}
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\JarEntryFilter.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.jar;
interface JarEntryFilter {
AsciiBytes apply(AsciiBytes paramAsciiBytes);
}
@@ -1,391 +1,387 @@
/* */ package org.springframework.boot.loader.jar;
/* */
/* */ import java.io.IOException;
/* */ import java.io.InputStream;
/* */ import java.util.Arrays;
/* */ import java.util.Collections;
/* */ import java.util.Iterator;
/* */ import java.util.LinkedHashMap;
/* */ import java.util.Map;
/* */ import java.util.NoSuchElementException;
/* */ import java.util.jar.Attributes;
/* */ import java.util.jar.Manifest;
/* */ import org.springframework.boot.loader.data.RandomAccessData;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ class JarFileEntries
/* */ implements CentralDirectoryVisitor, Iterable<JarEntry>
/* */ {
/* */ static {
/* */ int version;
/* */ }
/* */
/* */ private static final Runnable NO_VALIDATION = () -> {
/* */
/* */ };
/* */ private static final String META_INF_PREFIX = "META-INF/";
/* 55 */ private static final Attributes.Name MULTI_RELEASE = new Attributes.Name("Multi-Release");
/* */
/* */ private static final int BASE_VERSION = 8;
/* */
/* */ private static final int RUNTIME_VERSION;
/* */ private static final long LOCAL_FILE_HEADER_SIZE = 30L;
/* */
/* */ static {
/* */ try {
/* 64 */ Object runtimeVersion = Runtime.class.getMethod("version", new Class[0]).invoke(null, new Object[0]);
/* 65 */ version = ((Integer)runtimeVersion.getClass().getMethod("major", new Class[0]).invoke(runtimeVersion, new Object[0])).intValue();
/* */ }
/* 67 */ catch (Throwable ex) {
/* 68 */ version = 8;
/* */ }
/* 70 */ RUNTIME_VERSION = version;
/* */ }
/* */
/* */
/* */
/* */ private static final char SLASH = '/';
/* */
/* */ private static final char NO_SUFFIX = '\000';
/* */
/* */ protected static final int ENTRY_CACHE_SIZE = 25;
/* */
/* */ private final JarFile jarFile;
/* */
/* */ private final JarEntryFilter filter;
/* */
/* */ private RandomAccessData centralDirectoryData;
/* */
/* */ private int size;
/* */
/* */ private int[] hashCodes;
/* */
/* */ private int[] centralDirectoryOffsets;
/* */
/* */ private int[] positions;
/* */
/* */ private Boolean multiReleaseJar;
/* */
/* */
/* 98 */ private final Map<Integer, FileHeader> entriesCache = Collections.synchronizedMap(new LinkedHashMap<Integer, FileHeader>(16, 0.75F, true)
/* */ {
/* */ protected boolean removeEldestEntry(Map.Entry<Integer, FileHeader> eldest)
/* */ {
/* 102 */ if (JarFileEntries.this.jarFile.isSigned()) {
/* 103 */ return false;
/* */ }
/* 105 */ return (size() >= 25);
/* */ }
/* */ });
/* */
/* */
/* */ JarFileEntries(JarFile jarFile, JarEntryFilter filter) {
/* 111 */ this.jarFile = jarFile;
/* 112 */ this.filter = filter;
/* 113 */ if (RUNTIME_VERSION == 8) {
/* 114 */ this.multiReleaseJar = Boolean.valueOf(false);
/* */ }
/* */ }
/* */
/* */
/* */ public void visitStart(CentralDirectoryEndRecord endRecord, RandomAccessData centralDirectoryData) {
/* 120 */ int maxSize = endRecord.getNumberOfRecords();
/* 121 */ this.centralDirectoryData = centralDirectoryData;
/* 122 */ this.hashCodes = new int[maxSize];
/* 123 */ this.centralDirectoryOffsets = new int[maxSize];
/* 124 */ this.positions = new int[maxSize];
/* */ }
/* */
/* */
/* */ public void visitFileHeader(CentralDirectoryFileHeader fileHeader, int dataOffset) {
/* 129 */ AsciiBytes name = applyFilter(fileHeader.getName());
/* 130 */ if (name != null) {
/* 131 */ add(name, dataOffset);
/* */ }
/* */ }
/* */
/* */ private void add(AsciiBytes name, int dataOffset) {
/* 136 */ this.hashCodes[this.size] = name.hashCode();
/* 137 */ this.centralDirectoryOffsets[this.size] = dataOffset;
/* 138 */ this.positions[this.size] = this.size;
/* 139 */ this.size++;
/* */ }
/* */
/* */
/* */ public void visitEnd() {
/* 144 */ sort(0, this.size - 1);
/* 145 */ int[] positions = this.positions;
/* 146 */ this.positions = new int[positions.length];
/* 147 */ for (int i = 0; i < this.size; i++) {
/* 148 */ this.positions[positions[i]] = i;
/* */ }
/* */ }
/* */
/* */ int getSize() {
/* 153 */ return this.size;
/* */ }
/* */
/* */
/* */ private void sort(int left, int right) {
/* 158 */ if (left < right) {
/* 159 */ int pivot = this.hashCodes[left + (right - left) / 2];
/* 160 */ int i = left;
/* 161 */ int j = right;
/* 162 */ while (i <= j) {
/* 163 */ while (this.hashCodes[i] < pivot) {
/* 164 */ i++;
/* */ }
/* 166 */ while (this.hashCodes[j] > pivot) {
/* 167 */ j--;
/* */ }
/* 169 */ if (i <= j) {
/* 170 */ swap(i, j);
/* 171 */ i++;
/* 172 */ j--;
/* */ }
/* */ }
/* 175 */ if (left < j) {
/* 176 */ sort(left, j);
/* */ }
/* 178 */ if (right > i) {
/* 179 */ sort(i, right);
/* */ }
/* */ }
/* */ }
/* */
/* */ private void swap(int i, int j) {
/* 185 */ swap(this.hashCodes, i, j);
/* 186 */ swap(this.centralDirectoryOffsets, i, j);
/* 187 */ swap(this.positions, i, j);
/* */ }
/* */
/* */ private void swap(int[] array, int i, int j) {
/* 191 */ int temp = array[i];
/* 192 */ array[i] = array[j];
/* 193 */ array[j] = temp;
/* */ }
/* */
/* */
/* */ public Iterator<JarEntry> iterator() {
/* 198 */ return new EntryIterator(NO_VALIDATION);
/* */ }
/* */
/* */ Iterator<JarEntry> iterator(Runnable validator) {
/* 202 */ return new EntryIterator(validator);
/* */ }
/* */
/* */ boolean containsEntry(CharSequence name) {
/* 206 */ return (getEntry(name, FileHeader.class, true) != null);
/* */ }
/* */
/* */ JarEntry getEntry(CharSequence name) {
/* 210 */ return getEntry(name, JarEntry.class, true);
/* */ }
/* */
/* */ InputStream getInputStream(String name) throws IOException {
/* 214 */ FileHeader entry = getEntry(name, FileHeader.class, false);
/* 215 */ return getInputStream(entry);
/* */ }
/* */
/* */ InputStream getInputStream(FileHeader entry) throws IOException {
/* 219 */ if (entry == null) {
/* 220 */ return null;
/* */ }
/* 222 */ InputStream inputStream = getEntryData(entry).getInputStream();
/* 223 */ if (entry.getMethod() == 8) {
/* 224 */ inputStream = new ZipInflaterInputStream(inputStream, (int)entry.getSize());
/* */ }
/* 226 */ return inputStream;
/* */ }
/* */
/* */ RandomAccessData getEntryData(String name) throws IOException {
/* 230 */ FileHeader entry = getEntry(name, FileHeader.class, false);
/* 231 */ if (entry == null) {
/* 232 */ return null;
/* */ }
/* 234 */ return getEntryData(entry);
/* */ }
/* */
/* */
/* */
/* */
/* */ private RandomAccessData getEntryData(FileHeader entry) throws IOException {
/* 241 */ RandomAccessData data = this.jarFile.getData();
/* 242 */ byte[] localHeader = data.read(entry.getLocalHeaderOffset(), 30L);
/* 243 */ long nameLength = Bytes.littleEndianValue(localHeader, 26, 2);
/* 244 */ long extraLength = Bytes.littleEndianValue(localHeader, 28, 2);
/* 245 */ return data.getSubsection(entry.getLocalHeaderOffset() + 30L + nameLength + extraLength, entry
/* 246 */ .getCompressedSize());
/* */ }
/* */
/* */ private <T extends FileHeader> T getEntry(CharSequence name, Class<T> type, boolean cacheEntry) {
/* 250 */ T entry = doGetEntry(name, type, cacheEntry, null);
/* 251 */ if (!isMetaInfEntry(name) && isMultiReleaseJar()) {
/* 252 */ int version = RUNTIME_VERSION;
/* */
/* 254 */ AsciiBytes nameAlias = (entry instanceof JarEntry) ? ((JarEntry)entry).getAsciiBytesName() : new AsciiBytes(name.toString());
/* 255 */ while (version > 8) {
/* 256 */ T versionedEntry = doGetEntry("META-INF/versions/" + version + "/" + name, type, cacheEntry, nameAlias);
/* 257 */ if (versionedEntry != null) {
/* 258 */ return versionedEntry;
/* */ }
/* 260 */ version--;
/* */ }
/* */ }
/* 263 */ return entry;
/* */ }
/* */
/* */ private boolean isMetaInfEntry(CharSequence name) {
/* 267 */ return name.toString().startsWith("META-INF/");
/* */ }
/* */
/* */ private boolean isMultiReleaseJar() {
/* 271 */ Boolean multiRelease = this.multiReleaseJar;
/* 272 */ if (multiRelease != null) {
/* 273 */ return multiRelease.booleanValue();
/* */ }
/* */ try {
/* 276 */ Manifest manifest = this.jarFile.getManifest();
/* 277 */ if (manifest == null) {
/* 278 */ multiRelease = Boolean.valueOf(false);
/* */ } else {
/* */
/* 281 */ Attributes attributes = manifest.getMainAttributes();
/* 282 */ multiRelease = Boolean.valueOf(attributes.containsKey(MULTI_RELEASE));
/* */ }
/* */
/* 285 */ } catch (IOException ex) {
/* 286 */ multiRelease = Boolean.valueOf(false);
/* */ }
/* 288 */ this.multiReleaseJar = multiRelease;
/* 289 */ return multiRelease.booleanValue();
/* */ }
/* */
/* */
/* */ private <T extends FileHeader> T doGetEntry(CharSequence name, Class<T> type, boolean cacheEntry, AsciiBytes nameAlias) {
/* 294 */ int hashCode = AsciiBytes.hashCode(name);
/* 295 */ T entry = getEntry(hashCode, name, false, type, cacheEntry, nameAlias);
/* 296 */ if (entry == null) {
/* 297 */ hashCode = AsciiBytes.hashCode(hashCode, '/');
/* 298 */ entry = getEntry(hashCode, name, '/', type, cacheEntry, nameAlias);
/* */ }
/* 300 */ return entry;
/* */ }
/* */
/* */
/* */ private <T extends FileHeader> T getEntry(int hashCode, CharSequence name, char suffix, Class<T> type, boolean cacheEntry, AsciiBytes nameAlias) {
/* 305 */ int index = getFirstIndex(hashCode);
/* 306 */ while (index >= 0 && index < this.size && this.hashCodes[index] == hashCode) {
/* 307 */ T entry = getEntry(index, type, cacheEntry, nameAlias);
/* 308 */ if (entry.hasName(name, suffix)) {
/* 309 */ return entry;
/* */ }
/* 311 */ index++;
/* */ }
/* 313 */ return null;
/* */ }
/* */
/* */
/* */ private <T extends FileHeader> T getEntry(int index, Class<T> type, boolean cacheEntry, AsciiBytes nameAlias) {
/* */ try {
/* 319 */ FileHeader cached = this.entriesCache.get(Integer.valueOf(index));
/* */
/* 321 */ FileHeader entry = (cached != null) ? cached : CentralDirectoryFileHeader.fromRandomAccessData(this.centralDirectoryData, this.centralDirectoryOffsets[index], this.filter);
/* 322 */ if (CentralDirectoryFileHeader.class.equals(entry.getClass()) && type.equals(JarEntry.class)) {
/* 323 */ entry = new JarEntry(this.jarFile, (CentralDirectoryFileHeader)entry, nameAlias);
/* */ }
/* 325 */ if (cacheEntry && cached != entry) {
/* 326 */ this.entriesCache.put(Integer.valueOf(index), entry);
/* */ }
/* 328 */ return (T)entry;
/* */ }
/* 330 */ catch (IOException ex) {
/* 331 */ throw new IllegalStateException(ex);
/* */ }
/* */ }
/* */
/* */ private int getFirstIndex(int hashCode) {
/* 336 */ int index = Arrays.binarySearch(this.hashCodes, 0, this.size, hashCode);
/* 337 */ if (index < 0) {
/* 338 */ return -1;
/* */ }
/* 340 */ while (index > 0 && this.hashCodes[index - 1] == hashCode) {
/* 341 */ index--;
/* */ }
/* 343 */ return index;
/* */ }
/* */
/* */ void clearCache() {
/* 347 */ this.entriesCache.clear();
/* */ }
/* */
/* */ private AsciiBytes applyFilter(AsciiBytes name) {
/* 351 */ return (this.filter != null) ? this.filter.apply(name) : name;
/* */ }
/* */
/* */
/* */
/* */ private final class EntryIterator
/* */ implements Iterator<JarEntry>
/* */ {
/* */ private final Runnable validator;
/* */
/* 361 */ private int index = 0;
/* */
/* */ private EntryIterator(Runnable validator) {
/* 364 */ this.validator = validator;
/* 365 */ validator.run();
/* */ }
/* */
/* */
/* */ public boolean hasNext() {
/* 370 */ this.validator.run();
/* 371 */ return (this.index < JarFileEntries.this.size);
/* */ }
/* */
/* */
/* */ public JarEntry next() {
/* 376 */ this.validator.run();
/* 377 */ if (!hasNext()) {
/* 378 */ throw new NoSuchElementException();
/* */ }
/* 380 */ int entryIndex = JarFileEntries.this.positions[this.index];
/* 381 */ this.index++;
/* 382 */ return (JarEntry)JarFileEntries.this.getEntry(entryIndex, (Class)JarEntry.class, false, null);
/* */ }
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\JarFileEntries.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.jar;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import org.springframework.boot.loader.data.RandomAccessData;
class JarFileEntries
implements CentralDirectoryVisitor, Iterable<JarEntry>
{
static {
int version;
}
private static final Runnable NO_VALIDATION = () -> {
};
private static final String META_INF_PREFIX = "META-INF/";
private static final Attributes.Name MULTI_RELEASE = new Attributes.Name("Multi-Release");
private static final int BASE_VERSION = 8;
private static final int RUNTIME_VERSION;
private static final long LOCAL_FILE_HEADER_SIZE = 30L;
static {
try {
Object runtimeVersion = Runtime.class.getMethod("version", new Class[0]).invoke(null, new Object[0]);
version = ((Integer)runtimeVersion.getClass().getMethod("major", new Class[0]).invoke(runtimeVersion, new Object[0])).intValue();
}
catch (Throwable ex) {
version = 8;
}
RUNTIME_VERSION = version;
}
private static final char SLASH = '/';
private static final char NO_SUFFIX = '\000';
protected static final int ENTRY_CACHE_SIZE = 25;
private final JarFile jarFile;
private final JarEntryFilter filter;
private RandomAccessData centralDirectoryData;
private int size;
private int[] hashCodes;
private int[] centralDirectoryOffsets;
private int[] positions;
private Boolean multiReleaseJar;
private final Map<Integer, FileHeader> entriesCache = Collections.synchronizedMap(new LinkedHashMap<Integer, FileHeader>(16, 0.75F, true)
{
protected boolean removeEldestEntry(Map.Entry<Integer, FileHeader> eldest)
{
if (JarFileEntries.this.jarFile.isSigned()) {
return false;
}
return (size() >= 25);
}
});
JarFileEntries(JarFile jarFile, JarEntryFilter filter) {
this.jarFile = jarFile;
this.filter = filter;
if (RUNTIME_VERSION == 8) {
this.multiReleaseJar = Boolean.valueOf(false);
}
}
public void visitStart(CentralDirectoryEndRecord endRecord, RandomAccessData centralDirectoryData) {
int maxSize = endRecord.getNumberOfRecords();
this.centralDirectoryData = centralDirectoryData;
this.hashCodes = new int[maxSize];
this.centralDirectoryOffsets = new int[maxSize];
this.positions = new int[maxSize];
}
public void visitFileHeader(CentralDirectoryFileHeader fileHeader, int dataOffset) {
AsciiBytes name = applyFilter(fileHeader.getName());
if (name != null) {
add(name, dataOffset);
}
}
private void add(AsciiBytes name, int dataOffset) {
this.hashCodes[this.size] = name.hashCode();
this.centralDirectoryOffsets[this.size] = dataOffset;
this.positions[this.size] = this.size;
this.size++;
}
public void visitEnd() {
sort(0, this.size - 1);
int[] positions = this.positions;
this.positions = new int[positions.length];
for (int i = 0; i < this.size; i++) {
this.positions[positions[i]] = i;
}
}
int getSize() {
return this.size;
}
private void sort(int left, int right) {
if (left < right) {
int pivot = this.hashCodes[left + (right - left) / 2];
int i = left;
int j = right;
while (i <= j) {
while (this.hashCodes[i] < pivot) {
i++;
}
while (this.hashCodes[j] > pivot) {
j--;
}
if (i <= j) {
swap(i, j);
i++;
j--;
}
}
if (left < j) {
sort(left, j);
}
if (right > i) {
sort(i, right);
}
}
}
private void swap(int i, int j) {
swap(this.hashCodes, i, j);
swap(this.centralDirectoryOffsets, i, j);
swap(this.positions, i, j);
}
private void swap(int[] array, int i, int j) {
int temp = array[i];
array[i] = array[j];
array[j] = temp;
}
public Iterator<JarEntry> iterator() {
return new EntryIterator(NO_VALIDATION);
}
Iterator<JarEntry> iterator(Runnable validator) {
return new EntryIterator(validator);
}
boolean containsEntry(CharSequence name) {
return (getEntry(name, FileHeader.class, true) != null);
}
JarEntry getEntry(CharSequence name) {
return getEntry(name, JarEntry.class, true);
}
InputStream getInputStream(String name) throws IOException {
FileHeader entry = getEntry(name, FileHeader.class, false);
return getInputStream(entry);
}
InputStream getInputStream(FileHeader entry) throws IOException {
if (entry == null) {
return null;
}
InputStream inputStream = getEntryData(entry).getInputStream();
if (entry.getMethod() == 8) {
inputStream = new ZipInflaterInputStream(inputStream, (int)entry.getSize());
}
return inputStream;
}
RandomAccessData getEntryData(String name) throws IOException {
FileHeader entry = getEntry(name, FileHeader.class, false);
if (entry == null) {
return null;
}
return getEntryData(entry);
}
private RandomAccessData getEntryData(FileHeader entry) throws IOException {
RandomAccessData data = this.jarFile.getData();
byte[] localHeader = data.read(entry.getLocalHeaderOffset(), 30L);
long nameLength = Bytes.littleEndianValue(localHeader, 26, 2);
long extraLength = Bytes.littleEndianValue(localHeader, 28, 2);
return data.getSubsection(entry.getLocalHeaderOffset() + 30L + nameLength + extraLength, entry
.getCompressedSize());
}
private <T extends FileHeader> T getEntry(CharSequence name, Class<T> type, boolean cacheEntry) {
T entry = doGetEntry(name, type, cacheEntry, null);
if (!isMetaInfEntry(name) && isMultiReleaseJar()) {
int version = RUNTIME_VERSION;
AsciiBytes nameAlias = (entry instanceof JarEntry) ? ((JarEntry)entry).getAsciiBytesName() : new AsciiBytes(name.toString());
while (version > 8) {
T versionedEntry = doGetEntry("META-INF/versions/" + version + "/" + name, type, cacheEntry, nameAlias);
if (versionedEntry != null) {
return versionedEntry;
}
version--;
}
}
return entry;
}
private boolean isMetaInfEntry(CharSequence name) {
return name.toString().startsWith("META-INF/");
}
private boolean isMultiReleaseJar() {
Boolean multiRelease = this.multiReleaseJar;
if (multiRelease != null) {
return multiRelease.booleanValue();
}
try {
Manifest manifest = this.jarFile.getManifest();
if (manifest == null) {
multiRelease = Boolean.valueOf(false);
} else {
Attributes attributes = manifest.getMainAttributes();
multiRelease = Boolean.valueOf(attributes.containsKey(MULTI_RELEASE));
}
} catch (IOException ex) {
multiRelease = Boolean.valueOf(false);
}
this.multiReleaseJar = multiRelease;
return multiRelease.booleanValue();
}
private <T extends FileHeader> T doGetEntry(CharSequence name, Class<T> type, boolean cacheEntry, AsciiBytes nameAlias) {
int hashCode = AsciiBytes.hashCode(name);
T entry = getEntry(hashCode, name, false, type, cacheEntry, nameAlias);
if (entry == null) {
hashCode = AsciiBytes.hashCode(hashCode, '/');
entry = getEntry(hashCode, name, '/', type, cacheEntry, nameAlias);
}
return entry;
}
private <T extends FileHeader> T getEntry(int hashCode, CharSequence name, char suffix, Class<T> type, boolean cacheEntry, AsciiBytes nameAlias) {
int index = getFirstIndex(hashCode);
while (index >= 0 && index < this.size && this.hashCodes[index] == hashCode) {
T entry = getEntry(index, type, cacheEntry, nameAlias);
if (entry.hasName(name, suffix)) {
return entry;
}
index++;
}
return null;
}
private <T extends FileHeader> T getEntry(int index, Class<T> type, boolean cacheEntry, AsciiBytes nameAlias) {
try {
FileHeader cached = this.entriesCache.get(Integer.valueOf(index));
FileHeader entry = (cached != null) ? cached : CentralDirectoryFileHeader.fromRandomAccessData(this.centralDirectoryData, this.centralDirectoryOffsets[index], this.filter);
if (CentralDirectoryFileHeader.class.equals(entry.getClass()) && type.equals(JarEntry.class)) {
entry = new JarEntry(this.jarFile, (CentralDirectoryFileHeader)entry, nameAlias);
}
if (cacheEntry && cached != entry) {
this.entriesCache.put(Integer.valueOf(index), entry);
}
return (T)entry;
}
catch (IOException ex) {
throw new IllegalStateException(ex);
}
}
private int getFirstIndex(int hashCode) {
int index = Arrays.binarySearch(this.hashCodes, 0, this.size, hashCode);
if (index < 0) {
return -1;
}
while (index > 0 && this.hashCodes[index - 1] == hashCode) {
index--;
}
return index;
}
void clearCache() {
this.entriesCache.clear();
}
private AsciiBytes applyFilter(AsciiBytes name) {
return (this.filter != null) ? this.filter.apply(name) : name;
}
private final class EntryIterator
implements Iterator<JarEntry>
{
private final Runnable validator;
private int index = 0;
private EntryIterator(Runnable validator) {
this.validator = validator;
validator.run();
}
public boolean hasNext() {
this.validator.run();
return (this.index < JarFileEntries.this.size);
}
public JarEntry next() {
this.validator.run();
if (!hasNext()) {
throw new NoSuchElementException();
}
int entryIndex = JarFileEntries.this.positions[this.index];
this.index++;
return (JarEntry)JarFileEntries.this.getEntry(entryIndex, (Class)JarEntry.class, false, null);
}
}
}
@@ -1,400 +1,396 @@
/* */ package org.springframework.boot.loader.jar;
/* */
/* */ import java.io.ByteArrayOutputStream;
/* */ import java.io.FileNotFoundException;
/* */ import java.io.FilePermission;
/* */ import java.io.IOException;
/* */ import java.io.InputStream;
/* */ import java.io.UnsupportedEncodingException;
/* */ import java.net.JarURLConnection;
/* */ import java.net.MalformedURLException;
/* */ import java.net.URL;
/* */ import java.net.URLConnection;
/* */ import java.net.URLEncoder;
/* */ import java.net.URLStreamHandler;
/* */ import java.security.Permission;
/* */ import java.util.jar.JarEntry;
/* */ import java.util.jar.JarFile;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ final class JarURLConnection
/* */ extends JarURLConnection
/* */ {
/* 41 */ private static ThreadLocal<Boolean> useFastExceptions = new ThreadLocal<>();
/* */
/* 43 */ private static final FileNotFoundException FILE_NOT_FOUND_EXCEPTION = new FileNotFoundException("Jar file or entry not found");
/* */
/* */
/* 46 */ private static final IllegalStateException NOT_FOUND_CONNECTION_EXCEPTION = new IllegalStateException(FILE_NOT_FOUND_EXCEPTION);
/* */
/* */ private static final String SEPARATOR = "!/";
/* */
/* */ private static final URL EMPTY_JAR_URL;
/* */
/* */
/* */ static {
/* */ try {
/* 55 */ EMPTY_JAR_URL = new URL("jar:", null, 0, "file:!/", new URLStreamHandler()
/* */ {
/* */
/* */ protected URLConnection openConnection(URL u) throws IOException
/* */ {
/* 60 */ return null;
/* */ }
/* */ });
/* */ }
/* 64 */ catch (MalformedURLException ex) {
/* 65 */ throw new IllegalStateException(ex);
/* */ }
/* */ }
/* */
/* 69 */ private static final JarEntryName EMPTY_JAR_ENTRY_NAME = new JarEntryName(new StringSequence(""));
/* */
/* */ private static final String READ_ACTION = "read";
/* */
/* 73 */ private static final JarURLConnection NOT_FOUND_CONNECTION = notFound();
/* */
/* */ private final JarFile jarFile;
/* */
/* */ private Permission permission;
/* */
/* */ private URL jarFileUrl;
/* */
/* */ private final JarEntryName jarEntryName;
/* */
/* */ private JarEntry jarEntry;
/* */
/* */
/* */ private JarURLConnection(URL url, JarFile jarFile, JarEntryName jarEntryName) throws IOException {
/* 87 */ super(EMPTY_JAR_URL);
/* 88 */ this.url = url;
/* 89 */ this.jarFile = jarFile;
/* 90 */ this.jarEntryName = jarEntryName;
/* */ }
/* */
/* */
/* */ public void connect() throws IOException {
/* 95 */ if (this.jarFile == null) {
/* 96 */ throw FILE_NOT_FOUND_EXCEPTION;
/* */ }
/* 98 */ if (!this.jarEntryName.isEmpty() && this.jarEntry == null) {
/* 99 */ this.jarEntry = this.jarFile.getJarEntry(getEntryName());
/* 100 */ if (this.jarEntry == null) {
/* 101 */ throwFileNotFound(this.jarEntryName, this.jarFile);
/* */ }
/* */ }
/* 104 */ this.connected = true;
/* */ }
/* */
/* */
/* */ public JarFile getJarFile() throws IOException {
/* 109 */ connect();
/* 110 */ return this.jarFile;
/* */ }
/* */
/* */
/* */ public URL getJarFileURL() {
/* 115 */ if (this.jarFile == null) {
/* 116 */ throw NOT_FOUND_CONNECTION_EXCEPTION;
/* */ }
/* 118 */ if (this.jarFileUrl == null) {
/* 119 */ this.jarFileUrl = buildJarFileUrl();
/* */ }
/* 121 */ return this.jarFileUrl;
/* */ }
/* */
/* */ private URL buildJarFileUrl() {
/* */ try {
/* 126 */ String spec = this.jarFile.getUrl().getFile();
/* 127 */ if (spec.endsWith("!/")) {
/* 128 */ spec = spec.substring(0, spec.length() - "!/".length());
/* */ }
/* 130 */ if (!spec.contains("!/")) {
/* 131 */ return new URL(spec);
/* */ }
/* 133 */ return new URL("jar:" + spec);
/* */ }
/* 135 */ catch (MalformedURLException ex) {
/* 136 */ throw new IllegalStateException(ex);
/* */ }
/* */ }
/* */
/* */
/* */ public JarEntry getJarEntry() throws IOException {
/* 142 */ if (this.jarEntryName == null || this.jarEntryName.isEmpty()) {
/* 143 */ return null;
/* */ }
/* 145 */ connect();
/* 146 */ return this.jarEntry;
/* */ }
/* */
/* */
/* */ public String getEntryName() {
/* 151 */ if (this.jarFile == null) {
/* 152 */ throw NOT_FOUND_CONNECTION_EXCEPTION;
/* */ }
/* 154 */ return this.jarEntryName.toString();
/* */ }
/* */
/* */
/* */ public InputStream getInputStream() throws IOException {
/* 159 */ if (this.jarFile == null) {
/* 160 */ throw FILE_NOT_FOUND_EXCEPTION;
/* */ }
/* 162 */ if (this.jarEntryName.isEmpty() && this.jarFile.getType() == JarFile.JarFileType.DIRECT) {
/* 163 */ throw new IOException("no entry name specified");
/* */ }
/* 165 */ connect();
/* */
/* 167 */ InputStream inputStream = this.jarEntryName.isEmpty() ? this.jarFile.getData().getInputStream() : this.jarFile.getInputStream(this.jarEntry);
/* 168 */ if (inputStream == null) {
/* 169 */ throwFileNotFound(this.jarEntryName, this.jarFile);
/* */ }
/* 171 */ return inputStream;
/* */ }
/* */
/* */ private void throwFileNotFound(Object entry, JarFile jarFile) throws FileNotFoundException {
/* 175 */ if (Boolean.TRUE.equals(useFastExceptions.get())) {
/* 176 */ throw FILE_NOT_FOUND_EXCEPTION;
/* */ }
/* 178 */ throw new FileNotFoundException("JAR entry " + entry + " not found in " + jarFile.getName());
/* */ }
/* */
/* */
/* */ public int getContentLength() {
/* 183 */ long length = getContentLengthLong();
/* 184 */ if (length > 2147483647L) {
/* 185 */ return -1;
/* */ }
/* 187 */ return (int)length;
/* */ }
/* */
/* */
/* */ public long getContentLengthLong() {
/* 192 */ if (this.jarFile == null) {
/* 193 */ return -1L;
/* */ }
/* */ try {
/* 196 */ if (this.jarEntryName.isEmpty()) {
/* 197 */ return this.jarFile.size();
/* */ }
/* 199 */ JarEntry entry = getJarEntry();
/* 200 */ return (entry != null) ? (int)entry.getSize() : -1L;
/* */ }
/* 202 */ catch (IOException ex) {
/* 203 */ return -1L;
/* */ }
/* */ }
/* */
/* */
/* */ public Object getContent() throws IOException {
/* 209 */ connect();
/* 210 */ return this.jarEntryName.isEmpty() ? this.jarFile : super.getContent();
/* */ }
/* */
/* */
/* */ public String getContentType() {
/* 215 */ return (this.jarEntryName != null) ? this.jarEntryName.getContentType() : null;
/* */ }
/* */
/* */
/* */ public Permission getPermission() throws IOException {
/* 220 */ if (this.jarFile == null) {
/* 221 */ throw FILE_NOT_FOUND_EXCEPTION;
/* */ }
/* 223 */ if (this.permission == null) {
/* 224 */ this.permission = new FilePermission(this.jarFile.getRootJarFile().getFile().getPath(), "read");
/* */ }
/* 226 */ return this.permission;
/* */ }
/* */
/* */
/* */ public long getLastModified() {
/* 231 */ if (this.jarFile == null || this.jarEntryName.isEmpty()) {
/* 232 */ return 0L;
/* */ }
/* */ try {
/* 235 */ JarEntry entry = getJarEntry();
/* 236 */ return (entry != null) ? entry.getTime() : 0L;
/* */ }
/* 238 */ catch (IOException ex) {
/* 239 */ return 0L;
/* */ }
/* */ }
/* */
/* */ static void setUseFastExceptions(boolean useFastExceptions) {
/* 244 */ JarURLConnection.useFastExceptions.set(Boolean.valueOf(useFastExceptions));
/* */ }
/* */
/* */ static JarURLConnection get(URL url, JarFile jarFile) throws IOException {
/* 248 */ StringSequence spec = new StringSequence(url.getFile());
/* 249 */ int index = indexOfRootSpec(spec, jarFile.getPathFromRoot());
/* 250 */ if (index == -1) {
/* 251 */ return Boolean.TRUE.equals(useFastExceptions.get()) ? NOT_FOUND_CONNECTION : new JarURLConnection(url, null, EMPTY_JAR_ENTRY_NAME);
/* */ }
/* */
/* */ int separator;
/* 255 */ while ((separator = spec.indexOf("!/", index)) > 0) {
/* 256 */ JarEntryName entryName = JarEntryName.get(spec.subSequence(index, separator));
/* 257 */ JarEntry jarEntry = jarFile.getJarEntry(entryName.toCharSequence());
/* 258 */ if (jarEntry == null) {
/* 259 */ return notFound(jarFile, entryName);
/* */ }
/* 261 */ jarFile = jarFile.getNestedJarFile(jarEntry);
/* 262 */ index = separator + "!/".length();
/* */ }
/* 264 */ JarEntryName jarEntryName = JarEntryName.get(spec, index);
/* 265 */ if (Boolean.TRUE.equals(useFastExceptions.get()) && !jarEntryName.isEmpty() &&
/* 266 */ !jarFile.containsEntry(jarEntryName.toString())) {
/* 267 */ return NOT_FOUND_CONNECTION;
/* */ }
/* 269 */ return new JarURLConnection(url, new JarFile(jarFile), jarEntryName);
/* */ }
/* */
/* */ private static int indexOfRootSpec(StringSequence file, String pathFromRoot) {
/* 273 */ int separatorIndex = file.indexOf("!/");
/* 274 */ if (separatorIndex < 0 || !file.startsWith(pathFromRoot, separatorIndex)) {
/* 275 */ return -1;
/* */ }
/* 277 */ return separatorIndex + "!/".length() + pathFromRoot.length();
/* */ }
/* */
/* */ private static JarURLConnection notFound() {
/* */ try {
/* 282 */ return notFound((JarFile)null, (JarEntryName)null);
/* */ }
/* 284 */ catch (IOException ex) {
/* 285 */ throw new IllegalStateException(ex);
/* */ }
/* */ }
/* */
/* */ private static JarURLConnection notFound(JarFile jarFile, JarEntryName jarEntryName) throws IOException {
/* 290 */ if (Boolean.TRUE.equals(useFastExceptions.get())) {
/* 291 */ return NOT_FOUND_CONNECTION;
/* */ }
/* 293 */ return new JarURLConnection(null, jarFile, jarEntryName);
/* */ }
/* */
/* */
/* */
/* */ static class JarEntryName
/* */ {
/* */ private final StringSequence name;
/* */
/* */ private String contentType;
/* */
/* */
/* */ JarEntryName(StringSequence spec) {
/* 306 */ this.name = decode(spec);
/* */ }
/* */
/* */ private StringSequence decode(StringSequence source) {
/* 310 */ if (source.isEmpty() || source.indexOf('%') < 0) {
/* 311 */ return source;
/* */ }
/* 313 */ ByteArrayOutputStream bos = new ByteArrayOutputStream(source.length());
/* 314 */ write(source.toString(), bos);
/* */
/* 316 */ return new StringSequence(AsciiBytes.toString(bos.toByteArray()));
/* */ }
/* */
/* */ private void write(String source, ByteArrayOutputStream outputStream) {
/* 320 */ int length = source.length();
/* 321 */ for (int i = 0; i < length; i++) {
/* 322 */ int c = source.charAt(i);
/* 323 */ if (c > 127) {
/* */ try {
/* 325 */ String encoded = URLEncoder.encode(String.valueOf((char)c), "UTF-8");
/* 326 */ write(encoded, outputStream);
/* */ }
/* 328 */ catch (UnsupportedEncodingException ex) {
/* 329 */ throw new IllegalStateException(ex);
/* */ }
/* */ } else {
/* */
/* 333 */ if (c == 37) {
/* 334 */ if (i + 2 >= length) {
/* 335 */ throw new IllegalArgumentException("Invalid encoded sequence \"" + source
/* 336 */ .substring(i) + "\"");
/* */ }
/* 338 */ c = decodeEscapeSequence(source, i);
/* 339 */ i += 2;
/* */ }
/* 341 */ outputStream.write(c);
/* */ }
/* */ }
/* */ }
/* */
/* */ private char decodeEscapeSequence(String source, int i) {
/* 347 */ int hi = Character.digit(source.charAt(i + 1), 16);
/* 348 */ int lo = Character.digit(source.charAt(i + 2), 16);
/* 349 */ if (hi == -1 || lo == -1) {
/* 350 */ throw new IllegalArgumentException("Invalid encoded sequence \"" + source.substring(i) + "\"");
/* */ }
/* 352 */ return (char)((hi << 4) + lo);
/* */ }
/* */
/* */ CharSequence toCharSequence() {
/* 356 */ return this.name;
/* */ }
/* */
/* */
/* */ public String toString() {
/* 361 */ return this.name.toString();
/* */ }
/* */
/* */ boolean isEmpty() {
/* 365 */ return this.name.isEmpty();
/* */ }
/* */
/* */ String getContentType() {
/* 369 */ if (this.contentType == null) {
/* 370 */ this.contentType = deduceContentType();
/* */ }
/* 372 */ return this.contentType;
/* */ }
/* */
/* */
/* */ private String deduceContentType() {
/* 377 */ String type = isEmpty() ? "x-java/jar" : null;
/* 378 */ type = (type != null) ? type : URLConnection.guessContentTypeFromName(toString());
/* 379 */ type = (type != null) ? type : "content/unknown";
/* 380 */ return type;
/* */ }
/* */
/* */ static JarEntryName get(StringSequence spec) {
/* 384 */ return get(spec, 0);
/* */ }
/* */
/* */ static JarEntryName get(StringSequence spec, int beginIndex) {
/* 388 */ if (spec.length() <= beginIndex) {
/* 389 */ return JarURLConnection.EMPTY_JAR_ENTRY_NAME;
/* */ }
/* 391 */ return new JarEntryName(spec.subSequence(beginIndex));
/* */ }
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\JarURLConnection.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.jar;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.FilePermission;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.JarURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.net.URLStreamHandler;
import java.security.Permission;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
final class JarURLConnection
extends JarURLConnection
{
private static ThreadLocal<Boolean> useFastExceptions = new ThreadLocal<>();
private static final FileNotFoundException FILE_NOT_FOUND_EXCEPTION = new FileNotFoundException("Jar file or entry not found");
private static final IllegalStateException NOT_FOUND_CONNECTION_EXCEPTION = new IllegalStateException(FILE_NOT_FOUND_EXCEPTION);
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(new StringSequence(""));
private static final String READ_ACTION = "read";
private static final JarURLConnection NOT_FOUND_CONNECTION = notFound();
private final JarFile jarFile;
private Permission permission;
private URL jarFileUrl;
private final JarEntryName jarEntryName;
private JarEntry jarEntry;
private JarURLConnection(URL url, JarFile jarFile, JarEntryName jarEntryName) throws IOException {
super(EMPTY_JAR_URL);
this.url = url;
this.jarFile = jarFile;
this.jarEntryName = jarEntryName;
}
public void connect() throws IOException {
if (this.jarFile == null) {
throw FILE_NOT_FOUND_EXCEPTION;
}
if (!this.jarEntryName.isEmpty() && this.jarEntry == null) {
this.jarEntry = this.jarFile.getJarEntry(getEntryName());
if (this.jarEntry == null) {
throwFileNotFound(this.jarEntryName, this.jarFile);
}
}
this.connected = true;
}
public JarFile getJarFile() throws IOException {
connect();
return this.jarFile;
}
public URL getJarFileURL() {
if (this.jarFile == null) {
throw NOT_FOUND_CONNECTION_EXCEPTION;
}
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.contains("!/")) {
return new URL(spec);
}
return new URL("jar:" + spec);
}
catch (MalformedURLException ex) {
throw new IllegalStateException(ex);
}
}
public JarEntry getJarEntry() throws IOException {
if (this.jarEntryName == null || this.jarEntryName.isEmpty()) {
return null;
}
connect();
return this.jarEntry;
}
public String getEntryName() {
if (this.jarFile == null) {
throw NOT_FOUND_CONNECTION_EXCEPTION;
}
return this.jarEntryName.toString();
}
public InputStream getInputStream() throws IOException {
if (this.jarFile == null) {
throw FILE_NOT_FOUND_EXCEPTION;
}
if (this.jarEntryName.isEmpty() && this.jarFile.getType() == JarFile.JarFileType.DIRECT) {
throw new IOException("no entry name specified");
}
connect();
InputStream inputStream = this.jarEntryName.isEmpty() ? this.jarFile.getData().getInputStream() : this.jarFile.getInputStream(this.jarEntry);
if (inputStream == null) {
throwFileNotFound(this.jarEntryName, this.jarFile);
}
return inputStream;
}
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 int getContentLength() {
long length = getContentLengthLong();
if (length > 2147483647L) {
return -1;
}
return (int)length;
}
public long getContentLengthLong() {
if (this.jarFile == null) {
return -1L;
}
try {
if (this.jarEntryName.isEmpty()) {
return this.jarFile.size();
}
JarEntry entry = getJarEntry();
return (entry != null) ? (int)entry.getSize() : -1L;
}
catch (IOException ex) {
return -1L;
}
}
public Object getContent() throws IOException {
connect();
return this.jarEntryName.isEmpty() ? this.jarFile : super.getContent();
}
public String getContentType() {
return (this.jarEntryName != null) ? this.jarEntryName.getContentType() : null;
}
public Permission getPermission() throws IOException {
if (this.jarFile == null) {
throw FILE_NOT_FOUND_EXCEPTION;
}
if (this.permission == null) {
this.permission = new FilePermission(this.jarFile.getRootJarFile().getFile().getPath(), "read");
}
return this.permission;
}
public long getLastModified() {
if (this.jarFile == null || this.jarEntryName.isEmpty()) {
return 0L;
}
try {
JarEntry entry = getJarEntry();
return (entry != null) ? entry.getTime() : 0L;
}
catch (IOException ex) {
return 0L;
}
}
static void setUseFastExceptions(boolean useFastExceptions) {
JarURLConnection.useFastExceptions.set(Boolean.valueOf(useFastExceptions));
}
static JarURLConnection get(URL url, JarFile jarFile) throws IOException {
StringSequence spec = new StringSequence(url.getFile());
int index = indexOfRootSpec(spec, jarFile.getPathFromRoot());
if (index == -1) {
return Boolean.TRUE.equals(useFastExceptions.get()) ? NOT_FOUND_CONNECTION : new JarURLConnection(url, null, EMPTY_JAR_ENTRY_NAME);
}
int separator;
while ((separator = spec.indexOf("!/", index)) > 0) {
JarEntryName entryName = JarEntryName.get(spec.subSequence(index, separator));
JarEntry jarEntry = jarFile.getJarEntry(entryName.toCharSequence());
if (jarEntry == null) {
return notFound(jarFile, entryName);
}
jarFile = jarFile.getNestedJarFile(jarEntry);
index = separator + "!/".length();
}
JarEntryName jarEntryName = JarEntryName.get(spec, index);
if (Boolean.TRUE.equals(useFastExceptions.get()) && !jarEntryName.isEmpty() &&
!jarFile.containsEntry(jarEntryName.toString())) {
return NOT_FOUND_CONNECTION;
}
return new JarURLConnection(url, new JarFile(jarFile), jarEntryName);
}
private static int indexOfRootSpec(StringSequence file, String pathFromRoot) {
int separatorIndex = file.indexOf("!/");
if (separatorIndex < 0 || !file.startsWith(pathFromRoot, separatorIndex)) {
return -1;
}
return separatorIndex + "!/".length() + pathFromRoot.length();
}
private static JarURLConnection notFound() {
try {
return notFound((JarFile)null, (JarEntryName)null);
}
catch (IOException ex) {
throw new IllegalStateException(ex);
}
}
private static JarURLConnection notFound(JarFile jarFile, JarEntryName jarEntryName) throws IOException {
if (Boolean.TRUE.equals(useFastExceptions.get())) {
return NOT_FOUND_CONNECTION;
}
return new JarURLConnection(null, jarFile, jarEntryName);
}
static class JarEntryName
{
private final StringSequence name;
private String contentType;
JarEntryName(StringSequence spec) {
this.name = decode(spec);
}
private StringSequence decode(StringSequence source) {
if (source.isEmpty() || source.indexOf('%') < 0) {
return source;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream(source.length());
write(source.toString(), bos);
return new StringSequence(AsciiBytes.toString(bos.toByteArray()));
}
private void write(String source, ByteArrayOutputStream outputStream) {
int length = source.length();
for (int i = 0; i < length; i++) {
int c = source.charAt(i);
if (c > 127) {
try {
String encoded = URLEncoder.encode(String.valueOf((char)c), "UTF-8");
write(encoded, outputStream);
}
catch (UnsupportedEncodingException ex) {
throw new IllegalStateException(ex);
}
} else {
if (c == 37) {
if (i + 2 >= length) {
throw new IllegalArgumentException("Invalid encoded sequence \"" + source
.substring(i) + "\"");
}
c = decodeEscapeSequence(source, i);
i += 2;
}
outputStream.write(c);
}
}
}
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);
}
CharSequence toCharSequence() {
return this.name;
}
public String toString() {
return this.name.toString();
}
boolean isEmpty() {
return this.name.isEmpty();
}
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;
}
static JarEntryName get(StringSequence spec) {
return get(spec, 0);
}
static JarEntryName get(StringSequence spec, int beginIndex) {
if (spec.length() <= beginIndex) {
return JarURLConnection.EMPTY_JAR_ENTRY_NAME;
}
return new JarEntryName(spec.subSequence(beginIndex));
}
}
}
@@ -1,159 +1,155 @@
/* */ package org.springframework.boot.loader.jar;
/* */
/* */ import java.util.Objects;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ final class StringSequence
/* */ implements CharSequence
/* */ {
/* */ private final String source;
/* */ private final int start;
/* */ private final int end;
/* */ private int hash;
/* */
/* */ StringSequence(String source) {
/* 39 */ this(source, 0, (source != null) ? source.length() : -1);
/* */ }
/* */
/* */ StringSequence(String source, int start, int end) {
/* 43 */ Objects.requireNonNull(source, "Source must not be null");
/* 44 */ if (start < 0) {
/* 45 */ throw new StringIndexOutOfBoundsException(start);
/* */ }
/* 47 */ if (end > source.length()) {
/* 48 */ throw new StringIndexOutOfBoundsException(end);
/* */ }
/* 50 */ this.source = source;
/* 51 */ this.start = start;
/* 52 */ this.end = end;
/* */ }
/* */
/* */ StringSequence subSequence(int start) {
/* 56 */ return subSequence(start, length());
/* */ }
/* */
/* */
/* */ public StringSequence subSequence(int start, int end) {
/* 61 */ int subSequenceStart = this.start + start;
/* 62 */ int subSequenceEnd = this.start + end;
/* 63 */ if (subSequenceStart > this.end) {
/* 64 */ throw new StringIndexOutOfBoundsException(start);
/* */ }
/* 66 */ if (subSequenceEnd > this.end) {
/* 67 */ throw new StringIndexOutOfBoundsException(end);
/* */ }
/* 69 */ if (start == 0 && subSequenceEnd == this.end) {
/* 70 */ return this;
/* */ }
/* 72 */ return new StringSequence(this.source, subSequenceStart, subSequenceEnd);
/* */ }
/* */
/* */ boolean isEmpty() {
/* 76 */ return (length() == 0);
/* */ }
/* */
/* */
/* */ public int length() {
/* 81 */ return this.end - this.start;
/* */ }
/* */
/* */
/* */ public char charAt(int index) {
/* 86 */ return this.source.charAt(this.start + index);
/* */ }
/* */
/* */ int indexOf(char ch) {
/* 90 */ return this.source.indexOf(ch, this.start) - this.start;
/* */ }
/* */
/* */ int indexOf(String str) {
/* 94 */ return this.source.indexOf(str, this.start) - this.start;
/* */ }
/* */
/* */ int indexOf(String str, int fromIndex) {
/* 98 */ return this.source.indexOf(str, this.start + fromIndex) - this.start;
/* */ }
/* */
/* */ boolean startsWith(String prefix) {
/* 102 */ return startsWith(prefix, 0);
/* */ }
/* */
/* */ boolean startsWith(String prefix, int offset) {
/* 106 */ int prefixLength = prefix.length();
/* 107 */ int length = length();
/* 108 */ if (length - prefixLength - offset < 0) {
/* 109 */ return false;
/* */ }
/* 111 */ return this.source.startsWith(prefix, this.start + offset);
/* */ }
/* */
/* */
/* */ public boolean equals(Object obj) {
/* 116 */ if (this == obj) {
/* 117 */ return true;
/* */ }
/* 119 */ if (!(obj instanceof CharSequence)) {
/* 120 */ return false;
/* */ }
/* 122 */ CharSequence other = (CharSequence)obj;
/* 123 */ int n = length();
/* 124 */ if (n != other.length()) {
/* 125 */ return false;
/* */ }
/* 127 */ int i = 0;
/* 128 */ while (n-- != 0) {
/* 129 */ if (charAt(i) != other.charAt(i)) {
/* 130 */ return false;
/* */ }
/* 132 */ i++;
/* */ }
/* 134 */ return true;
/* */ }
/* */
/* */
/* */ public int hashCode() {
/* 139 */ int hash = this.hash;
/* 140 */ if (hash == 0 && length() > 0) {
/* 141 */ for (int i = this.start; i < this.end; i++) {
/* 142 */ hash = 31 * hash + this.source.charAt(i);
/* */ }
/* 144 */ this.hash = hash;
/* */ }
/* 146 */ return hash;
/* */ }
/* */
/* */
/* */ public String toString() {
/* 151 */ return this.source.substring(this.start, this.end);
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\StringSequence.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.jar;
import java.util.Objects;
final class StringSequence
implements CharSequence
{
private final String source;
private final int start;
private final int end;
private int hash;
StringSequence(String source) {
this(source, 0, (source != null) ? source.length() : -1);
}
StringSequence(String source, int start, int end) {
Objects.requireNonNull(source, "Source must not be null");
if (start < 0) {
throw new StringIndexOutOfBoundsException(start);
}
if (end > source.length()) {
throw new StringIndexOutOfBoundsException(end);
}
this.source = source;
this.start = start;
this.end = end;
}
StringSequence subSequence(int start) {
return subSequence(start, length());
}
public StringSequence subSequence(int start, int end) {
int subSequenceStart = this.start + start;
int subSequenceEnd = this.start + end;
if (subSequenceStart > this.end) {
throw new StringIndexOutOfBoundsException(start);
}
if (subSequenceEnd > this.end) {
throw new StringIndexOutOfBoundsException(end);
}
if (start == 0 && subSequenceEnd == this.end) {
return this;
}
return new StringSequence(this.source, subSequenceStart, subSequenceEnd);
}
boolean isEmpty() {
return (length() == 0);
}
public int length() {
return this.end - this.start;
}
public char charAt(int index) {
return this.source.charAt(this.start + index);
}
int indexOf(char ch) {
return this.source.indexOf(ch, this.start) - this.start;
}
int indexOf(String str) {
return this.source.indexOf(str, this.start) - this.start;
}
int indexOf(String str, int fromIndex) {
return this.source.indexOf(str, this.start + fromIndex) - this.start;
}
boolean startsWith(String prefix) {
return startsWith(prefix, 0);
}
boolean startsWith(String prefix, int offset) {
int prefixLength = prefix.length();
int length = length();
if (length - prefixLength - offset < 0) {
return false;
}
return this.source.startsWith(prefix, this.start + offset);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof CharSequence)) {
return false;
}
CharSequence other = (CharSequence)obj;
int n = length();
if (n != other.length()) {
return false;
}
int i = 0;
while (n-- != 0) {
if (charAt(i) != other.charAt(i)) {
return false;
}
i++;
}
return true;
}
public int hashCode() {
int hash = this.hash;
if (hash == 0 && length() > 0) {
for (int i = this.start; i < this.end; i++) {
hash = 31 * hash + this.source.charAt(i);
}
this.hash = hash;
}
return hash;
}
public String toString() {
return this.source.substring(this.start, this.end);
}
}
@@ -1,93 +1,89 @@
/* */ 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 int available;
/* */ private boolean extraBytesWritten;
/* */
/* */ 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;
/* */ }
/* */
/* */
/* */ public void close() throws IOException {
/* 61 */ super.close();
/* 62 */ this.inf.end();
/* */ }
/* */
/* */
/* */ protected void fill() throws IOException {
/* */ try {
/* 68 */ super.fill();
/* */ }
/* 70 */ catch (EOFException ex) {
/* 71 */ if (this.extraBytesWritten) {
/* 72 */ throw ex;
/* */ }
/* 74 */ this.len = 1;
/* 75 */ this.buf[0] = 0;
/* 76 */ this.extraBytesWritten = true;
/* 77 */ this.inf.setInput(this.buf, 0, this.len);
/* */ }
/* */ }
/* */
/* */ private static int getInflaterBufferSize(long size) {
/* 82 */ size += 2L;
/* 83 */ size = (size > 65536L) ? 8192L : size;
/* 84 */ size = (size <= 0L) ? 4096L : size;
/* 85 */ return (int)size;
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jar\ZipInflaterInputStream.class
* Java compiler version: 8 (52.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 int available;
private boolean extraBytesWritten;
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;
}
public void close() throws IOException {
super.close();
this.inf.end();
}
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;
}
}
@@ -1,13 +1,9 @@
package org.springframework.boot.loader.jarmode;
public interface JarMode {
boolean accepts(String paramString);
void run(String paramString, String[] paramArrayOfString);
}
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jarmode\JarMode.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.jarmode;
public interface JarMode {
boolean accepts(String paramString);
void run(String paramString, String[] paramArrayOfString);
}
@@ -1,57 +1,53 @@
/* */ package org.springframework.boot.loader.jarmode;
/* */
/* */ import java.util.List;
/* */ import org.springframework.core.io.support.SpringFactoriesLoader;
/* */ import org.springframework.util.ClassUtils;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public final class JarModeLauncher
/* */ {
/* 32 */ static final String DISABLE_SYSTEM_EXIT = JarModeLauncher.class.getName() + ".DISABLE_SYSTEM_EXIT";
/* */
/* */
/* */
/* */
/* */ public static void main(String[] args) {
/* 38 */ String mode = System.getProperty("jarmode");
/* 39 */ List<JarMode> candidates = SpringFactoriesLoader.loadFactories(JarMode.class,
/* 40 */ ClassUtils.getDefaultClassLoader());
/* 41 */ for (JarMode candidate : candidates) {
/* 42 */ if (candidate.accepts(mode)) {
/* 43 */ candidate.run(mode, args);
/* */ return;
/* */ }
/* */ }
/* 47 */ System.err.println("Unsupported jarmode '" + mode + "'");
/* 48 */ if (!Boolean.getBoolean(DISABLE_SYSTEM_EXIT))
/* 49 */ System.exit(1);
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jarmode\JarModeLauncher.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.jarmode;
import java.util.List;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.util.ClassUtils;
public final class JarModeLauncher
{
static final String DISABLE_SYSTEM_EXIT = JarModeLauncher.class.getName() + ".DISABLE_SYSTEM_EXIT";
public static void main(String[] args) {
String mode = System.getProperty("jarmode");
List<JarMode> candidates = SpringFactoriesLoader.loadFactories(JarMode.class,
ClassUtils.getDefaultClassLoader());
for (JarMode candidate : candidates) {
if (candidate.accepts(mode)) {
candidate.run(mode, args);
return;
}
}
System.err.println("Unsupported jarmode '" + mode + "'");
if (!Boolean.getBoolean(DISABLE_SYSTEM_EXIT))
System.exit(1);
}
}
@@ -1,43 +1,39 @@
/* */ package org.springframework.boot.loader.jarmode;
/* */
/* */ import java.util.Arrays;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ class TestJarMode
/* */ implements JarMode
/* */ {
/* */ public boolean accepts(String mode) {
/* 30 */ return "test".equals(mode);
/* */ }
/* */
/* */
/* */ public void run(String mode, String[] args) {
/* 35 */ System.out.println("running in " + mode + " jar mode " + Arrays.<String>asList(args));
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loader\jarmode\TestJarMode.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.jarmode;
import java.util.Arrays;
class TestJarMode
implements JarMode
{
public boolean accepts(String mode) {
return "test".equals(mode);
}
public void run(String mode, String[] args) {
System.out.println("running in " + mode + " jar mode " + Arrays.<String>asList(args));
}
}
@@ -1,237 +1,233 @@
/* */ package org.springframework.boot.loader.util;
/* */
/* */ import java.util.HashSet;
/* */ import java.util.Locale;
/* */ 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 = ":";
/* 56 */ private static final String SIMPLE_PREFIX = "${".substring(1);
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String resolvePlaceholders(String text) {
/* 68 */ if (text == null) {
/* 69 */ return text;
/* */ }
/* 71 */ return parseStringValue(null, text, text, new HashSet<>());
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String resolvePlaceholders(Properties properties, String text) {
/* 85 */ if (text == null) {
/* 86 */ return text;
/* */ }
/* 88 */ return parseStringValue(properties, text, text, new HashSet<>());
/* */ }
/* */
/* */
/* */
/* */ private static String parseStringValue(Properties properties, String value, String current, Set<String> visitedPlaceholders) {
/* 94 */ StringBuilder buf = new StringBuilder(current);
/* */
/* 96 */ int startIndex = current.indexOf("${");
/* 97 */ while (startIndex != -1) {
/* 98 */ int endIndex = findPlaceholderEndIndex(buf, startIndex);
/* 99 */ 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);
/* */
/* 111 */ String propVal = resolvePlaceholder(properties, value, placeholder);
/* 112 */ if (propVal == null) {
/* 113 */ int separatorIndex = placeholder.indexOf(":");
/* 114 */ if (separatorIndex != -1) {
/* 115 */ String actualPlaceholder = placeholder.substring(0, separatorIndex);
/* 116 */ String defaultValue = placeholder.substring(separatorIndex + ":".length());
/* 117 */ propVal = resolvePlaceholder(properties, value, actualPlaceholder);
/* 118 */ if (propVal == null) {
/* 119 */ propVal = defaultValue;
/* */ }
/* */ }
/* */ }
/* 123 */ if (propVal != null) {
/* */
/* */
/* 126 */ propVal = parseStringValue(properties, value, propVal, visitedPlaceholders);
/* 127 */ buf.replace(startIndex, endIndex + "}".length(), propVal);
/* 128 */ startIndex = buf.indexOf("${", startIndex + propVal.length());
/* */ }
/* */ else {
/* */
/* 132 */ startIndex = buf.indexOf("${", endIndex + "}".length());
/* */ }
/* 134 */ visitedPlaceholders.remove(originalPlaceholder);
/* */ continue;
/* */ }
/* 137 */ startIndex = -1;
/* */ }
/* */
/* */
/* 141 */ return buf.toString();
/* */ }
/* */
/* */ private static String resolvePlaceholder(Properties properties, String text, String placeholderName) {
/* 145 */ String propVal = getProperty(placeholderName, null, text);
/* 146 */ if (propVal != null) {
/* 147 */ return propVal;
/* */ }
/* 149 */ return (properties != null) ? properties.getProperty(placeholderName) : null;
/* */ }
/* */
/* */ public static String getProperty(String key) {
/* 153 */ return getProperty(key, null, "");
/* */ }
/* */
/* */ public static String getProperty(String key, String defaultValue) {
/* 157 */ return getProperty(key, defaultValue, "");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static String getProperty(String key, String defaultValue, String text) {
/* */ try {
/* 172 */ String propVal = System.getProperty(key);
/* 173 */ if (propVal == null)
/* */ {
/* 175 */ propVal = System.getenv(key);
/* */ }
/* 177 */ if (propVal == null) {
/* */
/* 179 */ String name = key.replace('.', '_');
/* 180 */ propVal = System.getenv(name);
/* */ }
/* 182 */ if (propVal == null) {
/* */
/* 184 */ String name = key.toUpperCase(Locale.ENGLISH).replace('.', '_');
/* 185 */ propVal = System.getenv(name);
/* */ }
/* 187 */ if (propVal != null) {
/* 188 */ return propVal;
/* */ }
/* */ }
/* 191 */ catch (Throwable ex) {
/* 192 */ System.err.println("Could not resolve key '" + key + "' in '" + text + "' as system property or in environment: " + ex);
/* */ }
/* */
/* 195 */ return defaultValue;
/* */ }
/* */
/* */ private static int findPlaceholderEndIndex(CharSequence buf, int startIndex) {
/* 199 */ int index = startIndex + "${".length();
/* 200 */ int withinNestedPlaceholder = 0;
/* 201 */ while (index < buf.length()) {
/* 202 */ if (substringMatch(buf, index, "}")) {
/* 203 */ if (withinNestedPlaceholder > 0) {
/* 204 */ withinNestedPlaceholder--;
/* 205 */ index += "}".length();
/* */ continue;
/* */ }
/* 208 */ return index;
/* */ }
/* */
/* 211 */ if (substringMatch(buf, index, SIMPLE_PREFIX)) {
/* 212 */ withinNestedPlaceholder++;
/* 213 */ index += SIMPLE_PREFIX.length();
/* */ continue;
/* */ }
/* 216 */ index++;
/* */ }
/* */
/* 219 */ return -1;
/* */ }
/* */
/* */ private static boolean substringMatch(CharSequence str, int index, CharSequence substring) {
/* 223 */ for (int j = 0; j < substring.length(); j++) {
/* 224 */ int i = index + j;
/* 225 */ if (i >= str.length() || str.charAt(i) != substring.charAt(j)) {
/* 226 */ return false;
/* */ }
/* */ }
/* 229 */ return true;
/* */ }
/* */ }
/* Location: D:\星中心\ninca_qk_alarm_app_01-ninca_qk_alarm_app\ninca-qk-alarm-app-V2.9.2_20210730.jar!\org\springframework\boot\loade\\util\SystemPropertyUtils.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/
package org.springframework.boot.loader.util;
import java.util.HashSet;
import java.util.Locale;
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<>());
}
public static String resolvePlaceholders(Properties properties, String text) {
if (text == null) {
return text;
}
return parseStringValue(properties, text, text, new HashSet<>());
}
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) {
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) ? properties.getProperty(placeholderName) : null;
}
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) {
String name = key.replace('.', '_');
propVal = System.getenv(name);
}
if (propVal == null) {
String name = key.toUpperCase(Locale.ENGLISH).replace('.', '_');
propVal = System.getenv(name);
}
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;
}
}