Skip to content

Commit

Permalink
Merge pull request apache#1488 from matthiasblaesing/update-jna
Browse files Browse the repository at this point in the history
Update netbeans bundled JNA library to 5.4.0
  • Loading branch information
matthiasblaesing authored Sep 13, 2019
2 parents 511b1a3 + e2feecc commit f93d8f5
Show file tree
Hide file tree
Showing 39 changed files with 156 additions and 273 deletions.
2 changes: 1 addition & 1 deletion contrib/libs.svnClientAdapter.svnkit/manifest.mf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.libs.svnClientAdapter.svnkit/1
OpenIDE-Module-Localizing-Bundle: org/netbeans/libs/svnclientadapter/svnkit/Bundle.properties
OpenIDE-Module-Specification-Version: 1.25
OpenIDE-Module-Specification-Version: 1.26

4 changes: 2 additions & 2 deletions contrib/libs.svnClientAdapter.svnkit/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.11</specification-version>
<release-version>2</release-version>
<specification-version>2.1</specification-version>
</run-dependency>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions ide/dlight.nativeexecution/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.4</specification-version>
<release-version>2</release-version>
<specification-version>2.1</specification-version>
</run-dependency>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private void createWin() throws IOException, InterruptedException {
f.setAccessible(true);
long phandle = f.getLong(process);

Win32APISupport kernel = Win32APISupport.instance;
Win32APISupport kernel = Win32APISupport.INSTANCE;
Win32APISupport.HANDLE handle = new Win32APISupport.HANDLE();
handle.setPointer(Pointer.createConstant(phandle));
newPid = kernel.GetProcessId(handle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,13 @@
import com.sun.jna.Pointer;
import com.sun.jna.PointerType;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIFunctionMapper;
import com.sun.jna.win32.W32APITypeMapper;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import com.sun.jna.win32.W32APIOptions;
/* https://jna.dev.java.net/ */
/* http://golesny.de/wiki/code:javahowtogetpid */

public interface Win32APISupport extends StdCallLibrary {

final Map<String, Object> DEFAULT_OPTIONS = Collections.unmodifiableMap(new HashMap<String, Object>() {

{
put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
}
});
final Win32APISupport instance = (Win32APISupport) Native.loadLibrary("kernel32", Win32APISupport.class, DEFAULT_OPTIONS); // NOI18N
final Win32APISupport INSTANCE = (Win32APISupport) Native.load("kernel32", Win32APISupport.class, W32APIOptions.UNICODE_OPTIONS); // NOI18N

/* http://msdn.microsoft.com/en-us/library/ms683179(VS.85).aspx */
HANDLE GetCurrentProcess();
Expand All @@ -53,13 +42,13 @@ public class HANDLE extends PointerType {
@Override
public Object fromNative(Object nativeValue, FromNativeContext context) {
Object o = super.fromNative(nativeValue, context);
if (InvalidHandle.equals(o)) {
return InvalidHandle;
if (INVALID_HANDLE.equals(o)) {
return INVALID_HANDLE;
}
return o;
}
}
public final static HANDLE InvalidHandle = new HANDLE() {
public final static HANDLE INVALID_HANDLE = new HANDLE() {

{
super.setPointer(Pointer.createConstant(-1));
Expand Down
4 changes: 2 additions & 2 deletions ide/extexecution.process/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.23</specification-version>
<release-version>2</release-version>
<specification-version>2.1</specification-version>
</run-dependency>
</dependency>
<dependency>
Expand Down
8 changes: 4 additions & 4 deletions ide/libs.jsch.agentproxy/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
<dependency>
<code-name-base>org.netbeans.libs.jna</code-name-base>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.37</specification-version>
<release-version>2</release-version>
<specification-version>2.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.libs.jna.platform</code-name-base>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.7</specification-version>
<release-version>2</release-version>
<specification-version>2.1</specification-version>
</run-dependency>
</dependency>
</module-dependencies>
Expand Down
18 changes: 9 additions & 9 deletions platform/core.nativeaccess/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,41 +39,41 @@
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.0</specification-version>
<release-version>2</release-version>
<specification-version>2.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.libs.jna.platform</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.0</specification-version>
<release-version>2</release-version>
<specification-version>2.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util.ui</code-name-base>
<code-name-base>org.openide.util</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>9.3</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util</code-name-base>
<code-name-base>org.openide.util.lookup</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>9.3</specification-version>
<specification-version>8.0</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util.lookup</code-name-base>
<code-name-base>org.openide.util.ui</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>8.0</specification-version>
<specification-version>9.3</specification-version>
</run-dependency>
</dependency>
</module-dependencies>
Expand Down
8 changes: 4 additions & 4 deletions platform/core.network/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.32</specification-version>
<release-version>2</release-version>
<specification-version>2.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.libs.jna.platform</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.16</specification-version>
<release-version>2</release-version>
<specification-version>2.1</specification-version>
</run-dependency>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;

/**
*
* @author lfischme
*/
public interface MacCoreFoundationLibrary extends Library {
MacCoreFoundationLibrary LIBRARY = Native.loadLibrary("CoreFoundation", MacCoreFoundationLibrary.class);
MacCoreFoundationLibrary LIBRARY = Native.load("CoreFoundation", MacCoreFoundationLibrary.class);

public boolean CFDictionaryGetValueIfPresent(Pointer dictionary, Pointer key, Pointer[] returnValue);

Expand All @@ -47,8 +46,8 @@ public interface MacCoreFoundationLibrary extends Library {
public boolean CFNumberGetValue(Pointer cfNumberRef, Pointer cfNumberType, Pointer value);

public long CFNumberGetByteSize(Pointer cfNumberRef);

public long CFArrayGetCount(Pointer cfArrayRef);

public Pointer CFArrayGetValueAtIndex(Pointer cfArrayRef, Pointer cfIndex);
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public NetworkProxySettings getNetworkProxySettings() {
boolean resolved = false;

LOGGER.log(Level.FINE, "Mac system proxy resolver started."); //NOI18N
Pointer settingsDictionary = cfNetworkLibrary.CFNetworkCopySystemProxySettings();
Pointer settingsDictionary = cfNetworkLibrary.CFNetworkCopySystemProxySettings();

Pointer autoDiscoveryEnable = cfLibrary.CFDictionaryGetValue(settingsDictionary, getKeyCFStringRef(KEY_AUTO_DISCOVERY_ENABLE));
if (getIntFromCFNumberRef(autoDiscoveryEnable) != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @author lfischme
*/
public interface MacNetworkProxyLibrary extends Library {
MacNetworkProxyLibrary LIBRARY = Native.loadLibrary("CoreServices", MacNetworkProxyLibrary.class);
MacNetworkProxyLibrary LIBRARY = Native.load("CoreServices", MacNetworkProxyLibrary.class);

public Pointer CFNetworkCopySystemProxySettings();
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public NetworkProxySettings getNetworkProxySettings() {

Pointer pacFilePointer = prxCnf.pacFile;
if (pacFilePointer != null) {
String pacFileUrl = pacFilePointer.getString(0L, true);
String pacFileUrl = pacFilePointer.getWideString(0);

LOGGER.log(Level.INFO, "Windows system proxy resolver: auto - PAC ({0})", pacFileUrl); //NOI18N
return new NetworkProxySettings(pacFileUrl);
Expand All @@ -66,7 +66,7 @@ public NetworkProxySettings getNetworkProxySettings() {
Pointer proxyPointer = prxCnf.proxy;
Pointer proxyBypassPointer = prxCnf.proxyBypass;
if (proxyPointer != null) {
String proxyString = proxyPointer.getString(0L, true);
String proxyString = proxyPointer.getWideString(0);

LOGGER.log(Level.INFO, "Windows system proxy resolver: manual ({0})", proxyString); //NOI18N

Expand Down Expand Up @@ -107,7 +107,7 @@ public NetworkProxySettings getNetworkProxySettings() {
}

if (proxyBypassPointer != null) {
String proxyBypass = proxyBypassPointer.getString(0L, true);
String proxyBypass = proxyBypassPointer.getWideString(0);

LOGGER.log(Level.INFO, "Windows system proxy resolver: manual - no proxy hosts ({0})", proxyBypass); //NOI18N

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,27 @@
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Structure.FieldOrder;

/**
*
* @author lfischme
*/
public interface WindowsNetworkProxyLibrary extends Library {
WindowsNetworkProxyLibrary LIBRARY = Native.loadLibrary("winhttp.dll", WindowsNetworkProxyLibrary.class);

public class ProxyConfig extends Structure {

@Override
protected List getFieldOrder() {
return Arrays.asList( new String[] {
"autoDetect",
"pacFile",
"proxy",
"proxyBypass"
} );
}
WindowsNetworkProxyLibrary LIBRARY = Native.load("winhttp.dll", WindowsNetworkProxyLibrary.class);

@SuppressWarnings("PublicField")
@FieldOrder({"autoDetect", "pacFile", "proxy", "proxyBypass"})
public class ProxyConfig extends Structure {
public static class ByReference extends ProxyConfig implements Structure.ByReference { }

public boolean autoDetect;
public Pointer pacFile;
public Pointer proxy;
public Pointer proxyBypass;

public Pointer proxyBypass;
}

}

public boolean WinHttpGetIEProxyConfigForCurrentUser(
ProxyConfig proxyConfig
);
ProxyConfig proxyConfig
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
interface CLib extends Library {

CLib INSTANCE = (CLib) Native.loadLibrary("c", CLib.class);
CLib INSTANCE = (CLib) Native.load("c", CLib.class);

public int gethostname(byte[] hostname, int bufferSize);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
public interface Winsock2Lib extends Library {

Winsock2Lib INSTANCE = (Winsock2Lib) Native.loadLibrary("ws2_32", Winsock2Lib.class);
Winsock2Lib INSTANCE = Native.load("ws2_32", Winsock2Lib.class);

public int gethostname(byte[] name, int namelen);
}
14 changes: 7 additions & 7 deletions platform/keyring.impl/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.32</specification-version>
<release-version>2</release-version>
<specification-version>2.1</specification-version>
</run-dependency>
</dependency>
<dependency>
Expand Down Expand Up @@ -76,27 +76,27 @@
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util.ui</code-name-base>
<code-name-base>org.openide.util</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>9.3</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util</code-name-base>
<code-name-base>org.openide.util.lookup</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>9.3</specification-version>
<specification-version>8.3</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.util.lookup</code-name-base>
<code-name-base>org.openide.util.ui</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>8.3</specification-version>
<specification-version>9.3</specification-version>
</run-dependency>
</dependency>
</module-dependencies>
Expand Down
Loading

0 comments on commit f93d8f5

Please sign in to comment.