This commit is contained in:
Abhijit Saha 2010-10-27 13:09:27 -07:00
commit 2ce0024552
345 changed files with 13905 additions and 3891 deletions

View File

@ -86,3 +86,5 @@ c4c8a5bc54f66abc68cd185d9294042121922154 jdk7-b99
e02b4d709e177d08d56130a4bc68061e4bbacc7d jdk7-b109
a6442d6bc38a44152e0662688213ce4d2701f42a jdk7-b110
69f3edf083477955b5bd2f754252c7504167d8e1 jdk7-b111
f960f117f1623629f64203e2b09a92a8f6f14ff5 jdk7-b112
1fee41c7ed2b3388970a756a85aa693c0de8407a jdk7-b113

View File

@ -86,3 +86,5 @@ f8be576feefce0c6695f188ef97ec16b73ad9cfd jdk7-b104
81dfc728d7bb7e1fff4a4dc6d0f7cea5a3315667 jdk7-b109
2a02d4a6955c7c078aee9a604cb3be409800d82c jdk7-b110
9702d6fef68e17533ee7fcf5923b11ead3e912ce jdk7-b111
b852103caf73da70068473777ae867a457bb3ae1 jdk7-b112
c1df968c4527bfab5f97662a89245f15d12d378b jdk7-b113

View File

