mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
Merge
This commit is contained in:
commit
d92c6042fe
351 changed files with 2669 additions and 3430 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2018, 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
|
||||
|
@ -455,7 +455,7 @@ public class Object {
|
|||
"nanosecond timeout value out of range");
|
||||
}
|
||||
|
||||
if (nanos > 0) {
|
||||
if (nanos > 0 && timeoutMillis < Long.MAX_VALUE) {
|
||||
timeoutMillis++;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import java.util.Map;
|
|||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
|
||||
import jdk.internal.misc.TerminatingThreadLocal;
|
||||
|
@ -332,7 +333,7 @@ class Thread implements Runnable {
|
|||
"nanosecond timeout value out of range");
|
||||
}
|
||||
|
||||
if (nanos >= 500000 || (nanos != 0 && millis == 0)) {
|
||||
if (nanos > 0 && millis < Long.MAX_VALUE) {
|
||||
millis++;
|
||||
}
|
||||
|
||||
|
@ -1291,28 +1292,23 @@ class Thread implements Runnable {
|
|||
* <i>interrupted status</i> of the current thread is
|
||||
* cleared when this exception is thrown.
|
||||
*/
|
||||
public final synchronized void join(long millis)
|
||||
public final synchronized void join(final long millis)
|
||||
throws InterruptedException {
|
||||
long base = System.currentTimeMillis();
|
||||
long now = 0;
|
||||
|
||||
if (millis < 0) {
|
||||
throw new IllegalArgumentException("timeout value is negative");
|
||||
}
|
||||
|
||||
if (millis == 0) {
|
||||
if (millis > 0) {
|
||||
if (isAlive()) {
|
||||
final long startTime = System.nanoTime();
|
||||
long delay = millis;
|
||||
do {
|
||||
wait(delay);
|
||||
} while (isAlive() && (delay = millis -
|
||||
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime)) > 0);
|
||||
}
|
||||
} else if (millis == 0) {
|
||||
while (isAlive()) {
|
||||
wait(0);
|
||||
}
|
||||
} else {
|
||||
while (isAlive()) {
|
||||
long delay = millis - now;
|
||||
if (delay <= 0) {
|
||||
break;
|
||||
}
|
||||
wait(delay);
|
||||
now = System.currentTimeMillis() - base;
|
||||
}
|
||||
throw new IllegalArgumentException("timeout value is negative");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1353,7 +1349,7 @@ class Thread implements Runnable {
|
|||
"nanosecond timeout value out of range");
|
||||
}
|
||||
|
||||
if (nanos >= 500000 || (nanos != 0 && millis == 0)) {
|
||||
if (nanos > 0 && millis < Long.MAX_VALUE) {
|
||||
millis++;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,8 @@ public final class Paths {
|
|||
* Converts the given URI to a {@link Path} object.
|
||||
*
|
||||
* @implSpec
|
||||
* This method simply invokes {@link Path#of(URI) * Path.of(URI)} with the given parameter.
|
||||
* This method simply invokes {@link Path#of(URI) Path.of(URI)} with the
|
||||
* given parameter.
|
||||
*
|
||||
* @param uri
|
||||
* the URI to convert
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2018, 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
|
||||
|
@ -351,7 +351,7 @@ public abstract class Identity implements Principal, Serializable {
|
|||
|
||||
/**
|
||||
* Tests for equality between the specified identity and this identity.
|
||||
* This method should be overriden by subclasses to test for equality.
|
||||
* This method should be overridden by subclasses to test for equality.
|
||||
* The default behavior is to return true if the names and public keys
|
||||
* are equal.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2018, 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
|
||||
|
@ -1318,7 +1318,7 @@ public abstract class Provider extends Properties {
|
|||
* {@code "putProviderProperty."+name}, where {@code name} is
|
||||
* the provider name, to see if it's ok to set this provider's property
|
||||
* values. If the default implementation of {@code checkSecurityAccess}
|
||||
* is used (that is, that method is not overriden), then this results in
|
||||
* is used (that is, that method is not overridden), then this results in
|
||||
* a call to the security manager's {@code checkPermission} method with
|
||||
* a {@code SecurityPermission("putProviderProperty."+name)}
|
||||
* permission.
|
||||
|
@ -1410,7 +1410,7 @@ public abstract class Provider extends Properties {
|
|||
* the provider name, to see if it's ok to remove this provider's
|
||||
* properties. If the default implementation of
|
||||
* {@code checkSecurityAccess} is used (that is, that method is not
|
||||
* overriden), then this results in a call to the security manager's
|
||||
* overridden), then this results in a call to the security manager's
|
||||
* {@code checkPermission} method with a
|
||||
* {@code SecurityPermission("removeProviderProperty."+name)}
|
||||
* permission.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2018, 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
|
||||
|
@ -422,7 +422,7 @@ public final class Security {
|
|||
* method is called with the string {@code "removeProvider."+name}
|
||||
* to see if it's ok to remove the provider.
|
||||
* If the default implementation of {@code checkSecurityAccess}
|
||||
* is used (i.e., that method is not overriden), then this will result in
|
||||
* is used (i.e., that method is not overridden), then this will result in
|
||||
* a call to the security manager's {@code checkPermission} method
|
||||
* with a {@code SecurityPermission("removeProvider."+name)}
|
||||
* permission.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2018, 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
|
||||
|
@ -348,7 +348,7 @@ public class RuleBasedCollator extends Collator{
|
|||
* Compares the character data stored in two different strings based on the
|
||||
* collation rules. Returns information about whether a string is less
|
||||
* than, greater than or equal to another string in a language.
|
||||
* This can be overriden in a subclass.
|
||||
* This can be overridden in a subclass.
|
||||
*
|
||||
* @exception NullPointerException if <code>source</code> or <code>target</code> is null.
|
||||
*/
|
||||
|
@ -567,7 +567,7 @@ public class RuleBasedCollator extends Collator{
|
|||
/**
|
||||
* Transforms the string into a series of characters that can be compared
|
||||
* with CollationKey.compareTo. This overrides java.text.Collator.getCollationKey.
|
||||
* It can be overriden in a subclass.
|
||||
* It can be overridden in a subclass.
|
||||
*/
|
||||
public synchronized CollationKey getCollationKey(String source)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2018, 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
|
||||
|
@ -136,7 +136,7 @@ class Random implements java.io.Serializable {
|
|||
if (getClass() == Random.class)
|
||||
this.seed = new AtomicLong(initialScramble(seed));
|
||||
else {
|
||||
// subclass might have overriden setSeed
|
||||
// subclass might have overridden setSeed
|
||||
this.seed = new AtomicLong();
|
||||
setSeed(seed);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2018, 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
|
||||
|
@ -77,7 +77,7 @@ public final class StringJoiner {
|
|||
private int len;
|
||||
|
||||
/**
|
||||
* When overriden by the user to be non-null via {@link setEmptyValue}, the
|
||||
* When overridden by the user to be non-null via {@link setEmptyValue}, the
|
||||
* string returned by toString() when no elements have yet been added.
|
||||
* When null, prefix + suffix is used as the empty value.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2018, 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
|
||||
|
@ -52,7 +52,7 @@ import javax.crypto.IllegalBlockSizeException;
|
|||
* method counts only data that have been processed by the encapsulated Cipher.
|
||||
*
|
||||
* <p> It is crucial for a programmer using this class not to use
|
||||
* methods that are not defined or overriden in this class (such as a
|
||||
* methods that are not defined or overridden in this class (such as a
|
||||
* new method or constructor that is later added to one of the super
|
||||
* classes), because the design and implementation of those methods
|
||||
* are unlikely to have considered security impact with regard to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2018, 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
|
||||
|
@ -53,7 +53,7 @@ import java.io.*;
|
|||
* alternative to using this class.
|
||||
*
|
||||
* <p> It is crucial for a programmer using this class not to use
|
||||
* methods that are not defined or overriden in this class (such as a
|
||||
* methods that are not defined or overridden in this class (such as a
|
||||
* new method or constructor that is later added to one of the super
|
||||
* classes), because the design and implementation of those methods
|
||||
* are unlikely to have considered security impact with regard to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2018, 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
|
||||
|
@ -46,7 +46,7 @@ import java.security.cert.X509Certificate;
|
|||
* However, the implementations can be replaced on a per-class (static) or
|
||||
* per-instance basis. All new <code>HttpsURLConnection</code>s instances
|
||||
* will be assigned
|
||||
* the "default" static values at instance creation, but they can be overriden
|
||||
* the "default" static values at instance creation, but they can be overridden
|
||||
* by calling the appropriate per-instance set method(s) before
|
||||
* <code>connect</code>ing.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2018, 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
|
||||
|
@ -48,7 +48,7 @@ import java.net.*;
|
|||
* authentication is necessary, and whether created sockets should
|
||||
* begin handshaking in client or server mode. The state
|
||||
* inherited by the created <code>SSLSocket</code> can be
|
||||
* overriden by calling the appropriate methods.
|
||||
* overridden by calling the appropriate methods.
|
||||
*
|
||||
* @see java.net.ServerSocket
|
||||
* @see SSLSocket
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2018, 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
|
||||
|
@ -31,7 +31,7 @@ import java.security.Principal;
|
|||
* Abstract class that provides for extension of the X509KeyManager
|
||||
* interface.
|
||||
* <P>
|
||||
* Methods in this class should be overriden to provide actual
|
||||
* Methods in this class should be overridden to provide actual
|
||||
* implementations.
|
||||
*
|
||||
* @since 1.5
|
||||
|
|
|
@ -27,7 +27,6 @@ package sun.security.ssl;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.AccessController;
|
||||
import java.security.AlgorithmConstraints;
|
||||
import java.security.AlgorithmParameters;
|
||||
import java.security.CryptoPrimitive;
|
||||
|
@ -672,6 +671,11 @@ final class SupportedGroupsExtension {
|
|||
}
|
||||
|
||||
AlgorithmParameters params = namedGroupParams.get(namedGroup);
|
||||
if (params == null) {
|
||||
throw new RuntimeException(
|
||||
"Not a supported EC named group: " + namedGroup);
|
||||
}
|
||||
|
||||
try {
|
||||
return params.getParameterSpec(ECGenParameterSpec.class);
|
||||
} catch (InvalidParameterSpecException ipse) {
|
||||
|
@ -687,6 +691,11 @@ final class SupportedGroupsExtension {
|
|||
}
|
||||
|
||||
AlgorithmParameters params = namedGroupParams.get(namedGroup);
|
||||
if (params == null) {
|
||||
throw new RuntimeException(
|
||||
"Not a supported DH named group: " + namedGroup);
|
||||
}
|
||||
|
||||
try {
|
||||
return params.getParameterSpec(DHParameterSpec.class);
|
||||
} catch (InvalidParameterSpecException ipse) {
|
||||
|
@ -739,7 +748,7 @@ final class SupportedGroupsExtension {
|
|||
namedGroupParams.get(namedGroup));
|
||||
}
|
||||
|
||||
// Is there any supported group permitted by the constraints?
|
||||
// Is the named group supported?
|
||||
static boolean isSupported(NamedGroup namedGroup) {
|
||||
for (NamedGroup group : supportedNamedGroups) {
|
||||
if (namedGroup.id == group.id) {
|
||||
|
@ -757,6 +766,7 @@ final class SupportedGroupsExtension {
|
|||
for (NamedGroup namedGroup : requestedNamedGroups) {
|
||||
if ((namedGroup.type == type) &&
|
||||
namedGroup.isAvailable(negotiatedProtocol) &&
|
||||
isSupported(namedGroup) &&
|
||||
constraints.permits(
|
||||
EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
|
||||
namedGroup.algorithm,
|
||||
|
|
|
@ -281,7 +281,7 @@ public class CLDRTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl {
|
|||
.replaceFirst("H+", (isShort ? "\\%1\\$d" : "\\%1\\$02d"))
|
||||
.replaceFirst("m+", "\\%2\\$02d");
|
||||
return MessageFormat.format(gmtFormat,
|
||||
String.format(hourFormat, offset / 60, offset % 60));
|
||||
String.format(l, hourFormat, offset / 60, offset % 60));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,6 +100,9 @@ DEF_STATIC_JNI_OnLoad
|
|||
static ZFILE
|
||||
ZFILE_Open(const char *fname, int flags) {
|
||||
#ifdef WIN32
|
||||
WCHAR *wfname, *wprefixed_fname;
|
||||
size_t converted_chars, fname_length;
|
||||
jlong fhandle;
|
||||
const DWORD access =
|
||||
(flags & O_RDWR) ? (GENERIC_WRITE | GENERIC_READ) :
|
||||
(flags & O_WRONLY) ? GENERIC_WRITE :
|
||||
|
@ -121,14 +124,37 @@ ZFILE_Open(const char *fname, int flags) {
|
|||
FILE_ATTRIBUTE_NORMAL;
|
||||
const DWORD flagsAndAttributes = maybeWriteThrough | maybeDeleteOnClose;
|
||||
|
||||
return (jlong) CreateFile(
|
||||
fname, /* Wide char path name */
|
||||
access, /* Read and/or write permission */
|
||||
sharing, /* File sharing flags */
|
||||
NULL, /* Security attributes */
|
||||
disposition, /* creation disposition */
|
||||
flagsAndAttributes, /* flags and attributes */
|
||||
NULL);
|
||||
fname_length = strlen(fname);
|
||||
if (fname_length < MAX_PATH) {
|
||||
return (jlong)CreateFile(
|
||||
fname, /* path name in multibyte char */
|
||||
access, /* Read and/or write permission */
|
||||
sharing, /* File sharing flags */
|
||||
NULL, /* Security attributes */
|
||||
disposition, /* creation disposition */
|
||||
flagsAndAttributes, /* flags and attributes */
|
||||
NULL);
|
||||
} else {
|
||||
if ((wfname = (WCHAR*)malloc((fname_length + 1) * sizeof(WCHAR))) == NULL)
|
||||
return (jlong)INVALID_HANDLE_VALUE;
|
||||
|
||||
if (mbstowcs_s(&converted_chars, wfname, fname_length + 1, fname, fname_length) != 0) {
|
||||
free(wfname);
|
||||
return (jlong)INVALID_HANDLE_VALUE;
|
||||
}
|
||||
wprefixed_fname = getPrefixed(wfname, (int)fname_length);
|
||||
fhandle = (jlong)CreateFileW(
|
||||
wprefixed_fname, /* Wide char path name */
|
||||
access, /* Read and/or write permission */
|
||||
sharing, /* File sharing flags */
|
||||
NULL, /* Security attributes */
|
||||
disposition, /* creation disposition */
|
||||
flagsAndAttributes, /* flags and attributes */
|
||||
NULL);
|
||||
free(wfname);
|
||||
free(wprefixed_fname);
|
||||
return fhandle;
|
||||
}
|
||||
#else
|
||||
return open(fname, flags, 0);
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, 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
|
||||
|
@ -26,6 +26,7 @@
|
|||
#define OS_SOLARIS_DTRACE_LIBJVM_DB_H
|
||||
|
||||
#include <proc_service.h>
|
||||
#include "jni.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -35,7 +36,7 @@ typedef struct jvm_agent jvm_agent_t;
|
|||
|
||||
#define JVM_DB_VERSION 1
|
||||
|
||||
jvm_agent_t *Jagent_create(struct ps_prochandle *P, int vers);
|
||||
JNIEXPORT jvm_agent_t *Jagent_create(struct ps_prochandle *P, int vers);
|
||||
|
||||
/*
|
||||
* Called from Jframe_iter() for each java frame. If it returns 0, then
|
||||
|
@ -57,9 +58,9 @@ typedef int java_stack_f(void *cld, const prgregset_t regs, const char* name, in
|
|||
* frames were found, or if there was some unrecoverable error. Otherwise,
|
||||
* returns the last value returned from 'func'.
|
||||
*/
|
||||
int Jframe_iter(jvm_agent_t *agent, prgregset_t gregs, java_stack_f *func, void* cld);
|
||||
JNIEXPORT int Jframe_iter(jvm_agent_t *agent, prgregset_t gregs, java_stack_f *func, void* cld);
|
||||
|
||||
void Jagent_destroy(jvm_agent_t *J);
|
||||
JNIEXPORT void Jagent_destroy(jvm_agent_t *J);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2018, 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
|
||||
|
@ -36,7 +36,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "jni.h"
|
||||
|
||||
struct _jvm_t;
|
||||
typedef struct _jvm_t jvm_t;
|
||||
|
@ -44,10 +44,10 @@ typedef struct _jvm_t jvm_t;
|
|||
|
||||
/* Attach to the given JVM process. Returns NULL on failure.
|
||||
jvm_get_last_error() returns last error message. */
|
||||
jvm_t* jvm_attach(pid_t pid);
|
||||
JNIEXPORT jvm_t* jvm_attach(pid_t pid);
|
||||
|
||||
/* Returns the last error message from this library or NULL if none. */
|
||||
const char* jvm_get_last_error();
|
||||
JNIEXPORT const char* jvm_get_last_error();
|
||||
|
||||
/* few well-known probe type constants for 'probe_types' param below */
|
||||
|
||||
|
@ -68,7 +68,7 @@ const char* jvm_get_last_error();
|
|||
* On success, this returns number of probe_types enabled.
|
||||
* On failure, jvm_get_last_error() returns the last error message.
|
||||
*/
|
||||
int jvm_enable_dtprobes(jvm_t* jvm, int num_probe_types, const char** probe_types);
|
||||
JNIEXPORT int jvm_enable_dtprobes(jvm_t* jvm, int num_probe_types, const char** probe_types);
|
||||
|
||||
/* Note: There is no jvm_disable_dtprobes function. Probes are automatically
|
||||
* disabled when there are no more clients requiring those probes.
|
||||
|
@ -77,7 +77,7 @@ int jvm_enable_dtprobes(jvm_t* jvm, int num_probe_types, const char** probe_type
|
|||
/* Detach the given JVM. Returns 0 on success, -1 on failure.
|
||||
* jvm_get_last_error() returns the last error message.
|
||||
*/
|
||||
int jvm_detach(jvm_t* jvm);
|
||||
JNIEXPORT int jvm_detach(jvm_t* jvm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2018, 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
|
||||
|
@ -105,7 +105,7 @@ public class Handler extends URLStreamHandler {
|
|||
return uc;
|
||||
}
|
||||
|
||||
// Template method to be overriden by Java Plug-in. [stanleyh]
|
||||
// Template method to be overridden by Java Plug-in. [stanleyh]
|
||||
//
|
||||
protected URLConnection createFileURLConnection(URL u, File file)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2018, 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
|
||||
|
@ -124,7 +124,7 @@ public class Handler extends URLStreamHandler {
|
|||
}
|
||||
|
||||
/**
|
||||
* Template method to be overriden by Java Plug-in. [stanleyh]
|
||||
* Template method to be overridden by Java Plug-in. [stanleyh]
|
||||
*/
|
||||
protected URLConnection createFileURLConnection(URL url, File file) {
|
||||
return new FileURLConnection(url, file);
|
||||
|
|
|
@ -1,226 +0,0 @@
|
|||
#
|
||||
# This file describes mapping information between Windows and Java
|
||||
# time zones.
|
||||
# Format: Each line should include a colon separated fields of Windows
|
||||
# time zone registry key, time zone mapID, locale (which is most
|
||||
# likely used in the time zone), and Java time zone ID. Blank lines
|
||||
# and lines that start with '#' are ignored. Data lines must be sorted
|
||||
# by mapID (ASCII order).
|
||||
#
|
||||
# NOTE
|
||||
# This table format is not a public interface of any Java
|
||||
# platforms. No applications should depend on this file in any form.
|
||||
#
|
||||
# This table has been generated by a program and should not be edited
|
||||
# manually.
|
||||
#
|
||||
Romance:-1,64::Europe/Paris:
|
||||
Romance Standard Time:-1,64::Europe/Paris:
|
||||
Warsaw:-1,65::Europe/Warsaw:
|
||||
Central Europe:-1,66::Europe/Prague:
|
||||
Central Europe Standard Time:-1,66::Europe/Prague:
|
||||
Prague Bratislava:-1,66::Europe/Prague:
|
||||
W. Central Africa Standard Time:-1,66:AO:Africa/Luanda:
|
||||
FLE:-1,67:FI:Europe/Helsinki:
|
||||
FLE Standard Time:-1,67:FI:Europe/Helsinki:
|
||||
GFT:-1,67::Europe/Athens:
|
||||
GFT Standard Time:-1,67::Europe/Athens:
|
||||
GTB:-1,67::Europe/Athens:
|
||||
GTB Standard Time:-1,67::Europe/Athens:
|
||||
Israel:-1,70::Asia/Jerusalem:
|
||||
Israel Standard Time:-1,70::Asia/Jerusalem:
|
||||
Arab:-1,71::Asia/Riyadh:
|
||||
Arab Standard Time:-1,71::Asia/Riyadh:
|
||||
Arabic Standard Time:-1,71:IQ:Asia/Baghdad:
|
||||
E. Africa:-1,71:KE:Africa/Nairobi:
|
||||
E. Africa Standard Time:-1,71:KE:Africa/Nairobi:
|
||||
Saudi Arabia:-1,71::Asia/Riyadh:
|
||||
Saudi Arabia Standard Time:-1,71::Asia/Riyadh:
|
||||
Iran:-1,72::Asia/Tehran:
|
||||
Iran Standard Time:-1,72::Asia/Tehran:
|
||||
Afghanistan:-1,73::Asia/Kabul:
|
||||
Afghanistan Standard Time:-1,73::Asia/Kabul:
|
||||
India:-1,74::Asia/Calcutta:
|
||||
India Standard Time:-1,74::Asia/Calcutta:
|
||||
Myanmar Standard Time:-1,74::Asia/Rangoon:
|
||||
Nepal Standard Time:-1,74::Asia/Katmandu:
|
||||
Sri Lanka:-1,74:LK:Asia/Colombo:
|
||||
Sri Lanka Standard Time:-1,74:LK:Asia/Colombo:
|
||||
Beijing:-1,75::Asia/Shanghai:
|
||||
China:-1,75::Asia/Shanghai:
|
||||
China Standard Time:-1,75::Asia/Shanghai:
|
||||
AUS Central:-1,76::Australia/Darwin:
|
||||
AUS Central Standard Time:-1,76::Australia/Darwin:
|
||||
Cen. Australia:-1,76::Australia/Adelaide:
|
||||
Cen. Australia Standard Time:-1,76::Australia/Adelaide:
|
||||
Vladivostok:-1,77::Asia/Vladivostok:
|
||||
Vladivostok Standard Time:-1,77::Asia/Vladivostok:
|
||||
West Pacific:-1,77:GU:Pacific/Guam:
|
||||
West Pacific Standard Time:-1,77:GU:Pacific/Guam:
|
||||
E. South America:-1,80::America/Sao_Paulo:
|
||||
E. South America Standard Time:-1,80::America/Sao_Paulo:
|
||||
Greenland Standard Time:-1,80:GL:America/Godthab:
|
||||
Newfoundland:-1,81::America/St_Johns:
|
||||
Newfoundland Standard Time:-1,81::America/St_Johns:
|
||||
Pacific SA:-1,82::America/Santiago:
|
||||
Pacific SA Standard Time:-1,82::America/Santiago:
|
||||
SA Western:-1,82:BO:America/La_Paz:
|
||||
SA Western Standard Time:-1,82:BO:America/La_Paz:
|
||||
SA Pacific:-1,83::America/Bogota:
|
||||
SA Pacific Standard Time:-1,83::America/Bogota:
|
||||
US Eastern:-1,84::America/Indianapolis:
|
||||
US Eastern Standard Time:-1,84::America/Indianapolis:
|
||||
Central America Standard Time:-1,85::America/Regina:
|
||||
Mexico:-1,85::America/Mexico_City:
|
||||
Mexico Standard Time:-1,85::America/Mexico_City:
|
||||
Canada Central:-1,86::America/Regina:
|
||||
Canada Central Standard Time:-1,86::America/Regina:
|
||||
US Mountain:-1,87::America/Phoenix:
|
||||
US Mountain Standard Time:-1,87::America/Phoenix:
|
||||
GMT:0,1::Europe/London:
|
||||
GMT Standard Time:0,1::Europe/London:
|
||||
Ekaterinburg:10,11::Asia/Yekaterinburg:
|
||||
Ekaterinburg Standard Time:10,11::Asia/Yekaterinburg:
|
||||
West Asia:10,11:UZ:Asia/Tashkent:
|
||||
West Asia Standard Time:10,11:UZ:Asia/Tashkent:
|
||||
Central Asia:12,13::Asia/Almaty:
|
||||
Central Asia Standard Time:12,13::Asia/Almaty:
|
||||
N. Central Asia Standard Time:12,13::Asia/Novosibirsk:
|
||||
Bangkok:14,15::Asia/Bangkok:
|
||||
Bangkok Standard Time:14,15::Asia/Bangkok:
|
||||
North Asia Standard Time:14,15::Asia/Krasnoyarsk:
|
||||
SE Asia:14,15::Asia/Bangkok:
|
||||
SE Asia Standard Time:14,15::Asia/Bangkok:
|
||||
North Asia East Standard Time:16,17:RU:Asia/Irkutsk:
|
||||
Singapore:16,17:SG:Asia/Singapore:
|
||||
Singapore Standard Time:16,17:SG:Asia/Singapore:
|
||||
Taipei:16,17::Asia/Taipei:
|
||||
Taipei Standard Time:16,17::Asia/Taipei:
|
||||
W. Australia:16,17:AU:Australia/Perth:
|
||||
W. Australia Standard Time:16,17:AU:Australia/Perth:
|
||||
Korea:18,19:KR:Asia/Seoul:
|
||||
Korea Standard Time:18,19:KR:Asia/Seoul:
|
||||
Tokyo:18,19::Asia/Tokyo:
|
||||
Tokyo Standard Time:18,19::Asia/Tokyo:
|
||||
Yakutsk:18,19:RU:Asia/Yakutsk:
|
||||
Yakutsk Standard Time:18,19:RU:Asia/Yakutsk:
|
||||
Central European:2,3:CS:Europe/Belgrade:
|
||||
Central European Standard Time:2,3:CS:Europe/Belgrade:
|
||||
W. Europe:2,3::Europe/Berlin:
|
||||
W. Europe Standard Time:2,3::Europe/Berlin:
|
||||
Tasmania:20,-1::Australia/Hobart:
|
||||
Tasmania Standard Time:20,-1::Australia/Hobart:
|
||||
AUS Eastern:20,21::Australia/Sydney:
|
||||
AUS Eastern Standard Time:20,21::Australia/Sydney:
|
||||
E. Australia:20,21::Australia/Brisbane:
|
||||
E. Australia Standard Time:20,21::Australia/Brisbane:
|
||||
Sydney Standard Time:20,21::Australia/Sydney:
|
||||
Tasmania Standard Time:20,65::Australia/Hobart:
|
||||
Central Pacific:22,23::Pacific/Guadalcanal:
|
||||
Central Pacific Standard Time:22,23::Pacific/Guadalcanal:
|
||||
Dateline:24,25::GMT-1200:
|
||||
Dateline Standard Time:24,25::GMT-1200:
|
||||
Fiji:24,25::Pacific/Fiji:
|
||||
Fiji Standard Time:24,25::Pacific/Fiji:
|
||||
Samoa:26,27::Pacific/Apia:
|
||||
Samoa Standard Time:26,27::Pacific/Apia:
|
||||
Hawaiian:28,29::Pacific/Honolulu:
|
||||
Hawaiian Standard Time:28,29::Pacific/Honolulu:
|
||||
Alaskan:30,31::America/Anchorage:
|
||||
Alaskan Standard Time:30,31::America/Anchorage:
|
||||
Pacific:32,33::America/Los_Angeles:
|
||||
Pacific Standard Time:32,33::America/Los_Angeles:
|
||||
Mexico Standard Time 2:34,35:MX:America/Chihuahua:
|
||||
Mountain:34,35::America/Denver:
|
||||
Mountain Standard Time:34,35::America/Denver:
|
||||
Central:36,37::America/Chicago:
|
||||
Central Standard Time:36,37::America/Chicago:
|
||||
Eastern:38,39::America/New_York:
|
||||
Eastern Standard Time:38,39::America/New_York:
|
||||
E. Europe:4,5::EET:
|
||||
E. Europe Standard Time:4,5::EET:
|
||||
Egypt:4,68::Africa/Cairo:
|
||||
Egypt Standard Time:4,68::Africa/Cairo:
|
||||
South Africa:4,69::Africa/Harare:
|
||||
South Africa Standard Time:4,69::Africa/Harare:
|
||||
Atlantic:40,41::America/Halifax:
|
||||
Atlantic Standard Time:40,41::America/Halifax:
|
||||
SA Eastern:42,43:GF:America/Cayenne:
|
||||
SA Eastern Standard Time:42,43:GF:America/Cayenne:
|
||||
Mid-Atlantic:44,45::Atlantic/South_Georgia:
|
||||
Mid-Atlantic Standard Time:44,45::Atlantic/South_Georgia:
|
||||
Azores:46,47::Atlantic/Azores:
|
||||
Azores Standard Time:46,47::Atlantic/Azores:
|
||||
Cape Verde Standard Time:46,47::Atlantic/Cape_Verde:
|
||||
Russian:6,7::Europe/Moscow:
|
||||
Russian Standard Time:6,7::Europe/Moscow:
|
||||
New Zealand:78,79::Pacific/Auckland:
|
||||
New Zealand Standard Time:78,79::Pacific/Auckland:
|
||||
Tonga Standard Time:78,79::Pacific/Tongatapu:
|
||||
Arabian:8,9::Asia/Muscat:
|
||||
Arabian Standard Time:8,9::Asia/Muscat:
|
||||
Caucasus:8,9:AM:Asia/Yerevan:
|
||||
Caucasus Standard Time:8,9:AM:Asia/Yerevan:
|
||||
GMT Standard Time:88,89::GMT:
|
||||
Greenwich:88,89::GMT:
|
||||
Greenwich Standard Time:88,89::GMT:
|
||||
Aleutian Standard Time:900,900:US:America/Adak:
|
||||
Altai Standard Time:901,901::Asia/Barnaul:
|
||||
Argentina Standard Time:902,902::America/Buenos_Aires:
|
||||
Armenian Standard Time:903,903:AM:Asia/Yerevan:
|
||||
Astrakhan Standard Time:904,904::Europe/Astrakhan:
|
||||
Aus Central W. Standard Time:905,905::Australia/Eucla:
|
||||
Azerbaijan Standard Time:906,906:AZ:Asia/Baku:
|
||||
Bahia Standard Time:907,907::America/Bahia:
|
||||
Bangladesh Standard Time:908,908::Asia/Dhaka:
|
||||
Belarus Standard Time:909,909:BY:Europe/Minsk:
|
||||
Bougainville Standard Time:910,910::Pacific/Bougainville:
|
||||
Central Brazilian Standard Time:911,911:BR:America/Cuiaba:
|
||||
Central Standard Time (Mexico):912,912::America/Mexico_City:
|
||||
Chatham Islands Standard Time:913,913::Pacific/Chatham:
|
||||
Cuba Standard Time:914,914:CU:America/Havana:
|
||||
Easter Island Standard Time:915,915:CL:Pacific/Easter:
|
||||
Eastern Standard Time (Mexico):916,916::America/Cancun:
|
||||
Georgian Standard Time:917,917:GE:Asia/Tbilisi:
|
||||
Haiti Standard Time:918,918:HT:America/Port-au-Prince:
|
||||
Jordan Standard Time:919,919:JO:Asia/Amman:
|
||||
Kaliningrad Standard Time:920,920:RU:Europe/Kaliningrad:
|
||||
Kamchatka Standard Time:921,921:RU:Asia/Kamchatka:
|
||||
Libya Standard Time:922,922:LY:Africa/Tripoli:
|
||||
Line Islands Standard Time:923,923::Pacific/Kiritimati:
|
||||
Lord Howe Standard Time:924,924::Australia/Lord_Howe:
|
||||
Magadan Standard Time:925,925::Asia/Magadan:
|
||||
Marquesas Standard Time:926,926::Pacific/Marquesas:
|
||||
Mauritius Standard Time:927,927:MU:Indian/Mauritius:
|
||||
Middle East Standard Time:928,928:LB:Asia/Beirut:
|
||||
Montevideo Standard Time:929,929:UY:America/Montevideo:
|
||||
Morocco Standard Time:930,930:MA:Africa/Casablanca:
|
||||
Mountain Standard Time (Mexico):931,931:MX:America/Chihuahua:
|
||||
Namibia Standard Time:932,932:NA:Africa/Windhoek:
|
||||
Norfolk Standard Time:933,933::Pacific/Norfolk:
|
||||
North Korea Standard Time:934,934:KP:Asia/Pyongyang:
|
||||
Pacific Standard Time (Mexico):935,935:MX:America/Tijuana:
|
||||
Pakistan Standard Time:936,936::Asia/Karachi:
|
||||
Paraguay Standard Time:937,937:PY:America/Asuncion:
|
||||
Russia Time Zone 10:938,938::Asia/Srednekolymsk:
|
||||
Russia Time Zone 11:939,939::Asia/Anadyr:
|
||||
Russia Time Zone 3:940,940::Europe/Samara:
|
||||
Saint Pierre Standard Time:941,941:PM:America/Miquelon:
|
||||
Sakhalin Standard Time:942,942::Asia/Sakhalin:
|
||||
Syria Standard Time:943,943:SY:Asia/Damascus:
|
||||
Tocantins Standard Time:944,944::America/Araguaina:
|
||||
Tomsk Standard Time:945,945::Asia/Tomsk:
|
||||
Transbaikal Standard Time:946,946::Asia/Chita:
|
||||
Turkey Standard Time:947,947::Asia/Istanbul:
|
||||
Turks And Caicos Standard Time:948,948:TC:America/Grand_Turk:
|
||||
UTC+12:949,949::GMT+1200:
|
||||
UTC-02:950,950::GMT-0200:
|
||||
UTC-08:951,951::GMT-0800:
|
||||
UTC-09:952,952::GMT-0900:
|
||||
UTC-11:953,953::GMT-1100:
|
||||
UTC:954,954::UTC:
|
||||
Ulaanbaatar Standard Time:955,955::Asia/Ulaanbaatar:
|
||||
Venezuela Standard Time:956,956::America/Caracas:
|
||||
W. Mongolia Standard Time:957,957::Asia/Hovd:
|
||||
West Bank Standard Time:958,958::Asia/Gaza:
|
||||
Western Brazilian Standard Time:959,959:BR:America/Rio_Branco:
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#define MAX_ZONE_CHAR 256
|
||||
#define MAX_MAPID_LENGTH 32
|
||||
#define MAX_REGION_LENGTH 4
|
||||
|
||||
#define NT_TZ_KEY "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones"
|
||||
#define WIN_TZ_KEY "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Time Zones"
|
||||
|
@ -145,7 +146,7 @@ static void customZoneName(LONG bias, char *buffer) {
|
|||
/*
|
||||
* Gets the current time zone entry in the "Time Zones" registry.
|
||||
*/
|
||||
static int getWinTimeZone(char *winZoneName, char *winMapID)
|
||||
static int getWinTimeZone(char *winZoneName)
|
||||
{
|
||||
DYNAMIC_TIME_ZONE_INFORMATION dtzi;
|
||||
DWORD timeType;
|
||||
|
@ -231,7 +232,6 @@ static int getWinTimeZone(char *winZoneName, char *winMapID)
|
|||
WCHAR stdNameInReg[MAX_ZONE_CHAR];
|
||||
TziValue tempTzi;
|
||||
WCHAR *stdNamePtr = tzi.StandardName;
|
||||
DWORD valueSize;
|
||||
int onlyMapID;
|
||||
|
||||
timeType = GetTimeZoneInformation(&tzi);
|
||||
|
@ -372,24 +372,7 @@ static int getWinTimeZone(char *winZoneName, char *winMapID)
|
|||
(void) RegCloseKey(hSubKey);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the "MapID" value of the registry to be able to eliminate
|
||||
* duplicated key names later.
|
||||
*/
|
||||
valueSize = MAX_MAPID_LENGTH;
|
||||
ret = RegQueryValueExA(hSubKey, "MapID", NULL, &valueType, winMapID, &valueSize);
|
||||
(void) RegCloseKey(hSubKey);
|
||||
(void) RegCloseKey(hKey);
|
||||
|
||||
if (ret != ERROR_SUCCESS) {
|
||||
/*
|
||||
* Vista doesn't have mapID. VALUE_UNKNOWN should be returned
|
||||
* only for Windows NT.
|
||||
*/
|
||||
if (onlyMapID == 1) {
|
||||
return VALUE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return VALUE_KEY;
|
||||
|
@ -410,24 +393,17 @@ static int getWinTimeZone(char *winZoneName, char *winMapID)
|
|||
* Index values for the mapping table.
|
||||
*/
|
||||
#define TZ_WIN_NAME 0
|
||||
#define TZ_MAPID 1
|
||||
#define TZ_REGION 2
|
||||
#define TZ_JAVA_NAME 3
|
||||
#define TZ_REGION 1
|
||||
#define TZ_JAVA_NAME 2
|
||||
|
||||
#define TZ_NITEMS 4 /* number of items (fields) */
|
||||
#define TZ_NITEMS 3 /* number of items (fields) */
|
||||
|
||||
/*
|
||||
* Looks up the mapping table (tzmappings) and returns a Java time
|
||||
* zone ID (e.g., "America/Los_Angeles") if found. Otherwise, NULL is
|
||||
* returned.
|
||||
*
|
||||
* value_type is one of the following values:
|
||||
* VALUE_KEY for exact key matching
|
||||
* VALUE_MAPID for MapID (this is
|
||||
* required for the old Windows, such as NT 4.0 SP3).
|
||||
*/
|
||||
static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName,
|
||||
char *mapID)
|
||||
static char *matchJavaTZ(const char *java_home_dir, char *tzName)
|
||||
{
|
||||
int line;
|
||||
int IDmatched = 0;
|
||||
|
@ -436,9 +412,22 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName
|
|||
char *items[TZ_NITEMS];
|
||||
char *mapFileName;
|
||||
char lineBuffer[MAX_ZONE_CHAR * 4];
|
||||
int noMapID = *mapID == '\0'; /* no mapID on Vista and later */
|
||||
int offset = 0;
|
||||
const char* errorMessage = "unknown error";
|
||||
char region[MAX_REGION_LENGTH];
|
||||
|
||||
// Get the user's location
|
||||
if (GetGeoInfo(GetUserGeoID(GEOCLASS_NATION),
|
||||
GEO_ISO2, region, MAX_REGION_LENGTH, 0) == 0) {
|
||||
// If GetGeoInfo fails, fallback to LCID's country
|
||||
LCID lcid = GetUserDefaultLCID();
|
||||
if (GetLocaleInfo(lcid,
|
||||
LOCALE_SISO3166CTRYNAME, region, MAX_REGION_LENGTH) == 0 &&
|
||||
GetLocaleInfo(lcid,
|
||||
LOCALE_SISO3166CTRYNAME2, region, MAX_REGION_LENGTH) == 0) {
|
||||
region[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
mapFileName = malloc(strlen(java_home_dir) + strlen(MAPPINGS_FILE) + 1);
|
||||
if (mapFileName == NULL) {
|
||||
|
@ -494,28 +483,20 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName
|
|||
goto illegal_format;
|
||||
}
|
||||
|
||||
if (noMapID || strcmp(mapID, items[TZ_MAPID]) == 0) {
|
||||
/*
|
||||
* We need to scan items until the
|
||||
* exact match is found or the end of data is detected.
|
||||
*/
|
||||
if (strcmp(items[TZ_WIN_NAME], tzName) == 0) {
|
||||
/*
|
||||
* When there's no mapID, we need to scan items until the
|
||||
* exact match is found or the end of data is detected.
|
||||
* Found the time zone in the mapping table.
|
||||
* Check the region code and select the appropriate entry
|
||||
*/
|
||||
if (!noMapID) {
|
||||
IDmatched = 1;
|
||||
}
|
||||
if (strcmp(items[TZ_WIN_NAME], tzName) == 0) {
|
||||
/*
|
||||
* Found the time zone in the mapping table.
|
||||
*/
|
||||
if (strcmp(items[TZ_REGION], region) == 0 ||
|
||||
strcmp(items[TZ_REGION], "001") == 0) {
|
||||
javaTZName = _strdup(items[TZ_JAVA_NAME]);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (IDmatched == 1) {
|
||||
/*
|
||||
* No need to look up the mapping table further.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
@ -535,19 +516,16 @@ static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName
|
|||
char *findJavaTZ_md(const char *java_home_dir)
|
||||
{
|
||||
char winZoneName[MAX_ZONE_CHAR];
|
||||
char winMapID[MAX_MAPID_LENGTH];
|
||||
char *std_timezone = NULL;
|
||||
int result;
|
||||
|
||||
winMapID[0] = 0;
|
||||
result = getWinTimeZone(winZoneName, winMapID);
|
||||
result = getWinTimeZone(winZoneName);
|
||||
|
||||
if (result != VALUE_UNKNOWN) {
|
||||
if (result == VALUE_GMTOFFSET) {
|
||||
std_timezone = _strdup(winZoneName);
|
||||
} else {
|
||||
std_timezone = matchJavaTZ(java_home_dir, result,
|
||||
winZoneName, winMapID);
|
||||
std_timezone = matchJavaTZ(java_home_dir, winZoneName);
|
||||
if (std_timezone == NULL) {
|
||||
std_timezone = getGMTOffsetID();
|
||||
}
|
||||
|
|
|
@ -225,6 +225,8 @@ lastErrorReportable()
|
|||
return 1;
|
||||
}
|
||||
|
||||
int wcanonicalize(WCHAR *orig_path, WCHAR *result, int size);
|
||||
|
||||
/* Convert a pathname to canonical form. The input orig_path is assumed to
|
||||
have been converted to native form already, via JVM_NativePath(). This is
|
||||
necessary because _fullpath() rejects duplicate separator characters on
|
||||
|
@ -237,6 +239,38 @@ canonicalize(char *orig_path, char *result, int size)
|
|||
HANDLE h;
|
||||
char path[1024]; /* Working copy of path */
|
||||
char *src, *dst, *dend;
|
||||
wchar_t *worig_path, *wresult;
|
||||
size_t converted_chars = 0;
|
||||
|
||||
/* handle long path with length >= MAX_PATH */
|
||||
if (strlen(orig_path) >= MAX_PATH) {
|
||||
if ((worig_path = (WCHAR*)malloc(size * sizeof(WCHAR))) == NULL)
|
||||
return -1;
|
||||
|
||||
if (mbstowcs_s(&converted_chars, worig_path, (size_t)size, orig_path, (size_t)(size - 1)) != 0) {
|
||||
free(worig_path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((wresult = (WCHAR*)malloc(size * sizeof(WCHAR))) == NULL)
|
||||
return -1;
|
||||
|
||||
if (wcanonicalize(worig_path, wresult, size) != 0) {
|
||||
free(worig_path);
|
||||
free(wresult);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (wcstombs_s(&converted_chars, result, (size_t)size, wresult, (size_t)(size - 1)) != 0) {
|
||||
free(worig_path);
|
||||
free(wresult);
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(worig_path);
|
||||
free(wresult);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reject paths that contain wildcards */
|
||||
if (wild(orig_path)) {
|
||||
|
@ -245,15 +279,15 @@ canonicalize(char *orig_path, char *result, int size)
|
|||
}
|
||||
|
||||
/* Collapse instances of "foo\.." and ensure absoluteness. Note that
|
||||
contrary to the documentation, the _fullpath procedure does not require
|
||||
the drive to be available. It also does not reliably change all
|
||||
occurrences of '/' to '\\' on Win95, so now JVM_NativePath does that. */
|
||||
if(!_fullpath(path, orig_path, sizeof(path))) {
|
||||
contrary to the documentation, the _fullpath procedure does not require
|
||||
the drive to be available. It also does not reliably change all
|
||||
occurrences of '/' to '\\' on Win95, so now JVM_NativePath does that. */
|
||||
if (!_fullpath(path, orig_path, sizeof(path))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Correction for Win95: _fullpath may leave a trailing "\\"
|
||||
on a UNC pathname */
|
||||
on a UNC pathname */
|
||||
if ((path[0] == '\\') && (path[1] == '\\')) {
|
||||
char *p = path + strlen(path);
|
||||
if ((p[-1] == '\\') && !islb(p[-2])) {
|
||||
|
@ -281,16 +315,16 @@ canonicalize(char *orig_path, char *result, int size)
|
|||
char *p;
|
||||
p = nextsep(src + 2); /* Skip past host name */
|
||||
if (!*p) {
|
||||
/* A UNC pathname must begin with "\\\\host\\share",
|
||||
so reject this path as invalid if there is no share name */
|
||||
/* A UNC pathname must begin with "\\\\host\\share",
|
||||
so reject this path as invalid if there is no share name */
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
p = nextsep(p + 1); /* Skip past share name */
|
||||
if (!(dst = cp(dst, dend, '\0', src, p))) {
|
||||
return -1;
|
||||
}
|
||||
src = p;
|
||||
}
|
||||
p = nextsep(p + 1); /* Skip past share name */
|
||||
if (!(dst = cp(dst, dend, '\0', src, p))) {
|
||||
return -1;
|
||||
}
|
||||
src = p;
|
||||
} else {
|
||||
/* Invalid path */
|
||||
errno = EINVAL;
|
||||
|
@ -309,11 +343,11 @@ canonicalize(char *orig_path, char *result, int size)
|
|||
}
|
||||
|
||||
/* At this point we have copied either a drive specifier ("z:") or a UNC
|
||||
prefix ("\\\\host\\share") to the result buffer, and src points to the
|
||||
first byte of the remainder of the path. We now scan through the rest
|
||||
of the path, looking up each prefix in order to find the true name of
|
||||
the last element of each prefix, thereby computing the full true name of
|
||||
the original path. */
|
||||
prefix ("\\\\host\\share") to the result buffer, and src points to the
|
||||
first byte of the remainder of the path. We now scan through the rest
|
||||
of the path, looking up each prefix in order to find the true name of
|
||||
the last element of each prefix, thereby computing the full true name of
|
||||
the original path. */
|
||||
while (*src) {
|
||||
char *p = nextsep(src + 1); /* Find next separator */
|
||||
char c = *p;
|
||||
|
@ -325,8 +359,8 @@ canonicalize(char *orig_path, char *result, int size)
|
|||
/* Lookup succeeded; append true name to result and continue */
|
||||
FindClose(h);
|
||||
if (!(dst = cp(dst, dend, '\\',
|
||||
fd.cFileName,
|
||||
fd.cFileName + strlen(fd.cFileName)))) {
|
||||
fd.cFileName,
|
||||
fd.cFileName + strlen(fd.cFileName)))) {
|
||||
return -1;
|
||||
}
|
||||
src = p;
|
||||
|
@ -344,8 +378,8 @@ canonicalize(char *orig_path, char *result, int size)
|
|||
}
|
||||
|
||||
if (dst >= dend) {
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
}
|
||||
*dst = '\0';
|
||||
return 0;
|
||||
|
@ -587,7 +621,7 @@ wcanonicalizeWithPrefix(WCHAR *canonicalPrefix, WCHAR *pathWithCanonicalPrefix,
|
|||
*/
|
||||
|
||||
/* copy \\?\ or \\?\UNC\ to the front of path*/
|
||||
WCHAR*
|
||||
__declspec(dllexport) WCHAR*
|
||||
getPrefixed(const WCHAR* path, int pathlen) {
|
||||
WCHAR* pathbuf = (WCHAR*)malloc((pathlen + 10) * sizeof (WCHAR));
|
||||
if (pathbuf != 0) {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
WCHAR* pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE);
|
||||
WCHAR* fileToNTPath(JNIEnv *env, jobject file, jfieldID id);
|
||||
WCHAR* getPrefixed(const WCHAR* path, int pathlen);
|
||||
__declspec(dllexport) WCHAR* getPrefixed(const WCHAR* path, int pathlen);
|
||||
WCHAR* currentDir(int di);
|
||||
int currentDirLength(const WCHAR* path, int pathlen);
|
||||
int handleAvailable(FD fd, jlong *pbytes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue