提交 bb15e51e 编写于 作者: T tbell

Merge

......@@ -41,7 +41,7 @@ AUTO_FILES_JAVA_DIRS = com/sun/org/apache/xml
# Resources
#
LOCALE_SET_DEFINITION = jre
NEW_RESOURCE_BUNDLES_PROPERTIES = \
NEW_RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = \
$(PKGDIR)/internal/security/resource/config.dtd \
$(PKGDIR)/internal/security/resource/config.xml \
$(PKGDIR)/internal/security/resource/xmlsecurity_de.properties \
......
......@@ -41,7 +41,7 @@ AUTO_FILES_JAVA_DIRS = com/sun/rowset
# Resources
#
LOCALE_SET_DEFINITION = jre
RESOURCE_BUNDLES_PROPERTIES = $(PKGDIR)/RowSetResourceBundle.properties
RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = $(PKGDIR)/RowSetResourceBundle.properties
#
# Rules
......
......@@ -44,12 +44,8 @@
#
# NEW_RESOURCE_BUNDLES_JAVA - new resource bundles implemented in
# Java, not localized
# NEW_RESOURCE_BUNDLES_PROPERTIES - new resource bundles implemented as
# properties files, not localized
# RESOURCE_BUNDLES_JAVA - resource bundles implemented in
# Java, localized
# RESOURCE_BUNDLES_PROPERTIES - new resource bundles implemented as
# properties files, localized
#
# The following variable is now used for most .properties files in the JDK.
# These properties files are converted into java and compiled with javac.
......@@ -61,6 +57,13 @@
# properties files, localized
# NEW_RESOURCE_BUNDLES_COMPILED_PROPERTIES - same as above, not localized
#
# For non-compiled properties files, use the following variables:
#
# NEW_RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES - new resource bundles implemented as
# properties files, not localized
# RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES - resource bundles implemented as
# properties files, localized
#
# Other properties files to be installed are identified using the variable:
#
# OTHER_PROPERTIES
......@@ -109,11 +112,12 @@ COMPILED_PROPERTIES += $(RESOURCE_BUNDLES_COMPILED_PROPERTIES) \
FILES_java += $(COMPILED_PROPERTIES:%.properties=%.java)
# Non-compiled files
PROPERTIES_FILES += $(NEW_RESOURCE_BUNDLES_PROPERTIES)
PROPERTIES_FILES += $(RESOURCE_BUNDLES_PROPERTIES) \
$(foreach file,$(RESOURCE_BUNDLES_PROPERTIES), \
PROPERTIES_FILES += $(NEW_RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES)
PROPERTIES_FILES += $(RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES) \
$(foreach file,$(RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES), \
$(foreach locale,$(LOCALE_SUFFIXES), \
$(basename $(file))_$(locale)$(suffix $(file))))
# other properties
PROPERTIES_FILES += $(OTHER_PROPERTIES)
#
......
......@@ -37,7 +37,7 @@ AUTO_FILES_JAVA_DIRS = sun/launcher
# Resources
#
LOCALE_SET_DEFINITION = jre
NEW_RESOURCE_BUNDLES_PROPERTIES = $(PKGDIR)/resources/launcher.properties
NEW_RESOURCE_BUNDLES_COMPILED_PROPERTIES = $(PKGDIR)/resources/launcher.properties
#
# Rules
......
......@@ -41,7 +41,7 @@ include FILES_java.gmk
# Resources
#
LOCALE_SET_DEFINITION = j2sdk
RESOURCE_BUNDLES_PROPERTIES = sun/tools/javac/resources/javac.properties
RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = sun/tools/javac/resources/javac.properties
#
# Rules
......
......@@ -41,7 +41,7 @@ AUTO_FILES_JAVA_DIRS = sun/rmi/registry
# Resources
#
LOCALE_SET_DEFINITION = jre
RESOURCE_BUNDLES_PROPERTIES = $(PKGDIR)/resources/rmiregistry.properties
RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = $(PKGDIR)/resources/rmiregistry.properties
#
# Rules
......
......@@ -43,7 +43,7 @@ FILES_java = $(RMIC_java)
# Resources
#
LOCALE_SET_DEFINITION = jdk
RESOURCE_BUNDLES_PROPERTIES = $(PKGDIR)/resources/rmic.properties
RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = $(PKGDIR)/resources/rmic.properties
#
# Rules
......
......@@ -39,7 +39,7 @@ build: stubs
# Resources
#
LOCALE_SET_DEFINITION = jre
RESOURCE_BUNDLES_PROPERTIES = sun/rmi/server/resources/rmid.properties
RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = sun/rmi/server/resources/rmid.properties
#
# Extra dependencies.
......
......@@ -41,7 +41,7 @@ AUTO_FILES_JAVA_DIRS = sun/tools/serialver
# Resources
#
LOCALE_SET_DEFINITION = jdk
RESOURCE_BUNDLES_PROPERTIES = $(PKGDIR)/resources/serialver.properties
RESOURCE_BUNDLES_UNCOMPILED_PROPERTIES = $(PKGDIR)/resources/serialver.properties
#
# Rules
......
/*
* Copyright 1994-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1994-2009 Sun Microsystems, Inc. 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
......@@ -404,8 +404,19 @@ public final class Double extends Number implements Comparable<Double> {
* binary value that is then rounded to type {@code double}
* by the usual round-to-nearest rule of IEEE 754 floating-point
* arithmetic, which includes preserving the sign of a zero
* value. Finally, a {@code Double} object representing this
* {@code double} value is returned.
* value.
*
* Note that the round-to-nearest rule also implies overflow and
* underflow behaviour; if the exact value of {@code s} is large
* enough in magnitude (greater than or equal to ({@link
* #MAX_VALUE} + {@link Math#ulp(double) ulp(MAX_VALUE)}/2),
* rounding to {@code double} will result in an infinity and if the
* exact value of {@code s} is small enough in magnitude (less
* than or equal to {@link #MIN_VALUE}/2), rounding to float will
* result in a zero.
*
* Finally, after rounding a {@code Double} object representing
* this {@code double} value is returned.
*
* <p> To interpret localized string representations of a
* floating-point value, use subclasses of {@link
......
/*
* Copyright 1994-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1994-2009 Sun Microsystems, Inc. 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
......@@ -365,8 +365,19 @@ public final class Float extends Number implements Comparable<Float> {
* binary value that is then rounded to type {@code float}
* by the usual round-to-nearest rule of IEEE 754 floating-point
* arithmetic, which includes preserving the sign of a zero
* value. Finally, a {@code Float} object representing this
* {@code float} value is returned.
* value.
*
* Note that the round-to-nearest rule also implies overflow and
* underflow behaviour; if the exact value of {@code s} is large
* enough in magnitude (greater than or equal to ({@link
* #MAX_VALUE} + {@link Math#ulp(float) ulp(MAX_VALUE)}/2),
* rounding to {@code float} will result in an infinity and if the
* exact value of {@code s} is small enough in magnitude (less
* than or equal to {@link #MIN_VALUE}/2), rounding to float will
* result in a zero.
*
* Finally, after rounding a {@code Float} object representing
* this {@code float} value is returned.
*
* <p>To interpret localized string representations of a
* floating-point value, use subclasses of {@link
......
......@@ -41,10 +41,11 @@ import java.security.PrivilegedExceptionAction;
* one machine to another may be routed differently, and may arrive in
* any order.
*
* <p>UDP broadcasts sends are always enabled on a DatagramSocket.
* In order to receive broadcast packets a DatagramSocket
* should be bound to the wildcard address. In some
* implementations, broadcast packets may also be received when
* <p> Where possible, a newly constructed {@code DatagramSocket} has the
* {@link SocketOptions#SO_BROADCAST SO_BROADCAST} socket option enabled so as
* to allow the transmission of broadcast datagrams. In order to receive
* broadcast packets a DatagramSocket should be bound to the wildcard address.
* In some implementations, broadcast packets may also be received when
* a DatagramSocket is bound to a more specific address.
* <p>
* Example:
......@@ -1017,9 +1018,18 @@ class DatagramSocket implements java.io.Closeable {
/**
* Enable/disable SO_BROADCAST.
* @param on whether or not to have broadcast turned on.
* @exception SocketException if there is an error
* in the underlying protocol, such as an UDP error.
*
* <p> Some operating systems may require that the Java virtual machine be
* started with implementation specific privileges to enable this option or
* send broadcast datagrams.
*
* @param on
* whether or not to have broadcast turned on.
*
* @throws SocketException
* if there is an error in the underlying protocol, such as an UDP
* error.
*
* @since 1.4
* @see #getBroadcast()
*/
......
......@@ -427,7 +427,7 @@ public interface Collection<E> extends Iterable<E> {
* contract for the <tt>Object.hashCode</tt> method, programmers should
* take note that any class that overrides the <tt>Object.equals</tt>
* method must also override the <tt>Object.hashCode</tt> method in order
* to satisfy the general contract for the <tt>Object.hashCode</tt>method.
* to satisfy the general contract for the <tt>Object.hashCode</tt> method.
* In particular, <tt>c1.equals(c2)</tt> implies that
* <tt>c1.hashCode()==c2.hashCode()</tt>.
*
......
......@@ -39,6 +39,7 @@ import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.math.RoundingMode;
import java.nio.charset.Charset;
import java.text.DateFormatSymbols;
import java.text.DecimalFormat;
......@@ -1252,7 +1253,7 @@ import sun.misc.FormattedFloatingDecimal;
* Double#toString(double)} respectively, then the value will be rounded
* using the {@linkplain java.math.BigDecimal#ROUND_HALF_UP round half up
* algorithm}. Otherwise, zeros may be appended to reach the precision.
* For a canonical representation of the value,use {@link
* For a canonical representation of the value, use {@link
* Float#toString(float)} or {@link Double#toString(double)} as
* appropriate.
*
......@@ -3569,15 +3570,23 @@ public final class Formatter implements Closeable, Flushable {
// Create a new BigDecimal with the desired precision.
int prec = (precision == -1 ? 6 : precision);
int scale = value.scale();
int compPrec = value.precision();
if (scale > prec)
compPrec -= (scale - prec);
MathContext mc = new MathContext(compPrec);
BigDecimal v
= new BigDecimal(value.unscaledValue(), scale, mc);
BigDecimalLayout bdl
= new BigDecimalLayout(v.unscaledValue(), v.scale(),
if (scale > prec) {
// more "scale" digits than the requested "precision
int compPrec = value.precision();
if (compPrec <= scale) {
// case of 0.xxxxxx
value = value.setScale(prec, RoundingMode.HALF_UP);
} else {
compPrec -= (scale - prec);
value = new BigDecimal(value.unscaledValue(),
scale,
new MathContext(compPrec));
}
}
BigDecimalLayout bdl = new BigDecimalLayout(
value.unscaledValue(),
value.scale(),
BigDecimalLayoutForm.DECIMAL_FLOAT);
char mant[] = bdl.mantissa();
......
......@@ -32,7 +32,7 @@ import sun.misc.Unsafe;
* An instance of this class is used to generate a stream of
* pseudorandom numbers. The class uses a 48-bit seed, which is
* modified using a linear congruential formula. (See Donald Knuth,
* <i>The Art of Computer Programming, Volume 3</i>, Section 3.2.1.)
* <i>The Art of Computer Programming, Volume 2</i>, Section 3.2.1.)
* <p>
* If two instances of {@code Random} are created with the same
* seed, and the same sequence of method calls is made for each, they
......
......@@ -60,9 +60,6 @@ public class FileChannelImpl
// Memory allocation size for mapping buffers
private static final long allocationGranularity;
// Cached field for MappedByteBuffer.isAMappedBuffer
private static final Field isAMappedBufferField;
// File descriptor
private final FileDescriptor fd;
......@@ -1315,8 +1312,6 @@ public class FileChannelImpl
Util.load();
allocationGranularity = initIDs();
nd = new FileDispatcher();
isAMappedBufferField = Reflect.lookupField("java.nio.MappedByteBuffer",
"isAMappedBuffer");
}
}
/*
* Portions Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
* Portions Copyright 2000-2009 Sun Microsystems, Inc. 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
......@@ -74,7 +74,7 @@ public class Config {
private String defaultRealm; // default kdc realm.
// used for native interface
private static native String getWindowsDirectory();
private static native String getWindowsDirectory(boolean isSystem);
/**
......@@ -661,38 +661,37 @@ public class Config {
}
/**
* Gets the default configuration file name. The file will be searched
* in a list of possible loations in the following order:
* 1. the location and file name defined by system property
* "java.security.krb5.conf",
* 2. at Java home lib\security directory with "krb5.conf" name,
* 3. "krb5.ini" at Java home,
* 4. at windows directory with the name of "krb5.ini" for Windows,
* /etc/krb5/krb5.conf for Solaris, /etc/krb5.conf for Linux.
* Gets the default configuration file name. This method will never
* return null.
*
* If the system property "java.security.krb5.conf" is defined, we'll
* use its value, no matter if the file exists or not. Otherwise,
* the file will be searched in a list of possible loations in the
* following order:
*
* 1. at Java home lib\security directory with "krb5.conf" name,
* 2. at windows directory with the name of "krb5.ini" for Windows,
* /etc/krb5/krb5.conf for Solaris, /etc/krb5.conf otherwise.
*
* Note: When the Terminal Service is started in Windows (from 2003),
* there are two kinds of Windows directories: A system one (say,
* C:\Windows), and a user-private one (say, C:\Users\Me\Windows).
* We will first look for krb5.ini in the user-private one. If not
* found, try the system one instead.
*/
private String getFileName() {
String name =
java.security.AccessController.doPrivileged(
new sun.security.action.
GetPropertyAction("java.security.krb5.conf"));
if (name != null) {
boolean temp =
java.security.AccessController.doPrivileged(
new FileExistsAction(name));
if (temp)
return name;
} else {
if (name == null) {
name = java.security.AccessController.doPrivileged(
new sun.security.action.
GetPropertyAction("java.home")) + File.separator +
"lib" + File.separator + "security" +
File.separator + "krb5.conf";
boolean temp =
java.security.AccessController.doPrivileged(
new FileExistsAction(name));
if (temp) {
return name;
} else {
if (!fileExists(name)) {
name = null;
String osname =
java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("os.name"));
......@@ -703,19 +702,35 @@ public class Config {
// ignore exceptions
}
if (Credentials.alreadyLoaded) {
if ((name = getWindowsDirectory()) == null) {
name = "c:\\winnt\\krb5.ini";
} else if (name.endsWith("\\")) {
name += "krb5.ini";
} else {
name += "\\krb5.ini";
String path = getWindowsDirectory(false);
if (path != null) {
if (path.endsWith("\\")) {
path = path + "krb5.ini";
} else {
path = path + "\\krb5.ini";
}
if (fileExists(path)) {
name = path;
}
}
} else {
if (name == null) {
path = getWindowsDirectory(true);
if (path != null) {
if (path.endsWith("\\")) {
path = path + "krb5.ini";
} else {
path = path + "\\krb5.ini";
}
name = path;
}
}
}
if (name == null) {
name = "c:\\winnt\\krb5.ini";
}
} else if (osname.startsWith("SunOS")) {
name = "/etc/krb5/krb5.conf";
} else if (osname.startsWith("Linux")) {
} else {
name = "/etc/krb5.conf";
}
}
......@@ -1171,6 +1186,11 @@ public class Config {
return kdcs;
}
private boolean fileExists(String name) {
return java.security.AccessController.doPrivileged(
new FileExistsAction(name));
}
static class FileExistsAction
implements java.security.PrivilegedAction<Boolean> {
......
......@@ -74,7 +74,6 @@ class Main {
static final String MANIFEST = JarFile.MANIFEST_NAME;
static final String MANIFEST_DIR = "META-INF/";
static final String VERSION = "1.0";
static final char SEPARATOR = File.separatorChar;
static final String INDEX = JarIndex.INDEX_NAME;
private static ResourceBundle rsrc;
......@@ -227,19 +226,32 @@ class Main {
}
tmpFile.delete();
}
} else if (xflag || tflag) {
InputStream in;
} else if (tflag) {
replaceFSC(files);
if (fname != null) {
in = new FileInputStream(fname);
list(fname, files);
} else {
in = new FileInputStream(FileDescriptor.in);
InputStream in = new FileInputStream(FileDescriptor.in);
try{
list(new BufferedInputStream(in), files);
} finally {
in.close();
}
}
if (xflag) {
extract(new BufferedInputStream(in), files);
} else if (xflag) {
replaceFSC(files);
if (fname != null && files != null) {
extract(fname, files);
} else {
list(new BufferedInputStream(in), files);
InputStream in = (fname == null)
? new FileInputStream(FileDescriptor.in)
: new FileInputStream(fname);
try {
extract(new BufferedInputStream(in), files);
} finally {
in.close();
}
}
in.close();
} else if (iflag) {
genIndex(rootjar, files);
}
......@@ -760,6 +772,31 @@ class Main {
e.setCrc(crc32.getValue());
}
void replaceFSC(String files[]) {
if (files != null) {
for (String file : files) {
file = file.replace(File.separatorChar, '/');
}
}
}
Set<ZipEntry> newDirSet() {
return new HashSet<ZipEntry>() {
public boolean add(ZipEntry e) {
return ((e == null || useExtractionTime) ? false : super.add(e));
}};
}
void updateLastModifiedTime(Set<ZipEntry> zes) throws IOException {
for (ZipEntry ze : zes) {
long lastModified = ze.getTime();
if (lastModified != -1) {
File f = new File(ze.getName().replace('/', File.separatorChar));
f.setLastModified(lastModified);
}
}
}
/*
* Extracts specified entries from JAR file.
*/
......@@ -768,19 +805,13 @@ class Main {
ZipEntry e;
// Set of all directory entries specified in archive. Disallows
// null entries. Disallows all entries if using pre-6.0 behavior.
Set<ZipEntry> dirs = new HashSet<ZipEntry>() {
public boolean add(ZipEntry e) {
return ((e == null || useExtractionTime) ? false : super.add(e));
}};
Set<ZipEntry> dirs = newDirSet();
while ((e = zis.getNextEntry()) != null) {
if (files == null) {
dirs.add(extractFile(zis, e));
} else {
String name = e.getName();
for (int i = 0; i < files.length; i++) {
String file = files[i].replace(File.separatorChar, '/');
for (String file : files) {
if (name.startsWith(file)) {
dirs.add(extractFile(zis, e));
break;
......@@ -793,13 +824,33 @@ class Main {
// timestamps as given in the archive. We do this after extraction,
// instead of during, because creating a file in a directory changes
// that directory's timestamp.
for (ZipEntry dirEntry : dirs) {
long lastModified = dirEntry.getTime();
if (lastModified != -1) {
File dir = new File(dirEntry.getName().replace('/', File.separatorChar));
dir.setLastModified(lastModified);
updateLastModifiedTime(dirs);
}
/*
* Extracts specified entries from JAR file, via ZipFile.
*/
void extract(String fname, String files[]) throws IOException {
ZipFile zf = new ZipFile(fname);
Set<ZipEntry> dirs = newDirSet();
Enumeration<? extends ZipEntry> zes = zf.entries();
while (zes.hasMoreElements()) {
ZipEntry e = zes.nextElement();
InputStream is;
if (files == null) {
dirs.add(extractFile(zf.getInputStream(e), e));
} else {
String name = e.getName();
for (String file : files) {
if (name.startsWith(file)) {
dirs.add(extractFile(zf.getInputStream(e), e));
break;
}
}
}
}
zf.close();
updateLastModifiedTime(dirs);
}
/*
......@@ -807,7 +858,7 @@ class Main {
* the entry is for a directory which doesn't exist prior to this
* invocation, returns that entry, otherwise returns null.
*/
ZipEntry extractFile(ZipInputStream zis, ZipEntry e) throws IOException {
ZipEntry extractFile(InputStream is, ZipEntry e) throws IOException {
ZipEntry rc = null;
String name = e.getName();
File f = new File(e.getName().replace('/', File.separatorChar));
......@@ -838,13 +889,19 @@ class Main {
}
}
OutputStream os = new FileOutputStream(f);
byte[] b = new byte[512];
byte[] b = new byte[8192];
int len;
while ((len = zis.read(b, 0, b.length)) != -1) {
os.write(b, 0, len);
try {
while ((len = is.read(b, 0, b.length)) != -1) {
os.write(b, 0, len);
}
} finally {
if (is instanceof ZipInputStream)
((ZipInputStream)is).closeEntry();
else
is.close();
os.close();
}
zis.closeEntry();
os.close();
if (vflag) {
if (e.getMethod() == ZipEntry.DEFLATED) {
output(formatMsg("out.inflated", name));
......@@ -869,7 +926,6 @@ class Main {
ZipInputStream zis = new ZipInputStream(in);
ZipEntry e;
while ((e = zis.getNextEntry()) != null) {
String name = e.getName();
/*
* In the case of a compressed (deflated) entry, the entry size
* is stored immediately following the entry data and cannot be
......@@ -877,18 +933,20 @@ class Main {
* the entry first before printing out its attributes.
*/
zis.closeEntry();
if (files == null) {
printEntry(e);
} else {
for (int i = 0; i < files.length; i++) {
String file = files[i].replace(File.separatorChar, '/');
if (name.startsWith(file)) {
printEntry(e);
break;
}
}
}
printEntry(e, files);
}
}
/*
* Lists contents of JAR file, via ZipFile.
*/
void list(String fname, String files[]) throws IOException {
ZipFile zf = new ZipFile(fname);
Enumeration<? extends ZipEntry> zes = zf.entries();
while (zes.hasMoreElements()) {
printEntry(zes.nextElement(), files);
}
zf.close();
}
/**
......@@ -974,13 +1032,29 @@ class Main {
dumpIndex(rootjar, index);
}
/*
* Prints entry information, if requested.
*/
void printEntry(ZipEntry e, String[] files) throws IOException {
if (files == null) {
printEntry(e);
} else {
String name = e.getName();
for (String file : files) {
if (name.startsWith(file)) {
printEntry(e);
return;
}
}
}
}
/*
* Prints entry information.
*/
void printEntry(ZipEntry e) throws IOException {
if (vflag) {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
String s = Long.toString(e.getSize());
for (int i = 6 - s.length(); i > 0; --i) {
sb.append(' ');
......
/*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2005-2009 Sun Microsystems, Inc. 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
......@@ -23,6 +23,7 @@
* have any questions.
*/
#define UNICODE
#include <jni.h>
#include <windows.h>
#include <stdlib.h>
......@@ -30,22 +31,20 @@
/*
* Class: sun_security_krb5_Config
* Method: getWindowsDirectory
* Signature: ()Ljava/lang/String;
* Signature: (Z)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_security_krb5_Config_getWindowsDirectory(
JNIEnv* env, jclass configClass) {
LPTSTR lpPath = NULL;
UINT uLength ;
jstring path = NULL;
if (uLength = GetWindowsDirectory(lpPath, 0)) {
lpPath = (LPTSTR)malloc(sizeof(TCHAR) * uLength);
if (lpPath != NULL) {
if (GetWindowsDirectory(lpPath, uLength)) {
path = (*env)->NewStringUTF(env, lpPath);
}
free(lpPath);
}
JNIEnv* env, jclass configClass, jboolean isSystem) {
TCHAR lpPath[MAX_PATH+1];
UINT len;
if (isSystem) {
len = GetSystemWindowsDirectory(lpPath, MAX_PATH);
} else {
len = GetWindowsDirectory(lpPath, MAX_PATH);
}
if (len) {
return (*env)->NewString(env, lpPath, len);
} else {
return NULL;
}
return path;
}
......@@ -1054,6 +1054,52 @@ public class Basic$Type$ extends Basic {
test("%4.1f", " 1.0", val);
test("%4.2f", "0.99", val);
test("%4.3f", "0.990", val);
// #6476425
val = new BigDecimal("0.00001");
test("%.0f", "0", val);
test("%.1f", "0.0", val);
test("%.2f", "0.00", val);
test("%.3f", "0.000", val);
test("%.4f", "0.0000", val);
test("%.5f", "0.00001", val);
val = new BigDecimal("1.00001");
test("%.0f", "1", val);
test("%.1f", "1.0", val);
test("%.2f", "1.00", val);
test("%.3f", "1.000", val);
test("%.4f", "1.0000", val);
test("%.5f", "1.00001", val);
val = new BigDecimal("1.23456");
test("%.0f", "1", val);
test("%.1f", "1.2", val);
test("%.2f", "1.23", val);
test("%.3f", "1.235", val);
test("%.4f", "1.2346", val);
test("%.5f", "1.23456", val);
test("%.6f", "1.234560", val);
val = new BigDecimal("9.99999");
test("%.0f", "10", val);
test("%.1f", "10.0", val);
test("%.2f", "10.00", val);
test("%.3f", "10.000", val);
test("%.4f", "10.0000", val);
test("%.5f", "9.99999", val);
test("%.6f", "9.999990", val);
val = new BigDecimal("1.99999");
test("%.0f", "2", val);
test("%.1f", "2.0", val);
test("%.2f", "2.00", val);
test("%.3f", "2.000", val);
test("%.4f", "2.0000", val);
test("%.5f", "1.99999", val);
test("%.6f", "1.999990", val);
#end[BigDecimal]
#if[float]
......
......@@ -25,7 +25,7 @@
* @summary Unit test for formatter
* @bug 4906370 4962433 4973103 4989961 5005818 5031150 4970931 4989491 5002937
* 5005104 5007745 5061412 5055180 5066788 5088703 6317248 6318369 6320122
* 6344623 6369500 6534606 6282094 6286592
* 6344623 6369500 6534606 6282094 6286592 6476425
*
* @run shell/timeout=240 Basic.sh
*/
......
......@@ -1055,6 +1055,52 @@ public class BasicBigDecimal extends Basic {
test("%4.2f", "0.99", val);
test("%4.3f", "0.990", val);
// #6476425
val = new BigDecimal("0.00001");
test("%.0f", "0", val);
test("%.1f", "0.0", val);
test("%.2f", "0.00", val);
test("%.3f", "0.000", val);
test("%.4f", "0.0000", val);
test("%.5f", "0.00001", val);
val = new BigDecimal("1.00001");
test("%.0f", "1", val);
test("%.1f", "1.0", val);
test("%.2f", "1.00", val);
test("%.3f", "1.000", val);
test("%.4f", "1.0000", val);
test("%.5f", "1.00001", val);
val = new BigDecimal("1.23456");
test("%.0f", "1", val);
test("%.1f", "1.2", val);
test("%.2f", "1.23", val);
test("%.3f", "1.235", val);
test("%.4f", "1.2346", val);
test("%.5f", "1.23456", val);
test("%.6f", "1.234560", val);
val = new BigDecimal("9.99999");
test("%.0f", "10", val);
test("%.1f", "10.0", val);
test("%.2f", "10.00", val);
test("%.3f", "10.000", val);
test("%.4f", "10.0000", val);
test("%.5f", "9.99999", val);
test("%.6f", "9.999990", val);
val = new BigDecimal("1.99999");
test("%.0f", "2", val);
test("%.1f", "2.0", val);
test("%.2f", "2.00", val);
test("%.3f", "2.000", val);
test("%.4f", "2.0000", val);
test("%.5f", "1.99999", val);
test("%.6f", "1.999990", val);
......
......@@ -1503,6 +1503,52 @@ public class BasicBigInteger extends Basic {
......
......@@ -1503,6 +1503,52 @@ public class BasicBoolean extends Basic {
......
......@@ -1503,6 +1503,52 @@ public class BasicBooleanObject extends Basic {
......
......@@ -1503,6 +1503,52 @@ public class BasicByte extends Basic {
......
......@@ -1503,6 +1503,52 @@ public class BasicByteObject extends Basic {
......
......@@ -1503,6 +1503,52 @@ public class BasicChar extends Basic {
......
......@@ -1503,6 +1503,52 @@ public class BasicCharObject extends Basic {
......
......@@ -1503,6 +1503,52 @@ public class BasicDateTime extends Basic {
......
......@@ -1053,6 +1053,52 @@ public class BasicDouble extends Basic {
......
......@@ -1053,6 +1053,52 @@ public class BasicDoubleObject extends Basic {
......
......@@ -1056,6 +1056,52 @@ public class BasicFloat extends Basic {
//---------------------------------------------------------------------
// %f - float
......
......@@ -1069,6 +1069,52 @@ public class BasicFloatObject extends Basic {
......
......@@ -1503,6 +1503,52 @@ public class BasicInt extends Basic {
......
......@@ -1503,6 +1503,52 @@ public class BasicIntObject extends Basic {
......
......@@ -1503,6 +1503,52 @@ public class BasicLong extends Basic {
......
......@@ -1503,6 +1503,52 @@ public class BasicLongObject extends Basic {
......
......@@ -1503,6 +1503,52 @@ public class BasicShort extends Basic {
......
......@@ -1503,6 +1503,52 @@ public class BasicShortObject extends Basic {
......
......@@ -23,14 +23,14 @@
# have any questions.
#
SPP='sh ../../../../make/java/nio/spp.sh'
javac -d . ../../../../make/tools/src/build/tools/spp/Spp.java
gen() {
# if [ $3 = "true" ]
# then $SPP -K$1 -Dtype=$1 -DType=$2 -Kprim<Basic-X.java >Basic$2.java
# else $SPP -K$1 -Dtype=$1 -DType=$2 -K$3 <Basic-X.java >Basic$2.java
# fi
$SPP -K$1 -Dtype=$1 -DType=$2 -K$3 -K$4 -K$5 -K$6 <Basic-X.java >Basic$2.java
java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -K$3 -K$4 -K$5 -K$6 <Basic-X.java >Basic$2.java
}
gen boolean Boolean prim "" "" ""
......@@ -54,3 +54,5 @@ gen Double DoubleObject "" fp "" ""
gen BigDecimal BigDecimal "" fp "" ""
gen Calendar DateTime "" "" "" datetime
rm -rf build
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册