@ -558,9 +558,12 @@ endif
# rule to test
################################################################
.NOTPARALLEL: test
.NOTPARALLEL: test_run
test: test_clean test_start test_summary
test:
$(MAKE) test_run
test_run: test_clean test_start test_summary
test_start:
@$(ECHO) "Tests started at `$(DATE)`"
@ -586,7 +589,7 @@ test_summary: $(OUTPUTDIR)/test_failures.txt
# Get failure list from log
$(OUTPUTDIR)/test_failures.txt: $(OUTPUTDIR)/test_log.txt
@$(RM) $@
@( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) > $@
@( $(EGREP) '^FAILED:' $< || $(ECHO) "" ) | $(NAWK) 'length>0' > $@
# Get log file of all tests run
JDK_TO_TEST := $(shell \
@ -598,10 +601,11 @@ JDK_TO_TEST := $(shell \
$(ECHO) "$(PRODUCT_HOME)"; \
fi \
)
TEST_TARGETS=all
$(OUTPUTDIR)/test_log.txt:
$(RM) $@
( $(CD) test && \
$(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) \
( $(CD) test && \
$(MAKE) NO_STOPPING=- PRODUCT_HOME=$(JDK_TO_TEST) $(TEST_TARGETS) \
) | tee $@
################################################################
@ -614,7 +618,7 @@ include ./make/jprt.gmk
# PHONY
################################################################
.PHONY: all test test_start test_summary test_clean \
.PHONY: all test test_run test_start test_summary test_clean \
generic_build_repo_series \
what clobber insane \
dev dev-build dev-sanity dev-clobber \

View File

@ -86,3 +86,5 @@ a56d734a1e970e1a21a8f4feb13053e9a33674c7 jdk7-b100
c3dd858e09b20206459d9e7b0ead99d27ab00eab jdk7-b109
0e1f80fda2271f53d4bbb59ec3f301dfbcef6a0a jdk7-b110
640fa4d4e2ad4c2d7e4815c955026740d8c52b7a jdk7-b111
cc67fdc4fee9a5b25caee4e71b51a8ff24ae7d1a jdk7-b112
a89a6c5be9d1a754868d3d359cbf7ad36aa95631 jdk7-b113

View File

@ -121,3 +121,5 @@ e44a93947ccbfce712b51725f313163606f15486 jdk7-b108
cc4bb3022b3144dc5db0805b9ef6c7eff2aa3b81 jdk7-b109
2f25f2b8de2700a1822463b1bd3d02b5e218018f jdk7-b110
07b042e13dde4f3479ba9ec55120fcd5e8623323 jdk7-b111
5511edd5d719f3fc9fdd04879482026a3d2c8652 jdk7-b112
beef35b96b81129c375d572357fb9548d9020db1 jdk7-b113

View File

@ -86,3 +86,5 @@ d42c4acb6424a094bdafe2ad9c8c1c7ca7fb7b7e jdk7-b104
0f382d6120fc07aed2209484a42458cabf405916 jdk7-b109
d422dbdd09766269344b796b3a46a5b3f74557e1 jdk7-b110
8106c747067c905d814a737a57fea0e29057b33f jdk7-b111
1b05254242881527b4d5d711295c0fe708c8823a jdk7-b112
bc0c84ce54c34d3e8b0604b94da0d7c75c26755e jdk7-b113

View File

@ -86,3 +86,5 @@ b1ca39340238a239ba6d8489ad5315215e1366ca jdk7-b108
4f626e0d70bda68c76bbd0e89d2bc2407f979736 jdk7-b109
95ecac35fb11530752bd0404c9bf02bcfb30990e jdk7-b110
2575ebca96c7fb1b78f6ae025a97321210aba309 jdk7-b111
8e0f0054817f0f73fb33e80fb1333fb45b1d513d jdk7-b112
d35c94fd22362f478f75b4bfcd2bef6a83cb9b3f jdk7-b113

View File

@ -86,3 +86,5 @@ b91ef6b60f4e19bf4592c6dd594c9bac62487519 jdk7-b106
ab0d3f54a63f2aadfcdd2e14b81f79362ce454e2 jdk7-b109
176586cd040e4dd17a5ff6e91f72df10d7442453 jdk7-b110
fb63a2688db807a73e2a3de7d9bab298f1bff0e8 jdk7-b111
b53f226b1d91473ac54184afa827be07b87e0319 jdk7-b112
61d3b9fbb26bdef56cfa41b9af5bc312a22cbeb8 jdk7-b113

View File

@ -466,14 +466,11 @@ JAVA_JAVA_java = \
java/security/ProtectionDomain.java \
java/net/URLClassLoader.java \
java/net/URLConnection.java \
sun/misc/BootClassLoaderHook.java \
sun/misc/Launcher.java \
sun/misc/MetaIndex.java \
sun/misc/URLClassPath.java \
sun/misc/Version.java \
sun/net/www/protocol/jar/Handler.java \
sun/net/www/protocol/jar/JarURLConnection.java \
sun/net/www/protocol/file/Handler.java \
sun/net/www/protocol/file/FileURLConnection.java \
sun/misc/FileURLMapper.java \
sun/misc/MessageUtils.java \
sun/misc/GC.java \
@ -483,6 +480,10 @@ JAVA_JAVA_java = \
sun/misc/JavaIOFileDescriptorAccess.java \
sun/misc/JavaNioAccess.java \
sun/misc/Perf.java \
sun/misc/PerfCounter.java
sun/misc/PerfCounter.java \
sun/net/www/protocol/jar/Handler.java \
sun/net/www/protocol/jar/JarURLConnection.java \
sun/net/www/protocol/file/Handler.java \
sun/net/www/protocol/file/FileURLConnection.java
FILES_java = $(JAVA_JAVA_java)

View File

@ -31,7 +31,7 @@ BUILDDIR = ..
PRODUCT = demos
include $(BUILDDIR)/common/Defs.gmk
SUBDIRS = jni
SUBDIRS = jni nio
SUBDIRS_desktop = applets jfc
SUBDIRS_management = management
SUBDIRS_misc = scripting

View File

@ -0,0 +1,39 @@
#
# Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Makefile for building the jfc demos
#
BUILDDIR = ../..
PRODUCT = demos
include $(BUILDDIR)/common/Defs.gmk
SUBDIRS = zipfs
include $(BUILDDIR)/common/Subdirs.gmk
all build clean clobber::
$(SUBDIRS-loop)

View File

@ -0,0 +1,44 @@
#
# Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Makefile to build the ZipFileSystem demo.
#
BUILDDIR = ../../..
PRODUCT = demo/zipfs
DEMONAME = zipfs
include $(BUILDDIR)/common/Defs.gmk
DEMO_ROOT = $(SHARE_SRC)/demo/nio/$(DEMONAME)
DEMO_TOPFILES = ./README.txt
DEMO_SRCDIR = $(DEMO_ROOT)
DEMO_DESTDIR = $(DEMODIR)/nio/$(DEMONAME)
#
# Demo jar building rules.
#
include $(BUILDDIR)/common/Demo.gmk

View File

@ -80,7 +80,12 @@ vpath %.c $(SHARE_SRC)/native/$(PKGDIR)
vpath %.c $(SHARE_SRC)/native/sun/java2d
ifeq ($(PLATFORM), windows)
OTHER_CFLAGS += -DCMS_IS_WINDOWS_ -Dsqrtf=sqrt
OTHER_CFLAGS += -DCMS_IS_WINDOWS_
ifeq ($(COMPILER_VERSION), VS2003)
OTHER_CFLAGS += -Dsqrtf=sqrt
endif
OTHER_LDLIBS = $(OBJDIR)/../../../sun.awt/awt/$(OBJDIRNAME)/awt.lib
OTHER_INCLUDES += -I$(SHARE_SRC)/native/sun/java2d \
-I$(SHARE_SRC)/native/sun/awt/debug

View File

@ -355,7 +355,6 @@ JavaMain(void * _args)
JavaVM *vm = 0;
JNIEnv *env = 0;
jstring mainClassName;
jclass mainClass;
jmethodID mainID;
jobjectArray mainArgs;

View File

@ -72,7 +72,7 @@ inflate_file(int fd, zentry *entry, int *size_out)
if (entry->how == STORED) {
*(char *)((size_t)in + entry->csize) = '\0';
if (size_out) {
*size_out = entry->csize;
*size_out = (int)entry->csize;
}
return (in);
} else if (entry->how == DEFLATED) {
@ -103,7 +103,7 @@ inflate_file(int fd, zentry *entry, int *size_out)
return (NULL);
}
if (size_out) {
*size_out = entry->isize;
*size_out = (int)entry->isize;
}
return (out);
} else
@ -317,7 +317,7 @@ find_file(int fd, zentry *entry, const char *file_name)
* manifest. If so, build the entry record from the data found in
* the header located and return success.
*/
if (CENNAM(p) == JLI_StrLen(file_name) &&
if ((size_t)CENNAM(p) == JLI_StrLen(file_name) &&
memcmp((p + CENHDR), file_name, JLI_StrLen(file_name)) == 0) {
if (lseek(fd, base_offset + CENOFF(p), SEEK_SET) < (off_t)0) {
free(buffer);
@ -606,8 +606,5 @@ JLI_ManifestIterate(const char *jarfile, attribute_closure ac, void *user_data)
}
free(mp);
close(fd);
if (rc == 0)
return (0);
else
return (-2);
return (rc == 0) ? 0 : -2;
}

View File

@ -290,12 +290,12 @@ FileList_join(FileList fl, char sep)
char *path;
char *p;
for (i = 0, size = 1; i < fl->size; i++)
size += JLI_StrLen(fl->files[i]) + 1;
size += (int)JLI_StrLen(fl->files[i]) + 1;
path = JLI_MemAlloc(size);
for (i = 0, p = path; i < fl->size; i++) {
int len = JLI_StrLen(fl->files[i]);
int len = (int)JLI_StrLen(fl->files[i]);
if (i > 0) *p++ = sep;
memcpy(p, fl->files[i], len);
p += len;
@ -309,7 +309,7 @@ static FileList
FileList_split(const char *path, char sep)
{
const char *p, *q;
int len = JLI_StrLen(path);
int len = (int)JLI_StrLen(path);
int count;
FileList fl;
for (count = 1, p = path; p < path + len; p++)
@ -330,7 +330,7 @@ FileList_split(const char *path, char sep)
static int
isJarFileName(const char *filename)
{
int len = JLI_StrLen(filename);
int len = (int)JLI_StrLen(filename);
return (len >= 4) &&
(filename[len - 4] == '.') &&
(equal(filename + len - 3, "jar") ||
@ -342,8 +342,8 @@ isJarFileName(const char *filename)
static char *
wildcardConcat(const char *wildcard, const char *basename)
{
int wildlen = JLI_StrLen(wildcard);
int baselen = JLI_StrLen(basename);
int wildlen = (int)JLI_StrLen(wildcard);
int baselen = (int)JLI_StrLen(basename);
char *filename = (char *) JLI_MemAlloc(wildlen + baselen);
/* Replace the trailing '*' with basename */
memcpy(filename, wildcard, wildlen-1);
@ -369,7 +369,7 @@ wildcardFileList(const char *wildcard)
static int
isWildcard(const char *filename)
{
int len = JLI_StrLen(filename);
int len = (int)JLI_StrLen(filename);
return (len > 0) &&
(filename[len - 1] == '*') &&
(len == 1 || IS_FILE_SEPARATOR(filename[len - 2])) &&

View File

@ -654,8 +654,8 @@ class Attribute implements Comparable, Constants {
String layout;
public FormatException(String message,
int ctype, String name, String layout) {
super(ATTR_CONTEXT_NAME[ctype]+"."+name
+(message == null? "": (": "+message)));
super(ATTR_CONTEXT_NAME[ctype]+ " attribute \"" + name + "\"" +
(message == null? "" : (": " + message)));
this.ctype = ctype;
this.name = name;
this.layout = layout;

View File

@ -30,6 +30,7 @@ import java.util.*;
import com.sun.java.util.jar.pack.Package.Class;
import com.sun.java.util.jar.pack.Package.InnerClass;
import com.sun.java.util.jar.pack.ConstantPool.*;
import com.sun.tools.classfile.AttributeException;
/**
* Reader for a class file that is being incorporated into a package.
@ -246,7 +247,9 @@ class ClassReader implements Constants {
fixups[fptr++] = in.readUnsignedShort();
break;
default:
throw new IOException("Bad constant pool tag "+tag);
throw new ClassFormatException("Bad constant pool tag " +
tag + " in File: " + cls.file.nameString +
" at pos: " + inPos);
}
}
@ -403,7 +406,7 @@ class ClassReader implements Constants {
skip(length, "unknown "+name+" attribute in "+h);
continue;
} else {
String message = "unknown in "+h;
String message = " is unknown attribute in class " + h;
throw new Attribute.FormatException(message, ctype, name,
unknownAttrCommand);
}
@ -415,7 +418,12 @@ class ClassReader implements Constants {
if (a.name() == "Code") {
Class.Method m = (Class.Method) h;
m.code = new Code(m);
readCode(m.code);
try {
readCode(m.code);
} catch (Instruction.FormatException iie) {
String message = iie.getMessage() + " in " + h;
throw new ClassReader.ClassFormatException(message);
}
} else {
assert(h == cls);
readInnerClasses(cls);
@ -427,6 +435,10 @@ class ClassReader implements Constants {
in.readFully(bytes);
a = a.addContent(bytes);
}
if (a.size() == 0 && !a.layout().isEmpty()) {
throw new ClassFormatException(name +
": attribute length cannot be zero, in " + h);
}
h.addAttribute(a);
if (verbose > 2)
Utils.log.fine("read "+a);
@ -438,6 +450,7 @@ class ClassReader implements Constants {
code.max_locals = readUnsignedShort();
code.bytes = new byte[readInt()];
in.readFully(code.bytes);
Instruction.opcodeChecker(code.bytes);
int nh = readUnsignedShort();
code.setHandlerCount(nh);
for (int i = 0; i < nh; i++) {
@ -463,4 +476,10 @@ class ClassReader implements Constants {
cls.innerClasses = ics; // set directly; do not use setInnerClasses.
// (Later, ics may be transferred to the pkg.)
}
class ClassFormatException extends IOException {
public ClassFormatException(String message) {
super(message);
}
}
}

View File

@ -25,6 +25,8 @@
package com.sun.java.util.jar.pack;
import java.io.IOException;
/**
* A parsed bytecode instruction.
* Provides accessors to various relevant bits.
@ -628,4 +630,21 @@ class Instruction implements Constants {
}
}
}
public static void opcodeChecker(byte[] code) throws FormatException {
Instruction i = at(code, 0);
while (i != null) {
int opcode = i.getBC();
if (opcode == _xxxunusedxxx || opcode < _nop || opcode > _jsr_w) {
String message = "illegal opcode: " + opcode + " " + i;
throw new FormatException(message);
}
i = i.next();
}
}
static class FormatException extends IOException {
FormatException(String message) {
super(message);
}
}
}

View File

@ -496,15 +496,29 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
reader.unknownAttrCommand = unknownAttrCommand;
try {
reader.read();
} catch (Attribute.FormatException ee) {
// He passed up the category to us in layout.
if (ee.layout.equals(Pack200.Packer.PASS)) {
Utils.log.warning("Passing class file uncompressed due to unrecognized attribute: "+fname);
Utils.log.info(ee.toString());
return null;
} catch (IOException ioe) {
String message = "Passing class file uncompressed due to";
if (ioe instanceof Attribute.FormatException) {
Attribute.FormatException ee = (Attribute.FormatException) ioe;
// He passed up the category to us in layout.
if (ee.layout.equals(Pack200.Packer.PASS)) {
Utils.log.info(ee.toString());
Utils.log.warning(message + " unrecognized attribute: " +
fname);
return null;
}
} else if (ioe instanceof ClassReader.ClassFormatException) {
ClassReader.ClassFormatException ce = (ClassReader.ClassFormatException) ioe;
// %% TODO: Do we invent a new property for this or reuse %%
if (unknownAttrCommand.equals(Pack200.Packer.PASS)) {
Utils.log.info(ce.toString());
Utils.log.warning(message + " unknown class format: " +
fname);
return null;
}
}
// Otherwise, it must be an error.
throw ee;
throw ioe;
}
pkg.addClass(cls);
return cls.file;

View File

@ -182,11 +182,8 @@ class Utils {
}
public void warning(String msg, Object param) {
int verbose = currentPropMap().getInteger(DEBUG_VERBOSE);
if (verbose > 0) {
getLogger().warning(msg, param);
}
}
public void warning(String msg) {
warning(msg, null);
@ -216,7 +213,9 @@ class Utils {
// Returns the Max Version String of this implementation
static String getVersionString() {
return "Pack200, Vendor: Sun Microsystems, Version: " +
return "Pack200, Vendor: " +
System.getProperty("java.vendor") +
", Version: " +
Constants.JAVA6_PACKAGE_MAJOR_VERSION + "." +
Constants.JAVA6_PACKAGE_MINOR_VERSION;
}

View File

@ -24,9 +24,6 @@
*/
package com.sun.net.httpserver;
import java.net.*;
import java.io.*;
import java.util.*;
/**
* BasicAuthenticator provides an implementation of HTTP Basic
@ -57,7 +54,6 @@ public abstract class BasicAuthenticator extends Authenticator {
public Result authenticate (HttpExchange t)
{
HttpContext context = t.getHttpContext();
Headers rmap = (Headers) t.getRequestHeaders();
/*
* look for auth token

View File

@ -25,11 +25,7 @@
package com.sun.net.httpserver;
import java.net.*;
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
import sun.net.www.MessageHeader;
import java.io.IOException;
import java.util.*;
/**
@ -56,12 +52,10 @@ public abstract class Filter {
/* the last element in the chain must invoke the users
* handler
*/
private List<Filter> filters;
private ListIterator<Filter> iter;
private HttpHandler handler;
public Chain (List<Filter> filters, HttpHandler handler) {
this.filters = filters;
iter = filters.listIterator();
this.handler = handler;
}

View File

@ -26,7 +26,6 @@
package com.sun.net.httpserver;
import java.util.*;
import java.io.*;
/**
* HTTP request and response headers are represented by this class which implements
@ -77,19 +76,16 @@ public class Headers implements Map<String,List<String>> {
if (len == 0) {
return key;
}
char[] b = new char [len];
String s = null;
b = key.toCharArray();
if (b[0] >= 'a' && b[0] <= 'z') {
b[0] = (char)(b[0] - ('a' - 'A'));
char[] b = key.toCharArray();
if (b[0] >= 'a' && b[0] <= 'z') {
b[0] = (char)(b[0] - ('a' - 'A'));
}
for (int i=1; i<len; i++) {
if (b[i] >= 'A' && b[i] <= 'Z') {
b[i] = (char) (b[i] + ('a' - 'A'));
}
for (int i=1; i<len; i++) {
if (b[i] >= 'A' && b[i] <= 'Z') {
b[i] = (char) (b[i] + ('a' - 'A'));
}
}
s = new String (b);
return s;
}
return new String(b);
}
public int size() {return map.size();}

View File

@ -24,9 +24,7 @@
*/
package com.sun.net.httpserver;
import java.net.*;
import java.io.*;
import java.util.*;
import java.net.InetSocketAddress;
import javax.net.ssl.SSLParameters;
/**
@ -90,7 +88,7 @@ public abstract class HttpsParameters {
* have been set.
*/
public String[] getCipherSuites() {
return cipherSuites;
return cipherSuites != null ? cipherSuites.clone() : null;
}
/**
@ -99,7 +97,7 @@ public abstract class HttpsParameters {
* @param cipherSuites the array of ciphersuites (or null)
*/
public void setCipherSuites(String[] cipherSuites) {
this.cipherSuites = cipherSuites;
this.cipherSuites = cipherSuites != null ? cipherSuites.clone() : null;
}
/**
@ -110,7 +108,7 @@ public abstract class HttpsParameters {
* have been set.
*/
public String[] getProtocols() {
return protocols;
return protocols != null ? protocols.clone() : null;
}
/**
@ -119,7 +117,7 @@ public abstract class HttpsParameters {
* @param protocols the array of protocols (or null)
*/
public void setProtocols(String[] protocols) {
this.protocols = protocols;
this.protocols = protocols != null ? protocols.clone() : null;
}
/**

View File

@ -3,7 +3,7 @@
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 1999-2005 The Apache Software Foundation.
* Copyright 1999-2010 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,66 +23,70 @@ package com.sun.org.apache.xml.internal.security.utils;
import java.io.OutputStream;
/**
* A simple Unsynced ByteArryOutputStream
* A simple Unsynced ByteArrayOutputStream
* @author raul
*
*/
public class UnsyncByteArrayOutputStream extends OutputStream {
private static ThreadLocal bufCahce = new ThreadLocal() {
private static final int INITIAL_SIZE = 8192;
private static ThreadLocal bufCache = new ThreadLocal() {
protected synchronized Object initialValue() {
return new byte[8*1024];
return new byte[INITIAL_SIZE];
}
};
byte[] buf;
int size=8*1024;//buf.length;
int pos=0;
public UnsyncByteArrayOutputStream() {
buf=(byte[])bufCahce.get();
}
/** @inheritDoc */
public void write(byte[] arg0) {
int newPos=pos+arg0.length;
if (newPos>size) {
expandSize();
}
System.arraycopy(arg0,0,buf,pos,arg0.length);
pos=newPos;
}
/** @inheritDoc */
public void write(byte[] arg0, int arg1, int arg2) {
int newPos=pos+arg2;
if (newPos>size) {
expandSize();
}
System.arraycopy(arg0,arg1,buf,pos,arg2);
pos=newPos;
}
/** @inheritDoc */
public void write(int arg0) {
if (pos>=size) {
expandSize();
}
buf[pos++]=(byte)arg0;
}
/** @inheritDoc */
public byte[] toByteArray() {
byte result[]=new byte[pos];
System.arraycopy(buf,0,result,0,pos);
return result;
}
/** @inheritDoc */
public void reset() {
pos=0;
}
private byte[] buf;
private int size = INITIAL_SIZE;
private int pos = 0;
/** @inheritDoc */
void expandSize() {
int newSize=size<<2;
byte newBuf[]=new byte[newSize];
System.arraycopy(buf,0,newBuf,0,pos);
buf=newBuf;
size=newSize;
public UnsyncByteArrayOutputStream() {
buf = (byte[])bufCache.get();
}
public void write(byte[] arg0) {
int newPos = pos + arg0.length;
if (newPos > size) {
expandSize(newPos);
}
System.arraycopy(arg0, 0, buf, pos, arg0.length);
pos = newPos;
}
public void write(byte[] arg0, int arg1, int arg2) {
int newPos = pos + arg2;
if (newPos > size) {
expandSize(newPos);
}
System.arraycopy(arg0, arg1, buf, pos, arg2);
pos = newPos;
}
public void write(int arg0) {
int newPos = pos + 1;
if (newPos > size) {
expandSize(newPos);
}
buf[pos++] = (byte)arg0;
}
public byte[] toByteArray() {
byte result[] = new byte[pos];
System.arraycopy(buf, 0, result, 0, pos);
return result;
}
public void reset() {
pos = 0;
}
private void expandSize(int newPos) {
int newSize = size;
while (newPos > newSize) {
newSize = newSize<<2;
}
byte newBuf[] = new byte[newSize];
System.arraycopy(buf, 0, newBuf, 0, pos);
buf = newBuf;
size = newSize;
}
}

View File

@ -1068,7 +1068,7 @@ public class Dialog extends Window {
modalityPushed();
try {
EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
secondaryLoop = eventQueue.createSecondaryLoop(cond, modalFilter, 5000);
secondaryLoop = eventQueue.createSecondaryLoop(cond, modalFilter, 0);
if (!secondaryLoop.enter()) {
secondaryLoop = null;
}

View File

@ -142,6 +142,9 @@ public abstract class KeyboardFocusManager
public void removeLastFocusRequest(Component heavyweight) {
KeyboardFocusManager.removeLastFocusRequest(heavyweight);
}
public void setMostRecentFocusOwner(Window window, Component component) {
KeyboardFocusManager.setMostRecentFocusOwner(window, component);
}
}
);
}

View File

@ -51,7 +51,7 @@ import java.awt.Event;
* in the range from {@code ACTION_FIRST} to {@code ACTION_LAST}.
*
* @see ActionListener
* @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/eventmodel.html">Tutorial: Java 1.1 Event Model</a>
* @see <a href="http://java.sun.com/docs/books/tutorial/uiswing/events/actionlistener.html">Tutorial: How to Write an Action Listener</a>
*
* @author Carl Quinn
* @since 1.1

View File

@ -937,14 +937,22 @@ public abstract class SampleModel
int iArray[], DataBuffer data) {
int pixels[];
int Offset=0;
int x1 = x + w;
int y1 = y + h;
if (x < 0 || x1 < x || x1 > width ||
y < 0 || y1 < y || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
if (iArray != null)
pixels = iArray;
else
pixels = new int[w * h];
for(int i=y; i<(h+y); i++) {
for (int j=x; j<(w+x); j++) {
for(int i=y; i<y1; i++) {
for (int j=x; j<x1; j++) {
pixels[Offset++] = getSample(j, i, b, data);
}
}
@ -978,14 +986,22 @@ public abstract class SampleModel
DataBuffer data) {
float pixels[];
int Offset=0;
int x1 = x + w;
int y1 = y + h;
if (x < 0 || x1 < x || x1 > width ||
y < 0 || y1 < y || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates");
}
if (fArray != null)
pixels = fArray;
else
pixels = new float[w * h];
for (int i=y; i<(h+y); i++) {
for (int j=x; j<(w+x); j++) {
for (int i=y; i<y1; i++) {
for (int j=x; j<x1; j++) {
pixels[Offset++] = getSampleFloat(j, i, b, data);
}
}
@ -1019,14 +1035,22 @@ public abstract class SampleModel
DataBuffer data) {
double pixels[];
int Offset=0;
int x1 = x + w;
int y1 = y + h;
if (x < 0 || x1 < x || x1 > width ||
y < 0 || y1 < y || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates");
}
if (dArray != null)
pixels = dArray;
else
pixels = new double[w * h];
for (int i=y; i<(y+h); i++) {
for (int j=x; j<(x+w); j++) {
for (int i=y; i<y1; i++) {
for (int j=x; j<x1; j++) {
pixels[Offset++] = getSampleDouble(j, i, b, data);
}
}

View File

@ -176,8 +176,9 @@ public class EventSetDescriptor extends FeatureDescriptor {
setRemoveListenerMethod(getMethod(sourceClass, removeListenerMethodName, 1));
// Be more forgiving of not finding the getListener method.
if (getListenerMethodName != null) {
setGetListenerMethod(Introspector.findInstanceMethod(sourceClass, getListenerMethodName));
Method method = Introspector.findMethod(sourceClass, getListenerMethodName, 0);
if (method != null) {
setGetListenerMethod(method);
}
}

View File

@ -189,11 +189,13 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
indexedReadMethodName = Introspector.GET_PREFIX + getBaseName();
}
}
indexedReadMethod = Introspector.findInstanceMethod(cls, indexedReadMethodName, int.class);
Class[] args = { int.class };
indexedReadMethod = Introspector.findMethod(cls, indexedReadMethodName, 1, args);
if (indexedReadMethod == null) {
// no "is" method, so look for a "get" method.
indexedReadMethodName = Introspector.GET_PREFIX + getBaseName();
indexedReadMethod = Introspector.findInstanceMethod(cls, indexedReadMethodName, int.class);
indexedReadMethod = Introspector.findMethod(cls, indexedReadMethodName, 1, args);
}
setIndexedReadMethod0(indexedReadMethod);
}
@ -265,7 +267,9 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
if (indexedWriteMethodName == null) {
indexedWriteMethodName = Introspector.SET_PREFIX + getBaseName();
}
indexedWriteMethod = Introspector.findInstanceMethod(cls, indexedWriteMethodName, int.class, type);
Class[] args = (type == null) ? null : new Class[] { int.class, type };
indexedWriteMethod = Introspector.findMethod(cls, indexedWriteMethodName, 2, args);
if (indexedWriteMethod != null) {
if (!indexedWriteMethod.getReturnType().equals(void.class)) {
indexedWriteMethod = null;

View File

@ -28,7 +28,6 @@ package java.beans;
import com.sun.beans.WeakCache;
import com.sun.beans.finder.BeanInfoFinder;
import com.sun.beans.finder.ClassFinder;
import com.sun.beans.finder.MethodFinder;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
@ -843,8 +842,8 @@ public class Introspector {
Method read = result.getReadMethod();
if (read == null && write != null) {
read = findInstanceMethod(result.getClass0(),
GET_PREFIX + NameGenerator.capitalize(result.getName()));
read = findMethod(result.getClass0(),
GET_PREFIX + NameGenerator.capitalize(result.getName()), 0);
if (read != null) {
try {
result.setReadMethod(read);
@ -854,9 +853,9 @@ public class Introspector {
}
}
if (write == null && read != null) {
write = findInstanceMethod(result.getClass0(),
SET_PREFIX + NameGenerator.capitalize(result.getName()),
FeatureDescriptor.getReturnType(result.getClass0(), read));
write = findMethod(result.getClass0(),
SET_PREFIX + NameGenerator.capitalize(result.getName()), 1,
new Class[] { FeatureDescriptor.getReturnType(result.getClass0(), read) });
if (write != null) {
try {
result.setWriteMethod(write);
@ -1280,27 +1279,90 @@ public class Introspector {
// Package private support methods.
//======================================================================
static Method findMethod(Class<?> type, String name, int args) {
for (Method method : type.getMethods()) {
if (method.getName().equals(name) && (args == method.getParameterTypes().length)) {
try {
return MethodFinder.findAccessibleMethod(method);
/**
* Internal support for finding a target methodName with a given
* parameter list on a given class.
*/
private static Method internalFindMethod(Class start, String methodName,
int argCount, Class args[]) {
// For overriden methods we need to find the most derived version.
// So we start with the given class and walk up the superclass chain.
Method method = null;
for (Class cl = start; cl != null; cl = cl.getSuperclass()) {
Method methods[] = getPublicDeclaredMethods(cl);
for (int i = 0; i < methods.length; i++) {
method = methods[i];
if (method == null) {
continue;
}
catch (NoSuchMethodException exception) {
// continue search for a method with the specified count of parameters
// make sure method signature matches.
Class params[] = FeatureDescriptor.getParameterTypes(start, method);
if (method.getName().equals(methodName) &&
params.length == argCount) {
if (args != null) {
boolean different = false;
if (argCount > 0) {
for (int j = 0; j < argCount; j++) {
if (params[j] != args[j]) {
different = true;
continue;
}
}
if (different) {
continue;
}
}
}
return method;
}
}
}
return null;
method = null;
// Now check any inherited interfaces. This is necessary both when
// the argument class is itself an interface, and when the argument
// class is an abstract class.
Class ifcs[] = start.getInterfaces();
for (int i = 0 ; i < ifcs.length; i++) {
// Note: The original implementation had both methods calling
// the 3 arg method. This is preserved but perhaps it should
// pass the args array instead of null.
method = internalFindMethod(ifcs[i], methodName, argCount, null);
if (method != null) {
break;
}
}
return method;
}
static Method findInstanceMethod(Class<?> type, String name, Class<?>... args) {
try {
return MethodFinder.findInstanceMethod(type, name, args);
}
catch (NoSuchMethodException exception) {
/**
* Find a target methodName on a given class.
*/
static Method findMethod(Class cls, String methodName, int argCount) {
return findMethod(cls, methodName, argCount, null);
}
/**
* Find a target methodName with specific parameter list on a given class.
* <p>
* Used in the contructors of the EventSetDescriptor,
* PropertyDescriptor and the IndexedPropertyDescriptor.
* <p>
* @param cls The Class object on which to retrieve the method.
* @param methodName Name of the method.
* @param argCount Number of arguments for the desired method.
* @param args Array of argument types for the method.
* @return the method or null if not found
*/
static Method findMethod(Class cls, String methodName, int argCount,
Class args[]) {
if (methodName == null) {
return null;
}
return internalFindMethod(cls, methodName, argCount, args);
}
/**

View File

@ -90,13 +90,13 @@ public class MethodDescriptor extends FeatureDescriptor {
// Find methods for up to 2 params. We are guessing here.
// This block should never execute unless the classloader
// that loaded the argument classes disappears.
method = Introspector.findMethod(cls, name, i);
method = Introspector.findMethod(cls, name, i, null);
if (method != null) {
break;
}
}
} else {
method = Statement.getMethod(cls, name, params);
method = Introspector.findMethod(cls, name, params.length, params);
}
setMethod(method);
}

View File

@ -112,7 +112,8 @@ public class PropertyDescriptor extends FeatureDescriptor {
// If this class or one of its base classes allow PropertyChangeListener,
// then we assume that any properties we discover are "bound".
// See Introspector.getTargetPropertyInfo() method.
this.bound = null != Introspector.findInstanceMethod(beanClass, "addPropertyChangeListener", PropertyChangeListener.class);
Class[] args = { PropertyChangeListener.class };
this.bound = null != Introspector.findMethod(beanClass, "addPropertyChangeListener", args.length, args);
}
/**
@ -223,10 +224,10 @@ public class PropertyDescriptor extends FeatureDescriptor {
// property type is. For booleans, there can be "is" and "get"
// methods. If an "is" method exists, this is the official
// reader method so look for this one first.
readMethod = Introspector.findInstanceMethod(cls, readMethodName);
readMethod = Introspector.findMethod(cls, readMethodName, 0);
if (readMethod == null) {
readMethodName = Introspector.GET_PREFIX + getBaseName();
readMethod = Introspector.findInstanceMethod(cls, readMethodName);
readMethod = Introspector.findMethod(cls, readMethodName, 0);
}
try {
setReadMethod(readMethod);
@ -291,7 +292,8 @@ public class PropertyDescriptor extends FeatureDescriptor {
writeMethodName = Introspector.SET_PREFIX + getBaseName();
}
writeMethod = Introspector.findInstanceMethod(cls, writeMethodName, type);
Class[] args = (type == null) ? null : new Class[] { type };
writeMethod = Introspector.findMethod(cls, writeMethodName, 1, args);
if (writeMethod != null) {
if (!writeMethod.getReturnType().equals(void.class)) {
writeMethod = null;

View File

@ -100,7 +100,8 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* @param minimumCapacity the minimum desired capacity.
*/
public void ensureCapacity(int minimumCapacity) {
ensureCapacityInternal(minimumCapacity);
if (minimumCapacity > 0)
ensureCapacityInternal(minimumCapacity);
}
/**
@ -108,6 +109,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* never synchronized.
*/
private void ensureCapacityInternal(int minimumCapacity) {
// overflow-conscious code
if (minimumCapacity - value.length > 0)
expandCapacity(minimumCapacity);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -100,8 +100,11 @@ import sun.security.util.SecurityConstants;
* themselves at their class initialization time by invoking the
* {@link
* #registerAsParallelCapable <tt>ClassLoader.registerAsParallelCapable</tt>}
* method. In environments in which the delegation model is not strictly
* hierarchical, class loaders need to be parallel capable, otherise class
* method. Note that the <tt>ClassLoader</tt> class is registered as parallel
* capable by default. However, its subclasses still need to register themselves
* if they are parallel capable. <br>
* In environments in which the delegation model is not strictly
* hierarchical, class loaders need to be parallel capable, otherwise class
* loading can lead to deadlocks because the loader lock is held for the
* duration of the class loading process (see {@link #loadClass
* <tt>loadClass</tt>} methods).
@ -1218,14 +1221,14 @@ public abstract class ClassLoader {
private static native Class<? extends ClassLoader> getCaller(int index);
/**
* Registers the caller class loader as parallel capable.
* In order for the registration to succeed, all super classes
* of the caller class loader must also be registered as
* parallel capable when this method is called. </p>
* Note that once a class loader is registered as
* parallel capable, there is no way to change it back.
* In addition, registration should be done statically before
* any instance of the caller classloader being constructed. </p>
* Registers the caller as parallel capable.</p>
* The registration succeeds if and only if all of the following
* conditions are met: <br>
* 1. no instance of the caller has been created</p>
* 2. all of the super classes (except class Object) of the caller are
* registered as parallel capable</p>
* Note that once a class loader is registered as parallel capable, there
* is no way to change it back. </p>
*
* @return true if the caller is successfully registered as
* parallel capable and false if otherwise.

View File

@ -586,25 +586,13 @@ public final class Integer extends Number implements Comparable<Integer> {
* Cache to support the object identity semantics of autoboxing for values between
* -128 and 127 (inclusive) as required by JLS.
*
* The cache is initialized on first usage. During VM initialization the
* getAndRemoveCacheProperties method may be used to get and remove any system
* properites that configure the cache size. At this time, the size of the
* cache may be controlled by the -XX:AutoBoxCacheMax=<size> option.
* The cache is initialized on first usage. The size of the cache
* may be controlled by the -XX:AutoBoxCacheMax=<size> option.
* During VM initialization, java.lang.Integer.IntegerCache.high property
* may be set and saved in the private system properties in the
* sun.misc.VM class.
*/
// value of java.lang.Integer.IntegerCache.high property (obtained during VM init)
private static String integerCacheHighPropValue;
static void getAndRemoveCacheProperties() {
if (!sun.misc.VM.isBooted()) {
Properties props = System.getProperties();
integerCacheHighPropValue =
(String)props.remove("java.lang.Integer.IntegerCache.high");
if (integerCacheHighPropValue != null)
System.setProperties(props); // remove from system props
}
}
private static class IntegerCache {
static final int low = -128;
static final int high;
@ -613,6 +601,8 @@ public final class Integer extends Number implements Comparable<Integer> {
static {
// high value may be configured by property
int h = 127;
String integerCacheHighPropValue =
sun.misc.VM.getSavedProperty("java.lang.Integer.IntegerCache.high");
if (integerCacheHighPropValue != null) {
int i = parseInt(integerCacheHighPropValue);
i = Math.max(i, 127);

View File

@ -53,7 +53,13 @@ import sun.reflect.annotation.AnnotationType;
*/
public final class System {
/* First thing---register the natives */
/* register the natives via the static initializer.
*
* VM will invoke the initializeSystemClass method to complete
* the initialization for this class separated from clinit.
* Note that to use properties set by the VM, see the constraints
* described in the initializeSystemClass method.
*/
private static native void registerNatives();
static {
registerNatives();
@ -1096,17 +1102,21 @@ public final class System {
* Initialize the system class. Called after thread initialization.
*/
private static void initializeSystemClass() {
props = new Properties();
initProperties(props);
// There are certain system configurations that may be controlled by
// VM options such as the maximum amount of direct memory and
// Integer cache size used to support the object identity semantics
// of autoboxing. Typically, the library will obtain these values
// from the properties set by the VM. If the properties are for
// internal implementation use only, these properties should be
// removed from the system properties.
//
// See java.lang.Integer.IntegerCache and the
// sun.misc.VM.saveAndRemoveProperties method for example.
props = initSystemProperties();
lineSeparator = props.getProperty("line.separator");
sun.misc.Version.init();
// Gets and removes system properties that configure the Integer
// cache used to support the object identity semantics of autoboxing.
// At this time, the size of the cache may be controlled by the
// vm option -XX:AutoBoxCacheMax=<size>.
Integer.getAndRemoveCacheProperties();
FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
@ -1127,17 +1137,6 @@ public final class System {
// classes are used.
sun.misc.VM.initializeOSEnvironment();
// Set the maximum amount of direct memory. This value is controlled
// by the vm option -XX:MaxDirectMemorySize=<size>. This method acts
// as an initializer only if it is called before sun.misc.VM.booted().
sun.misc.VM.maxDirectMemory();
// Set a boolean to determine whether ClassLoader.loadClass accepts
// array syntax. This value is controlled by the system property
// "sun.lang.ClassLoader.allowArraySyntax". This method acts as
// an initializer only if it is called before sun.misc.VM.booted().
sun.misc.VM.allowArraySyntax();
// Subsystems that are invoked during initialization can invoke
// sun.misc.VM.isBooted() in order to avoid doing things that should
// wait until the application class loader has been set up.
@ -1152,6 +1151,18 @@ public final class System {
setJavaLangAccess();
}
private static Properties initSystemProperties() {
Properties props = new Properties();
initProperties(props); // initialized by the VM
// Save a private copy of the system properties object that
// can only be accessed by the internal implementation. Remove
// certain system properties that are not intended for public access.
sun.misc.VM.saveAndRemoveProperties(props);
return props;
}
private static void setJavaLangAccess() {
// Allow privileged classes outside of java.lang
sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){

View File

@ -28,9 +28,7 @@ package java.net;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.InterruptedIOException;
import java.io.FileDescriptor;
import java.io.ByteArrayOutputStream;
import sun.net.ConnectionResetException;
import sun.net.NetHooks;
@ -58,7 +56,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
protected int fdUseCount = 0;
/* lock when increment/decrementing fdUseCount */
protected Object fdLock = new Object();
protected final Object fdLock = new Object();
/* indicates a close is pending on the file descriptor */
protected boolean closePending = false;
@ -68,7 +66,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
private int CONNECTION_RESET_PENDING = 1;
private int CONNECTION_RESET = 2;
private int resetState;
private Object resetLock = new Object();
private final Object resetLock = new Object();
/**
* Load net library into runtime.
@ -100,25 +98,24 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
protected void connect(String host, int port)
throws UnknownHostException, IOException
{
IOException pending = null;
boolean connected = false;
try {
InetAddress address = InetAddress.getByName(host);
this.port = port;
this.address = address;
try {
connectToAddress(address, port, timeout);
return;
} catch (IOException e) {
pending = e;
connectToAddress(address, port, timeout);
connected = true;
} finally {
if (!connected) {
try {
close();
} catch (IOException ioe) {
/* Do nothing. If connect threw an exception then
it will be passed up the call stack */
}
}
} catch (UnknownHostException e) {
pending = e;
}
// everything failed
close();
throw pending;
}
/**
@ -151,22 +148,29 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
* SocketAddress subclass not supported by this socket
* @since 1.4
*/
protected void connect(SocketAddress address, int timeout) throws IOException {
if (address == null || !(address instanceof InetSocketAddress))
throw new IllegalArgumentException("unsupported address type");
InetSocketAddress addr = (InetSocketAddress) address;
if (addr.isUnresolved())
throw new UnknownHostException(addr.getHostName());
this.port = addr.getPort();
this.address = addr.getAddress();
protected void connect(SocketAddress address, int timeout)
throws IOException {
boolean connected = false;
try {
if (address == null || !(address instanceof InetSocketAddress))
throw new IllegalArgumentException("unsupported address type");
InetSocketAddress addr = (InetSocketAddress) address;
if (addr.isUnresolved())
throw new UnknownHostException(addr.getHostName());
this.port = addr.getPort();
this.address = addr.getAddress();
connectToAddress(this.address, port, timeout);
return;
} catch (IOException e) {
// everything failed
close();
throw e;
connected = true;
} finally {
if (!connected) {
try {
close();
} catch (IOException ioe) {
/* Do nothing. If connect threw an exception then
it will be passed up the call stack */
}
}
}
}
@ -311,7 +315,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
}
}
try {
FileDescriptor fd = acquireFD();
acquireFD();
try {
socketConnect(address, port, timeout);
/* socket may have been closed during poll/select */
@ -370,7 +374,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
* @param s the connection
*/
protected void accept(SocketImpl s) throws IOException {
FileDescriptor fd = acquireFD();
acquireFD();
try {
socketAccept(s);
} finally {
@ -562,7 +566,6 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
close();
}
/*
* "Acquires" and returns the FileDescriptor for this impl
*

View File

@ -622,7 +622,7 @@ class Bits { // package-private
// initialization if it is launched with "-XX:MaxDirectMemorySize=<size>".
private static volatile long maxMemory = VM.maxDirectMemory();
private static volatile long reservedMemory;
private static volatile long usedMemory;
private static volatile long totalCapacity;
private static volatile long count;
private static boolean memoryLimitSet = false;
@ -630,15 +630,17 @@ class Bits { // package-private
// freed. They allow the user to control the amount of direct memory
// which a process may access. All sizes are specified in bytes.
static void reserveMemory(long size, int cap) {
synchronized (Bits.class) {
if (!memoryLimitSet && VM.isBooted()) {
maxMemory = VM.maxDirectMemory();
memoryLimitSet = true;
}
if (size <= maxMemory - reservedMemory) {
// -XX:MaxDirectMemorySize limits the total capacity rather than the
// actual memory usage, which will differ when buffers are page
// aligned.
if (cap <= maxMemory - totalCapacity) {
reservedMemory += size;
usedMemory += cap;
totalCapacity += cap;
count++;
return;
}
@ -652,10 +654,10 @@ class Bits { // package-private
Thread.currentThread().interrupt();
}
synchronized (Bits.class) {
if (reservedMemory + size > maxMemory)
if (totalCapacity + cap > maxMemory)
throw new OutOfMemoryError("Direct buffer memory");
reservedMemory += size;
usedMemory += cap;
totalCapacity += cap;
count++;
}
@ -664,7 +666,7 @@ class Bits { // package-private
static synchronized void unreserveMemory(long size, int cap) {
if (reservedMemory > 0) {
reservedMemory -= size;
usedMemory -= cap;
totalCapacity -= cap;
count--;
assert (reservedMemory > -1);
}
@ -689,7 +691,7 @@ class Bits { // package-private
}
@Override
public long getTotalCapacity() {
return Bits.usedMemory;
return Bits.totalCapacity;
}
@Override
public long getMemoryUsed() {

View File

@ -27,8 +27,10 @@
package java.nio;
import java.io.FileDescriptor;
import sun.misc.Cleaner;
import sun.misc.Unsafe;
import sun.misc.VM;
import sun.nio.ch.DirectBuffer;
@ -113,9 +115,10 @@ class Direct$Type$Buffer$RW$$BO$
//
Direct$Type$Buffer$RW$(int cap) { // package-private
#if[rw]
super(-1, 0, cap, cap, false);
super(-1, 0, cap, cap);
boolean pa = VM.isDirectMemoryPageAligned();
int ps = Bits.pageSize();
int size = cap + ps;
long size = Math.max(1L, (long)cap + (pa ? ps : 0));
Bits.reserveMemory(size, cap);
long base = 0;
@ -126,7 +129,7 @@ class Direct$Type$Buffer$RW$$BO$
throw x;
}
unsafe.setMemory(base, size, (byte) 0);
if (base % ps != 0) {
if (pa && (base % ps != 0)) {
// Round up to page boundary
address = base + ps - (base & (ps - 1));
} else {
@ -143,7 +146,7 @@ class Direct$Type$Buffer$RW$$BO$
// Invoked only by JNI: NewDirectByteBuffer(void*, long)
//
private Direct$Type$Buffer(long addr, int cap) {
super(-1, 0, cap, cap, false);
super(-1, 0, cap, cap);
address = addr;
cleaner = null;
}
@ -152,14 +155,17 @@ class Direct$Type$Buffer$RW$$BO$
// For memory-mapped buffers -- invoked by FileChannelImpl via reflection
//
protected Direct$Type$Buffer$RW$(int cap, long addr, Runnable unmapper) {
protected Direct$Type$Buffer$RW$(int cap, long addr,
FileDescriptor fd,
Runnable unmapper)
{
#if[rw]
super(-1, 0, cap, cap, true);
super(-1, 0, cap, cap, fd);
address = addr;
viewedBuffer = null;
cleaner = Cleaner.create(this, unmapper);
#else[rw]
super(cap, addr, unmapper);
super(cap, addr, fd, unmapper);
#end[rw]
}

View File

@ -25,6 +25,7 @@
package java.nio;
import java.io.FileDescriptor;
import sun.misc.Unsafe;
@ -71,26 +72,26 @@ public abstract class MappedByteBuffer
// for optimization purposes, it's easier to do it the other way around.
// This works because DirectByteBuffer is a package-private class.
// Volatile to make sure that the finalization thread sees the current
// value of this so that a region is not accidentally unmapped again later.
volatile boolean isAMappedBuffer; // package-private
// For mapped buffers, a FileDescriptor that may be used for mapping
// operations if valid; null if the buffer is not mapped.
private final FileDescriptor fd;
// This should only be invoked by the DirectByteBuffer constructors
//
MappedByteBuffer(int mark, int pos, int lim, int cap, // package-private
boolean mapped)
FileDescriptor fd)
{
super(mark, pos, lim, cap);
isAMappedBuffer = mapped;
this.fd = fd;
}
MappedByteBuffer(int mark, int pos, int lim, int cap) { // package-private
super(mark, pos, lim, cap);
isAMappedBuffer = false;
this.fd = null;
}
private void checkMapped() {
if (!isAMappedBuffer)
if (fd == null)
// Can only happen if a luser explicitly casts a direct byte buffer
throw new UnsupportedOperationException();
}
@ -191,13 +192,12 @@ public abstract class MappedByteBuffer
checkMapped();
if ((address != 0) && (capacity() != 0)) {
long offset = mappingOffset();
force0(mappingAddress(offset), mappingLength(offset));
force0(fd, mappingAddress(offset), mappingLength(offset));
}
return this;
}
private native boolean isLoaded0(long address, long length, int pageCount);
private native void load0(long address, long length);
private native void force0(long address, long length);
private native void force0(FileDescriptor fd, long address, long length);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -61,8 +61,8 @@ public class CertificateRevokedException extends CertificateException {
*/
private final CRLReason reason;
/**
* @serial the name of the authority that signed the certificate's
* revocation status information
* @serial the <code>X500Principal</code> that represents the name of the
* authority that signed the certificate's revocation status information
*/
private final X500Principal authority;
@ -79,8 +79,9 @@ public class CertificateRevokedException extends CertificateException {
* @param extensions a map of X.509 Extensions. Each key is an OID String
* that maps to the corresponding Extension. The map is copied to
* prevent subsequent modification.
* @param authority the name of the authority that signed the certificate's
* revocation status information
* @param authority the <code>X500Principal</code> that represents the name
* of the authority that signed the certificate's revocation status
* information
* @throws NullPointerException if <code>revocationDate</code>,
* <code>reason</code>, <code>authority</code>, or
* <code>extensions</code> is <code>null</code>
@ -121,8 +122,8 @@ public class CertificateRevokedException extends CertificateException {
* Returns the name of the authority that signed the certificate's
* revocation status information.
*
* @return the name of the authority that signed the certificate's
* revocation status information
* @return the <code>X500Principal</code> that represents the name of the
* authority that signed the certificate's revocation status information
*/
public X500Principal getAuthorityName() {
return authority;

View File

@ -176,6 +176,11 @@ public class ArrayList<E> extends AbstractList<E>
* @param minCapacity the desired minimum capacity
*/
public void ensureCapacity(int minCapacity) {
if (minCapacity > 0)
ensureCapacityInternal(minCapacity);
}
private void ensureCapacityInternal(int minCapacity) {
modCount++;
// overflow-conscious code
if (minCapacity - elementData.length > 0)
@ -403,7 +408,7 @@ public class ArrayList<E> extends AbstractList<E>
* @return <tt>true</tt> (as specified by {@link Collection#add})
*/
public boolean add(E e) {
ensureCapacity(size + 1); // Increments modCount!!
ensureCapacityInternal(size + 1); // Increments modCount!!
elementData[size++] = e;
return true;
}
@ -420,7 +425,7 @@ public class ArrayList<E> extends AbstractList<E>
public void add(int index, E element) {
rangeCheckForAdd(index);
ensureCapacity(size + 1); // Increments modCount!!
ensureCapacityInternal(size + 1); // Increments modCount!!
System.arraycopy(elementData, index, elementData, index + 1,
size - index);
elementData[index] = element;
@ -524,7 +529,7 @@ public class ArrayList<E> extends AbstractList<E>
public boolean addAll(Collection<? extends E> c) {
Object[] a = c.toArray();
int numNew = a.length;
ensureCapacity(size + numNew); // Increments modCount
ensureCapacityInternal(size + numNew); // Increments modCount
System.arraycopy(a, 0, elementData, size, numNew);
size += numNew;
return numNew != 0;
@ -550,7 +555,7 @@ public class ArrayList<E> extends AbstractList<E>
Object[] a = c.toArray();
int numNew = a.length;
ensureCapacity(size + numNew); // Increments modCount
ensureCapacityInternal(size + numNew); // Increments modCount
int numMoved = size - index;
if (numMoved > 0)

View File

@ -97,7 +97,8 @@ public class Arrays {
* if {@code fromIndex < 0} or {@code toIndex > a.length}
*/
public static void sort(int[] a, int fromIndex, int toIndex) {
DualPivotQuicksort.sort(a, fromIndex, toIndex);
rangeCheck(a.length, fromIndex, toIndex);
DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
}
/**
@ -136,7 +137,8 @@ public class Arrays {
* if {@code fromIndex < 0} or {@code toIndex > a.length}
*/
public static void sort(long[] a, int fromIndex, int toIndex) {
DualPivotQuicksort.sort(a, fromIndex, toIndex);
rangeCheck(a.length, fromIndex, toIndex);
DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
}
/**
@ -175,7 +177,8 @@ public class Arrays {
* if {@code fromIndex < 0} or {@code toIndex > a.length}
*/
public static void sort(short[] a, int fromIndex, int toIndex) {
DualPivotQuicksort.sort(a, fromIndex, toIndex);
rangeCheck(a.length, fromIndex, toIndex);
DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
}
/**
@ -214,7 +217,8 @@ public class Arrays {
* if {@code fromIndex < 0} or {@code toIndex > a.length}
*/
public static void sort(char[] a, int fromIndex, int toIndex) {
DualPivotQuicksort.sort(a, fromIndex, toIndex);
rangeCheck(a.length, fromIndex, toIndex);
DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
}
/**
@ -253,7 +257,8 @@ public class Arrays {
* if {@code fromIndex < 0} or {@code toIndex > a.length}
*/
public static void sort(byte[] a, int fromIndex, int toIndex) {
DualPivotQuicksort.sort(a, fromIndex, toIndex);
rangeCheck(a.length, fromIndex, toIndex);
DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
}
/**
@ -308,7 +313,8 @@ public class Arrays {
* if {@code fromIndex < 0} or {@code toIndex > a.length}
*/
public static void sort(float[] a, int fromIndex, int toIndex) {
DualPivotQuicksort.sort(a, fromIndex, toIndex);
rangeCheck(a.length, fromIndex, toIndex);
DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
}
/**
@ -363,12 +369,12 @@ public class Arrays {
* if {@code fromIndex < 0} or {@code toIndex > a.length}
*/
public static void sort(double[] a, int fromIndex, int toIndex) {
DualPivotQuicksort.sort(a, fromIndex, toIndex);
rangeCheck(a.length, fromIndex, toIndex);
DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
}
/*
* Sorting of complex type arrays.
*
*/
/**

File diff suppressed because it is too large Load Diff

View File

@ -569,6 +569,9 @@ public final class Locale implements Cloneable, Serializable {
* @exception NullPointerException thrown if any argument is null.
*/
public Locale(String language, String country, String variant) {
if (language== null || country == null || variant == null) {
throw new NullPointerException();
}
_baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), "", country, variant);
_extensions = getCompatibilityExtensions(language, "", country, variant);
}

View File

@ -705,7 +705,7 @@ class Properties extends Hashtable<Object,Object> {
* <code>Strings</code>.
*/
@Deprecated
public synchronized void save(OutputStream out, String comments) {
public void save(OutputStream out, String comments) {
try {
store(out, comments);
} catch (IOException e) {
@ -890,7 +890,7 @@ class Properties extends Hashtable<Object,Object> {
* @see #loadFromXML(InputStream)
* @since 1.5
*/
public synchronized void storeToXML(OutputStream os, String comment)
public void storeToXML(OutputStream os, String comment)
throws IOException
{
if (os == null)
@ -929,8 +929,7 @@ class Properties extends Hashtable<Object,Object> {
* @see #loadFromXML(InputStream)
* @since 1.5
*/
public synchronized void storeToXML(OutputStream os, String comment,
String encoding)
public void storeToXML(OutputStream os, String comment, String encoding)
throws IOException
{
if (os == null)

View File

@ -292,16 +292,6 @@ public abstract class ResourceBundle {
private static final ConcurrentMap<CacheKey, BundleReference> cacheList
= new ConcurrentHashMap<CacheKey, BundleReference>(INITIAL_CACHE_SIZE);
/**
* This ConcurrentMap is used to keep multiple threads from loading the
* same bundle concurrently. The table entries are <CacheKey, Thread>
* where CacheKey is the key for the bundle that is under construction
* and Thread is the thread that is constructing the bundle.
* This list is manipulated in findBundleInCache and putBundleInCache.
*/
private static final ConcurrentMap<CacheKey, Thread> underConstruction
= new ConcurrentHashMap<CacheKey, Thread>();
/**
* Queue for reference objects referring to class loaders or bundles.
*/
@ -1381,7 +1371,7 @@ public abstract class ResourceBundle {
boolean expiredBundle = false;
// First, look up the cache to see if it's in the cache, without
// declaring beginLoading.
// attempting to load bundle.
cacheKey.setLocale(targetLocale);
ResourceBundle bundle = findBundleInCache(cacheKey, control);
if (isValidBundle(bundle)) {
@ -1408,56 +1398,25 @@ public abstract class ResourceBundle {
CacheKey constKey = (CacheKey) cacheKey.clone();
try {
// Try declaring loading. If beginLoading() returns true,
// then we can proceed. Otherwise, we need to take a look
// at the cache again to see if someone else has loaded
// the bundle and put it in the cache while we've been
// waiting for other loading work to complete.
while (!beginLoading(constKey)) {
bundle = findBundleInCache(cacheKey, control);
if (bundle == null) {
continue;
}
if (bundle == NONEXISTENT_BUNDLE) {
// If the bundle is NONEXISTENT_BUNDLE, the bundle doesn't exist.
return parent;
}
expiredBundle = bundle.expired;
if (!expiredBundle) {
if (bundle.parent == parent) {
return bundle;
}
BundleReference bundleRef = cacheList.get(cacheKey);
if (bundleRef != null && bundleRef.get() == bundle) {
cacheList.remove(cacheKey, bundleRef);
}
bundle = loadBundle(cacheKey, formats, control, expiredBundle);
if (bundle != null) {
if (bundle.parent == null) {
bundle.setParent(parent);
}
bundle.locale = targetLocale;
bundle = putBundleInCache(cacheKey, bundle, control);
return bundle;
}
try {
bundle = loadBundle(cacheKey, formats, control, expiredBundle);
if (bundle != null) {
if (bundle.parent == null) {
bundle.setParent(parent);
}
bundle.locale = targetLocale;
bundle = putBundleInCache(cacheKey, bundle, control);
return bundle;
}
// Put NONEXISTENT_BUNDLE in the cache as a mark that there's no bundle
// instance for the locale.
putBundleInCache(cacheKey, NONEXISTENT_BUNDLE, control);
} finally {
endLoading(constKey);
}
// Put NONEXISTENT_BUNDLE in the cache as a mark that there's no bundle
// instance for the locale.
putBundleInCache(cacheKey, NONEXISTENT_BUNDLE, control);
} finally {
if (constKey.getCause() instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
}
}
assert underConstruction.get(cacheKey) != Thread.currentThread();
return parent;
}
@ -1465,7 +1424,6 @@ public abstract class ResourceBundle {
List<String> formats,
Control control,
boolean reload) {
assert underConstruction.get(cacheKey) == Thread.currentThread();
// Here we actually load the bundle in the order of formats
// specified by the getFormats() value.
@ -1498,7 +1456,6 @@ public abstract class ResourceBundle {
break;
}
}
assert underConstruction.get(cacheKey) == Thread.currentThread();
return bundle;
}
@ -1529,57 +1486,6 @@ public abstract class ResourceBundle {
return true;
}
/**
* Declares the beginning of actual resource bundle loading. This method
* returns true if the declaration is successful and the current thread has
* been put in underConstruction. If someone else has already begun
* loading, this method waits until that loading work is complete and
* returns false.
*/
private static final boolean beginLoading(CacheKey constKey) {
Thread me = Thread.currentThread();
Thread worker;
// We need to declare by putting the current Thread (me) to
// underConstruction that we are working on loading the specified
// resource bundle. If we are already working the loading, it means
// that the resource loading requires a recursive call. In that case,
// we have to proceed. (4300693)
if (((worker = underConstruction.putIfAbsent(constKey, me)) == null)
|| worker == me) {
return true;
}
// If someone else is working on the loading, wait until
// the Thread finishes the bundle loading.
synchronized (worker) {
while (underConstruction.get(constKey) == worker) {
try {
worker.wait();
} catch (InterruptedException e) {
// record the interruption
constKey.setCause(e);
}
}
}
return false;
}
/**
* Declares the end of the bundle loading. This method calls notifyAll
* for those who are waiting for this completion.
*/
private static final void endLoading(CacheKey constKey) {
// Remove this Thread from the underConstruction map and wake up
// those who have been waiting for me to complete this bundle
// loading.
Thread me = Thread.currentThread();
assert (underConstruction.get(constKey) == me);
underConstruction.remove(constKey);
synchronized (me) {
me.notifyAll();
}
}
/**
* Throw a MissingResourceException with proper message
*/

View File

@ -222,8 +222,10 @@ public class Vector<E>
* @param minCapacity the desired minimum capacity
*/
public synchronized void ensureCapacity(int minCapacity) {
modCount++;
ensureCapacityHelper(minCapacity);
if (minCapacity > 0) {
modCount++;
ensureCapacityHelper(minCapacity);
}
}
/**

View File

@ -141,14 +141,13 @@ class XMLUtils {
comments.appendChild(doc.createTextNode(comment));
}
Set keys = props.keySet();
Iterator i = keys.iterator();
while(i.hasNext()) {
String key = (String)i.next();
Element entry = (Element)properties.appendChild(
doc.createElement("entry"));
entry.setAttribute("key", key);
entry.appendChild(doc.createTextNode(props.getProperty(key)));
synchronized (props) {
for (String key : props.stringPropertyNames()) {
Element entry = (Element)properties.appendChild(
doc.createElement("entry"));
entry.setAttribute("key", key);
entry.appendChild(doc.createTextNode(props.getProperty(key)));
}
}
emitDocument(doc, os, encoding);
}

View File

@ -529,8 +529,6 @@ public class LogRecord implements java.io.Serializable {
Throwable throwable = new Throwable();
int depth = access.getStackTraceDepth(throwable);
String logClassName = "java.util.logging.Logger";
String plogClassName = "sun.util.logging.PlatformLogger";
boolean lookingForLogger = true;
for (int ix = 0; ix < depth; ix++) {
// Calling getStackTraceElement directly prevents the VM
@ -538,13 +536,14 @@ public class LogRecord implements java.io.Serializable {
StackTraceElement frame =
access.getStackTraceElement(throwable, ix);
String cname = frame.getClassName();
boolean isLoggerImpl = isLoggerImplFrame(cname);
if (lookingForLogger) {
// Skip all frames until we have found the first logger frame.
if (cname.equals(logClassName) || cname.startsWith(plogClassName)) {
if (isLoggerImpl) {
lookingForLogger = false;
}
} else {
if (!cname.equals(logClassName) && !cname.startsWith(plogClassName)) {
if (!isLoggerImpl) {
// skip reflection call
if (!cname.startsWith("java.lang.reflect.") && !cname.startsWith("sun.reflect.")) {
// We've found the relevant frame.
@ -558,4 +557,11 @@ public class LogRecord implements java.io.Serializable {
// We haven't found a suitable frame, so just punt. This is
// OK as we are only committed to making a "best effort" here.
}
private boolean isLoggerImplFrame(String cname) {
// the log record could be created for a platform logger
return (cname.equals("java.util.logging.Logger") ||
cname.startsWith("java.util.logging.LoggingProxyImpl") ||
cname.startsWith("sun.util.logging."));
}
}

View File

@ -85,8 +85,7 @@ class ZipFile implements ZipConstants, Closeable {
static {
// A system prpperty to disable mmap use to avoid vm crash when
// in-use zip file is accidently overwritten by others.
String prop = AccessController.doPrivileged(
new GetPropertyAction("sun.zip.disableMemoryMapping"));
String prop = sun.misc.VM.getSavedProperty("sun.zip.disableMemoryMapping");
usemmap = (prop == null ||
!(prop.length() == 0 || prop.equalsIgnoreCase("true")));
}

View File

@ -1464,8 +1464,8 @@ public class GroupLayout implements LayoutManager2 {
* &lt;= {@code pref} &lt;= {@code max}.
* <p>
* Similarly any methods that take a {@code Component} throw a
* {@code NullPointerException} if passed {@code null} and any methods
* that take a {@code Group} throw an {@code IllegalArgumentException} if
* {@code IllegalArgumentException} if passed {@code null} and any methods
* that take a {@code Group} throw an {@code NullPointerException} if
* passed {@code null}.
*
* @see #createSequentialGroup

View File

@ -4787,6 +4787,17 @@ public abstract class JComponent extends Container implements Serializable,
* @see RepaintManager#addDirtyRegion
*/
public void repaint(long tm, int x, int y, int width, int height) {
Container p = this;
while ((p = p.getParent()) instanceof JComponent) {
JComponent jp = (JComponent) p;
if (jp.isPaintingOrigin()) {
Rectangle rectangle = SwingUtilities.convertRectangle(
this, new Rectangle(x, y, width, height), jp);
jp.repaint(tm,
rectangle.x, rectangle.y, rectangle.width, rectangle.height);
return;
}
}
RepaintManager.currentManager(this).addDirtyRegion(this, x, y, width, height);
}

View File

@ -215,7 +215,8 @@ public class JDesktopPane extends JLayeredPane implements Accessible
/**
* Sets the <code>DesktopManger</code> that will handle
* desktop-specific UI actions.
* desktop-specific UI actions. This may be overridden by
* {@code LookAndFeel}.
*
* @param d the <code>DesktopManager</code> to use
*

View File

@ -25,17 +25,17 @@
package javax.swing;
import sun.awt.AWTAccessor;
import javax.swing.plaf.LayerUI;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.security.AccessController;
import java.security.PrivilegedAction;
@ -156,8 +156,6 @@ public final class JLayer<V extends Component>
private LayerUI<? super V> layerUI;
private JPanel glassPane;
private boolean isPainting;
private static final DefaultLayerLayout sharedLayoutInstance =
new DefaultLayerLayout();
private long eventMask;
private static final LayerEventController eventController =
@ -165,7 +163,7 @@ public final class JLayer<V extends Component>
/**
* Creates a new {@code JLayer} object with a {@code null} view component
* and {@code null} {@link javax.swing.plaf.LayerUI}.
* and default {@link javax.swing.plaf.LayerUI}.
*
* @see #setView
* @see #setUI
@ -176,14 +174,14 @@ public final class JLayer<V extends Component>
/**
* Creates a new {@code JLayer} object
* with {@code null} {@link javax.swing.plaf.LayerUI}.
* with default {@link javax.swing.plaf.LayerUI}.
*
* @param view the component to be decorated by this {@code JLayer}
*
* @see #setUI
*/
public JLayer(V view) {
this(view, null);
this(view, new LayerUI<V>());
}
/**
@ -195,7 +193,6 @@ public final class JLayer<V extends Component>
* to be used by this {@code JLayer}
*/
public JLayer(V view, LayerUI<V> ui) {
setLayout(sharedLayoutInstance);
setGlassPane(createGlassPane());
setView(view);
setUI(ui);
@ -279,10 +276,15 @@ public final class JLayer<V extends Component>
*/
public void setGlassPane(JPanel glassPane) {
Component oldGlassPane = getGlassPane();
boolean isGlassPaneVisible = false;
if (oldGlassPane != null) {
isGlassPaneVisible = oldGlassPane.isVisible();
super.remove(oldGlassPane);
}
if (glassPane != null) {
AWTAccessor.getComponentAccessor().setMixingCutoutShape(glassPane,
new Rectangle());
glassPane.setVisible(isGlassPaneVisible);
super.addImpl(glassPane, null, 0);
}
this.glassPane = glassPane;
@ -302,6 +304,40 @@ public final class JLayer<V extends Component>
return new DefaultLayerGlassPane();
}
/**
* Sets the layout manager for this container. This method is
* overridden to prevent the layout manager from being set.
* <p/>Note: If {@code mgr} is non-{@code null}, this
* method will throw an exception as layout managers are not supported on
* a {@code JLayer}.
*
* @param mgr the specified layout manager
* @exception IllegalArgumentException this method is not supported
*/
public void setLayout(LayoutManager mgr) {
if (mgr != null) {
throw new IllegalArgumentException("JLayer.setLayout() not supported");
}
}
/**
* A non-{@code null] border, or non-zero insets, isn't supported, to prevent the geometry
* of this component from becoming complex enough to inhibit
* subclassing of {@code LayerUI} class. To create a {@code JLayer} with a border,
* add it to a {@code JPanel} that has a border.
* <p/>Note: If {@code border} is non-{@code null}, this
* method will throw an exception as borders are not supported on
* a {@code JLayer}.
*
* @param border the {@code Border} to set
* @exception IllegalArgumentException this method is not supported
*/
public void setBorder(Border border) {
if (border != null) {
throw new IllegalArgumentException("JLayer.setBorder() not supported");
}
}
/**
* This method is not supported by {@code JLayer}
* and always throws {@code UnsupportedOperationException}
@ -340,6 +376,32 @@ public final class JLayer<V extends Component>
setGlassPane(null);
}
/**
* Always returns {@code true} to cause painting to originate from {@code JLayer},
* or one of its ancestors.
*
* @return true
* @see JComponent#isPaintingOrigin()
*/
boolean isPaintingOrigin() {
return true;
}
/**
* Delegates repainting to {@link javax.swing.plaf.LayerUI#repaint} method.
*
* @param tm this parameter is not used
* @param x the x value of the dirty region
* @param y the y value of the dirty region
* @param width the width of the dirty region
* @param height the height of the dirty region
*/
public void repaint(long tm, int x, int y, int width, int height) {
if (getUI() != null) {
getUI().repaint(tm, x, y, width, height, this);
}
}
/**
* Delegates all painting to the {@link javax.swing.plaf.LayerUI} object.
*
@ -364,14 +426,18 @@ public final class JLayer<V extends Component>
}
/**
* To enable the correct painting of the {@code glassPane} and view component,
* the {@code JLayer} overrides the default implementation of
* this method to return {@code false} when the {@code glassPane} is visible.
* The {@code JLayer} overrides the default implementation of
* this method (in {@code JComponent}) to return {@code false}.
* This ensures
* that the drawing machinery will call the {@code JLayer}'s
* {@code paint}
* implementation rather than messaging the {@code JLayer}'s
* children directly.
*
* @return false if {@code JLayer}'s {@code glassPane} is visible
* @return false
*/
public boolean isOptimizedDrawingEnabled() {
return glassPane == null || !glassPane.isVisible();
return false;
}
/**
@ -461,17 +527,16 @@ public final class JLayer<V extends Component>
/**
* Returns the preferred size of the viewport for a view component.
* <p/>
* If the ui delegate of this layer is not {@code null}, this method delegates its
* implementation to the {@code LayerUI.getPreferredScrollableViewportSize(JLayer)}
* If the view component of this layer implements {@link Scrollable}, this method delegates its
* implementation to the view component.
*
* @return the preferred size of the viewport for a view component
*
* @see Scrollable
* @see LayerUI#getPreferredScrollableViewportSize(JLayer)
*/
public Dimension getPreferredScrollableViewportSize() {
if (getUI() != null) {
return getUI().getPreferredScrollableViewportSize(this);
if (getView() instanceof Scrollable) {
return ((Scrollable)getView()).getPreferredScrollableViewportSize();
}
return getPreferredSize();
}
@ -481,18 +546,17 @@ public final class JLayer<V extends Component>
* that display logical rows or columns in order to completely expose
* one block of rows or columns, depending on the value of orientation.
* <p/>
* If the ui delegate of this layer is not {@code null}, this method delegates its
* implementation to the {@code LayerUI.getScrollableBlockIncrement(JLayer,Rectangle,int,int)}
* If the view component of this layer implements {@link Scrollable}, this method delegates its
* implementation to the view component.
*
* @return the "block" increment for scrolling in the specified direction
*
* @see Scrollable
* @see LayerUI#getScrollableBlockIncrement(JLayer, Rectangle, int, int)
*/
public int getScrollableBlockIncrement(Rectangle visibleRect,
int orientation, int direction) {
if (getUI() != null) {
return getUI().getScrollableBlockIncrement(this, visibleRect,
if (getView() instanceof Scrollable) {
return ((Scrollable)getView()).getScrollableBlockIncrement(visibleRect,
orientation, direction);
}
return (orientation == SwingConstants.VERTICAL) ? visibleRect.height :
@ -504,17 +568,16 @@ public final class JLayer<V extends Component>
* determine the height of the layer, unless the preferred height
* of the layer is smaller than the height of the viewport.
* <p/>
* If the ui delegate of this layer is not null, this method delegates its
* implementation to the {@code LayerUI.getScrollableTracksViewportHeight(JLayer)}
* If the view component of this layer implements {@link Scrollable}, this method delegates its
* implementation to the view component.
*
* @return whether the layer should track the height of the viewport
*
* @see Scrollable
* @see LayerUI#getScrollableTracksViewportHeight(JLayer)
*/
public boolean getScrollableTracksViewportHeight() {
if (getUI() != null) {
return getUI().getScrollableTracksViewportHeight(this);
if (getView() instanceof Scrollable) {
return ((Scrollable)getView()).getScrollableTracksViewportHeight();
}
return false;
}
@ -524,17 +587,16 @@ public final class JLayer<V extends Component>
* determine the width of the layer, unless the preferred width
* of the layer is smaller than the width of the viewport.
* <p/>
* If the ui delegate of this layer is not null, this method delegates its
* implementation to the {@code LayerUI.getScrollableTracksViewportWidth(JLayer)}
* If the view component of this layer implements {@link Scrollable}, this method delegates its
* implementation to the view component.
*
* @return whether the layer should track the width of the viewport
*
* @see Scrollable
* @see LayerUI#getScrollableTracksViewportWidth(JLayer)
*/
public boolean getScrollableTracksViewportWidth() {
if (getUI() != null) {
return getUI().getScrollableTracksViewportWidth(this);
if (getView() instanceof Scrollable) {
return ((Scrollable)getView()).getScrollableTracksViewportWidth();
}
return false;
}
@ -549,20 +611,19 @@ public final class JLayer<V extends Component>
* Scrolling containers, like {@code JScrollPane}, will use this method
* each time the user requests a unit scroll.
* <p/>
* If the ui delegate of this layer is not {@code null}, this method delegates its
* implementation to the {@code LayerUI.getScrollableUnitIncrement(JLayer,Rectangle,int,int)}
* If the view component of this layer implements {@link Scrollable}, this method delegates its
* implementation to the view component.
*
* @return The "unit" increment for scrolling in the specified direction.
* This value should always be positive.
*
* @see Scrollable
* @see LayerUI#getScrollableUnitIncrement(JLayer, Rectangle, int, int)
*/
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation,
int direction) {
if (getUI() != null) {
return getUI().getScrollableUnitIncrement(
this, visibleRect, orientation, direction);
if (getView() instanceof Scrollable) {
return ((Scrollable) getView()).getScrollableUnitIncrement(
visibleRect, orientation, direction);
}
return 1;
}
@ -594,6 +655,16 @@ public final class JLayer<V extends Component>
eventController.updateAWTEventListener(eventMask, 0);
}
/**
* Delegates its functionality to the {@link javax.swing.plaf.LayerUI#doLayout(JLayer)} method,
* if {@code LayerUI} is set.
*/
public void doLayout() {
if (getUI() != null) {
getUI().doLayout(this);
}
}
/**
* static AWTEventListener to be shared with all AbstractLayerUIs
*/
@ -625,8 +696,8 @@ public final class JLayer<V extends Component>
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(),
event.getID())) {
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
@ -758,82 +829,4 @@ public final class JLayer<V extends Component>
return super.contains(x, y);
}
}
/**
* The default layout manager for the {@link javax.swing.JLayer}.<br/>
* It places the glassPane on top of the view component
* and makes it the same size as {@code JLayer},
* it also makes the view component the same size but minus layer's insets<br/>
*/
private static class DefaultLayerLayout implements LayoutManager, Serializable {
/**
* {@inheritDoc}
*/
public void layoutContainer(Container parent) {
JLayer layer = (JLayer) parent;
Component view = layer.getView();
Component glassPane = layer.getGlassPane();
if (view != null) {
Insets insets = layer.getInsets();
view.setLocation(insets.left, insets.top);
view.setSize(layer.getWidth() - insets.left - insets.right,
layer.getHeight() - insets.top - insets.bottom);
}
if (glassPane != null) {
glassPane.setLocation(0, 0);
glassPane.setSize(layer.getWidth(), layer.getHeight());
}
}
/**
* {@inheritDoc}
*/
public Dimension minimumLayoutSize(Container parent) {
JLayer layer = (JLayer) parent;
Insets insets = layer.getInsets();
Dimension ret = new Dimension(insets.left + insets.right,
insets.top + insets.bottom);
Component view = layer.getView();
if (view != null) {
Dimension size = view.getMinimumSize();
ret.width += size.width;
ret.height += size.height;
}
if (ret.width == 0 || ret.height == 0) {
ret.width = ret.height = 4;
}
return ret;
}
/**
* {@inheritDoc}
*/
public Dimension preferredLayoutSize(Container parent) {
JLayer layer = (JLayer) parent;
Insets insets = layer.getInsets();
Dimension ret = new Dimension(insets.left + insets.right,
insets.top + insets.bottom);
Component view = layer.getView();
if (view != null) {
Dimension size = view.getPreferredSize();
if (size.width > 0 && size.height > 0) {
ret.width += size.width;
ret.height += size.height;
}
}
return ret;
}
/**
* {@inheritDoc}
*/
public void addLayoutComponent(String name, Component comp) {
}
/**
* {@inheritDoc}
*/
public void removeLayoutComponent(Component comp) {
}
}
}

View File

@ -4574,9 +4574,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
* @see TableColumnModelListener
*/
public void columnMoved(TableColumnModelEvent e) {
// If I'm currently editing, then I should stop editing
if (isEditing()) {
removeEditor();
if (isEditing() && !getCellEditor().stopCellEditing()) {
getCellEditor().cancelCellEditing();
}
repaint();
}
@ -4593,8 +4592,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
* @see TableColumnModelListener
*/
public void columnMarginChanged(ChangeEvent e) {
if (isEditing()) {
removeEditor();
if (isEditing() && !getCellEditor().stopCellEditing()) {
getCellEditor().cancelCellEditing();
}
TableColumn resizingColumn = getResizingColumn();
// Need to do this here, before the parent's

View File

@ -459,7 +459,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
if (insideComponent == null) {
// Drag exit
}
if (window != null && event.getSource() == window) {
if (window != null && event.getSource() == window && insideComponent != null) {
// if we get an exit and have a heavy window
// we need to check if it if overlapping the inside component
Container insideComponentWindow = insideComponent.getTopLevelAncestor();

View File

@ -599,104 +599,6 @@ public class LayerUI<V extends Component>
public void applyPropertyChange(PropertyChangeEvent evt, JLayer<? extends V> l) {
}
/**
* Returns the preferred size of the viewport for a view component.
*
* @param l the {@code JLayer} component where this UI delegate is being installed
* @return the preferred size of the viewport for a view component
* @see Scrollable#getPreferredScrollableViewportSize()
*/
public Dimension getPreferredScrollableViewportSize(JLayer<? extends V> l) {
if (l.getView() instanceof Scrollable) {
return ((Scrollable)l.getView()).getPreferredScrollableViewportSize();
}
return l.getPreferredSize();
}
/**
* Returns a scroll increment, which is required for components
* that display logical rows or columns in order to completely expose
* one block of rows or columns, depending on the value of orientation.
*
* @param l the {@code JLayer} component where this UI delegate is being installed
* @param visibleRect The view area visible within the viewport
* @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
* @param direction Less than zero to scroll up/left, greater than zero for down/right.
* @return the "block" increment for scrolling in the specified direction
* @see Scrollable#getScrollableBlockIncrement(Rectangle, int, int)
*/
public int getScrollableBlockIncrement(JLayer<? extends V> l,
Rectangle visibleRect,
int orientation, int direction) {
if (l.getView() instanceof Scrollable) {
return ((Scrollable)l.getView()).getScrollableBlockIncrement(
visibleRect,orientation, direction);
}
return (orientation == SwingConstants.VERTICAL) ? visibleRect.height :
visibleRect.width;
}
/**
* Returns {@code false} to indicate that the height of the viewport does not
* determine the height of the layer, unless the preferred height
* of the layer is smaller than the height of the viewport.
*
* @param l the {@code JLayer} component where this UI delegate is being installed
* @return whether the layer should track the height of the viewport
* @see Scrollable#getScrollableTracksViewportHeight()
*/
public boolean getScrollableTracksViewportHeight(JLayer<? extends V> l) {
if (l.getView() instanceof Scrollable) {
return ((Scrollable)l.getView()).getScrollableTracksViewportHeight();
}
return false;
}
/**
* Returns {@code false} to indicate that the width of the viewport does not
* determine the width of the layer, unless the preferred width
* of the layer is smaller than the width of the viewport.
*
* @param l the {@code JLayer} component where this UI delegate is being installed
* @return whether the layer should track the width of the viewport
* @see Scrollable
* @see LayerUI#getScrollableTracksViewportWidth(JLayer)
*/
public boolean getScrollableTracksViewportWidth(JLayer<? extends V> l) {
if (l.getView() instanceof Scrollable) {
return ((Scrollable)l.getView()).getScrollableTracksViewportWidth();
}
return false;
}
/**
* Returns a scroll increment, which is required for components
* that display logical rows or columns in order to completely expose
* one new row or column, depending on the value of orientation.
* Ideally, components should handle a partially exposed row or column
* by returning the distance required to completely expose the item.
* <p>
* Scrolling containers, like JScrollPane, will use this method
* each time the user requests a unit scroll.
*
* @param l the {@code JLayer} component where this UI delegate is being installed
* @param visibleRect The view area visible within the viewport
* @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
* @param direction Less than zero to scroll up/left, greater than zero for down/right.
* @return The "unit" increment for scrolling in the specified direction.
* This value should always be positive.
* @see Scrollable#getScrollableUnitIncrement(Rectangle, int, int)
*/
public int getScrollableUnitIncrement(JLayer<? extends V> l,
Rectangle visibleRect,
int orientation, int direction) {
if (l.getView() instanceof Scrollable) {
return ((Scrollable)l.getView()).getScrollableUnitIncrement(
visibleRect, orientation, direction);
}
return 1;
}
/**
* If the {@code JLayer}'s view component is not {@code null},
* this calls the view's {@code getBaseline()} method.
@ -718,7 +620,7 @@ public class LayerUI<V extends Component>
/**
* If the {@code JLayer}'s view component is not {@code null},
* this calls the view's {@code getBaselineResizeBehavior()} method.
* this returns the result of the view's {@code getBaselineResizeBehavior()} method.
* Otherwise, the default implementation is called.
*
* @param c {@code JLayer} to return baseline resize behavior for
@ -732,4 +634,90 @@ public class LayerUI<V extends Component>
}
return super.getBaselineResizeBehavior(c);
}
/**
* Causes the passed instance of {@code JLayer} to lay out its components.
*
* @param l the {@code JLayer} component where this UI delegate is being installed
*/
public void doLayout(JLayer<? extends V> l) {
Component view = l.getView();
if (view != null) {
view.setBounds(0, 0, l.getWidth(), l.getHeight());
}
Component glassPane = l.getGlassPane();
if (glassPane != null) {
glassPane.setBounds(0, 0, l.getWidth(), l.getHeight());
}
}
/**
* If the {@code JLayer}'s view component is not {@code null},
* this returns the result of the view's {@code getPreferredSize()} method.
* Otherwise, the default implementation is used.
*
* @param c {@code JLayer} to return preferred size for
* @return preferred size for the passed {@code JLayer}
*/
public Dimension getPreferredSize(JComponent c) {
JLayer l = (JLayer) c;
Component view = l.getView();
if (view != null) {
return view.getPreferredSize();
}
return super.getPreferredSize(c);
}
/**
* If the {@code JLayer}'s view component is not {@code null},
* this returns the result of the view's {@code getMinimalSize()} method.
* Otherwise, the default implementation is used.
*
* @param c {@code JLayer} to return preferred size for
* @return minimal size for the passed {@code JLayer}
*/
public Dimension getMinimumSize(JComponent c) {
JLayer l = (JLayer) c;
Component view = l.getView();
if (view != null) {
return view.getMinimumSize();
}
return super.getMinimumSize(c);
}
/**
* If the {@code JLayer}'s view component is not {@code null},
* this returns the result of the view's {@code getMaximumSize()} method.
* Otherwise, the default implementation is used.
*
* @param c {@code JLayer} to return preferred size for
* @return maximun size for the passed {@code JLayer}
*/
public Dimension getMaximumSize(JComponent c) {
JLayer l = (JLayer) c;
Component view = l.getView();
if (view != null) {
return view.getMaximumSize();
}
return super.getMaximumSize(c);
}
/**
* Adds the specified region to the dirty region list if the component
* is showing. The component will be repainted after all of the
* currently pending events have been dispatched.
* <p/>
* This method is to be overridden when the dirty region needs to be changed.
*
* @param tm this parameter is not used
* @param x the x value of the dirty region
* @param y the y value of the dirty region
* @param width the width of the dirty region
* @param height the height of the dirty region
* @see java.awt.Component#isShowing
* @see RepaintManager#addDirtyRegion
*/
public void repaint(long tm, int x, int y, int width, int height, JLayer<? extends V> l) {
RepaintManager.currentManager(l).addDirtyRegion(l, x, y, width, height);
}
}

View File

@ -1603,6 +1603,7 @@ public class BasicScrollBarUI
BoundedRangeModel newModel = (BoundedRangeModel)e.getNewValue();
oldModel.removeChangeListener(modelListener);
newModel.addChangeListener(modelListener);
scrollBarValue = scrollbar.getValue();
scrollbar.repaint();
scrollbar.revalidate();
} else if ("orientation" == propertyName) {

View File

@ -144,7 +144,7 @@ public class MetalComboBoxUI extends BasicComboBoxUI {
*/
public int getBaseline(JComponent c, int width, int height) {
int baseline;
if (MetalLookAndFeel.usingOcean()) {
if (MetalLookAndFeel.usingOcean() && height >= 4) {
height -= 4;
baseline = super.getBaseline(c, width, height);
if (baseline >= 0) {

View File

@ -115,6 +115,9 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI
return new SynthTabbedPaneUI();
}
private SynthTabbedPaneUI() {
}
private boolean scrollableTabLayoutEnabled() {
return (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT);
}

View File

@ -344,6 +344,11 @@ public final class AWTAccessor {
* Removes the last focus request for the heavyweight from the queue.
*/
void removeLastFocusRequest(Component heavyweight);
/*
* Sets the most recent focus owner in the window.
*/
void setMostRecentFocusOwner(Window window, Component component);
}
/*

View File

@ -70,7 +70,10 @@ public abstract class EmbeddedFrame extends Frame
// JDK 1.1 compatibility
private static final long serialVersionUID = 2967042741780317130L;
// Use these in traverseOut method to determine directions
/*
* The constants define focus traversal directions.
* Use them in {@code traverseIn}, {@code traverseOut} methods.
*/
protected static final boolean FORWARD = true;
protected static final boolean BACKWARD = false;
@ -283,6 +286,41 @@ public abstract class EmbeddedFrame extends Frame
return false;
}
/**
* This method is called by the embedder when we should receive focus as element
* of the traversal chain. The method requests focus on:
* 1. the first Component of this EmbeddedFrame if user moves focus forward
* in the focus traversal cycle.
* 2. the last Component of this EmbeddedFrame if user moves focus backward
* in the focus traversal cycle.
*
* The direction parameter specifies which of the two mentioned cases is
* happening. Use FORWARD and BACKWARD constants defined in the EmbeddedFrame class
* to avoid confusing boolean values.
*
* A concrete implementation of this method is defined in the platform-dependent
* subclasses.
*
* @param direction FORWARD or BACKWARD
* @return true, if the EmbeddedFrame wants to get focus, false otherwise.
*/
public boolean traverseIn(boolean direction) {
Component comp = null;
if (direction == FORWARD) {
comp = getFocusTraversalPolicy().getFirstComponent(this);
} else {
comp = getFocusTraversalPolicy().getLastComponent(this);
}
if (comp != null) {
// comp.requestFocus(); - Leads to a hung.
AWTAccessor.getKeyboardFocusManagerAccessor().setMostRecentFocusOwner(this, comp);
synthesizeWindowActivation(true);
}
return (null != comp);
}
/**
* This method is called from dispatchKeyEvent in the following two cases:
* 1. The focus is on the first Component of this EmbeddedFrame and we are

View File

@ -25,13 +25,18 @@
package sun.jkernel;
import java.io.*;
import java.net.URLStreamHandlerFactory;
import java.net.URL;
import java.net.MalformedURLException;
import java.security.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.jar.*;
import java.util.zip.*;
import sun.misc.Launcher;
import sun.misc.BootClassLoaderHook;
import sun.misc.Launcher;
import sun.misc.URLClassPath;
import sun.net.www.ParseUtil;
/**
* Handles the downloading of additional JRE components. The bootstrap class
@ -658,31 +663,61 @@ public class DownloadManager extends BootClassLoaderHook {
return getAppDataLocalLow() + getKernelJREDir();
}
/**
* Returns an array of JAR files which have been added to the boot strap
* class path since the JVM was first booted.
*/
public static synchronized File[] getAdditionalBootStrapPaths() {
return additionalBootStrapPaths != null ? additionalBootStrapPaths :
new File[0];
}
// To be revisited:
// How DownloadManager maintains its bootstrap class path.
// sun.misc.Launcher.getBootstrapClassPath() returns
// DownloadManager.getBootstrapClassPath() instead.
//
// So should no longer need to lock the Launcher.class.
// In addition, additionalBootStrapPaths is not really needed
// if it obtains the initial bootclasspath during DownloadManager's
// initialization.
private static void addEntryToBootClassPath(File path) {
// Must acquire these locks in this order
synchronized(Launcher.class) {
synchronized(DownloadManager.class) {
synchronized(DownloadManager.class) {
File[] newBootStrapPaths = new File[
additionalBootStrapPaths.length + 1];
System.arraycopy(additionalBootStrapPaths, 0, newBootStrapPaths,
0, additionalBootStrapPaths.length);
newBootStrapPaths[newBootStrapPaths.length - 1] = path;
additionalBootStrapPaths = newBootStrapPaths;
Launcher.flushBootstrapClassPath();
if (bootstrapClassPath != null)
bootstrapClassPath.addURL(getFileURL(path));
}
}
}
/**
* Returns the kernel's bootstrap class path which includes the additional
* JARs downloaded
*/
private static URLClassPath bootstrapClassPath = null;
private synchronized static
URLClassPath getBootClassPath(URLClassPath bcp,
URLStreamHandlerFactory factory)
{
if (bootstrapClassPath == null) {
bootstrapClassPath = new URLClassPath(bcp.getURLs(), factory);
for (File path : additionalBootStrapPaths) {
bootstrapClassPath.addURL(getFileURL(path));
}
}
return bootstrapClassPath;
}
private static URL getFileURL(File file) {
try {
file = file.getCanonicalFile();
} catch (IOException e) {}
try {
return ParseUtil.fileToEncodedURL(file);
} catch (MalformedURLException e) {
// Should never happen since we specify the protocol...
throw new InternalError();
}
}
/**
* Scan through java.ext.dirs to see if the lib/ext directory is included.
@ -1680,8 +1715,10 @@ public class DownloadManager extends BootClassLoaderHook {
}
}
public File[] getAdditionalBootstrapPaths() {
return DownloadManager.getAdditionalBootStrapPaths();
public URLClassPath getBootstrapClassPath(URLClassPath bcp,
URLStreamHandlerFactory factory)
{
return DownloadManager.getBootClassPath(bcp, factory);
}
public boolean isCurrentThreadPrefetching() {

View File

@ -49,7 +49,7 @@ java.launcher.opt.footer =\ -cp <class search path of directories and zip
\ -version:<value>\n\
\ require the specified version to run\n\
\ -showversion print product version and continue\n\
\ -jre-restrict-search | -jre-no-restrict-search\n\
\ -jre-restrict-search | -no-jre-restrict-search\n\
\ include/exclude user private JREs in the version search\n\
\ -? -help print this help message\n\
\ -X print help on non-standard options\n\

View File

@ -34,7 +34,7 @@ java.launcher.ergo.message1 =\ Standard-VM ist {0},
java.launcher.ergo.message2 =\ da Sie auf einem Server-Class-Computer ausf\u00fchren.\n
# Translators please note do not translate the options themselves
java.launcher.opt.footer =\ -cp <Pfad zur Klassensuche von Verzeichnissen und Zip-/Jar-Dateien>\n\ -classpath <Pfad zur Klassensuche von Verzeichnissen und Zip-/Jar-Dateien >\n\ A {0} getrennte Liste von Verzeichnissen, JAR-Archiven,\n\ und ZIP-Archiven f\u00fcr die Suche nach Klassendateien .\n\ -D<Name>=<Wert>\n\ Systemeigenschaft festlegen\n\ -verbose[:class|gc|jni]\n\ ausf\u00fchrliche Ausgabe aktivieren\n\ -version Produktversion drucken und beenden\n\ -version:<Wert>\n\ angegebene Version zum Ausf\u00fchren erforderlich \n\ -showversion Produktversion drucken und fortfahren\n\ -jre-restrict-search | -jre-no-restrict-search\n\ private JREs der Benutzer in Versionssuche ein-/ausschlie\u00dfen\n\ -? -help diese Hilfemeldung drucken\n\ -X Hilfe zu nicht standardm\u00e4\u00dfigen Optionen drucken\n\ -ea[:<Paketname>...|:<Klassenname>]\n\ -enableassertions[:<Paketname>...|:<Klassenname>]\n\ Assertions mit spezifizierter Granularit\u00e4t aktivieren\n\ -da[:<Paketname>...|:<Klassenname>]\n\ -disableassertions[:<Paketname>...|:<Klassenname>]\n\ Assertions mit spezifizierter Granularit\u00e4t deaktivieren\n\ -esa | --enablesystemassertions\n\ System-Assertions aktivieren\n\ -dsa | --disablesystemassertions\n\ System-Assertions deaktivieren\n\ -agentlib:<Name der Bibliothek>[=<Optionen>]\n\ systemeigene Agent-Bibliothek laden <Name der Bibliothek>, z.B. -agentlib:hprof\n\ siehe auch, -agentlib:jdwp=help und -agentlib:hprof=help\n\ -agentpath:<Pfadname>[=<Optionen>]\n\ systemeigene Agent-Bibliothek \u00fcber vollst\u00e4ndigen Pfadnamen laden\n\ -javaagent:<Jar-Pfad>[=<Optionen>]\n\ Java Programmierungs-Sprachagenten laden, siehe java.lang.instrument\n\ -splash:<Bildpfad>\n\ Eingangsbildschirm mit spezifiziertem Bild anzeigen\nWeitere Informationen finden Sie unter http://java.sun.com/javase/reference.
java.launcher.opt.footer =\ -cp <Pfad zur Klassensuche von Verzeichnissen und Zip-/Jar-Dateien>\n\ -classpath <Pfad zur Klassensuche von Verzeichnissen und Zip-/Jar-Dateien >\n\ A {0} getrennte Liste von Verzeichnissen, JAR-Archiven,\n\ und ZIP-Archiven f\u00fcr die Suche nach Klassendateien .\n\ -D<Name>=<Wert>\n\ Systemeigenschaft festlegen\n\ -verbose[:class|gc|jni]\n\ ausf\u00fchrliche Ausgabe aktivieren\n\ -version Produktversion drucken und beenden\n\ -version:<Wert>\n\ angegebene Version zum Ausf\u00fchren erforderlich \n\ -showversion Produktversion drucken und fortfahren\n\ -jre-restrict-search | -no-jre-restrict-search\n\ private JREs der Benutzer in Versionssuche ein-/ausschlie\u00dfen\n\ -? -help diese Hilfemeldung drucken\n\ -X Hilfe zu nicht standardm\u00e4\u00dfigen Optionen drucken\n\ -ea[:<Paketname>...|:<Klassenname>]\n\ -enableassertions[:<Paketname>...|:<Klassenname>]\n\ Assertions mit spezifizierter Granularit\u00e4t aktivieren\n\ -da[:<Paketname>...|:<Klassenname>]\n\ -disableassertions[:<Paketname>...|:<Klassenname>]\n\ Assertions mit spezifizierter Granularit\u00e4t deaktivieren\n\ -esa | --enablesystemassertions\n\ System-Assertions aktivieren\n\ -dsa | --disablesystemassertions\n\ System-Assertions deaktivieren\n\ -agentlib:<Name der Bibliothek>[=<Optionen>]\n\ systemeigene Agent-Bibliothek laden <Name der Bibliothek>, z.B. -agentlib:hprof\n\ siehe auch, -agentlib:jdwp=help und -agentlib:hprof=help\n\ -agentpath:<Pfadname>[=<Optionen>]\n\ systemeigene Agent-Bibliothek \u00fcber vollst\u00e4ndigen Pfadnamen laden\n\ -javaagent:<Jar-Pfad>[=<Optionen>]\n\ Java Programmierungs-Sprachagenten laden, siehe java.lang.instrument\n\ -splash:<Bildpfad>\n\ Eingangsbildschirm mit spezifiziertem Bild anzeigen\nWeitere Informationen finden Sie unter http://java.sun.com/javase/reference.
# Translators please note do not translate the options themselves
java.launcher.X.usage=\ -Xmixed gemischte Ausf\u00fchrung des Modus (Standard)\n\ -Xint nur interpretierte Ausf\u00fchrung des Modus\n\ -Xbootclasspath:<Verzeichnisse und Zip-/Jar-Dateien, die durch {0} getrennt sind>\n\ Suchpfad f\u00fcr Bootstrap-Klassen und Ressourcen einrichten\n\ -Xbootclasspath/a:<Verzeichnisse und Zip-/Jar-Dateien, die durch {0} getrennt sind>\n\ an das Ende des Bootstrap-Klassenpfads anh\u00e4ngen\n\ -Xbootclasspath/p:<Verzeichnisse und Zip-/Jar-Dateien, die durch {0} getrennt sind>\n\ an den Beginn des Bootstrap-Klassenpfads anh\u00e4ngen\n\ -Xnoclassgc Klassen-Speicherbereinigung deaktivieren\n\ -Xincgc inkrementelle Speicherbereinigung aktivieren\n\ -Xloggc:<Datei> GC-Status f\u00fcr eine Datei mit Zeitstempeln einrichten\n\ -Xbatch Hintergrund-Kompilation deaktivieren\n\ -Xms<Gr\u00f6\u00dfe> anf\u00e4ngliche Java Heap-Gr\u00f6\u00dfe einstellen\n\ -Xmx<Gr\u00f6\u00dfe> maximale Java Heap-Gr\u00f6\u00dfe einstellen\n\ -Xss<Gr\u00f6\u00dfe> Gr\u00f6\u00dfe des Java Thread-Stack einstellen\n\ -Xprof CPU-Profildaten ausgeben\n\ -Xfuture genaueste Pr\u00fcfungen aktivieren und zuk\u00fcnftige Standards absehen\n\ -Xrs Verwendung von OS-Signalen durch Java/VM reduzieren (siehe Dokumentation)\n\ -Xcheck:jni zus\u00e4tzliche Pr\u00fcfungen f\u00fcr JNI- Funktionen ausf\u00fchren\n\ -Xshare:off Nicht versuchen, freigegebene Klassendaten zu verwenden\n\ -Xshare:auto Freigegebene Klassendaten verwenden, wenn m\u00f6glich (Standard)\n\ -Xshare:on Nutzung freigegebener Daten ist erforderlich, ansonsten schl\u00e4gt der Vorgang fehl.\n\nDie -X-Optionen sind kein Standard und k\u00f6nnen \u00c4nderungen unterliegen.\n

View File

@ -34,7 +34,7 @@ java.launcher.ergo.message1 =\ La m\u00e1quina virtual predete
java.launcher.ergo.message2 =\ porque est\u00e1 trabajando en una m\u00e1quina de clase servidor.\n
# Translators please note do not translate the options themselves
java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n\ -classpath <class search path of directories and zip/jar files>\n\ Una {0} lista de directorios, archivos JAR,\n\ y archivos ZIP en los que buscar los archivos de clase.\n\ -D<name>=<value>\n\ establecer una propiedad de sistema\n\ -verbose[:class|gc|jni]\n\ permitir la salida detallada\n\ -version imprimir versi\u00f3n del producto y salir\n\ -version:<value>\n\ solicitar la versi\u00f3n especificada para ejecutar\n\ -showversion imprimir versi\u00f3n del producto y continuar\n\ -jre-restrict-search | -jre-no-restrict-search\n\ incluir/excluir JRE privados del usuario en la b\u00fasqueda de la versi\u00f3n\n\ -? -help imprimir este mensaje de ayuda\n\ -X imprimir ayuda en las opciones no est\u00e1ndar\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ permitir afirmaciones con granularidad especificada\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ desactivar afirmaciones con granularidad especificada\n\ -esa | -enablesystemassertions\n\ permitir afirmaciones del sistema\n\ -dsa | -disablesystemassertions\n\ desactivar afirmaciones del sistema\n\ -agentlib:<libname>[=<options>]\n\ cargar biblioteca de agente nativo<libname>, por ejemplo -agentlib:hprof\n\ consulte tambi\u00e9n, -agentlib:jdwp=help y -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ cargar biblioteca de agente nativo por ruta completa\n\ -javaagent:<jarpath>[=<options>]\n\ cargar agente del lenguaje de programaci\u00f3n Java, consulte java.lang.instrument\n\ -splash:<imagepath>\n\ mostrar pantalla de bienvenida con imagen especificada\nConsulte http://java.sun.com/javase/reference para m\u00e1s informaci\u00f3n.
java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n\ -classpath <class search path of directories and zip/jar files>\n\ Una {0} lista de directorios, archivos JAR,\n\ y archivos ZIP en los que buscar los archivos de clase.\n\ -D<name>=<value>\n\ establecer una propiedad de sistema\n\ -verbose[:class|gc|jni]\n\ permitir la salida detallada\n\ -version imprimir versi\u00f3n del producto y salir\n\ -version:<value>\n\ solicitar la versi\u00f3n especificada para ejecutar\n\ -showversion imprimir versi\u00f3n del producto y continuar\n\ -jre-restrict-search | -no-jre-restrict-search\n\ incluir/excluir JRE privados del usuario en la b\u00fasqueda de la versi\u00f3n\n\ -? -help imprimir este mensaje de ayuda\n\ -X imprimir ayuda en las opciones no est\u00e1ndar\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ permitir afirmaciones con granularidad especificada\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ desactivar afirmaciones con granularidad especificada\n\ -esa | -enablesystemassertions\n\ permitir afirmaciones del sistema\n\ -dsa | -disablesystemassertions\n\ desactivar afirmaciones del sistema\n\ -agentlib:<libname>[=<options>]\n\ cargar biblioteca de agente nativo<libname>, por ejemplo -agentlib:hprof\n\ consulte tambi\u00e9n, -agentlib:jdwp=help y -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ cargar biblioteca de agente nativo por ruta completa\n\ -javaagent:<jarpath>[=<options>]\n\ cargar agente del lenguaje de programaci\u00f3n Java, consulte java.lang.instrument\n\ -splash:<imagepath>\n\ mostrar pantalla de bienvenida con imagen especificada\nConsulte http://java.sun.com/javase/reference para m\u00e1s informaci\u00f3n.
# Translators please note do not translate the options themselves
java.launcher.X.usage=\ -Xmixed modo mixto de ejecuci\u00f3n (predeterminado)\n\ -Xint s\u00f3lo modo de ejecuci\u00f3n interpretado\n\ -Xbootclasspath:<directories and zip/jar files separated by {0}>\n\ definir ruta de b\u00fasqueda para clases y recursos de la rutina de carga\n\ -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n\ a\u00f1adir al final de la ruta de clase de la rutina de carga\n\ -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n\ a\u00f1adir al principio de la ruta de clase de la rutina de carga\n\ -Xnoclassgc desactivar recolecci\u00f3n de residuos de clase\n\ -Xincgc permitir recolecci\u00f3n de residuos incremental\n\ -Xloggc:<file> registrar estado de GC en un archivo con marcas de tiempo\n\ -Xbatch desactivar recopilaci\u00f3n de fondos\n\ -Xms<size> definir tama\u00f1o del mont\u00f3n de Java inicial\n\ -Xmx<size> definir tama\u00f1o m\u00e1ximo del mont\u00f3n de Java\n\ -Xss<size> definir tama\u00f1o de la pila del subproceso de java\n\ -Xprof salida de datos del perfil de la cpu\n\ -Xfuture permitir comprobaciones m\u00e1s estrictas para los procesos predeterminados futuros\n\ -Xrs reducir el uso de se\u00f1ales del SO por parte de Java o la m\u00e1quina virtual (consulte la documentaci\u00f3n)\n\ -Xcheck:jni realizar comprobaciones adicionales para las funciones de JNI\n\ -Xshare:off no intentar utilizar datos de clase compartidos\n\ -Xshare:auto utilizar datos de clase compartidos siempre que sea posible (predeterminado)\n\ -Xshare:on solicitar el uso obligatorio de datos de clase compartidos.\n\nLas opciones "-X" no son est\u00e1ndar y pueden sufrir modificaciones sin previo aviso.\n

View File

@ -34,7 +34,7 @@ java.launcher.ergo.message1 =\ La machine virtuelle par d\u00e
java.launcher.ergo.message2 =\ car vous utilisez une machine de type serveur.\n
# Translators please note do not translate the options themselves
java.launcher.opt.footer =\ -cp <chemin de recherche de classe des r\u00e9pertoires et fichiers zip/jar>\n\ -classpath <chemin de recherche de classe des r\u00e9pertoires et fichiers zip/jar>\n\ Une liste s\u00e9par\u00e9e {0} de r\u00e9pertoires, archives JAR\n\ et archives ZIP dans laquelle rechercher des fichiers de classe.\n\ -D<nom>=<valeur>\n\ d\u00e9finir une propri\u00e9t\u00e9 syst\u00e8me\n\ -verbose[:class|gc|jni]\n\ activer une sortie d\u00e9taill\u00e9ee\n\ -version imprimer la version du produit et quitter\n\ -version:<valeur>\n\ utiliser la version sp\u00e9cifi\u00e9e pour l''ex\u00e9cution\n\ -showversion imprimer la version du produit et continuer\n\ -jre-restrict-search | -jre-no-restrict-search\n\ inclure/exclure les JRE priv\u00e9s d''utilisateur dans la recherche de version\n\ -? -help imprimer ce message d''aide\n\ -X imprimer l''aide relative aux options non standard\n\ -ea[:<nom du package>...|:<nom de la classe>]\n\ -enableassertions[:<nom du package>...|:<nom de la classe>]\n\ activer les assertions avec la granularit\u00e9 sp\u00e9cifi\u00e9e\n\ -da[:<nom du package>...|:<nom de la classe>]\n\ -disableassertions[:<nom du package>...|:<nom de la classe>]\n\ d\u00e9sactiver les assertions avec la granularit\u00e9 sp\u00e9cifi\u00e9e\n\ -esa | -enablesystemassertions\n\ activer les assertions syst\u00e8me\n\ -dsa | -disablesystemassertions\n\ d\u00e9sactiver les assertions syst\u00e8me\n\ -agentlib:<nom de la biblioth\u00e8que>[=<options>]\n\ charger la biblioth\u00e8que d''agents natifs<nom de la biblioth\u00e8que>, par exemple -agentlib:hprof\n\ voir \u00e9galement, -agentlib:jdwp=help et -agentlib:hprof=help\n\ -agentpath:<nom du chemin>[=<options>]\n\ charger la biblioth\u00e8que d''agents natifs en indiquant le chemin complet\n\ -javaagent:<chemin jar>[=<options>]\n\ charger l''agent de langage de programmation Java, voir java.lang.instrument\n\ -splash:<chemin de l''image>\n\ afficher l''\u00e9cran de bienvenue avec l''image sp\u00e9cifi\u00e9e\nPour plus de d\u00e9tails, reportez-vous \u00e0 la page http://java.sun.com/javase/reference.
java.launcher.opt.footer =\ -cp <chemin de recherche de classe des r\u00e9pertoires et fichiers zip/jar>\n\ -classpath <chemin de recherche de classe des r\u00e9pertoires et fichiers zip/jar>\n\ Une liste s\u00e9par\u00e9e {0} de r\u00e9pertoires, archives JAR\n\ et archives ZIP dans laquelle rechercher des fichiers de classe.\n\ -D<nom>=<valeur>\n\ d\u00e9finir une propri\u00e9t\u00e9 syst\u00e8me\n\ -verbose[:class|gc|jni]\n\ activer une sortie d\u00e9taill\u00e9ee\n\ -version imprimer la version du produit et quitter\n\ -version:<valeur>\n\ utiliser la version sp\u00e9cifi\u00e9e pour l''ex\u00e9cution\n\ -showversion imprimer la version du produit et continuer\n\ -jre-restrict-search | -no-jre-restrict-search\n\ inclure/exclure les JRE priv\u00e9s d''utilisateur dans la recherche de version\n\ -? -help imprimer ce message d''aide\n\ -X imprimer l''aide relative aux options non standard\n\ -ea[:<nom du package>...|:<nom de la classe>]\n\ -enableassertions[:<nom du package>...|:<nom de la classe>]\n\ activer les assertions avec la granularit\u00e9 sp\u00e9cifi\u00e9e\n\ -da[:<nom du package>...|:<nom de la classe>]\n\ -disableassertions[:<nom du package>...|:<nom de la classe>]\n\ d\u00e9sactiver les assertions avec la granularit\u00e9 sp\u00e9cifi\u00e9e\n\ -esa | -enablesystemassertions\n\ activer les assertions syst\u00e8me\n\ -dsa | -disablesystemassertions\n\ d\u00e9sactiver les assertions syst\u00e8me\n\ -agentlib:<nom de la biblioth\u00e8que>[=<options>]\n\ charger la biblioth\u00e8que d''agents natifs<nom de la biblioth\u00e8que>, par exemple -agentlib:hprof\n\ voir \u00e9galement, -agentlib:jdwp=help et -agentlib:hprof=help\n\ -agentpath:<nom du chemin>[=<options>]\n\ charger la biblioth\u00e8que d''agents natifs en indiquant le chemin complet\n\ -javaagent:<chemin jar>[=<options>]\n\ charger l''agent de langage de programmation Java, voir java.lang.instrument\n\ -splash:<chemin de l''image>\n\ afficher l''\u00e9cran de bienvenue avec l''image sp\u00e9cifi\u00e9e\nPour plus de d\u00e9tails, reportez-vous \u00e0 la page http://java.sun.com/javase/reference.
# Translators please note do not translate the options themselves
java.launcher.X.usage=\ -Xmixed ex\u00e9cution du mode compil\u00e9 (par d\u00e9faut)\n\ -Xint ex\u00e9cution du mode interpr\u00e9t\u00e9 uniquement\n\ -Xbootclasspath:<r\u00e9pertoires et fichiers zip/jar s\u00e9par\u00e9s par {0}>\n\ d\u00e9finir le chemin de recherche pour les classes et ressources bootstrap\n\ -Xbootclasspath/a:<r\u00e9pertoires et fichiers zip/jar s\u00e9par\u00e9s par {0}>\n\ ajouter \u00e0 la fin du chemin de la classe bootstrap\n\ -Xbootclasspath/p:<r\u00e9pertoires et fichiers zip/jar s\u00e9par\u00e9s par {0}>\n\ ajouter au d\u00e9but du chemin de la classe bootstrap\n\ -Xnoclassgc d\u00e9sactiver la collection d''informations parasites sur la classe\n\ -Xincgc activer la collection incr\u00e9mentielle d''informations parasites\n\ -Xloggc:<fichier> enregistrer le statut GC dans un fichier horodat\u00e9\n\ -Xbatch d\u00e9sactiver la compilation d''arri\u00e8re-plans\n\ -Xms<taille> d\u00e9finir la taille initiale des tas Java\n\ -Xmx<taille> d\u00e9finir la taille maximale des tas Java\n\ -Xss<taille> d\u00e9finir la taille des piles de fil Java\n\ -Xprof \u00e9mettre des donn\u00e9es de profilage d''UC\n\ -Xfuture activer des contr\u00f4les plus stricts, en anticipant les erreurs futures\n\ -Xrs r\u00e9duire l''utilisation des signaux d''OS par Java/la machine virtuelle (reportez-vous \u00e0 la documentation)\n\ -Xcheck:jni effectuer des contr\u00f4les suppl\u00e9mentaires pour les fonctions JNI\n\ -Xshare:off ne pas tenter d''utiliser les donn\u00e9es de classe partag\u00e9es\n\ -Xshare:auto utiliser les donn\u00e9es de classe partag\u00e9es si possible (par d\u00e9faut)\n\ -Xshare:on forcer l''utilisation de donn\u00e9es de classe partag\u00e9es, sinon \u00e9chec.\n\nLes options\u00a0X ne sont pas standard et sont sujettes \u00e0 modification sans pr\u00e9avis.\n

View File

@ -34,7 +34,7 @@ java.launcher.ergo.message1 =\ La macchina virtuale predefinit
java.launcher.ergo.message2 =\ perch\u00e9 l'esecuzione avviene su una macchina di classe server.\n
# Translators please note do not translate the options themselves
java.launcher.opt.footer =\ -cp <percorso di ricerca classe di directory e file zip/jar>\n\ -classpath <percorso di ricerca classe di directory e file zip/jar>\n\ Elenco separato da {0} di directory, archivi JAR\n\ e archivi ZIP in cui cercare i file di classe.\n\ -D<nome>=<valore>\n\ imposta una propriet\u00e0 di sistema\n\ -verbose[:class|gc|jni]\n\ attiva l''output dettagliato\n\ -version stampa la versione del prodotto ed esce\n\ -version:<valore>\n\ richiede la versione specificata per l''esecuzione\n\ -showversion stampa la versione del prodotto e procede\n\ -jre-restrict-search | -jre-no-restrict-search\n\ consente di includere/escludere JRE privati dell''utente nella ricerca della versione\n\ -? -help stampa il presente messaggio della Guida\n\ -X stampa la Guida delle opzioni non standard\n\ -ea[:<nomepacchetto>...|:<nomeclasse>]\n\ -enableassertions[:<nomepacchetto>...|:<nomeclasse>]\n\ attiva le asserzioni con la granularit\u00e0 specificata\n\ -da[:<nomepacchetto>...|:<nomeclasse>]\n\ -disableassertions[:<nomepacchetto>...|:<nomeclasse>]\n\ disattiva le asserzioni con la granularit\u00e0 specificata\n\ -esa | -enablesystemassertions\n\ attiva le asserzioni di sistema\n\ -dsa | -disablesystemassertions\n\ disattiva le asserzioni di sistema\n\ -agentlib:<nomelibreria>[=<opzioni>]\n\ carica la libreria agente nativa <nomelibreria>, ad es. -agentlib:hprof\n\ vedere anche, -agentlib:jdwp=help e -agentlib:hprof=help\n\ -agentpath:<percorso>[=<opzioni>]\n\ carica la libreria agente nativa in base al percorso completo\n\ -javaagent:<percorsojar>[=<opzioni>]\n\ carica l''agente del linguaggio di programmazione Java, vedere java.lang.instrument\n\ -splash:<percorsoimmagine>\n\ mostra la schermata iniziale con l''immagine specificata\nPer ulteriori informazioni, visitare http://java.sun.com/javase/reference.
java.launcher.opt.footer =\ -cp <percorso di ricerca classe di directory e file zip/jar>\n\ -classpath <percorso di ricerca classe di directory e file zip/jar>\n\ Elenco separato da {0} di directory, archivi JAR\n\ e archivi ZIP in cui cercare i file di classe.\n\ -D<nome>=<valore>\n\ imposta una propriet\u00e0 di sistema\n\ -verbose[:class|gc|jni]\n\ attiva l''output dettagliato\n\ -version stampa la versione del prodotto ed esce\n\ -version:<valore>\n\ richiede la versione specificata per l''esecuzione\n\ -showversion stampa la versione del prodotto e procede\n\ -jre-restrict-search | -no-jre-restrict-search\n\ consente di includere/escludere JRE privati dell''utente nella ricerca della versione\n\ -? -help stampa il presente messaggio della Guida\n\ -X stampa la Guida delle opzioni non standard\n\ -ea[:<nomepacchetto>...|:<nomeclasse>]\n\ -enableassertions[:<nomepacchetto>...|:<nomeclasse>]\n\ attiva le asserzioni con la granularit\u00e0 specificata\n\ -da[:<nomepacchetto>...|:<nomeclasse>]\n\ -disableassertions[:<nomepacchetto>...|:<nomeclasse>]\n\ disattiva le asserzioni con la granularit\u00e0 specificata\n\ -esa | -enablesystemassertions\n\ attiva le asserzioni di sistema\n\ -dsa | -disablesystemassertions\n\ disattiva le asserzioni di sistema\n\ -agentlib:<nomelibreria>[=<opzioni>]\n\ carica la libreria agente nativa <nomelibreria>, ad es. -agentlib:hprof\n\ vedere anche, -agentlib:jdwp=help e -agentlib:hprof=help\n\ -agentpath:<percorso>[=<opzioni>]\n\ carica la libreria agente nativa in base al percorso completo\n\ -javaagent:<percorsojar>[=<opzioni>]\n\ carica l''agente del linguaggio di programmazione Java, vedere java.lang.instrument\n\ -splash:<percorsoimmagine>\n\ mostra la schermata iniziale con l''immagine specificata\nPer ulteriori informazioni, visitare http://java.sun.com/javase/reference.
# Translators please note do not translate the options themselves
java.launcher.X.usage=\ -Xmixed esecuzione in modalit\u00e0 mista (predefinita)\n\ -Xint solo esecuzione in modalit\u00e0 interpretata\n\ -Xbootclasspath:<directory e file zip/jar separati da {0}>\n\ imposta il percorso di ricerca per classi e risorse di bootstrap\n\ -Xbootclasspath/a:<directory e file zip/jar separati da {0}>\n\ accoda alla fine del percorso della classe di bootstrap\n\ -Xbootclasspath/p:<directory e file zip/jar separati da {0}>\n\ antepone al percorso della classe di bootsrap\n\ -Xnoclassgc disattiva Garbage Collection per la classe\n\ -Xincgc attiva Garbage Collection incrementale\n\ -Xloggc:<file> registra lo stato GC in un file con timestamp\n\ -Xbatch disattiva la compilazione in background\n\ -Xms<dimensione> imposta la dimensione heap Java iniziale\n\ -Xmx<dimensione> imposta la dimensione heap Java massima\n\ -Xss<dimensione> imposta la dimensione dello stack del thread Java\n\ -Xprof dati di profilo della CPU di output\n\ -Xfuture attiva verifiche pi\u00f9 dettagliate, anticipa le impostazioni predefinite future\n\ -Xrs riduce l''uso di segnali OS da parte di Java o della macchina virtuale (vedere la documentazione)\n\ -Xcheck:jni esegue verifiche aggiuntive per le funzioni JNI\n\ -Xshare:off esclude l''utilizzo di dati classe condivisi\n\ -Xshare:auto imposta l''utilizzo di dati classe condivisi ogni volta che \u00e8 possibile (impostazione predefinita)\n\ -Xshare:on richiede l''utilizzo di dati classe condivisi, in caso contrario origina un errore.\n\nLe opzioni -X sono non standard e soggette a modifiche senza preavviso.\n

View File

@ -34,7 +34,7 @@ java.launcher.ergo.message1 =\ \u30c7\u30d5\u30a9\u30eb\u30c8
java.launcher.ergo.message2 =\ \u7406\u7531\u306f\u3001\u30b5\u30fc\u30d0\u30fc\u30af\u30e9\u30b9\u306e\u30de\u30b7\u30f3\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u304b\u3089\u3067\u3059\u3002\n
# Translators please note do not translate the options themselves
java.launcher.opt.footer =\ -cp <\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304a\u3088\u3073 ZIP/JAR \u30d5\u30a1\u30a4\u30eb\u306e\u30af\u30e9\u30b9\u691c\u7d22\u30d1\u30b9>\n\ -classpath <\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304a\u3088\u3073 ZIP/JAR \u30d5\u30a1\u30a4\u30eb\u306e\u30af\u30e9\u30b9\u691c\u7d22\u30d1\u30b9>\n\ \u30af\u30e9\u30b9\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3001JAR \u30a2\u30fc\u30ab\u30a4\u30d6\u3001\n\ \u304a\u3088\u3073 ZIP \u30a2\u30fc\u30ab\u30a4\u30d6\u306e {0} \u3067\u5206\u5272\u3055\u308c\u305f\u30ea\u30b9\u30c8\u3002\n\ -D<name>=<value>\n\ \u30b7\u30b9\u30c6\u30e0\u30d7\u30ed\u30d1\u30c6\u30a3\u30fc\u306e\u8a2d\u5b9a\n\ -verbose[:class|gc|jni]\n\ \u8a73\u7d30\u51fa\u529b\u306e\u6709\u52b9\u5316\n\ -version \u88fd\u54c1\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5370\u5237\u3057\u3066\u7d42\u4e86\n\ -version:<value>\n\ \u5b9f\u884c\u306b\u5fc5\u8981\u306a\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u8981\u6c42\n\ -showversion \u88fd\u54c1\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5370\u5237\u3057\u3066\u7d99\u7d9a\n\ -jre-restrict-search | -jre-no-restrict-search\n\ \u30d0\u30fc\u30b8\u30e7\u30f3\u691c\u7d22\u306b\u30e6\u30fc\u30b6\u30fc\u306e\u975e\u516c\u958b JRE \u3092\u542b\u3081\u308b\u304b\u9664\u5916\u3059\u308b\u304b\u3092\u5207\u308a\u66ff\u3048\u308b\n\ -? -help \u3053\u306e\u30d8\u30eb\u30d7\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5370\u5237\n\ -X \u975e\u6a19\u6e96\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u30d8\u30eb\u30d7\u3092\u5370\u5237\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ \u6307\u5b9a\u3057\u305f\u7c92\u5ea6\u3067\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u3092\u6709\u52b9\u5316\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ \u6307\u5b9a\u3057\u305f\u7c92\u5ea6\u3067\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u3092\u7121\u52b9\u5316\n\ -esa | -enablesystemassertions\n\ \u30b7\u30b9\u30c6\u30e0\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u3092\u6709\u52b9\u5316\n\ -dsa | -disablesystemassertions\n\ \u30b7\u30b9\u30c6\u30e0\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u3092\u7121\u52b9\u5316\n\ -agentlib:<libname>[=<options>]\n\ \u30cd\u30a4\u30c6\u30a3\u30d6\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea <libname> (\u4f8b: -agentlib:hprof) \u3092\u30ed\u30fc\u30c9\n\ \u95a2\u9023\u9805\u76ee\u3001 -agentlib:jdwp=help and -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ \u5b8c\u5168\u306a\u30d1\u30b9\u540d\u3067\u30cd\u30a4\u30c6\u30a3\u30d6\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30ed\u30fc\u30c9\n\ -javaagent:<jarpath>[=<options>]\n\ Java \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3092\u30ed\u30fc\u30c9\u3002java.lang.instrument \u3092\u53c2\u7167\n\ -splash:<imagepath>\n\ \u6307\u5b9a\u3057\u305f\u753b\u50cf\u306e\u30b9\u30d7\u30e9\u30c3\u30b7\u30e5\u753b\u9762\u3092\u8868\u793a\n\u8a73\u7d30\u306f http://java.sun.com/javase/reference \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002
java.launcher.opt.footer =\ -cp <\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304a\u3088\u3073 ZIP/JAR \u30d5\u30a1\u30a4\u30eb\u306e\u30af\u30e9\u30b9\u691c\u7d22\u30d1\u30b9>\n\ -classpath <\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304a\u3088\u3073 ZIP/JAR \u30d5\u30a1\u30a4\u30eb\u306e\u30af\u30e9\u30b9\u691c\u7d22\u30d1\u30b9>\n\ \u30af\u30e9\u30b9\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3001JAR \u30a2\u30fc\u30ab\u30a4\u30d6\u3001\n\ \u304a\u3088\u3073 ZIP \u30a2\u30fc\u30ab\u30a4\u30d6\u306e {0} \u3067\u5206\u5272\u3055\u308c\u305f\u30ea\u30b9\u30c8\u3002\n\ -D<name>=<value>\n\ \u30b7\u30b9\u30c6\u30e0\u30d7\u30ed\u30d1\u30c6\u30a3\u30fc\u306e\u8a2d\u5b9a\n\ -verbose[:class|gc|jni]\n\ \u8a73\u7d30\u51fa\u529b\u306e\u6709\u52b9\u5316\n\ -version \u88fd\u54c1\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5370\u5237\u3057\u3066\u7d42\u4e86\n\ -version:<value>\n\ \u5b9f\u884c\u306b\u5fc5\u8981\u306a\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u8981\u6c42\n\ -showversion \u88fd\u54c1\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5370\u5237\u3057\u3066\u7d99\u7d9a\n\ -jre-restrict-search | -no-jre-restrict-search\n\ \u30d0\u30fc\u30b8\u30e7\u30f3\u691c\u7d22\u306b\u30e6\u30fc\u30b6\u30fc\u306e\u975e\u516c\u958b JRE \u3092\u542b\u3081\u308b\u304b\u9664\u5916\u3059\u308b\u304b\u3092\u5207\u308a\u66ff\u3048\u308b\n\ -? -help \u3053\u306e\u30d8\u30eb\u30d7\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5370\u5237\n\ -X \u975e\u6a19\u6e96\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u30d8\u30eb\u30d7\u3092\u5370\u5237\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ \u6307\u5b9a\u3057\u305f\u7c92\u5ea6\u3067\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u3092\u6709\u52b9\u5316\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ \u6307\u5b9a\u3057\u305f\u7c92\u5ea6\u3067\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u3092\u7121\u52b9\u5316\n\ -esa | -enablesystemassertions\n\ \u30b7\u30b9\u30c6\u30e0\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u3092\u6709\u52b9\u5316\n\ -dsa | -disablesystemassertions\n\ \u30b7\u30b9\u30c6\u30e0\u30a2\u30b5\u30fc\u30b7\u30e7\u30f3\u3092\u7121\u52b9\u5316\n\ -agentlib:<libname>[=<options>]\n\ \u30cd\u30a4\u30c6\u30a3\u30d6\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea <libname> (\u4f8b: -agentlib:hprof) \u3092\u30ed\u30fc\u30c9\n\ \u95a2\u9023\u9805\u76ee\u3001 -agentlib:jdwp=help and -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ \u5b8c\u5168\u306a\u30d1\u30b9\u540d\u3067\u30cd\u30a4\u30c6\u30a3\u30d6\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30ed\u30fc\u30c9\n\ -javaagent:<jarpath>[=<options>]\n\ Java \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3092\u30ed\u30fc\u30c9\u3002java.lang.instrument \u3092\u53c2\u7167\n\ -splash:<imagepath>\n\ \u6307\u5b9a\u3057\u305f\u753b\u50cf\u306e\u30b9\u30d7\u30e9\u30c3\u30b7\u30e5\u753b\u9762\u3092\u8868\u793a\n\u8a73\u7d30\u306f http://java.sun.com/javase/reference \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002
# Translators please note do not translate the options themselves
java.launcher.X.usage=\ -Xmixed \u6df7\u5408\u30e2\u30fc\u30c9\u3067\u306e\u5b9f\u884c (\u30c7\u30d5\u30a9\u30eb\u30c8)\n\ -Xint \u30a4\u30f3\u30bf\u30fc\u30d7\u30ea\u30bf\u30e2\u30fc\u30c9\u3067\u306e\u307f\u5b9f\u884c\n\ -Xbootclasspath:<directories and zip/jar files separated by {0}>\n\ \u30d6\u30fc\u30c8\u30b9\u30c8\u30e9\u30c3\u30d7\u30af\u30e9\u30b9\u304a\u3088\u3073\u30ea\u30bd\u30fc\u30b9\u306e\u691c\u7d22\u30d1\u30b9\u3092\u8a2d\u5b9a\n\ -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n\ \u30d6\u30fc\u30c8\u30b9\u30c8\u30e9\u30c3\u30d7\u30af\u30e9\u30b9\u306e\u30d1\u30b9\u306e\u672b\u5c3e\u306b\u8ffd\u52a0\n\ -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n\ \u30d6\u30fc\u30c8\u30b9\u30c8\u30e9\u30c3\u30d7\u30af\u30e9\u30b9\u306e\u30d1\u30b9\u306e\u5192\u982d\u306b\u8ffd\u52a0\n\ -Xnoclassgc \u30af\u30e9\u30b9\u30ac\u30fc\u30d9\u30fc\u30b8\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u7121\u52b9\u5316\n\ -Xincgc \u5897\u5206\u30ac\u30fc\u30d9\u30fc\u30b8\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u7121\u52b9\u5316\n\ -Xloggc:<file> \u30d5\u30a1\u30a4\u30eb\u306e GC \u30b9\u30c6\u30fc\u30bf\u30b9\u3092\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\u4ed8\u304d\u3067\u8a18\u9332\n\ -Xbatch \u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u30b3\u30f3\u30d1\u30a4\u30eb\u3092\u7121\u52b9\u5316\n\ -Xms<size> \u521d\u671f Java \u30d2\u30fc\u30d7\u30b5\u30a4\u30ba\u3092\u8a2d\u5b9a\n\ -Xmx<size> \u6700\u5927 Java \u30d2\u30fc\u30d7\u30b5\u30a4\u30ba\u3092\u8a2d\u5b9a\n\ -Xss<size> Java \u30b9\u30ec\u30c3\u30c9\u30b9\u30bf\u30c3\u30af\u30b5\u30a4\u30ba\u3092\u8a2d\u5b9a\n\ -Xprof CPU \u30d7\u30ed\u30d5\u30a1\u30a4\u30ea\u30f3\u30b0\u30c7\u30fc\u30bf\u3092\u51fa\u529b\n\ -Xfuture \u4eca\u5f8c\u30c7\u30d5\u30a9\u30eb\u30c8\u3068\u3059\u308b\u6700\u3082\u53b3\u683c\u306a\u30c1\u30a7\u30c3\u30af\u3092\u6709\u52b9\u5316\n\ -Xrs Java/VM \u306e OS \u30b7\u30b0\u30ca\u30eb\u4f7f\u7528\u3092\u524a\u6e1b (\u30de\u30cb\u30e5\u30a2\u30eb\u3092\u53c2\u7167)\n\ -Xcheck:jni JNI \u95a2\u6570\u306e\u8ffd\u52a0\u30c1\u30a7\u30c3\u30af\u3092\u5b9f\u884c\n\ -Xshare:off \u5171\u6709\u30af\u30e9\u30b9\u30c7\u30fc\u30bf\u306e\u4f7f\u7528\u3092\u8a66\u884c\u3057\u306a\u3044\n\ -Xshare:auto \u53ef\u80fd\u306a\u5834\u5408\u306f\u5171\u6709\u30af\u30e9\u30b9\u30c7\u30fc\u30bf\u3092\u4f7f\u7528 (\u30c7\u30d5\u30a9\u30eb\u30c8)\n\ -Xshare:on \u5171\u6709\u30af\u30e9\u30b9\u30c7\u30fc\u30bf\u306e\u4f7f\u7528\u3092\u8981\u6c42 (\u305d\u3046\u3057\u306a\u3044\u3068\u969c\u5bb3\u304c\u767a\u751f\u3059\u308b\u5834\u5408)\n\n-X \u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u975e\u6a19\u6e96\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3042\u308a\u3001\u4e88\u544a\u306a\u304f\u5909\u66f4\u3055\u308c\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\n

View File

@ -34,7 +34,7 @@ java.launcher.ergo.message1 =\ \uae30\ubcf8 VM\uc740 {0}\uc784
java.launcher.ergo.message2 =\ \uadf8 \uc774\uc720\ub294 \uc11c\ubc84 \ud074\ub798\uc2a4 \uc2dc\uc2a4\ud15c\uc5d0\uc11c \uc2e4\ud589 \uc911\uc774\uae30 \ub54c\ubb38\uc785\ub2c8\ub2e4.\n
# Translators please note do not translate the options themselves
java.launcher.opt.footer =\ -cp <\ub514\ub809\ud1a0\ub9ac \ubc0f zip/jar \ud30c\uc77c\uc758 \ud074\ub798\uc2a4 \uac80\uc0c9 \uacbd\ub85c>\n\ -classpath <\ub514\ub809\ud1a0\ub9ac \ubc0f zip/jar \ud30c\uc77c\uc758 \ud074\ub798\uc2a4 \uac80\uc0c9 \uacbd\ub85c>\n\ \ud074\ub798\uc2a4 \ud30c\uc77c\uc744 \uac80\uc0c9\ud558\uae30 \uc704\ud55c \ub514\ub809\ud1a0\ub9ac, JAR \uc544\uce74\uc774\ube0c \ubc0f\n\ ZIP \uc544\uce74\uc774\ube0c\uc758 {0} \uad6c\ubd84\ub41c \ubaa9\ub85d\uc785\ub2c8\ub2e4.\n\ -D<name>=<value>\n\ \uc2dc\uc2a4\ud15c \ub4f1\ub85d \uc815\ubcf4 \uc124\uc815\n\ -verbose[:class|gc|jni]\n\ \ucd94\uac00 \ucd9c\ub825 \uc0ac\uc6a9\n\ -version \uc81c\ud488 \ubc84\uc804\uc744 \uc778\uc1c4\ud558\uace0 \uc885\ub8cc\n\ -version:<value>\n\ \uc2e4\ud589\ud558\ub824\uba74 \uc9c0\uc815\ud55c \ubc84\uc804 \ud544\uc694\n\ -showversion \uc81c\ud488 \ubc84\uc804\uc744 \uc778\uc1c4\ud558\uace0 \uacc4\uc18d\n\ -jre-restrict-search | -jre-no-restrict-search\n\ \ubc84\uc804 \uac80\uc0c9\uc5d0\uc11c \uc0ac\uc6a9\uc790 \uac1c\uc778 JRE \ud3ec\ud568/\uc81c\uc678\n\ -? -help \uc774 \ub3c4\uc6c0\ub9d0 \uba54\uc2dc\uc9c0 \uc778\uc1c4\n\ -X \ube44\ud45c\uc900 \uc635\uc158\uc5d0 \ub300\ud55c \ub3c4\uc6c0\ub9d0 \uc778\uc1c4\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ \uc9c0\uc815\ud55c \uc815\ubc00\ub3c4\uc758 \uba85\uc81c \uc0ac\uc6a9\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ \uc9c0\uc815\ud55c \uc815\ubc00\ub3c4\uc758 \uba85\uc81c \uc0ac\uc6a9 \uc548 \ud568\n\ -esa | -enablesystemassertions\n\ \uc2dc\uc2a4\ud15c \uba85\uc81c \uc0ac\uc6a9\n\ -dsa | -disablesystemassertions\n\ \uc2dc\uc2a4\ud15c \uba85\uc81c \uc0ac\uc6a9 \uc548 \ud568\n\ -agentlib:<libname>[=<options>]\n\ \uc6d0\uc2dc \uc5d0\uc774\uc804\ud2b8 \ub77c\uc774\ube0c\ub7ec\ub9ac <libname> \ub85c\ub4dc, \uc608: -agentlib:hprof\n\ \ucc38\uc870: -agentlib:jdwp=help \ubc0f -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ \uc804\uccb4 \uacbd\ub85c \uc774\ub984\uc73c\ub85c \uc6d0\uc2dc \uc5d0\uc774\uc804\ud2b8 \ub77c\uc774\ube0c\ub7ec\ub9ac \ub85c\ub4dc\n\ -javaagent:<jarpath>[=<options>]\n\ Java \ud504\ub85c\uadf8\ub798\ubc0d \uc5b8\uc5b4 \uc5d0\uc774\uc804\ud2b8 \ub85c\ub4dc, java.lang.instrument \ucc38\uc870\n\ -splash:<imagepath>\n\ \uc9c0\uc815\ud55c \uc774\ubbf8\uc9c0\uc758 \uc2a4\ud50c\ub798\uc2dc \ud654\uba74 \ud45c\uc2dc\n\uc790\uc138\ud55c \ub0b4\uc6a9\uc740 http://java.sun.com/javase/reference\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624.
java.launcher.opt.footer =\ -cp <\ub514\ub809\ud1a0\ub9ac \ubc0f zip/jar \ud30c\uc77c\uc758 \ud074\ub798\uc2a4 \uac80\uc0c9 \uacbd\ub85c>\n\ -classpath <\ub514\ub809\ud1a0\ub9ac \ubc0f zip/jar \ud30c\uc77c\uc758 \ud074\ub798\uc2a4 \uac80\uc0c9 \uacbd\ub85c>\n\ \ud074\ub798\uc2a4 \ud30c\uc77c\uc744 \uac80\uc0c9\ud558\uae30 \uc704\ud55c \ub514\ub809\ud1a0\ub9ac, JAR \uc544\uce74\uc774\ube0c \ubc0f\n\ ZIP \uc544\uce74\uc774\ube0c\uc758 {0} \uad6c\ubd84\ub41c \ubaa9\ub85d\uc785\ub2c8\ub2e4.\n\ -D<name>=<value>\n\ \uc2dc\uc2a4\ud15c \ub4f1\ub85d \uc815\ubcf4 \uc124\uc815\n\ -verbose[:class|gc|jni]\n\ \ucd94\uac00 \ucd9c\ub825 \uc0ac\uc6a9\n\ -version \uc81c\ud488 \ubc84\uc804\uc744 \uc778\uc1c4\ud558\uace0 \uc885\ub8cc\n\ -version:<value>\n\ \uc2e4\ud589\ud558\ub824\uba74 \uc9c0\uc815\ud55c \ubc84\uc804 \ud544\uc694\n\ -showversion \uc81c\ud488 \ubc84\uc804\uc744 \uc778\uc1c4\ud558\uace0 \uacc4\uc18d\n\ -jre-restrict-search | -no-jre-restrict-search\n\ \ubc84\uc804 \uac80\uc0c9\uc5d0\uc11c \uc0ac\uc6a9\uc790 \uac1c\uc778 JRE \ud3ec\ud568/\uc81c\uc678\n\ -? -help \uc774 \ub3c4\uc6c0\ub9d0 \uba54\uc2dc\uc9c0 \uc778\uc1c4\n\ -X \ube44\ud45c\uc900 \uc635\uc158\uc5d0 \ub300\ud55c \ub3c4\uc6c0\ub9d0 \uc778\uc1c4\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ \uc9c0\uc815\ud55c \uc815\ubc00\ub3c4\uc758 \uba85\uc81c \uc0ac\uc6a9\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ \uc9c0\uc815\ud55c \uc815\ubc00\ub3c4\uc758 \uba85\uc81c \uc0ac\uc6a9 \uc548 \ud568\n\ -esa | -enablesystemassertions\n\ \uc2dc\uc2a4\ud15c \uba85\uc81c \uc0ac\uc6a9\n\ -dsa | -disablesystemassertions\n\ \uc2dc\uc2a4\ud15c \uba85\uc81c \uc0ac\uc6a9 \uc548 \ud568\n\ -agentlib:<libname>[=<options>]\n\ \uc6d0\uc2dc \uc5d0\uc774\uc804\ud2b8 \ub77c\uc774\ube0c\ub7ec\ub9ac <libname> \ub85c\ub4dc, \uc608: -agentlib:hprof\n\ \ucc38\uc870: -agentlib:jdwp=help \ubc0f -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ \uc804\uccb4 \uacbd\ub85c \uc774\ub984\uc73c\ub85c \uc6d0\uc2dc \uc5d0\uc774\uc804\ud2b8 \ub77c\uc774\ube0c\ub7ec\ub9ac \ub85c\ub4dc\n\ -javaagent:<jarpath>[=<options>]\n\ Java \ud504\ub85c\uadf8\ub798\ubc0d \uc5b8\uc5b4 \uc5d0\uc774\uc804\ud2b8 \ub85c\ub4dc, java.lang.instrument \ucc38\uc870\n\ -splash:<imagepath>\n\ \uc9c0\uc815\ud55c \uc774\ubbf8\uc9c0\uc758 \uc2a4\ud50c\ub798\uc2dc \ud654\uba74 \ud45c\uc2dc\n\uc790\uc138\ud55c \ub0b4\uc6a9\uc740 http://java.sun.com/javase/reference\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624.
# Translators please note do not translate the options themselves
java.launcher.X.usage=\ -Xmixed \ud63c\ud569 \ubaa8\ub4dc \uc2e4\ud589(\uae30\ubcf8\uac12)\n\ -Xint \ud574\uc11d\ub41c \ubaa8\ub4dc \uc2e4\ud589 \uc804\uc6a9\n\ -Xbootclasspath:<directories and zip/jar files separated by {0}>\n\ \ubd80\ud2b8\uc2a4\ud2b8\ub7a9 \ud074\ub798\uc2a4\uc640 \uc790\uc6d0\uc758 \uac80\uc0c9 \uacbd\ub85c \uc124\uc815\n\ -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n\ \ubd80\ud2b8\uc2a4\ud2b8\ub7a9 \ud074\ub798\uc2a4 \uacbd\ub85c \ub05d\uc5d0 \ucd94\uac00\n\ -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n\ \ubd80\ud2b8\uc2a4\ud2b8\ub7a9 \ud074\ub798\uc2a4 \uacbd\ub85c \uc55e\uc5d0 \ucd94\uac00\n\ -Xnoclassgc \ud074\ub798\uc2a4 \uac00\ube44\uc9c0 \uceec\ub809\uc158 \uc0ac\uc6a9 \uc548 \ud568\n\ -Xincgc \uc99d\ubd84 \uac00\ube44\uc9c0 \uceec\ub809\uc158 \uc0ac\uc6a9\n\ -Xloggc:<file> GC \uc0c1\ud0dc\ub97c \ud0c0\uc784 \uc2a4\ud0ec\ud504\uc640 \ud568\uaed8 \ud30c\uc77c\uc5d0 \ub85c\uadf8\n\ -Xbatch \ubc31\uadf8\ub77c\uc6b4\ub4dc \ucef4\ud30c\uc77c \uc0ac\uc6a9 \uc548 \ud568\n\ -Xms<size> \ucd08\uae30 Java \ud799 \ud06c\uae30 \uc124\uc815\n\ -Xmx<size> \ucd5c\ub300 Java \ud799 \ud06c\uae30 \uc124\uc815\n\ -Xss<size> java \uc2a4\ub808\ub4dc \uc2a4\ud0dd \ud06c\uae30 \uc124\uc815\n\ -Xprof cpu \ud504\ub85c\ud30c\uc77c\ub9c1 \ub370\uc774\ud130 \ucd9c\ub825\n\ -Xfuture \ubbf8\ub798 \uae30\ubcf8\uac12\uc744 \uc608\uce21\ud558\uc5ec \uac00\uc7a5 \uc5c4\uaca9\ud55c \uac80\uc0ac \uc0ac\uc6a9\n\ -Xrs Java/VM\uc5d0 \uc758\ud55c OS \uc2e0\ud638 \uc0ac\uc6a9 \uac10\uc18c(\uc124\uba85\uc11c \ucc38\uc870)\n\ -Xcheck:jni JNI \uae30\ub2a5\uc5d0 \ub300\ud55c \ucd94\uac00\uc801\uc778 \uac80\uc0ac \uc218\ud589\n\ -Xshare:off \uacf5\uc720\ub41c \ud074\ub798\uc2a4 \ub370\uc774\ud130\uc758 \uc0ac\uc6a9\uc744 \uc2dc\ub3c4\ud558\uc9c0 \uc54a\uc74c\n\ -Xshare:auto \uac00\ub2a5\ud55c \uacbd\uc6b0 \uacf5\uc720\ub41c \ud074\ub798\uc2a4 \ub370\uc774\ud130 \uc0ac\uc6a9(\uae30\ubcf8\uac12)\n\ -Xshare:on \uacf5\uc720\ub41c \ud074\ub798\uc2a4 \ub370\uc774\ud130\ub97c \uc0ac\uc6a9\ud574\uc57c \ud558\uba70 \uadf8\ub807\uc9c0 \uc54a\uc73c\uba74 \uc2e4\ud328.\n\n-X \uc635\uc158\uc740 \ud45c\uc900\uc774 \uc544\ub2c8\uba70 \uc54c\ub9bc \uc5c6\uc774 \ubcc0\uacbd\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n

View File

@ -34,7 +34,7 @@ java.launcher.ergo.message1 =\ Standard-VM \u00e4r {0}
java.launcher.ergo.message2 =\ eftersom du k\u00f6r p\u00e5 en dator med server-klass.\n
# Translators please note do not translate the options themselves
java.launcher.opt.footer =\ -cp <klass\u00f6kv\u00e4g till kataloger och zip-/jar-filers>\n\ -classpath <klass\u00f6kv\u00e4g till kataloger och zip-/jar-filer>\n\ en med {0} avgr\u00e4nsad lista \u00f6ver kataloger, JAR-arkiv\n\ och ZIP-arkiv f\u00f6r s\u00f6kning efter klassfiler.\n\ -D<namn>=<v\u00e4rde>\n\ ange en systemegenskap\n\ -verbose[:klass|gc|jni]\n\ visa mer text\n\ -version skriv ut produktversionen och avsluta\n\ -version:<value>\n\ kr\u00e4ver den angivna versionen f\u00f6r att kunna k\u00f6ras\n\ -showversion skriv ut produktversion och forts\u00e4tt\n\ -jre-restrict-search | -jre-no-restrict-search\n\ inkludera/exkludera anv\u00e4ndarens privata JRE-filer i versionss\u00f6kningen\n\ -? -help skriver ut det h\u00e4r hj\u00e4lpmeddelandet\n\ -X skriv ut hj\u00e4lp f\u00f6r alternativ som inte \u00e4r standard\n\ -ea[:<paketnamn>...|:<klassnamn>]\n\ -enableassertions[:<paketnamn>...|:<klassnamn>]\n\ aktivera bekr\u00e4ftelser med angiven precision\n\ -da[:<paketnamn>...|:<klassnamn>]\n\ -disableassertions[:<paketnamn>...|:<klassnamn>]\n\ inaktivera bekr\u00e4ftelser med angiven precision\n\ -esa | -enablesystemassertions\n\ aktivera systembekr\u00e4ftelser\n\ -dsa | -disablesystemassertions\n\ inaktivera systembekr\u00e4ftelser\n\ -agentlib:<biblnamn>[=<alternativ>]\n\ l\u00e4s in det interna agentbiblioteket <biblnamn>, t.ex. -agentlib:hprof\n\ se \u00e4ven, -agentlib:jdwp=help och -agentlib:hprof=help\n\ -agentpath:<filnamn>[=<alternativ>]\n\ l\u00e4s in internt agentbibliotek utifr\u00e5n fullst\u00e4ndig s\u00f6kv\u00e4g\n\ -javaagent:<jar-s\u00f6kv\u00e4g>[=<alternativ>]\n\ l\u00e4s in agenten f\u00f6r programmeringsspr\u00e5ket Java, se java.lang.instrument\n\ -splash:<bilds\u00f6kv\u00e4g>\n\ visa v\u00e4lkomstf\u00f6nster med angiven bild\nMer information finns p\u00e5 http://java.sun.com/javase/reference.
java.launcher.opt.footer =\ -cp <klass\u00f6kv\u00e4g till kataloger och zip-/jar-filers>\n\ -classpath <klass\u00f6kv\u00e4g till kataloger och zip-/jar-filer>\n\ en med {0} avgr\u00e4nsad lista \u00f6ver kataloger, JAR-arkiv\n\ och ZIP-arkiv f\u00f6r s\u00f6kning efter klassfiler.\n\ -D<namn>=<v\u00e4rde>\n\ ange en systemegenskap\n\ -verbose[:klass|gc|jni]\n\ visa mer text\n\ -version skriv ut produktversionen och avsluta\n\ -version:<value>\n\ kr\u00e4ver den angivna versionen f\u00f6r att kunna k\u00f6ras\n\ -showversion skriv ut produktversion och forts\u00e4tt\n\ -jre-restrict-search | -no-jre-restrict-search\n\ inkludera/exkludera anv\u00e4ndarens privata JRE-filer i versionss\u00f6kningen\n\ -? -help skriver ut det h\u00e4r hj\u00e4lpmeddelandet\n\ -X skriv ut hj\u00e4lp f\u00f6r alternativ som inte \u00e4r standard\n\ -ea[:<paketnamn>...|:<klassnamn>]\n\ -enableassertions[:<paketnamn>...|:<klassnamn>]\n\ aktivera bekr\u00e4ftelser med angiven precision\n\ -da[:<paketnamn>...|:<klassnamn>]\n\ -disableassertions[:<paketnamn>...|:<klassnamn>]\n\ inaktivera bekr\u00e4ftelser med angiven precision\n\ -esa | -enablesystemassertions\n\ aktivera systembekr\u00e4ftelser\n\ -dsa | -disablesystemassertions\n\ inaktivera systembekr\u00e4ftelser\n\ -agentlib:<biblnamn>[=<alternativ>]\n\ l\u00e4s in det interna agentbiblioteket <biblnamn>, t.ex. -agentlib:hprof\n\ se \u00e4ven, -agentlib:jdwp=help och -agentlib:hprof=help\n\ -agentpath:<filnamn>[=<alternativ>]\n\ l\u00e4s in internt agentbibliotek utifr\u00e5n fullst\u00e4ndig s\u00f6kv\u00e4g\n\ -javaagent:<jar-s\u00f6kv\u00e4g>[=<alternativ>]\n\ l\u00e4s in agenten f\u00f6r programmeringsspr\u00e5ket Java, se java.lang.instrument\n\ -splash:<bilds\u00f6kv\u00e4g>\n\ visa v\u00e4lkomstf\u00f6nster med angiven bild\nMer information finns p\u00e5 http://java.sun.com/javase/reference.
# Translators please note do not translate the options themselves
java.launcher.X.usage=\ -Xmixed k\u00f6rning i blandat l\u00e4ge (standard)\n\ -Xint endast k\u00f6rning i tolkat l\u00e4ge\n\ -Xbootclasspath:<kataloger och zip-/jar-filer som avgr\u00e4nsas med {0}>\n\ ange s\u00f6kv\u00e4g f\u00f6r bootstrap-klasser och -resurser\n\ -Xbootclasspath/a:<kataloger och zip-/jar-filer som avgr\u00e4nsas med {0}>\n\ l\u00e4gg till p\u00e5 slutet av s\u00f6kv\u00e4gen till bootstrap-klassen\n\ -Xbootclasspath/p:<kataloger och zip-/jar-filer som avgr\u00e4nsas med {0}>\n\ l\u00e4gg till i b\u00f6rjan av s\u00f6kv\u00e4gen till bootstrap-klassen\n\ -Xnoclassgc inaktivera skr\u00e4pinsamling f\u00f6r klass\n\ -Xincgc aktivera inkrementell skr\u00e4pinsaming\n\ -Xloggc:<file> logga GC-status till en fil med tidsst\u00e4mpel\n\ -Xbatch inaktivera kompilering i bakgrunden\n\ -Xms<size> st\u00e4ll in ursprunglig heapstorlek f\u00f6r Java\n\ -Xmx<size> st\u00e4ll in st\u00f6rsta heapstorlek f\u00f6r Java\n\ -Xss<size> st\u00e4ll in tr\u00e5dstackens storlek f\u00f6r Java\n\ -Xprof visa profileringsdata om processorn\n\ -Xfuture aktivera de mest rigor\u00f6sa kontrollerna och f\u00f6regrip framtida standardl\u00e4ge\n\ -Xrs minska anv\u00e4ndningen av signaler fr\u00e5n operativsystemet i Java/VM (mer information finns i dokumentationen)\n\ -Xcheck:jni utf\u00f6r ytterligare kontroller f\u00f6r JNI-funktioner\n\ -Xshare:off f\u00f6rs\u00f6k inte att anv\u00e4nda delade klassdata\n\ -Xshare:auto anv\u00e4nd om m\u00f6jligt delade klassdata (standard)\n\ -Xshare:on kr\u00e4v att delade klassdata anv\u00e4nds, skicka fel om s\u00e5 inte \u00e4r fallet.\n\n -X-alternativen betraktas inte som standard och kan \u00e4ndras utan att detta meddelas.\n

View File

@ -34,7 +34,7 @@ java.launcher.ergo.message1 =\ \u9ed8\u8ba4\u7684 VM \u4e3a {0
java.launcher.ergo.message2 =\ \u56e0\u4e3a\u60a8\u662f\u5728\u670d\u52a1\u5668\u7c7b\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u3002\n
# Translators please note do not translate the options themselves
java.launcher.opt.footer =\ -cp <\u76ee\u5f55\u548c zip/jar \u6587\u4ef6\u7684\u7c7b\u641c\u7d22\u8def\u5f84>\n\ -classpath <\u76ee\u5f55\u548c zip/jar \u6587\u4ef6\u7684\u7c7b\u641c\u7d22\u8def\u5f84>\n\ \u4e00\u4e2a\u4ee5 {0} \u5206\u9694\u7684\u76ee\u5f55\u3001JAR \u5f52\u6863\u6587\u4ef6\n\ \u548c ZIP \u5f52\u6863\u6587\u4ef6\u7684\u5217\u8868\uff0c\u7528\u4e8e\u641c\u7d22\u7c7b\u6587\u4ef6\u3002\n\ -D<name>=<value>\n\ \u8bbe\u7f6e\u7cfb\u7edf\u5c5e\u6027\n\ -verbose[:class|gc|jni]\n\ \u542f\u7528\u8be6\u7ec6\u8f93\u51fa\n\ -version \u663e\u793a\u4ea7\u54c1\u7248\u672c\u5e76\u9000\u51fa\n\ -version:<value>\n\ \u8981\u6c42\u8fd0\u884c\u6307\u5b9a\u7684\u7248\u672c\n\ -showversion \u663e\u793a\u4ea7\u54c1\u7248\u672c\u5e76\u7ee7\u7eed\n\ -jre-restrict-search | -jre-no-restrict-search\n\ \u5728\u7248\u672c\u641c\u7d22\u4e2d\u5305\u62ec/\u4e0d\u5305\u62ec\u7528\u6237\u79c1\u6709 JRE\n\ -? -help \u663e\u793a\u6b64\u5e2e\u52a9\u6d88\u606f\n\ -X \u663e\u793a\u6709\u5173\u975e\u6807\u51c6\u9009\u9879\u7684\u5e2e\u52a9\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ \u542f\u7528\u6307\u5b9a\u7c92\u5ea6\u7684\u65ad\u8a00\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ \u7981\u7528\u6307\u5b9a\u7c92\u5ea6\u7684\u65ad\u8a00\n\ -esa | -enablesystemassertions\n\ \u542f\u7528\u7cfb\u7edf\u65ad\u8a00\n\ -dsa | -disablesystemassertions\n\ \u7981\u7528\u7cfb\u7edf\u65ad\u8a00\n\ -agentlib:<libname>[=<options>]\n\ \u88c5\u5165\u672c\u673a\u4ee3\u7406\u5e93 <libname>\uff0c\u4f8b\u5982\uff1a-agentlib:hprof\n\ \u53e6\u8bf7\u53c2\u89c1 -agentlib:jdwp=help \u548c -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ \u4ee5\u5168\u8def\u5f84\u540d\u88c5\u5165\u672c\u673a\u4ee3\u7406\u5e93\n\ -javaagent:<jarpath>[=<options>]\n\ \u88c5\u5165 Java \u7f16\u7a0b\u8bed\u8a00\u4ee3\u7406\uff0c\u8bf7\u53c2\u89c1 java.lang.instrument\n\ -splash:<imagepath>\n\ \u4f7f\u7528\u6307\u5b9a\u56fe\u50cf\u663e\u793a\u95ea\u73b0\u5c4f\u5e55\n\u6709\u5173\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1 http://java.sun.com/javase/reference\u3002
java.launcher.opt.footer =\ -cp <\u76ee\u5f55\u548c zip/jar \u6587\u4ef6\u7684\u7c7b\u641c\u7d22\u8def\u5f84>\n\ -classpath <\u76ee\u5f55\u548c zip/jar \u6587\u4ef6\u7684\u7c7b\u641c\u7d22\u8def\u5f84>\n\ \u4e00\u4e2a\u4ee5 {0} \u5206\u9694\u7684\u76ee\u5f55\u3001JAR \u5f52\u6863\u6587\u4ef6\n\ \u548c ZIP \u5f52\u6863\u6587\u4ef6\u7684\u5217\u8868\uff0c\u7528\u4e8e\u641c\u7d22\u7c7b\u6587\u4ef6\u3002\n\ -D<name>=<value>\n\ \u8bbe\u7f6e\u7cfb\u7edf\u5c5e\u6027\n\ -verbose[:class|gc|jni]\n\ \u542f\u7528\u8be6\u7ec6\u8f93\u51fa\n\ -version \u663e\u793a\u4ea7\u54c1\u7248\u672c\u5e76\u9000\u51fa\n\ -version:<value>\n\ \u8981\u6c42\u8fd0\u884c\u6307\u5b9a\u7684\u7248\u672c\n\ -showversion \u663e\u793a\u4ea7\u54c1\u7248\u672c\u5e76\u7ee7\u7eed\n\ -jre-restrict-search | -no-jre-restrict-search\n\ \u5728\u7248\u672c\u641c\u7d22\u4e2d\u5305\u62ec/\u4e0d\u5305\u62ec\u7528\u6237\u79c1\u6709 JRE\n\ -? -help \u663e\u793a\u6b64\u5e2e\u52a9\u6d88\u606f\n\ -X \u663e\u793a\u6709\u5173\u975e\u6807\u51c6\u9009\u9879\u7684\u5e2e\u52a9\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ \u542f\u7528\u6307\u5b9a\u7c92\u5ea6\u7684\u65ad\u8a00\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ \u7981\u7528\u6307\u5b9a\u7c92\u5ea6\u7684\u65ad\u8a00\n\ -esa | -enablesystemassertions\n\ \u542f\u7528\u7cfb\u7edf\u65ad\u8a00\n\ -dsa | -disablesystemassertions\n\ \u7981\u7528\u7cfb\u7edf\u65ad\u8a00\n\ -agentlib:<libname>[=<options>]\n\ \u88c5\u5165\u672c\u673a\u4ee3\u7406\u5e93 <libname>\uff0c\u4f8b\u5982\uff1a-agentlib:hprof\n\ \u53e6\u8bf7\u53c2\u89c1 -agentlib:jdwp=help \u548c -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ \u4ee5\u5168\u8def\u5f84\u540d\u88c5\u5165\u672c\u673a\u4ee3\u7406\u5e93\n\ -javaagent:<jarpath>[=<options>]\n\ \u88c5\u5165 Java \u7f16\u7a0b\u8bed\u8a00\u4ee3\u7406\uff0c\u8bf7\u53c2\u89c1 java.lang.instrument\n\ -splash:<imagepath>\n\ \u4f7f\u7528\u6307\u5b9a\u56fe\u50cf\u663e\u793a\u95ea\u73b0\u5c4f\u5e55\n\u6709\u5173\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1 http://java.sun.com/javase/reference\u3002
# Translators please note do not translate the options themselves
java.launcher.X.usage=\ -Xmixed \u6df7\u5408\u6a21\u5f0f\u6267\u884c\uff08\u9ed8\u8ba4\uff09\n\ -Xint \u4ec5\u89e3\u91ca\u6a21\u5f0f\u6267\u884c\n\ -Xbootclasspath:<\u4ee5 {0} \u5206\u9694\u7684\u76ee\u5f55\u548c zip/jar \u6587\u4ef6>\n\ \u8bbe\u7f6e\u5f15\u5bfc\u7c7b\u548c\u8d44\u6e90\u7684\u641c\u7d22\u8def\u5f84\n\ -Xbootclasspath/a:<\u4ee5 {0} \u5206\u9694\u7684\u76ee\u5f55\u548c zip/jar \u6587\u4ef6>\n\ \u9644\u52a0\u5230\u5f15\u5bfc\u7c7b\u8def\u5f84\u5c3e\u90e8\n\ -Xbootclasspath/p:<\u4ee5 {0} \u5206\u9694\u7684\u76ee\u5f55\u548c zip/jar \u6587\u4ef6>\n\ \u7f6e\u4e8e\u5f15\u5bfc\u7c7b\u8def\u5f84\u524d\u9762\n\ -Xnoclassgc \u7981\u7528\u7c7b\u5783\u573e\u6536\u96c6\n\ -Xincgc \u542f\u7528\u589e\u91cf\u5783\u573e\u6536\u96c6\n\ -Xloggc:<\u6587\u4ef6> \u5c06 GC \u72b6\u6001\u8bb0\u5f55\u5230\u4e00\u4e2a\u5e26\u6709\u65f6\u95f4\u6233\u7684\u6587\u4ef6\n\ -Xbatch \u7981\u7528\u540e\u53f0\u7f16\u8bd1\n\ -Xms<\u5927\u5c0f> \u8bbe\u7f6e\u521d\u59cb Java \u5806\u5927\u5c0f\n\ -Xmx<\u5927\u5c0f> \u8bbe\u7f6e\u6700\u5927 Java \u5806\u5927\u5c0f\n\ -Xss<\u5927\u5c0f> \u8bbe\u7f6e Java \u7ebf\u7a0b\u5806\u6808\u5927\u5c0f\n\ -Xprof \u8f93\u51fa CPU \u914d\u7f6e\u6570\u636e\n\ -Xfuture \u542f\u7528\u6700\u4e25\u683c\u7684\u68c0\u67e5\uff0c\u672a\u6765\u53ef\u80fd\u4f1a\u6210\u4e3a\u9ed8\u8ba4\u9009\u9879\n\ -Xrs \u51cf\u5c11 Java/VM \u5bf9\u64cd\u4f5c\u7cfb\u7edf\u4fe1\u53f7\u7684\u4f7f\u7528\uff08\u8bf7\u53c2\u89c1\u6587\u6863\uff09\n\ -Xcheck:jni \u9488\u5bf9 JNI \u529f\u80fd\u6267\u884c\u989d\u5916\u7684\u68c0\u67e5\n\ -Xshare:off \u4e0d\u5c1d\u8bd5\u4f7f\u7528\u5171\u4eab\u7c7b\u6570\u636e\n\ -Xshare:auto \u5982\u679c\u53ef\u80fd\u7684\u8bdd\uff0c\u4f7f\u7528\u5171\u4eab\u7c7b\u6570\u636e\uff08\u9ed8\u8ba4\uff09\n\ -Xshare:on \u8981\u6c42\u4f7f\u7528\u5171\u4eab\u7c7b\u6570\u636e\uff0c\u5426\u5219\u4f1a\u5931\u8d25\u3002\n\n-X \u9009\u9879\u662f\u975e\u6807\u51c6\u9009\u9879\uff0c\u5982\u6709\u66f4\u6539\uff0c\u6055\u4e0d\u53e6\u884c\u901a\u77e5\u3002\n

View File

@ -34,7 +34,7 @@ java.launcher.ergo.message1 =\ \u9810\u8a2d VM \u70ba {0}
java.launcher.ergo.message2 =\ \u56e0\u70ba\u60a8\u6b63\u57f7\u884c\u65bc\u4f3a\u670d\u5668\u7d1a\u7684\u6a5f\u5668\u4e0a\u3002\n
# Translators please note do not translate the options themselves
java.launcher.opt.footer =\ -cp <\u76ee\u9304\u548c zip/jar \u6a94\u6848\u7684\u985e\u5225\u641c\u5c0b\u8def\u5f91>\n\ -classpath <\u76ee\u9304\u548c zip/jar \u6a94\u6848\u7684\u985e\u5225\u641c\u5c0b\u8def\u5f91>\n\ {0} \u76ee\u9304\u3001JAR \u6b78\u6a94\n\ \u548c ZIP \u6b78\u6a94\u7684\u5206\u9694\u6e05\u55ae\uff0c\u7528\u65bc\u641c\u5c0b\u985e\u5225\u6a94\u6848\u3002\n\ -D<name>=<value>\n\ \u8a2d\u5b9a\u7cfb\u7d71\u7279\u6027\n\ -verbose[:class|gc|jni]\n\ \u555f\u7528\u8a73\u7d30\u8f38\u51fa\n\ -version \u5217\u5370\u7522\u54c1\u7248\u672c\u4e26\u7d50\u675f\n\ -version:<value>\n\ \u9700\u8981\u57f7\u884c\u6307\u5b9a\u7684\u7248\u672c\n\ -showversion \u5217\u5370\u7522\u54c1\u7248\u672c\u4e26\u7e7c\u7e8c\n\ -jre-restrict-search | -jre-no-restrict-search\n\ \u5728\u7248\u672c\u641c\u5c0b\u4e2d\u5305\u542b/\u6392\u9664\u4f7f\u7528\u8005\u79c1\u7528 JRE\n\ -? -help \u5217\u5370\u6b64\u8aaa\u660e\u8a0a\u606f\n\ -X \u5217\u5370\u6709\u95dc\u975e\u6a19\u6e96\u9078\u9805\u7684\u8aaa\u660e\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ \u555f\u7528\u5177\u6709\u6307\u5b9a\u9846\u7c92\u6027\u7684\u5ba3\u544a\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ \u505c\u7528\u5177\u6709\u6307\u5b9a\u9846\u7c92\u6027\u7684\u5ba3\u544a\n\ -esa | -enablesystemassertions\n\ \u555f\u7528\u7cfb\u7d71\u5ba3\u544a\n\ -dsa | -disablesystemassertions\n\ \u505c\u7528\u7cfb\u7d71\u5ba3\u544a\n\ -agentlib:<libname>[=<options>]\n\ \u8f09\u5165\u539f\u751f\u4ee3\u7406\u7a0b\u5f0f\u7a0b\u5f0f\u5eab <libname>\uff0c\u4f8b\u5982 -agentlib:hprof\n\ \u53e6\u8acb\u53c3\u95b1 -agentlib:jdwp=help \u548c -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ \u4f9d\u64da\u5b8c\u6574\u8def\u5f91\u540d\u7a31\u8f09\u5165\u539f\u751f\u4ee3\u7406\u7a0b\u5f0f\n\ -javaagent:<jarpath>[=<options>]\n\ \u8f09\u5165 Java \u7a0b\u5f0f\u8a2d\u8a08\u8a9e\u8a00\u4ee3\u7406\u7a0b\u5f0f\uff0c\u8acb\u53c3\u95b1 java.lang.instrument\n\ -splash:<imagepath>\n\ \u986f\u793a\u542b\u6709\u6307\u5b9a\u5f71\u50cf\u7684\u8edf\u9ad4\u8cc7\u8a0a\u756b\u9762\n\u8acb\u53c3\u95b1 http://java.sun.com/javase/reference\uff0c\u4ee5\u53d6\u5f97\u66f4\u591a\u8a73\u7d30\u8cc7\u8a0a\u3002
java.launcher.opt.footer =\ -cp <\u76ee\u9304\u548c zip/jar \u6a94\u6848\u7684\u985e\u5225\u641c\u5c0b\u8def\u5f91>\n\ -classpath <\u76ee\u9304\u548c zip/jar \u6a94\u6848\u7684\u985e\u5225\u641c\u5c0b\u8def\u5f91>\n\ {0} \u76ee\u9304\u3001JAR \u6b78\u6a94\n\ \u548c ZIP \u6b78\u6a94\u7684\u5206\u9694\u6e05\u55ae\uff0c\u7528\u65bc\u641c\u5c0b\u985e\u5225\u6a94\u6848\u3002\n\ -D<name>=<value>\n\ \u8a2d\u5b9a\u7cfb\u7d71\u7279\u6027\n\ -verbose[:class|gc|jni]\n\ \u555f\u7528\u8a73\u7d30\u8f38\u51fa\n\ -version \u5217\u5370\u7522\u54c1\u7248\u672c\u4e26\u7d50\u675f\n\ -version:<value>\n\ \u9700\u8981\u57f7\u884c\u6307\u5b9a\u7684\u7248\u672c\n\ -showversion \u5217\u5370\u7522\u54c1\u7248\u672c\u4e26\u7e7c\u7e8c\n\ -jre-restrict-search | -no-jre-restrict-search\n\ \u5728\u7248\u672c\u641c\u5c0b\u4e2d\u5305\u542b/\u6392\u9664\u4f7f\u7528\u8005\u79c1\u7528 JRE\n\ -? -help \u5217\u5370\u6b64\u8aaa\u660e\u8a0a\u606f\n\ -X \u5217\u5370\u6709\u95dc\u975e\u6a19\u6e96\u9078\u9805\u7684\u8aaa\u660e\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ \u555f\u7528\u5177\u6709\u6307\u5b9a\u9846\u7c92\u6027\u7684\u5ba3\u544a\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ \u505c\u7528\u5177\u6709\u6307\u5b9a\u9846\u7c92\u6027\u7684\u5ba3\u544a\n\ -esa | -enablesystemassertions\n\ \u555f\u7528\u7cfb\u7d71\u5ba3\u544a\n\ -dsa | -disablesystemassertions\n\ \u505c\u7528\u7cfb\u7d71\u5ba3\u544a\n\ -agentlib:<libname>[=<options>]\n\ \u8f09\u5165\u539f\u751f\u4ee3\u7406\u7a0b\u5f0f\u7a0b\u5f0f\u5eab <libname>\uff0c\u4f8b\u5982 -agentlib:hprof\n\ \u53e6\u8acb\u53c3\u95b1 -agentlib:jdwp=help \u548c -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ \u4f9d\u64da\u5b8c\u6574\u8def\u5f91\u540d\u7a31\u8f09\u5165\u539f\u751f\u4ee3\u7406\u7a0b\u5f0f\n\ -javaagent:<jarpath>[=<options>]\n\ \u8f09\u5165 Java \u7a0b\u5f0f\u8a2d\u8a08\u8a9e\u8a00\u4ee3\u7406\u7a0b\u5f0f\uff0c\u8acb\u53c3\u95b1 java.lang.instrument\n\ -splash:<imagepath>\n\ \u986f\u793a\u542b\u6709\u6307\u5b9a\u5f71\u50cf\u7684\u8edf\u9ad4\u8cc7\u8a0a\u756b\u9762\n\u8acb\u53c3\u95b1 http://java.sun.com/javase/reference\uff0c\u4ee5\u53d6\u5f97\u66f4\u591a\u8a73\u7d30\u8cc7\u8a0a\u3002
# Translators please note do not translate the options themselves
java.launcher.X.usage=\ -Xmixed \u57f7\u884c\u6df7\u5408\u6a21\u5f0f (\u9810\u8a2d)\n\ -Xint \u50c5\u57f7\u884c\u89e3\u8b6f\u6a21\u5f0f\n\ -Xbootclasspath:<\u4ee5 {0} \u5206\u9694\u7684\u76ee\u9304\u548c zip/jar \u6a94\u6848>\n\ \u8a2d\u5b9a\u555f\u52d5\u985e\u5225\u548c\u8cc7\u6e90\u7684\u641c\u5c0b\u8def\u5f91\n\ -Xbootclasspath/a:<\u4ee5 {0} \u5206\u9694\u7684\u76ee\u9304\u548c zip/jar \u6a94\u6848>\n\ \u9644\u52a0\u81f3\u555f\u52d5\u985e\u5225\u7684\u672b\u5c3e\n\ -Xbootclasspath/p:<\u4ee5 {0} \u5206\u9694\u7684\u76ee\u9304\u548c zip/jar \u6a94\u6848>\n\ \u524d\u7f6e\u65bc\u555f\u52d5\u985e\u5225\u8def\u5f91\u7684\u524d\u9762\n\ -Xnoclassgc \u505c\u7528\u985e\u5225\u56de\u6536\u6536\u96c6\n\ -Xincgc \u555f\u7528\u905e\u589e\u56de\u6536\u6536\u96c6\n\ -Xloggc:<\u6a94\u6848> \u4f7f\u7528\u6642\u9593\u6233\u8a18\u5c07 GC \u72c0\u614b\u8a18\u9304\u81f3\u6a94\u6848\n\ -Xbatch \u505c\u7528\u80cc\u5f71\u7de8\u8b6f\n\ -Xms<\u5927\u5c0f> \u8a2d\u5b9a\u521d\u59cb Java \u5806\u758a\u5927\u5c0f\n\ -Xmx<\u5927\u5c0f> \u8a2d\u5b9a\u6700\u5927 Java \u5806\u758a\u5927\u5c0f\n\ -Xss<\u5927\u5c0f> \u8a2d\u5b9a java \u57f7\u884c\u7dd2\u5806\u758a\u5927\u5c0f\n\ -Xprof \u8f38\u51fa cpu \u8a2d\u5b9a\u6a94\u8cc7\u6599\n\ -Xfuture \u555f\u7528\u6700\u56b4\u683c\u7684\u6aa2\u67e5\uff0c\u9810\u671f\u672a\u4f86\u9810\u8a2d\u503c\n\ -Xrs \u964d\u4f4e Java/VM \u7684 OS \u8a0a\u865f\u4f7f\u7528 (\u8acb\u53c3\u95b1\u6587\u4ef6)\n\ -Xcheck:jni \u5c0d JNI \u529f\u80fd\u57f7\u884c\u5176\u4ed6\u6aa2\u67e5\n\ -Xshare:off \u4e0d\u5617\u8a66\u4f7f\u7528\u5171\u7528\u985e\u5225\u8cc7\u6599\n\ -Xshare:auto \u5982\u53ef\u80fd\uff0c\u4f7f\u7528\u5171\u7528\u985e\u5225\u8cc7\u6599 (\u9810\u8a2d)\n\ -Xshare:on \u9700\u8981\u4f7f\u7528\u5171\u7528\u985e\u5225\u8cc7\u6599\uff0c\u5426\u5247\u6703\u5931\u6557\u3002\n\n-X \u9078\u9805\u70ba\u975e\u6a19\u6e96\u9078\u9805\uff0c\u53ef\u80fd\u6703\u8b8a\u66f4\uff0c\u6055\u4e0d\u53e6\u884c\u901a\u77e5\u3002\n

View File

@ -27,6 +27,8 @@ package sun.misc;
import java.io.File;
import java.io.IOException;
import java.net.URLStreamHandlerFactory;
import sun.misc.URLClassPath;
/**
* BootClassLoaderHook defines an interface for a hook to inject
@ -94,20 +96,6 @@ public abstract class BootClassLoaderHook {
}
}
private static final File[] EMPTY_FILE_ARRAY = new File[0];
/**
* Returns bootstrap class paths added by the hook.
*/
public static File[] getBootstrapPaths() {
BootClassLoaderHook hook = getHook();
if (hook != null) {
return hook.getAdditionalBootstrapPaths();
} else {
return EMPTY_FILE_ARRAY;
}
}
/**
* Returns a pathname of a JAR or class that the hook loads
* per this loadClass request; or null.
@ -133,10 +121,13 @@ public abstract class BootClassLoaderHook {
public abstract boolean loadLibrary(String libname);
/**
* Returns additional boot class paths added by the hook that
* should be searched by the boot class loader.
* Returns a bootstrap class path constructed by the hook.
*
* @param bcp VM's bootstrap class path
* @param factory Launcher's URL stream handler
*/
public abstract File[] getAdditionalBootstrapPaths();
public abstract URLClassPath getBootstrapClassPath(URLClassPath bcp,
URLStreamHandlerFactory factory);
/**
* Returns true if the current thread is in the process of doing

View File

@ -47,7 +47,6 @@ import java.security.Permissions;
import java.security.Permission;
import java.security.ProtectionDomain;
import java.security.CodeSource;
import sun.security.action.GetPropertyAction;
import sun.security.util.SecurityConstants;
import sun.net.www.ParseUtil;
@ -57,6 +56,8 @@ Launcher */
public class Launcher {
private static URLStreamHandlerFactory factory = new Factory();
private static Launcher launcher = new Launcher();
private static String bootClassPath =
System.getProperty("sun.boot.class.path");
public static Launcher getLauncher() {
return launcher;
@ -227,7 +228,8 @@ public class Launcher {
File dir = new File(urls[i].getPath()).getParentFile();
if (dir != null && !dir.equals(prevDir)) {
// Look in architecture-specific subdirectory first
String arch = System.getProperty("os.arch");
// Read from the saved system properties to avoid deadlock
String arch = VM.getSavedProperty("os.arch");
if (arch != null) {
File file = new File(new File(dir, arch), name);
if (file.exists()) {
@ -377,19 +379,15 @@ public class Launcher {
}
}
private static URLClassPath bootstrapClassPath;
public static synchronized URLClassPath getBootstrapClassPath() {
if (bootstrapClassPath == null) {
String prop = AccessController.doPrivileged(
new GetPropertyAction("sun.boot.class.path"));
private static class BootClassPathHolder {
static final URLClassPath bcp;
static {
URL[] urls;
if (prop != null) {
final String path = prop;
if (bootClassPath != null) {
urls = AccessController.doPrivileged(
new PrivilegedAction<URL[]>() {
public URL[] run() {
File[] classPath = getClassPath(path);
File[] classPath = getClassPath(bootClassPath);
int len = classPath.length;
Set<File> seenDirs = new HashSet<File>();
for (int i = 0; i < len; i++) {
@ -410,25 +408,16 @@ public class Launcher {
} else {
urls = new URL[0];
}
bootstrapClassPath = new URLClassPath(urls, factory);
final File[] additionalBootStrapPaths =
BootClassLoaderHook.getBootstrapPaths();
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
for (int i=0; i<additionalBootStrapPaths.length; i++) {
bootstrapClassPath.addURL(
getFileURL(additionalBootStrapPaths[i]));
}
return null;
}
});
bcp = new URLClassPath(urls, factory);
}
return bootstrapClassPath;
}
public static synchronized void flushBootstrapClassPath() {
bootstrapClassPath = null;
public static URLClassPath getBootstrapClassPath() {
URLClassPath bcp = BootClassPathHolder.bcp;
// if DownloadManager is installed, return the bootstrap class path
// maintained by the Java kernel
BootClassLoaderHook hook = BootClassLoaderHook.getHook();
return hook == null ? bcp : hook.getBootstrapClassPath(bcp, factory);
}
private static URL[] pathToURLs(File[] path) {

View File

@ -170,36 +170,25 @@ public class VM {
//
private static long directMemory = 64 * 1024 * 1024;
// If this method is invoked during VM initialization, it initializes the
// maximum amount of allocatable direct buffer memory (in bytes) from the
// system property sun.nio.MaxDirectMemorySize. The system property will
// be removed when it is accessed.
//
// If this method is invoked after the VM is booted, it returns the
// maximum amount of allocatable direct buffer memory.
// Returns the maximum amount of allocatable direct buffer memory.
// The directMemory variable is initialized during system initialization
// in the saveAndRemoveProperties method.
//
public static long maxDirectMemory() {
if (booted)
return directMemory;
Properties p = System.getProperties();
String s = (String)p.remove("sun.nio.MaxDirectMemorySize");
System.setProperties(p);
if (s != null) {
if (s.equals("-1")) {
// -XX:MaxDirectMemorySize not given, take default
directMemory = Runtime.getRuntime().maxMemory();
} else {
long l = Long.parseLong(s);
if (l > -1)
directMemory = l;
}
}
return directMemory;
}
// User-controllable flag that determines if direct buffers should be page
// aligned. The "-XX:+PageAlignDirectMemory" option can be used to force
// buffers, allocated by ByteBuffer.allocateDirect, to be page aligned.
private static boolean pageAlignDirectMemory;
// Returns {@code true} if the direct buffers should be page aligned. This
// variable is initialized by saveAndRemoveProperties.
public static boolean isDirectMemoryPageAligned() {
return pageAlignDirectMemory;
}
// A user-settable boolean to determine whether ClassLoader.loadClass should
// accept array syntax. This value may be changed during VM initialization
// via the system property "sun.lang.ClassLoader.allowArraySyntax".
@ -212,28 +201,89 @@ public class VM {
private static boolean defaultAllowArraySyntax = false;
private static boolean allowArraySyntax = defaultAllowArraySyntax;
// If this method is invoked during VM initialization, it initializes the
// allowArraySyntax boolean based on the value of the system property
// The allowArraySyntax boolean is initialized during system initialization
// in the saveAndRemoveProperties method.
//
// It is initialized based on the value of the system property
// "sun.lang.ClassLoader.allowArraySyntax". If the system property is not
// provided, the default for 1.5 is "true". In 1.6, the default will be
// "false". If the system property is provided, then the value of
// allowArraySyntax will be equal to "true" if Boolean.parseBoolean()
// returns "true". Otherwise, the field will be set to "false".
//
// If this method is invoked after the VM is booted, it returns the
// allowArraySyntax boolean set during initialization.
//
public static boolean allowArraySyntax() {
if (!booted) {
String s
= System.getProperty("sun.lang.ClassLoader.allowArraySyntax");
allowArraySyntax = (s == null
? defaultAllowArraySyntax
: Boolean.parseBoolean(s));
}
return allowArraySyntax;
}
/**
* Returns the system property of the specified key saved at
* system initialization time. This method should only be used
* for the system properties that are not changed during runtime.
* It accesses a private copy of the system properties so
* that user's locking of the system properties object will not
* cause the library to deadlock.
*
* Note that the saved system properties do not include
* the ones set by sun.misc.Version.init().
*
*/
public static String getSavedProperty(String key) {
if (savedProps.isEmpty())
throw new IllegalStateException("Should be non-empty if initialized");
return savedProps.getProperty(key);
}
private static final Properties savedProps = new Properties();
// Save a private copy of the system properties and remove
// the system properties that are not intended for public access.
//
// This method can only be invoked during system initialization.
public static void saveAndRemoveProperties(Properties props) {
if (booted)
throw new IllegalStateException("System initialization has completed");
savedProps.putAll(props);
// Set the maximum amount of direct memory. This value is controlled
// by the vm option -XX:MaxDirectMemorySize=<size>.
// The maximum amount of allocatable direct buffer memory (in bytes)
// from the system property sun.nio.MaxDirectMemorySize set by the VM.
// The system property will be removed.
String s = (String)props.remove("sun.nio.MaxDirectMemorySize");
if (s != null) {
if (s.equals("-1")) {
// -XX:MaxDirectMemorySize not given, take default
directMemory = Runtime.getRuntime().maxMemory();
} else {
long l = Long.parseLong(s);
if (l > -1)
directMemory = l;
}
}
// Check if direct buffers should be page aligned
s = (String)props.remove("sun.nio.PageAlignDirectMemory");
if ("true".equals(s))
pageAlignDirectMemory = true;
// Set a boolean to determine whether ClassLoader.loadClass accepts
// array syntax. This value is controlled by the system property
// "sun.lang.ClassLoader.allowArraySyntax".
s = props.getProperty("sun.lang.ClassLoader.allowArraySyntax");
allowArraySyntax = (s == null
? defaultAllowArraySyntax
: Boolean.parseBoolean(s));
// Remove other private system properties
// used by java.lang.Integer.IntegerCache
props.remove("java.lang.Integer.IntegerCache.high");
// used by java.util.zip.ZipFile
props.remove("sun.zip.disableMemoryMapping");
}
// Initialize any miscellenous operating system settings that need to be
// set for the class libraries.
//

View File

@ -25,7 +25,6 @@
package sun.net;
import java.net.InetAddress;
import java.security.PrivilegedAction;
import java.security.Security;
@ -57,7 +56,7 @@ public final class InetAddressCachePolicy {
* caching. For security reasons, this caching is made forever when
* a security manager is set.
*/
private static int cachePolicy;
private static int cachePolicy = FOREVER;
/* The Java-level namelookup cache policy for negative lookups:
*
@ -67,31 +66,24 @@ public final class InetAddressCachePolicy {
* default value is 0. It can be set to some other value for
* performance reasons.
*/
private static int negativeCachePolicy;
private static int negativeCachePolicy = NEVER;
/*
* Whether or not the cache policy for successful lookups was set
* using a property (cmd line).
*/
private static boolean set = false;
private static boolean propertySet;
/*
* Whether or not the cache policy for negative lookups was set
* using a property (cmd line).
*/
private static boolean negativeSet = false;
private static boolean propertyNegativeSet;
/*
* Initialize
*/
static {
set = false;
negativeSet = false;
cachePolicy = FOREVER;
negativeCachePolicy = 0;
Integer tmp = null;
try {
@ -110,7 +102,7 @@ public final class InetAddressCachePolicy {
if (cachePolicy < 0) {
cachePolicy = FOREVER;
}
set = true;
propertySet = true;
} else {
tmp = java.security.AccessController.doPrivileged
(new sun.security.action.GetIntegerAction(cachePolicyPropFallback));
@ -119,7 +111,14 @@ public final class InetAddressCachePolicy {
if (cachePolicy < 0) {
cachePolicy = FOREVER;
}
set = true;
propertySet = true;
} else {
/* No properties defined for positive caching. If there is no
* security manager then use the default positive cache value.
*/
if (System.getSecurityManager() == null) {
cachePolicy = DEFAULT_POSITIVE;
}
}
}
@ -140,7 +139,7 @@ public final class InetAddressCachePolicy {
if (negativeCachePolicy < 0) {
negativeCachePolicy = FOREVER;
}
negativeSet = true;
propertyNegativeSet = true;
} else {
tmp = java.security.AccessController.doPrivileged
(new sun.security.action.GetIntegerAction(negativeCachePolicyPropFallback));
@ -149,17 +148,13 @@ public final class InetAddressCachePolicy {
if (negativeCachePolicy < 0) {
negativeCachePolicy = FOREVER;
}
negativeSet = true;
propertyNegativeSet = true;
}
}
}
public static synchronized int get() {
if (!set && System.getSecurityManager() == null) {
return DEFAULT_POSITIVE;
} else {
return cachePolicy;
}
return cachePolicy;
}
public static synchronized int getNegative() {
@ -174,21 +169,17 @@ public final class InetAddressCachePolicy {
* should be cached
*/
public static synchronized void setIfNotSet(int newPolicy) {
/*
* When setting the new value we may want to signal that the
* cache should be flushed, though this doesn't seem strictly
* necessary.
*/
if (!set) {
if (!propertySet) {
checkValue(newPolicy, cachePolicy);
cachePolicy = newPolicy;
}
}
/**
* Sets the cache policy for negative lookups if the user has not
* already specified a cache policy for it using a
@ -197,14 +188,12 @@ public final class InetAddressCachePolicy {
* should be cached
*/
public static synchronized void setNegativeIfNotSet(int newPolicy) {
/*
* When setting the new value we may want to signal that the
* cache should be flushed, though this doesn't seem strictly
* necessary.
*/
if (!negativeSet) {
if (!propertyNegativeSet) {
// Negative caching does not seem to have any security
// implications.
// checkValue(newPolicy, negativeCachePolicy);
@ -213,13 +202,11 @@ public final class InetAddressCachePolicy {
}
private static void checkValue(int newPolicy, int oldPolicy) {
/*
* If malicious code gets a hold of this method, prevent
* setting the cache policy to something laxer or some
* invalid negative value.
*/
if (newPolicy == FOREVER)
return;
@ -229,7 +216,6 @@ public final class InetAddressCachePolicy {
throw new
SecurityException("can't make InetAddress cache more lax");
}
}
}

View File

@ -40,6 +40,12 @@ import java.security.PrivilegedAction;
* @author Jonathan Payne
*/
public class NetworkClient {
/* Default value of read timeout, if not specified (infinity) */
public static final int DEFAULT_READ_TIMEOUT = -1;
/* Default value of connect timeout, if not specified (infinity) */
public static final int DEFAULT_CONNECT_TIMEOUT = -1;
protected Proxy proxy = Proxy.NO_PROXY;
/** Socket for communicating with server. */
protected Socket serverSocket = null;
@ -53,8 +59,8 @@ public class NetworkClient {
protected static int defaultSoTimeout;
protected static int defaultConnectTimeout;
protected int readTimeout = -1;
protected int connectTimeout = -1;
protected int readTimeout = DEFAULT_READ_TIMEOUT;
protected int connectTimeout = DEFAULT_CONNECT_TIMEOUT;
/* Name of encoding to use for output */
protected static String encoding;
@ -71,16 +77,12 @@ public class NetworkClient {
return null;
}
});
if (vals[0] == 0)
defaultSoTimeout = -1;
else
if (vals[0] != 0) {
defaultSoTimeout = vals[0];
if (vals[1] == 0)
defaultConnectTimeout = -1;
else
}
if (vals[1] != 0) {
defaultConnectTimeout = vals[1];
}
encoding = encs[0];
try {
@ -232,7 +234,23 @@ public class NetworkClient {
return connectTimeout;
}
/**
* Sets the read timeout.
*
* Note: Public URLConnection (and protocol specific implementations)
* protect against negative timeout values being set. This implemenation,
* and protocol specific implementations, use -1 to represent the default
* read timeout.
*
* This method may be invoked with the default timeout value when the
* protocol handler is trying to reset the timeout after doing a
* potentially blocking internal operation, e.g. cleaning up unread
* response data, buffering error stream response data, etc
*/
public void setReadTimeout(int timeout) {
if (timeout == DEFAULT_READ_TIMEOUT)
timeout = defaultSoTimeout;
if (serverSocket != null && timeout >= 0) {
try {
serverSocket.setSoTimeout(timeout);

View File

@ -73,29 +73,32 @@ public class MimeTable implements FileNameMap {
private static final String filePreamble = "sun.net.www MIME content-types table";
private static final String fileMagic = "#" + filePreamble;
private static MimeTable defaultInstance = null;
MimeTable() {
load();
}
private static class DefaultInstanceHolder {
static final MimeTable defaultInstance = getDefaultInstance();
static MimeTable getDefaultInstance() {
return java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<MimeTable>() {
public MimeTable run() {
MimeTable instance = new MimeTable();
URLConnection.setFileNameMap(instance);
return instance;
}
});
}
}
/**
* Get the single instance of this class. First use will load the
* table from a data file.
*/
public static MimeTable getDefaultTable() {
if (defaultInstance == null) {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
defaultInstance = new MimeTable();
URLConnection.setFileNameMap(defaultInstance);
return null;
}
});
}
return defaultInstance;
return DefaultInstanceHolder.defaultInstance;
}
/**

View File

@ -46,6 +46,7 @@ import java.net.ProxySelector;
import java.util.StringTokenizer;
import java.util.Iterator;
import java.security.Permission;
import sun.net.NetworkClient;
import sun.net.www.MessageHeader;
import sun.net.www.MeteredStream;
import sun.net.www.URLConnection;
@ -102,11 +103,11 @@ public class FtpURLConnection extends URLConnection {
static final int BIN = 2;
static final int DIR = 3;
int type = NONE;
/* Redefine timeouts from java.net.URLConnection as we nee -1 to mean
/* Redefine timeouts from java.net.URLConnection as we need -1 to mean
* not set. This is to ensure backward compatibility.
*/
private int connectTimeout = -1;
private int readTimeout = -1;
private int connectTimeout = NetworkClient.DEFAULT_CONNECT_TIMEOUT;;
private int readTimeout = NetworkClient.DEFAULT_READ_TIMEOUT;;
/**
* For FTP URLs we need to have a special InputStream because we

View File

@ -359,11 +359,11 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
private TunnelState tunnelState = TunnelState.NONE;
/* Redefine timeouts from java.net.URLConnection as we nee -1 to mean
/* Redefine timeouts from java.net.URLConnection as we need -1 to mean
* not set. This is to ensure backward compatibility.
*/
private int connectTimeout = -1;
private int readTimeout = -1;
private int connectTimeout = NetworkClient.DEFAULT_CONNECT_TIMEOUT;
private int readTimeout = NetworkClient.DEFAULT_READ_TIMEOUT;
/* Logging support */
private static final PlatformLogger logger =
@ -1041,9 +1041,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
throw new ProtocolException("Server rejected operation");
}
}
if (oldTimeout > 0) {
http.setReadTimeout(oldTimeout);
}
http.setReadTimeout(oldTimeout);
responseCode = -1;
responses.reset();
// Proceed

View File

@ -699,15 +699,19 @@ public class FileChannelImpl
static volatile long totalSize;
static volatile long totalCapacity;
private long address;
private long size;
private int cap;
private volatile long address;
private final long size;
private final int cap;
private final FileDescriptor fd;
private Unmapper(long address, long size, int cap) {
private Unmapper(long address, long size, int cap,
FileDescriptor fd)
{
assert (address != 0);
this.address = address;
this.size = size;
this.cap = cap;
this.fd = fd;
synchronized (Unmapper.class) {
count++;
@ -722,6 +726,15 @@ public class FileChannelImpl
unmap0(address, size);
address = 0;
// if this mapping has a valid file descriptor then we close it
if (fd.valid()) {
try {
nd.close(fd);
} catch (IOException ignore) {
// nothing we can do
}
}
synchronized (Unmapper.class) {
count--;
totalSize -= size;
@ -784,10 +797,12 @@ public class FileChannelImpl
}
if (size == 0) {
addr = 0;
// a valid file descriptor is not required
FileDescriptor dummy = new FileDescriptor();
if ((!writable) || (imode == MAP_RO))
return Util.newMappedByteBufferR(0, 0, null);
return Util.newMappedByteBufferR(0, 0, dummy, null);
else
return Util.newMappedByteBuffer(0, 0, null);
return Util.newMappedByteBuffer(0, 0, dummy, null);
}
int pagePosition = (int)(position % allocationGranularity);
@ -813,14 +828,31 @@ public class FileChannelImpl
}
}
// On Windows, and potentially other platforms, we need an open
// file descriptor for some mapping operations.
FileDescriptor mfd;
try {
mfd = nd.duplicateForMapping(fd);
} catch (IOException ioe) {
unmap0(addr, mapSize);
throw ioe;
}
assert (IOStatus.checkAll(addr));
assert (addr % allocationGranularity == 0);
int isize = (int)size;
Unmapper um = new Unmapper(addr, size + pagePosition, isize);
if ((!writable) || (imode == MAP_RO))
return Util.newMappedByteBufferR(isize, addr + pagePosition, um);
else
return Util.newMappedByteBuffer(isize, addr + pagePosition, um);
Unmapper um = new Unmapper(addr, mapSize, isize, mfd);
if ((!writable) || (imode == MAP_RO)) {
return Util.newMappedByteBufferR(isize,
addr + pagePosition,
mfd,
um);
} else {
return Util.newMappedByteBuffer(isize,
addr + pagePosition,
mfd,
um);
}
} finally {
threads.remove(ti);
end(IOStatus.checkAll(addr));

View File

@ -45,4 +45,12 @@ abstract class FileDispatcher extends NativeDispatcher {
abstract void release(FileDescriptor fd, long pos, long size)
throws IOException;
/**
* Returns a dup of fd if a file descriptor is required for
* memory-mapping operations, otherwise returns an invalid
* FileDescriptor (meaning a newly allocated FileDescriptor)
*/
abstract FileDescriptor duplicateForMapping(FileDescriptor fd)
throws IOException;
}

View File

@ -28,6 +28,7 @@ package sun.nio.ch;
import java.lang.ref.SoftReference;
import java.lang.reflect.*;
import java.io.IOException;
import java.io.FileDescriptor;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.*;
@ -364,6 +365,7 @@ class Util {
Constructor ctor = cl.getDeclaredConstructor(
new Class[] { int.class,
long.class,
FileDescriptor.class,
Runnable.class });
ctor.setAccessible(true);
directByteBufferConstructor = ctor;
@ -381,6 +383,7 @@ class Util {
}
static MappedByteBuffer newMappedByteBuffer(int size, long addr,
FileDescriptor fd,
Runnable unmapper)
{
MappedByteBuffer dbb;
@ -390,6 +393,7 @@ class Util {
dbb = (MappedByteBuffer)directByteBufferConstructor.newInstance(
new Object[] { new Integer(size),
new Long(addr),
fd,
unmapper });
} catch (InstantiationException e) {
throw new InternalError();
@ -411,6 +415,7 @@ class Util {
Constructor ctor = cl.getDeclaredConstructor(
new Class[] { int.class,
long.class,
FileDescriptor.class,
Runnable.class });
ctor.setAccessible(true);
directByteBufferRConstructor = ctor;
@ -428,6 +433,7 @@ class Util {
}
static MappedByteBuffer newMappedByteBufferR(int size, long addr,
FileDescriptor fd,
Runnable unmapper)
{
MappedByteBuffer dbb;
@ -437,6 +443,7 @@ class Util {
dbb = (MappedByteBuffer)directByteBufferRConstructor.newInstance(
new Object[] { new Integer(size),
new Long(addr),
fd,
unmapper });
} catch (InstantiationException e) {
throw new InternalError();

View File

@ -159,15 +159,18 @@ public class Providers {
* could not be loaded) removed. This is the list we need to
* present to applications.
*/
public static synchronized ProviderList getFullProviderList() {
ProviderList list = getThreadProviderList();
if (list != null) {
ProviderList newList = list.removeInvalid();
if (newList != list) {
changeThreadProviderList(newList);
list = newList;
public static ProviderList getFullProviderList() {
ProviderList list;
synchronized (Providers.class) {
list = getThreadProviderList();
if (list != null) {
ProviderList newList = list.removeInvalid();
if (newList != list) {
changeThreadProviderList(newList);
list = newList;
}
return list;
}
return list;
}
list = getSystemProviderList();
ProviderList newList = list.removeInvalid();

View File

@ -36,7 +36,7 @@ import java.util.ArrayList;
/**
* Various utility methods for processing Java tool command line arguments.
*
* <p><b>This is NOT part of any API suppored by Sun Microsystems. If
* <p><b>This is NOT part of any API supported by Oracle. If
* you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>

View File

@ -64,12 +64,14 @@ public final class BaseLocale {
public static BaseLocale getInstance(String language, String script, String region, String variant) {
// JDK uses deprecated ISO639.1 language codes for he, yi and id
if (AsciiUtil.caseIgnoreMatch(language, "he")) {
language = "iw";
} else if (AsciiUtil.caseIgnoreMatch(language, "yi")) {
language = "ji";
} else if (AsciiUtil.caseIgnoreMatch(language, "id")) {
language = "in";
if (language != null) {
if (AsciiUtil.caseIgnoreMatch(language, "he")) {
language = "iw";
} else if (AsciiUtil.caseIgnoreMatch(language, "yi")) {
language = "ji";
} else if (AsciiUtil.caseIgnoreMatch(language, "id")) {
language = "in";
}
}
Key key = new Key(language, script, region, variant);

View File

@ -535,10 +535,6 @@ public class PlatformLogger {
}
void doLog(int level, String msg, Object... params) {
int paramsNumber = (params != null) ? params.length : 0;
for (int i = 0; i < paramsNumber; i++) {
params[i] = String.valueOf(params[i]);
}
LoggingSupport.log(javaLogger, levelObjects.get(level), msg, params);
}

View File

@ -0,0 +1,664 @@
/*
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.net.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import static java.nio.file.StandardOpenOption.*;
import static java.nio.file.StandardCopyOption.*;
/*
* ZipFileSystem usage demo
*
* java [-cp .../zipfs.jar:./] Demo action ZipfileName [...]
*
* To deploy the provider, either copy the zipfs.jar into JDK/JRE
* extensions directory or add
* <JDK_HOME>/demo/nio/ZipFileSystem/zipfs.jar
* into your class path as showed above.
*
* @author Xueming Shen
*/
public class Demo {
static enum Action {
rename, // <java Demo rename zipfile src dst>
// rename entry src to dst inside zipfile
movein, // <java Demo movein zipfile src dst>
// move an external src file into zipfile
// as entry dst
moveout, // <java Demo moveout zipfile src dst>
// move a zipfile entry src out to dst
copy, // <java Demo copy zipfile src dst>
// copy entry src to dst inside zipfile
copyin, // <java Demo copyin zipfile src dst>
// copy an external src file into zipfile
// as entry dst
copyout, // <java Demo copyout zipfile src dst>
// copy zipfile entry src" out to file dst
zzmove, // <java Demo zzmove zfsrc zfdst path>
// move entry path/dir from zfsrc to zfdst
zzcopy, // <java Demo zzcopy zfsrc zfdst path>
// copy path from zipfile zfsrc to zipfile
// zfdst
attrs, // <java Demo attrs zipfile path>
// printout the attributes of entry path
attrsspace, // <java Demo attrsspace zipfile path>
// printout the storespace attrs of entry path
setmtime, // <java Demo setmtime zipfile "MM/dd/yy-HH:mm:ss" path...>
// set the lastModifiedTime of entry path
lsdir, // <java Demo lsdir zipfile dir>
// list dir's direct child files/dirs
mkdir, // <java Demo mkdir zipfile dir>
mkdirs, // <java Demo mkdirs zipfile dir>
rmdirs, // <java Demo rmdirs zipfile dir>
list, // <java Demo list zipfile [dir]>
// recursively list all entries of dir
// via DirectoryStream
tlist, // <java Demo tlist zipfile [dir]>
// list with buildDirTree=true
vlist, // <java Demo vlist zipfile [dir]>
// recursively verbose list all entries of
// dir via DirectoryStream
walk, // <java Demo walk zipfile [dir]>
// recursively walk all entries of dir
// via Files.walkFileTree
twalk, // <java Demo twalk zipfile [dir]>
// walk with buildDirTree=true
extract, // <java Demo extract zipfile file [...]>
update, // <java Demo extract zipfile file [...]>
delete, // <java Demo delete zipfile file [...]>
add, // <java Demo add zipfile file [...]>
create, // <java Demo create zipfile file [...]>
// create a new zipfile if it doesn't exit
// and then add the file(s) into it.
attrs2, // <java Demo attrs2 zipfile file [...]>
// test different ways to print attrs
}
public static void main(String[] args) throws Throwable {
Action action = Action.valueOf(args[0]);;
Map<String, Object> env = env = new HashMap<String, Object>();
if (action == Action.create)
env.put("createNew", true);
if (action == Action.tlist || action == Action.twalk)
env.put("buildDirTree", true);
FileSystem fs = FileSystems.newFileSystem(
URI.create("zip" + Paths.get(args[1]).toUri().toString().substring(4)),
env,
null);
try {
FileSystem fs2;
Path path, src, dst;
boolean isRename = false;
switch (action) {
case rename:
src = fs.getPath(args[2]);
dst = fs.getPath(args[3]);
src.moveTo(dst);
break;
case moveout:
src = fs.getPath(args[2]);
dst = Paths.get(args[3]);
src.moveTo(dst);
break;
case movein:
src = Paths.get(args[2]);
dst = fs.getPath(args[3]);
src.moveTo(dst);
break;
case copy:
src = fs.getPath(args[2]);
dst = fs.getPath(args[3]);
src.copyTo(dst);
break;
case copyout:
src = fs.getPath(args[2]);
dst = Paths.get(args[3]);
src.copyTo(dst);
break;
case copyin:
src = Paths.get(args[2]);
dst = fs.getPath(args[3]);
src.copyTo(dst);
break;
case zzmove:
fs2 = FileSystems.newFileSystem(
URI.create("zip" + Paths.get(args[2]).toUri().toString().substring(4)),
env,
null);
//sf1.getPath(args[3]).moveTo(fs2.getPath(args[3]));
z2zmove(fs, fs2, args[3]);
fs2.close();
break;
case zzcopy:
fs2 = FileSystems.newFileSystem(
URI.create("zip" + Paths.get(args[2]).toUri().toString().substring(4)),
env,
null);
//sf1.getPath(args[3]).copyTo(fs2.getPath(args[3]));
z2zcopy(fs, fs2, args[3]);
fs2.close();
break;
case attrs:
for (int i = 2; i < args.length; i++) {
path = fs.getPath(args[i]);
System.out.println(
Attributes.readBasicFileAttributes(path).toString());
}
break;
case setmtime:
DateFormat df = new SimpleDateFormat("MM/dd/yyyy-HH:mm:ss");
Date newDatetime = df.parse(args[2]);
for (int i = 3; i < args.length; i++) {
path = fs.getPath(args[i]);
path.setAttribute("lastModifiedTime",
FileTime.fromMillis(newDatetime.getTime()));
System.out.println(
Attributes.readBasicFileAttributes(path).toString());
}
break;
case attrsspace:
path = fs.getPath("/");
FileStore fstore = path.getFileStore();
//System.out.println(fstore.getFileStoreAttributeView(FileStoreSpaceAttributeView.class)
// .readAttributes());
// or
System.out.printf("filestore[%s]%n", fstore.name());
System.out.printf(" totalSpace: %d%n",
(Long)fstore.getAttribute("space:totalSpace"));
System.out.printf(" usableSpace: %d%n",
(Long)fstore.getAttribute("space:usableSpace"));
System.out.printf(" unallocSpace: %d%n",
(Long)fstore.getAttribute("space:unallocatedSpace"));
break;
case list:
case tlist:
if (args.length < 3)
list(fs.getPath("/"), false);
else
list(fs.getPath(args[2]), false);
break;
case vlist:
if (args.length < 3)
list(fs.getPath("/"), true);
else
list(fs.getPath(args[2]), true);
break;
case twalk:
case walk:
walk(fs.getPath((args.length > 2)? args[2] : "/"));
break;
case extract:
if (args.length == 2) {
extract(fs, "/");
} else {
for (int i = 2; i < args.length; i++) {
extract(fs, args[i]);
}
}
break;
case delete:
for (int i = 2; i < args.length; i++)
fs.getPath(args[i]).delete();
break;
case create:
case add:
case update:
for (int i = 2; i < args.length; i++) {
update(fs, args[i]);
}
break;
case lsdir:
path = fs.getPath(args[2]);
final String fStr = (args.length > 3)?args[3]:"";
DirectoryStream<Path> ds = path.newDirectoryStream(
new DirectoryStream.Filter<Path>() {
public boolean accept(Path path) {
return path.toString().contains(fStr);
}
});
for (Path p : ds)
System.out.println(p);
break;
case mkdir:
fs.getPath(args[2]).createDirectory();
break;
case mkdirs:
mkdirs(fs.getPath(args[2]));
break;
case attrs2:
for (int i = 2; i < args.length; i++) {
path = fs.getPath(args[i]);
System.out.println("-------(1)---------");
System.out.println(
Attributes.readBasicFileAttributes(path).toString());
System.out.println("-------(2)---------");
Map<String, ?> map = path.readAttributes("zip:*");
for (Map.Entry<String, ?> e : map.entrySet()) {
System.out.printf(" %s : %s%n", e.getKey(), e.getValue());
}
System.out.println("-------(3)---------");
map = path.readAttributes("size,lastModifiedTime,isDirectory");
for (Map.Entry<String, ?> e : map.entrySet()) {
System.out.printf(" %s : %s%n", e.getKey(), e.getValue());
}
}
break;
}
} catch (Exception x) {
x.printStackTrace();
} finally {
if (fs != null)
fs.close();
}
}
private static byte[] getBytes(String name) {
return name.getBytes();
}
private static String getString(byte[] name) {
return new String(name);
}
private static void walk(Path path) throws IOException
{
Files.walkFileTree(
path,
new SimpleFileVisitor<Path>() {
private int indent = 0;
private void indent() {
int n = 0;
while (n++ < indent)
System.out.printf(" ");
}
@Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs)
{
indent();
System.out.printf("%s%n", file.getName().toString());
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult preVisitDirectory(Path dir,
BasicFileAttributes attrs)
{
indent();
System.out.printf("[%s]%n", dir.toString());
indent += 2;
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir,
IOException ioe)
{
indent -= 2;
return FileVisitResult.CONTINUE;
}
});
}
private static void update(FileSystem fs, String path) throws Throwable{
Path src = FileSystems.getDefault().getPath(path);
if (Boolean.TRUE.equals(src.getAttribute("isDirectory"))) {
DirectoryStream<Path> ds = src.newDirectoryStream();
for (Path child : ds)
update(fs, child.toString());
ds.close();
} else {
Path dst = fs.getPath(path);
Path parent = dst.getParent();
if (parent != null && parent.notExists())
mkdirs(parent);
src.copyTo(dst, REPLACE_EXISTING);
}
}
private static void extract(FileSystem fs, String path) throws Throwable{
Path src = fs.getPath(path);
if (Boolean.TRUE.equals(src.getAttribute("isDirectory"))) {
DirectoryStream<Path> ds = src.newDirectoryStream();
for (Path child : ds)
extract(fs, child.toString());
ds.close();
} else {
if (path.startsWith("/"))
path = path.substring(1);
Path dst = FileSystems.getDefault().getPath(path);
Path parent = dst.getParent();
if (parent.notExists())
mkdirs(parent);
src.copyTo(dst, REPLACE_EXISTING);
}
}
// use DirectoryStream
private static void z2zcopy(FileSystem src, FileSystem dst, String path)
throws IOException
{
Path srcPath = src.getPath(path);
Path dstPath = dst.getPath(path);
if (Boolean.TRUE.equals(srcPath.getAttribute("isDirectory"))) {
if (!dstPath.exists()) {
try {
mkdirs(dstPath);
} catch (FileAlreadyExistsException x) {}
}
DirectoryStream<Path> ds = srcPath.newDirectoryStream();
for (Path child : ds) {
z2zcopy(src, dst,
path + (path.endsWith("/")?"":"/") + child.getName());
}
ds.close();
} else {
//System.out.println("copying..." + path);
srcPath.copyTo(dstPath);
}
}
// use TreeWalk to move
private static void z2zmove(FileSystem src, FileSystem dst, String path)
throws IOException
{
final Path srcPath = src.getPath(path).toAbsolutePath();
final Path dstPath = dst.getPath(path).toAbsolutePath();
Files.walkFileTree(srcPath, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs)
{
Path dst = srcPath.relativize(file);
dst = dstPath.resolve(dst);
try {
Path parent = dstPath.getParent();
if (parent != null && parent.notExists())
mkdirs(parent);
file.moveTo(dst);
} catch (IOException x) {
x.printStackTrace();
}
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult preVisitDirectory(Path dir,
BasicFileAttributes attrs)
{
Path dst = srcPath.relativize(dir);
dst = dstPath.resolve(dst);
try {
if (dst.notExists())
mkdirs(dst);
} catch (IOException x) {
x.printStackTrace();
}
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir,
IOException ioe)
throws IOException
{
try {
dir.delete();
} catch (IOException x) {
//x.printStackTrace();
}
return FileVisitResult.CONTINUE;
}
});
}
private static void mkdirs(Path path) throws IOException {
path = path.toAbsolutePath();
Path parent = path.getParent();
if (parent != null) {
if (parent.notExists())
mkdirs(parent);
}
path.createDirectory();
}
private static void rmdirs(Path path) throws IOException {
while (path != null && path.getNameCount() != 0) {
path.delete();
path = path.getParent();
}
}
private static void list(Path path, boolean verbose ) throws IOException {
if (verbose)
System.out.println(Attributes.readBasicFileAttributes(path).toString());
else
System.out.printf(" %s%n", path.toString());
if (path.notExists())
return;
if (Attributes.readBasicFileAttributes(path).isDirectory()) {
DirectoryStream<Path> ds = path.newDirectoryStream();
for (Path child : ds)
list(child, verbose);
ds.close();
}
}
// check the content of two paths are equal
private static void checkEqual(Path src, Path dst) throws IOException
{
//System.out.printf("checking <%s> vs <%s>...%n",
// src.toString(), dst.toString());
//streams
InputStream isSrc = src.newInputStream();
InputStream isDst = dst.newInputStream();
byte[] bufSrc = new byte[8192];
byte[] bufDst = new byte[8192];
try {
int nSrc = 0;
while ((nSrc = isSrc.read(bufSrc)) != -1) {
int nDst = 0;
while (nDst < nSrc) {
int n = isDst.read(bufDst, nDst, nSrc - nDst);
if (n == -1) {
System.out.printf("checking <%s> vs <%s>...%n",
src.toString(), dst.toString());
throw new RuntimeException("CHECK FAILED!");
}
nDst += n;
}
while (--nSrc >= 0) {
if (bufSrc[nSrc] != bufDst[nSrc]) {
System.out.printf("checking <%s> vs <%s>...%n",
src.toString(), dst.toString());
throw new RuntimeException("CHECK FAILED!");
}
nSrc--;
}
}
} finally {
isSrc.close();
isDst.close();
}
// channels
SeekableByteChannel chSrc = src.newByteChannel();
SeekableByteChannel chDst = dst.newByteChannel();
if (chSrc.size() != chDst.size()) {
System.out.printf("src[%s].size=%d, dst[%s].size=%d%n",
chSrc.toString(), chSrc.size(),
chDst.toString(), chDst.size());
throw new RuntimeException("CHECK FAILED!");
}
ByteBuffer bbSrc = ByteBuffer.allocate(8192);
ByteBuffer bbDst = ByteBuffer.allocate(8192);
try {
int nSrc = 0;
while ((nSrc = chSrc.read(bbSrc)) != -1) {
int nDst = chDst.read(bbDst);
if (nSrc != nDst) {
System.out.printf("checking <%s> vs <%s>...%n",
src.toString(), dst.toString());
throw new RuntimeException("CHECK FAILED!");
}
while (--nSrc >= 0) {
if (bbSrc.get(nSrc) != bbDst.get(nSrc)) {
System.out.printf("checking <%s> vs <%s>...%n",
src.toString(), dst.toString());
throw new RuntimeException("CHECK FAILED!");
}
nSrc--;
}
bbSrc.flip();
bbDst.flip();
}
} catch (IOException x) {
x.printStackTrace();
} finally {
chSrc.close();
chDst.close();
}
}
private static void fchCopy(Path src, Path dst) throws IOException
{
Set<OpenOption> read = new HashSet<>();
read.add(READ);
Set<OpenOption> openwrite = new HashSet<>();
openwrite.add(CREATE_NEW);
openwrite.add(WRITE);
FileChannel srcFc = src.getFileSystem()
.provider()
.newFileChannel(src, read);
FileChannel dstFc = dst.getFileSystem()
.provider()
.newFileChannel(dst, openwrite);
try {
ByteBuffer bb = ByteBuffer.allocate(8192);
while (srcFc.read(bb) >= 0) {
bb.flip();
dstFc.write(bb);
bb.clear();
}
} finally {
srcFc.close();
dstFc.close();
}
}
private static void chCopy(Path src, Path dst) throws IOException
{
Set<OpenOption> read = new HashSet<>();
read.add(READ);
Set<OpenOption> openwrite = new HashSet<>();
openwrite.add(CREATE_NEW);
openwrite.add(WRITE);
SeekableByteChannel srcCh = src.newByteChannel(read);
SeekableByteChannel dstCh = dst.newByteChannel(openwrite);
try {
ByteBuffer bb = ByteBuffer.allocate(8192);
while (srcCh.read(bb) >= 0) {
bb.flip();
dstCh.write(bb);
bb.clear();
}
} finally {
srcCh.close();
dstCh.close();
}
}
private static void streamCopy(Path src, Path dst) throws IOException
{
InputStream isSrc = src.newInputStream();
OutputStream osDst = dst.newOutputStream();
byte[] buf = new byte[8192];
try {
int n = 0;
while ((n = isSrc.read(buf)) != -1) {
osDst.write(buf, 0, n);
}
} finally {
isSrc.close();
osDst.close();
}
}
}

View File

@ -0,0 +1,3 @@
com.sun.nio.zipfs.ZipFileSystemProvider
com.sun.nio.zipfs.JarFileSystemProvider

View File

@ -0,0 +1,29 @@
ZipFileSystem is a file system provider that treats the contents of a zip or
JAR file as a java.nio.file.FileSystem.
To deploy the provider you must copy zipfs.jar into your extensions
directory or else add <JDK_HOME>/demo/nio/ZipFileSystem/zipfs.jar
to your class path.
The factory methods defined by the java.nio.file.FileSystems class can be
used to create a FileSystem, eg:
// use file type detection
Map<String,?> env = Collections.emptyMap();
Path jarfile = Path.get("foo.jar");
FileSystem fs = FileSystems.newFileSystem(jarfile, env);
-or
// locate file system by URI
Map<String,?> env = Collections.emptyMap();
URI uri = URI.create("zip:///mydir/foo.jar");
FileSystem fs = FileSystems.newFileSystem(uri, env);
Once a FileSystem is created then classes in the java.nio.file package
can be used to access files in the zip/JAR file, eg:
Path mf = fs.getPath("/META-INF/MANIFEST.MF");
InputStream in = mf.newInputStream();

View File

@ -0,0 +1,71 @@
/*
* Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Sun Microsystems nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.sun.nio.zipfs;
import java.nio.file.*;
import java.nio.file.spi.*;
import java.nio.file.attribute.*;
import java.nio.file.spi.FileSystemProvider;
import java.net.URI;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.channels.FileChannel;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class JarFileSystemProvider extends ZipFileSystemProvider
{
@Override
public String getScheme() {
return "jar";
}
@Override
protected Path uriToPath(URI uri) {
String scheme = uri.getScheme();
if ((scheme == null) || !scheme.equalsIgnoreCase(getScheme())) {
throw new IllegalArgumentException("URI scheme is not '" + getScheme() + "'");
}
try {
String uristr = uri.toString();
int end = uristr.indexOf("!/");
uristr = uristr.substring(4, (end == -1) ? uristr.length() : end);
uri = new URI(uristr);
return Paths.get(new URI("file", uri.getHost(), uri.getPath(), null))
.toAbsolutePath();
} catch (URISyntaxException e) {
throw new AssertionError(e); //never thrown
}
}
}

View File

@ -0,0 +1,160 @@
/*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.sun.nio.zipfs;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.CoderResult;
import java.nio.charset.CodingErrorAction;
import java.util.Arrays;
/**
* Utility class for zipfile name and comment decoding and encoding
*
* @author Xueming Shen
*/
final class ZipCoder {
String toString(byte[] ba, int length) {
CharsetDecoder cd = decoder().reset();
int len = (int)(length * cd.maxCharsPerByte());
char[] ca = new char[len];
if (len == 0)
return new String(ca);
ByteBuffer bb = ByteBuffer.wrap(ba, 0, length);
CharBuffer cb = CharBuffer.wrap(ca);
CoderResult cr = cd.decode(bb, cb, true);
if (!cr.isUnderflow())
throw new IllegalArgumentException(cr.toString());
cr = cd.flush(cb);
if (!cr.isUnderflow())
throw new IllegalArgumentException(cr.toString());
return new String(ca, 0, cb.position());
}
String toString(byte[] ba) {
return toString(ba, ba.length);
}
byte[] getBytes(String s) {
CharsetEncoder ce = encoder().reset();
char[] ca = s.toCharArray();
int len = (int)(ca.length * ce.maxBytesPerChar());
byte[] ba = new byte[len];
if (len == 0)
return ba;
ByteBuffer bb = ByteBuffer.wrap(ba);
CharBuffer cb = CharBuffer.wrap(ca);
CoderResult cr = ce.encode(cb, bb, true);
if (!cr.isUnderflow())
throw new IllegalArgumentException(cr.toString());
cr = ce.flush(bb);
if (!cr.isUnderflow())
throw new IllegalArgumentException(cr.toString());
if (bb.position() == ba.length) // defensive copy?
return ba;
else
return Arrays.copyOf(ba, bb.position());
}
// assume invoked only if "this" is not utf8
byte[] getBytesUTF8(String s) {
if (isutf8)
return getBytes(s);
if (utf8 == null)
utf8 = new ZipCoder(Charset.forName("UTF-8"));
return utf8.getBytes(s);
}
String toStringUTF8(byte[] ba, int len) {
if (isutf8)
return toString(ba, len);
if (utf8 == null)
utf8 = new ZipCoder(Charset.forName("UTF-8"));
return utf8.toString(ba, len);
}
boolean isUTF8() {
return isutf8;
}
private Charset cs;
private boolean isutf8;
private ZipCoder utf8;
private ZipCoder(Charset cs) {
this.cs = cs;
this.isutf8 = cs.name().equals("UTF-8");
}
static ZipCoder get(Charset charset) {
return new ZipCoder(charset);
}
static ZipCoder get(String csn) {
try {
return new ZipCoder(Charset.forName(csn));
} catch (Throwable t) {
t.printStackTrace();
}
return new ZipCoder(Charset.defaultCharset());
}
private final ThreadLocal<CharsetDecoder> decTL = new ThreadLocal<>();
private final ThreadLocal<CharsetEncoder> encTL = new ThreadLocal<>();
private CharsetDecoder decoder() {
CharsetDecoder dec = decTL.get();
if (dec == null) {
dec = cs.newDecoder()
.onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
decTL.set(dec);
}
return dec;
}
private CharsetEncoder encoder() {
CharsetEncoder enc = encTL.get();
if (enc == null) {
enc = cs.newEncoder()
.onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
encTL.set(enc);
}
return enc;
}
}

View File

@ -0,0 +1,261 @@
/*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.sun.nio.zipfs;
import java.nio.ByteBuffer;
/**
*
* @author Xueming Shen
*/
class ZipConstants {
/*
* Compression methods
*/
static final int METHOD_STORED = 0;
static final int METHOD_DEFLATED = 8;
static final int METHOD_DEFLATED64 = 9;
static final int METHOD_BZIP2 = 12;
static final int METHOD_LZMA = 14;
static final int METHOD_LZ77 = 19;
/*
* General purpose big flag
*/
static final int FLAG_ENCRYPTED = 0x01;
static final int FLAG_DATADESCR = 0x08; // crc, size and csize in dd
static final int FLAG_EFS = 0x800; // If this bit is set the filename and
// comment fields for this file must be
// encoded using UTF-8.
/*
* Header signatures
*/
static long LOCSIG = 0x04034b50L; // "PK\003\004"
static long EXTSIG = 0x08074b50L; // "PK\007\008"
static long CENSIG = 0x02014b50L; // "PK\001\002"
static long ENDSIG = 0x06054b50L; // "PK\005\006"
/*
* Header sizes in bytes (including signatures)
*/
static final int LOCHDR = 30; // LOC header size
static final int EXTHDR = 16; // EXT header size
static final int CENHDR = 46; // CEN header size
static final int ENDHDR = 22; // END header size
/*
* Local file (LOC) header field offsets
*/
static final int LOCVER = 4; // version needed to extract
static final int LOCFLG = 6; // general purpose bit flag
static final int LOCHOW = 8; // compression method
static final int LOCTIM = 10; // modification time
static final int LOCCRC = 14; // uncompressed file crc-32 value
static final int LOCSIZ = 18; // compressed size
static final int LOCLEN = 22; // uncompressed size
static final int LOCNAM = 26; // filename length
static final int LOCEXT = 28; // extra field length
/*
* Extra local (EXT) header field offsets
*/
static final int EXTCRC = 4; // uncompressed file crc-32 value
static final int EXTSIZ = 8; // compressed size
static final int EXTLEN = 12; // uncompressed size
/*
* Central directory (CEN) header field offsets
*/
static final int CENVEM = 4; // version made by
static final int CENVER = 6; // version needed to extract
static final int CENFLG = 8; // encrypt, decrypt flags
static final int CENHOW = 10; // compression method
static final int CENTIM = 12; // modification time
static final int CENCRC = 16; // uncompressed file crc-32 value
static final int CENSIZ = 20; // compressed size
static final int CENLEN = 24; // uncompressed size
static final int CENNAM = 28; // filename length
static final int CENEXT = 30; // extra field length
static final int CENCOM = 32; // comment length
static final int CENDSK = 34; // disk number start
static final int CENATT = 36; // internal file attributes
static final int CENATX = 38; // external file attributes
static final int CENOFF = 42; // LOC header offset
/*
* End of central directory (END) header field offsets
*/
static final int ENDSUB = 8; // number of entries on this disk
static final int ENDTOT = 10; // total number of entries
static final int ENDSIZ = 12; // central directory size in bytes
static final int ENDOFF = 16; // offset of first CEN header
static final int ENDCOM = 20; // zip file comment length
/*
* ZIP64 constants
*/
static final long ZIP64_ENDSIG = 0x06064b50L; // "PK\006\006"
static final long ZIP64_LOCSIG = 0x07064b50L; // "PK\006\007"
static final int ZIP64_ENDHDR = 56; // ZIP64 end header size
static final int ZIP64_LOCHDR = 20; // ZIP64 end loc header size
static final int ZIP64_EXTHDR = 24; // EXT header size
static final int ZIP64_EXTID = 0x0001; // Extra field Zip64 header ID
static final int ZIP64_MINVAL32 = 0xFFFF;
static final long ZIP64_MINVAL = 0xFFFFFFFFL;
/*
* Zip64 End of central directory (END) header field offsets
*/
static final int ZIP64_ENDLEN = 4; // size of zip64 end of central dir
static final int ZIP64_ENDVEM = 12; // version made by
static final int ZIP64_ENDVER = 14; // version needed to extract
static final int ZIP64_ENDNMD = 16; // number of this disk
static final int ZIP64_ENDDSK = 20; // disk number of start
static final int ZIP64_ENDTOD = 24; // total number of entries on this disk
static final int ZIP64_ENDTOT = 32; // total number of entries
static final int ZIP64_ENDSIZ = 40; // central directory size in bytes
static final int ZIP64_ENDOFF = 48; // offset of first CEN header
static final int ZIP64_ENDEXT = 56; // zip64 extensible data sector
/*
* Zip64 End of central directory locator field offsets
*/
static final int ZIP64_LOCDSK = 4; // disk number start
static final int ZIP64_LOCOFF = 8; // offset of zip64 end
static final int ZIP64_LOCTOT = 16; // total number of disks
/*
* Zip64 Extra local (EXT) header field offsets
*/
static final int ZIP64_EXTCRC = 4; // uncompressed file crc-32 value
static final int ZIP64_EXTSIZ = 8; // compressed size, 8-byte
static final int ZIP64_EXTLEN = 16; // uncompressed size, 8-byte
/*
* Extra field header ID
*/
static final int EXTID_ZIP64 = 0x0001; // ZIP64
static final int EXTID_NTFS = 0x000a; // NTFS
static final int EXTID_UNIX = 0x000d; // UNIX
/*
* fields access methods
*/
///////////////////////////////////////////////////////
static final int CH(byte[] b, int n) {
return b[n] & 0xff;
}
static final int SH(byte[] b, int n) {
return (b[n] & 0xff) | ((b[n + 1] & 0xff) << 8);
}
static final long LG(byte[] b, int n) {
return ((SH(b, n)) | (SH(b, n + 2) << 16)) & 0xffffffffL;
}
static final long LL(byte[] b, int n) {
return (LG(b, n)) | (LG(b, n + 4) << 32);
}
static final long GETSIG(byte[] b) {
return LG(b, 0);
}
// local file (LOC) header fields
static final long LOCSIG(byte[] b) { return LG(b, 0); } // signature
static final int LOCVER(byte[] b) { return SH(b, 4); } // version needed to extract
static final int LOCFLG(byte[] b) { return SH(b, 6); } // general purpose bit flags
static final int LOCHOW(byte[] b) { return SH(b, 8); } // compression method
static final long LOCTIM(byte[] b) { return LG(b, 10);} // modification time
static final long LOCCRC(byte[] b) { return LG(b, 14);} // crc of uncompressed data
static final long LOCSIZ(byte[] b) { return LG(b, 18);} // compressed data size
static final long LOCLEN(byte[] b) { return LG(b, 22);} // uncompressed data size
static final int LOCNAM(byte[] b) { return SH(b, 26);} // filename length
static final int LOCEXT(byte[] b) { return SH(b, 28);} // extra field length
// extra local (EXT) header fields
static final long EXTCRC(byte[] b) { return LG(b, 4);} // crc of uncompressed data
static final long EXTSIZ(byte[] b) { return LG(b, 8);} // compressed size
static final long EXTLEN(byte[] b) { return LG(b, 12);} // uncompressed size
// end of central directory header (END) fields
static final int ENDSUB(byte[] b) { return SH(b, 8); } // number of entries on this disk
static final int ENDTOT(byte[] b) { return SH(b, 10);} // total number of entries
static final long ENDSIZ(byte[] b) { return LG(b, 12);} // central directory size
static final long ENDOFF(byte[] b) { return LG(b, 16);} // central directory offset
static final int ENDCOM(byte[] b) { return SH(b, 20);} // size of zip file comment
static final int ENDCOM(byte[] b, int off) { return SH(b, off + 20);}
// zip64 end of central directory recoder fields
static final long ZIP64_ENDTOD(byte[] b) { return LL(b, 24);} // total number of entries on disk
static final long ZIP64_ENDTOT(byte[] b) { return LL(b, 32);} // total number of entries
static final long ZIP64_ENDSIZ(byte[] b) { return LL(b, 40);} // central directory size
static final long ZIP64_ENDOFF(byte[] b) { return LL(b, 48);} // central directory offset
static final long ZIP64_LOCOFF(byte[] b) { return LL(b, 8);} // zip64 end offset
//////////////////////////////////////////
static final int CH(ByteBuffer b, int pos) {
return b.get(pos) & 0xff;
}
static final int SH(ByteBuffer b, int pos) {
return b.getShort(pos) & 0xffff;
}
static final long LG(ByteBuffer b, int pos) {
return b.getInt(pos) & 0xffffffffL;
}
// central directory header (END) fields
static final long CENSIG(ByteBuffer b, int pos) { return LG(b, pos + 0); }
static final int CENVEM(ByteBuffer b, int pos) { return SH(b, pos + 4); }
static final int CENVER(ByteBuffer b, int pos) { return SH(b, pos + 6); }
static final int CENFLG(ByteBuffer b, int pos) { return SH(b, pos + 8); }
static final int CENHOW(ByteBuffer b, int pos) { return SH(b, pos + 10);}
static final long CENTIM(ByteBuffer b, int pos) { return LG(b, pos + 12);}
static final long CENCRC(ByteBuffer b, int pos) { return LG(b, pos + 16);}
static final long CENSIZ(ByteBuffer b, int pos) { return LG(b, pos + 20);}
static final long CENLEN(ByteBuffer b, int pos) { return LG(b, pos + 24);}
static final int CENNAM(ByteBuffer b, int pos) { return SH(b, pos + 28);}
static final int CENEXT(ByteBuffer b, int pos) { return SH(b, pos + 30);}
static final int CENCOM(ByteBuffer b, int pos) { return SH(b, pos + 32);}
static final int CENDSK(ByteBuffer b, int pos) { return SH(b, pos + 34);}
static final int CENATT(ByteBuffer b, int pos) { return SH(b, pos + 36);}
static final long CENATX(ByteBuffer b, int pos) { return LG(b, pos + 38);}
static final long CENOFF(ByteBuffer b, int pos) { return LG(b, pos + 42);}
/* The END header is followed by a variable length comment of size < 64k. */
static final long END_MAXLEN = 0xFFFF + ENDHDR;
static final int READBLOCKSZ = 128;
}

View File

@ -0,0 +1,109 @@
/*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.sun.nio.zipfs;
import java.nio.file.DirectoryStream;
import java.nio.file.ClosedDirectoryStreamException;
import java.nio.file.NotDirectoryException;
import java.nio.file.Path;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.io.IOException;
import static com.sun.nio.zipfs.ZipUtils.*;
/**
*
* @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
*/
public class ZipDirectoryStream implements DirectoryStream<Path> {
private final ZipFileSystem zipfs;
private final byte[] path;
private final DirectoryStream.Filter<? super Path> filter;
private volatile boolean isClosed;
private volatile Iterator<Path> itr;
ZipDirectoryStream(ZipPath zipPath,
DirectoryStream.Filter<? super java.nio.file.Path> filter)
throws IOException
{
this.zipfs = zipPath.getFileSystem();
this.path = zipPath.getResolvedPath();
this.filter = filter;
// sanity check
if (!zipfs.isDirectory(path))
throw new NotDirectoryException(zipPath.toString());
}
@Override
public synchronized Iterator<Path> iterator() {
if (isClosed)
throw new ClosedDirectoryStreamException();
if (itr != null)
throw new IllegalStateException("Iterator has already been returned");
try {
itr = zipfs.iteratorOf(path, filter);
} catch (IOException e) {
throw new IllegalStateException(e);
}
return new Iterator<Path>() {
private Path next;
@Override
public boolean hasNext() {
if (isClosed)
return false;
return itr.hasNext();
}
@Override
public synchronized Path next() {
if (isClosed)
throw new NoSuchElementException();
return itr.next();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
@Override
public synchronized void close() throws IOException {
isClosed = true;
}
}

View File

@ -0,0 +1,185 @@
/*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.sun.nio.zipfs;
import java.nio.file.ReadOnlyFileSystemException;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.FileAttributeView;
import java.nio.file.attribute.FileTime;
import java.io.IOException;
import java.util.LinkedHashMap;
/*
* @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
*/
public class ZipFileAttributeView implements BasicFileAttributeView
{
private static enum AttrID {
size,
creationTime,
lastAccessTime,
lastModifiedTime,
isDirectory,
isRegularFile,
isSymbolicLink,
isOther,
fileKey,
compressedSize,
crc,
method
};
private final ZipPath path;
private final boolean isZipView;
private ZipFileAttributeView(ZipPath path, boolean isZipView) {
this.path = path;
this.isZipView = isZipView;
}
static <V extends FileAttributeView> V get(ZipPath path, Class<V> type) {
if (type == null)
throw new NullPointerException();
if (type == BasicFileAttributeView.class)
return (V)new ZipFileAttributeView(path, false);
if (type == ZipFileAttributeView.class)
return (V)new ZipFileAttributeView(path, true);
return null;
}
static ZipFileAttributeView get(ZipPath path, String type) {
if (type == null)
throw new NullPointerException();
if (type.equals("basic"))
return new ZipFileAttributeView(path, false);
if (type.equals("zip"))
return new ZipFileAttributeView(path, true);
return null;
}
@Override
public String name() {
return isZipView ? "zip" : "basic";
}
public ZipFileAttributes readAttributes() throws IOException
{
return path.getAttributes();
}
@Override
public void setTimes(FileTime lastModifiedTime,
FileTime lastAccessTime,
FileTime createTime)
throws IOException
{
path.setTimes(lastModifiedTime, lastAccessTime, createTime);
}
void setAttribute(String attribute, Object value)
throws IOException
{
try {
if (AttrID.valueOf(attribute) == AttrID.lastModifiedTime)
setTimes ((FileTime)value, null, null);
return;
} catch (IllegalArgumentException x) {}
throw new UnsupportedOperationException("'" + attribute +
"' is unknown or read-only attribute");
}
public Object getAttribute(String attribute, boolean domap)
throws IOException
{
ZipFileAttributes zfas = readAttributes();
if (!domap) {
try {
return attribute(AttrID.valueOf(attribute), zfas);
} catch (IllegalArgumentException x) {}
return null;
}
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
if ("*".equals(attribute)) {
for (AttrID id : AttrID.values()) {
try {
map.put(id.name(), attribute(id, zfas));
} catch (IllegalArgumentException x) {}
}
} else {
String[] as = attribute.split(",");
for (String a : as) {
try {
map.put(a, attribute(AttrID.valueOf(a), zfas));
} catch (IllegalArgumentException x) {}
}
}
return map;
}
Object attribute(AttrID id, ZipFileAttributes zfas) {
switch (id) {
case size:
return zfas.size();
case creationTime:
return zfas.creationTime();
case lastAccessTime:
return zfas.lastAccessTime();
case lastModifiedTime:
return zfas.lastModifiedTime();
case isDirectory:
return zfas.isDirectory();
case isRegularFile:
return zfas.isRegularFile();
case isSymbolicLink:
return zfas.isSymbolicLink();
case isOther:
return zfas.isOther();
case fileKey:
return zfas.fileKey();
case compressedSize:
if (isZipView)
return zfas.compressedSize();
break;
case crc:
if (isZipView)
return zfas.crc();
break;
case method:
if (isZipView)
return zfas.method();
break;
}
return null;
}
}

Some files were not shown because too many files have changed in this diff Show More