diff -Nru libjna-java-4.5.0/ant-elfanalyser-src/com/sun/jna/BuildArmSoftFloatDetector.java libjna-java-4.5.1/ant-elfanalyser-src/com/sun/jna/BuildArmSoftFloatDetector.java
--- libjna-java-4.5.0/ant-elfanalyser-src/com/sun/jna/BuildArmSoftFloatDetector.java 2017-09-13 20:12:57.000000000 +0000
+++ libjna-java-4.5.1/ant-elfanalyser-src/com/sun/jna/BuildArmSoftFloatDetector.java 1970-01-01 00:00:00.000000000 +0000
@@ -1,53 +0,0 @@
-
-package com.sun.jna;
-
-import java.io.File;
-import java.io.IOException;
-import org.apache.tools.ant.Project;
-
-/**
- * Ant task to expose the arm soft-/hardfloat detection routines of the JNA core
- * for the build script.
- *
- *
The build script is expected to build a minimal set of classes that are
- * required to execute this. At the time of writing these are:
- *
- *
- *
com.sun.jna.ELFAnalyser
- *
- */
-public class BuildArmSoftFloatDetector {
-
- private String targetProperty;
- private Project project;
-
- public void setProject(Project proj) {
- project = proj;
- }
-
- /**
- * targetProperty receives the name of the property, that should take the
- * new property
- *
- * @param targetProperty
- */
- public void setTargetProperty(String targetProperty) {
- this.targetProperty = targetProperty;
- }
-
- public void execute() throws IOException {
- boolean result = false;
- // On linux /proc/self/exe is a symblink to the currently executing
- // binary (the JVM)
- File self = new File("/proc/self/exe");
- try {
- // The self.getCanonicalPath() resolves the symblink to the backing
- // realfile and passes that to the detection routines
- ELFAnalyser ahfd = ELFAnalyser.analyse(self.getCanonicalPath());
- result = ahfd.isArmSoftFloat();
- } catch (IOException ex) {
- result = false;
- }
- project.setNewProperty(targetProperty, Boolean.toString(result));
- }
-}
diff -Nru libjna-java-4.5.0/ant-tools-src/com/sun/jna/BuildArmSoftFloatDetector.java libjna-java-4.5.1/ant-tools-src/com/sun/jna/BuildArmSoftFloatDetector.java
--- libjna-java-4.5.0/ant-tools-src/com/sun/jna/BuildArmSoftFloatDetector.java 1970-01-01 00:00:00.000000000 +0000
+++ libjna-java-4.5.1/ant-tools-src/com/sun/jna/BuildArmSoftFloatDetector.java 2017-12-27 19:27:16.000000000 +0000
@@ -0,0 +1,69 @@
+/* Copyright (c) 2016 Matthias Bläsing, All Rights Reserved
+ *
+ * The contents of this file is dual-licensed under 2
+ * alternative Open Source/Free licenses: LGPL 2.1 or later and
+ * Apache License 2.0. (starting with JNA version 4.0.0).
+ *
+ * You can freely decide which license you want to apply to
+ * the project.
+ *
+ * You may obtain a copy of the LGPL License at:
+ *
+ * http://www.gnu.org/licenses/licenses.html
+ *
+ * A copy is also included in the downloadable source code package
+ * containing JNA, in file "LGPL2.1".
+ *
+ * You may obtain a copy of the Apache License at:
+ *
+ * http://www.apache.org/licenses/
+ *
+ * A copy is also included in the downloadable source code package
+ * containing JNA, in file "AL2.0".
+ */
+
+package com.sun.jna;
+
+import java.io.File;
+import java.io.IOException;
+import org.apache.tools.ant.Project;
+
+/**
+ * Ant task to expose the arm soft-/hardfloat detection routines of the JNA core
+ * for the build script.
+ */
+public class BuildArmSoftFloatDetector {
+
+ private String targetProperty;
+ private Project project;
+
+ public void setProject(Project proj) {
+ project = proj;
+ }
+
+ /**
+ * targetProperty receives the name of the property, that should take the
+ * new property
+ *
+ * @param targetProperty
+ */
+ public void setTargetProperty(String targetProperty) {
+ this.targetProperty = targetProperty;
+ }
+
+ public void execute() throws IOException {
+ boolean result = false;
+ // On linux /proc/self/exe is a symblink to the currently executing
+ // binary (the JVM)
+ File self = new File("/proc/self/exe");
+ try {
+ // The self.getCanonicalPath() resolves the symblink to the backing
+ // realfile and passes that to the detection routines
+ ELFAnalyser ahfd = ELFAnalyser.analyse(self.getCanonicalPath());
+ result = ahfd.isArmSoftFloat();
+ } catch (IOException ex) {
+ result = false;
+ }
+ project.setNewProperty(targetProperty, Boolean.toString(result));
+ }
+}
diff -Nru libjna-java-4.5.0/ant-tools-src/com/sun/jna/CalcAndroidVersion.java libjna-java-4.5.1/ant-tools-src/com/sun/jna/CalcAndroidVersion.java
--- libjna-java-4.5.0/ant-tools-src/com/sun/jna/CalcAndroidVersion.java 1970-01-01 00:00:00.000000000 +0000
+++ libjna-java-4.5.1/ant-tools-src/com/sun/jna/CalcAndroidVersion.java 2017-12-27 19:27:16.000000000 +0000
@@ -0,0 +1,102 @@
+/* Copyright (c) 2017 Matthias Bläsing, All Rights Reserved
+ *
+ * The contents of this file is dual-licensed under 2
+ * alternative Open Source/Free licenses: LGPL 2.1 or later and
+ * Apache License 2.0. (starting with JNA version 4.0.0).
+ *
+ * You can freely decide which license you want to apply to
+ * the project.
+ *
+ * You may obtain a copy of the LGPL License at:
+ *
+ * http://www.gnu.org/licenses/licenses.html
+ *
+ * A copy is also included in the downloadable source code package
+ * containing JNA, in file "LGPL2.1".
+ *
+ * You may obtain a copy of the Apache License at:
+ *
+ * http://www.apache.org/licenses/
+ *
+ * A copy is also included in the downloadable source code package
+ * containing JNA, in file "AL2.0".
+ */
+
+package com.sun.jna;
+
+import java.io.IOException;
+import org.apache.tools.ant.Project;
+
+/**
+ * Calculate the androidVersion code based on the major, minor, patchlevel.
+ *
+ *
+ * The gethostname function returns the name of the local host into the
+ * buffer specified by the name parameter. The host name is returned as a
+ * null-terminated string. The form of the host name is dependent on the
+ * Windows Sockets provider—it can be a simple host name, or it can be a
+ * fully qualified domain name. However, it is guaranteed that the name
+ * returned will be successfully parsed by gethostbyname and
+ * WSAAsyncGetHostByName.
+ *
+ *
+ * The maximum length of the name returned in the buffer pointed to by the
+ * name parameter is dependent on the namespace provider.
+ *
+ *
+ * If the gethostname function is used on a cluster resource on Windows
+ * Server 2008, Windows Server 2003, or Windows 2000 Server and the
+ * _CLUSTER_NETWORK_NAME_ environment variable is defined, then the value in
+ * this environment variable overrides the actual hostname and is returned.
+ * On a cluster resource, the _CLUSTER_NETWORK_NAME_ environment variable
+ * contains the name of the cluster.
+ *
+ *
+ * The gethostname function queries namespace providers to determine the
+ * local host name using the SVCID_HOSTNAME GUID defined in the Svgguid.h
+ * header file. If no namespace provider responds, then the gethostname
+ * function returns the NetBIOS name of the local computer.
+ *
+ *
+ * The maximum length, in bytes, of the string returned in the buffer
+ * pointed to by the name parameter is dependent on the namespace provider,
+ * but this string must be 256 bytes or less. So if a buffer of 256 bytes is
+ * passed in the name parameter and the namelen parameter is set to 256, the
+ * buffer size will always be adequate.
+ *
+ * @param name A bytearray that receives the local host name.
+ * @param namelen The length, in bytes, of the buffer pointed to by the name parameter.
+ * @return If no error occurs, gethostname returns zero. Otherwise, it returns SOCKET_ERROR and a specific error code can be retrieved by calling WSAGetLastError.
+ */
+ public int gethostname(byte[] name, int namelen);
+
+}
diff -Nru libjna-java-4.5.0/contrib/platform/src/com/sun/jna/platform/win32/WinspoolUtil.java libjna-java-4.5.1/contrib/platform/src/com/sun/jna/platform/win32/WinspoolUtil.java
--- libjna-java-4.5.0/contrib/platform/src/com/sun/jna/platform/win32/WinspoolUtil.java 2017-09-13 20:12:57.000000000 +0000
+++ libjna-java-4.5.1/contrib/platform/src/com/sun/jna/platform/win32/WinspoolUtil.java 2017-12-27 19:27:16.000000000 +0000
@@ -118,7 +118,7 @@
if (!Winspool.INSTANCE.ClosePrinter(pHandle.getValue())) {
Win32Exception ex = new Win32Exception(Kernel32.INSTANCE.GetLastError());
if (we != null) {
- ex.addSuppressed(we);
+ ex.addSuppressedReflected(we);
}
}
}
diff -Nru libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/unix/LibCTest.java libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/unix/LibCTest.java
--- libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/unix/LibCTest.java 2017-09-13 20:12:57.000000000 +0000
+++ libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/unix/LibCTest.java 2017-12-27 19:27:16.000000000 +0000
@@ -1,17 +1,29 @@
/* Copyright (c) 2015 Goldstein Lyor, All Rights Reserved
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
+ * The contents of this file is dual-licensed under 2
+ * alternative Open Source/Free licenses: LGPL 2.1 or later and
+ * Apache License 2.0. (starting with JNA version 4.0.0).
+ *
+ * You can freely decide which license you want to apply to
+ * the project.
+ *
+ * You may obtain a copy of the LGPL License at:
+ *
+ * http://www.gnu.org/licenses/licenses.html
+ *
+ * A copy is also included in the downloadable source code package
+ * containing JNA, in file "LGPL2.1".
+ *
+ * You may obtain a copy of the Apache License at:
+ *
+ * http://www.apache.org/licenses/
+ *
+ * A copy is also included in the downloadable source code package
+ * containing JNA, in file "AL2.0".
*/
package com.sun.jna.platform.unix;
+import com.sun.jna.Native;
import java.sql.Date;
import java.util.Map;
@@ -21,6 +33,7 @@
* @author Lyor Goldstein
*/
public class LibCTest extends AbstractUnixTestSupport {
+
public LibCTest() {
super();
}
@@ -48,7 +61,7 @@
LibC.INSTANCE.unsetenv(name);
}
}
-
+
@Test
public void testGetLoadAvg() {
double[] loadavg = new double[3];
@@ -58,4 +71,18 @@
assertTrue(loadavg[1] >= 0);
assertTrue(loadavg[2] >= 0);
}
+
+ @Test
+ public void testGethostnameGetdomainname() {
+ // This needs visual inspection ...
+ byte[] buffer = new byte[256];
+ LibC.INSTANCE.gethostname(buffer, buffer.length);
+ String hostname = Native.toString(buffer);
+ System.out.println("Hostname: " + hostname);
+ assertTrue(hostname.length() > 0);
+ LibC.INSTANCE.getdomainname(buffer, buffer.length);
+ String domainname = Native.toString(buffer);
+ System.out.println("Domainname: " + domainname);
+ assertTrue(domainname.length() > 0);
+ }
}
diff -Nru libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/win32/COM/util/ProxyObjectFactory_Test.java libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/win32/COM/util/ProxyObjectFactory_Test.java
--- libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/win32/COM/util/ProxyObjectFactory_Test.java 2017-09-13 20:12:57.000000000 +0000
+++ libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/win32/COM/util/ProxyObjectFactory_Test.java 2017-12-27 19:27:16.000000000 +0000
@@ -12,7 +12,6 @@
*/
package com.sun.jna.platform.win32.COM.util;
-import com.sun.jna.Pointer;
import static org.junit.Assert.*;
import java.io.File;
@@ -25,7 +24,6 @@
import com.sun.jna.platform.win32.COM.util.annotation.ComObject;
import com.sun.jna.platform.win32.COM.util.annotation.ComMethod;
import com.sun.jna.platform.win32.COM.util.annotation.ComProperty;
-import com.sun.jna.platform.win32.Ole32;
public class ProxyObjectFactory_Test {
diff -Nru libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/win32/COM/util/ProxyObjectObjectFactory_Test.java libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/win32/COM/util/ProxyObjectObjectFactory_Test.java
--- libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/win32/COM/util/ProxyObjectObjectFactory_Test.java 2017-09-13 20:12:57.000000000 +0000
+++ libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/win32/COM/util/ProxyObjectObjectFactory_Test.java 2017-12-27 19:27:16.000000000 +0000
@@ -15,6 +15,8 @@
import com.sun.jna.Pointer;
import static org.junit.Assert.*;
+import java.lang.reflect.Proxy;
+
import java.io.File;
import org.junit.After;
@@ -156,7 +158,8 @@
@Test
public void accessWhilstDisposing() {
MsWordApp comObj1 = this.factory.createObject(MsWordApp.class);
-
+ comObj1.Quit();
+
//TODO: how to test this?
this.factory.disposeAll();
@@ -186,4 +189,13 @@
boolean wasDeleted = new File("abcdefg.pdf").delete();
assertTrue(wasDeleted);
}
+
+
+ @Test
+ public void testDisposeMustBeCallableMultipleTimes() {
+ MsWordApp comObj = this.factory.createObject(MsWordApp.class);
+ comObj.Quit();
+ ((ProxyObject) Proxy.getInvocationHandler(comObj)).dispose();
+ ((ProxyObject) Proxy.getInvocationHandler(comObj)).dispose();
+ }
}
diff -Nru libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/win32/Kernel32Test.java libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/win32/Kernel32Test.java
--- libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/win32/Kernel32Test.java 2017-09-13 20:12:57.000000000 +0000
+++ libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/win32/Kernel32Test.java 2017-12-27 19:27:16.000000000 +0000
@@ -1552,7 +1552,7 @@
if (we == null) {
we = e;
} else {
- we.addSuppressed(e);
+ we.addSuppressedReflected(e);
}
}
@@ -1589,7 +1589,7 @@
if (we == null) {
we = e;
} else {
- we.addSuppressed(e);
+ we.addSuppressedReflected(e);
}
}
diff -Nru libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/win32/PsapiTest.java libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/win32/PsapiTest.java
--- libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/win32/PsapiTest.java 2017-09-13 20:12:57.000000000 +0000
+++ libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/win32/PsapiTest.java 2017-12-27 19:27:16.000000000 +0000
@@ -135,7 +135,7 @@
if (we == null) {
we = e;
} else {
- we.addSuppressed(e);
+ we.addSuppressedReflected(e);
}
}
if (we != null) {
@@ -186,7 +186,7 @@
if (we == null) {
we = e;
} else {
- we.addSuppressed(e);
+ we.addSuppressedReflected(e);
}
}
if (we != null) {
@@ -218,7 +218,7 @@
if (we == null) {
we = e;
} else {
- we.addSuppressed(e);
+ we.addSuppressedReflected(e);
}
}
if (we != null) {
diff -Nru libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/win32/Win32ExceptionTest.java libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/win32/Win32ExceptionTest.java
--- libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/win32/Win32ExceptionTest.java 2017-09-13 20:12:57.000000000 +0000
+++ libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/win32/Win32ExceptionTest.java 2017-12-27 19:27:16.000000000 +0000
@@ -15,6 +15,7 @@
import com.sun.jna.LastErrorException;
import junit.framework.TestCase;
+import org.junit.Assume;
/**
* @author dblock[at]dblock[dot]org
@@ -50,8 +51,27 @@
}
}
+ public void testAddSuppressed() {
+ Assume.assumeTrue(isMethodPresent(Win32Exception.class, "addSuppressed", Throwable.class));
+
+ Win32Exception demoException = new Win32Exception(WinError.E_FAIL);
+ demoException.addSuppressed(new RuntimeException("Demo"));
+
+ assertEquals(1, demoException.getSuppressed().length);
+ assertEquals("Demo", demoException.getSuppressed()[0].getMessage());
+ }
+
private void assertLastErrorValue(LastErrorException e, int code, String msg) {
assertEquals("Mismatched error code", code, e.getErrorCode());
assertEquals("Mismatched error message", msg, e.getMessage());
}
+
+ private boolean isMethodPresent(Class> baseClass, String methodName, Class... parameters) throws SecurityException {
+ try {
+ baseClass.getMethod(methodName, parameters);
+ return true;
+ } catch (NoSuchMethodException ex) {
+ return false;
+ }
+ }
}
diff -Nru libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/win32/Winsock2Test.java libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/win32/Winsock2Test.java
--- libjna-java-4.5.0/contrib/platform/test/com/sun/jna/platform/win32/Winsock2Test.java 1970-01-01 00:00:00.000000000 +0000
+++ libjna-java-4.5.1/contrib/platform/test/com/sun/jna/platform/win32/Winsock2Test.java 2017-12-27 19:27:16.000000000 +0000
@@ -0,0 +1,41 @@
+/* Copyright (c) 2017 Matthias Bläsing, All Rights Reserved
+ *
+ * The contents of this file is dual-licensed under 2
+ * alternative Open Source/Free licenses: LGPL 2.1 or later and
+ * Apache License 2.0. (starting with JNA version 4.0.0).
+ *
+ * You can freely decide which license you want to apply to
+ * the project.
+ *
+ * You may obtain a copy of the LGPL License at:
+ *
+ * http://www.gnu.org/licenses/licenses.html
+ *
+ * A copy is also included in the downloadable source code package
+ * containing JNA, in file "LGPL2.1".
+ *
+ * You may obtain a copy of the Apache License at:
+ *
+ * http://www.apache.org/licenses/
+ *
+ * A copy is also included in the downloadable source code package
+ * containing JNA, in file "AL2.0".
+ */
+package com.sun.jna.platform.win32;
+
+import com.sun.jna.Native;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class Winsock2Test {
+ @Test
+ public void testGethostname() {
+ // This needs visual inspection ...
+ byte[] buffer = new byte[256];
+ Winsock2.INSTANCE.gethostname(buffer, buffer.length);
+ String hostname = Native.toString(buffer);
+ System.out.println("Hostname: " + hostname);
+ assertTrue(hostname.length() > 0);
+ }
+
+}
diff -Nru libjna-java-4.5.0/debian/changelog libjna-java-4.5.1/debian/changelog
--- libjna-java-4.5.0/debian/changelog 2017-11-29 16:20:25.000000000 +0000
+++ libjna-java-4.5.1/debian/changelog 2018-01-09 23:32:50.000000000 +0000
@@ -1,3 +1,13 @@
+libjna-java (4.5.1-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream release
+ - Refreshed the patches
+ * Removed the contradicting javadoc patches
+ * Standards-Version updated to 4.1.3
+
+ -- Emmanuel Bourg Wed, 10 Jan 2018 00:32:50 +0100
+
libjna-java (4.5.0-2) unstable; urgency=medium
* Team upload.
diff -Nru libjna-java-4.5.0/debian/control libjna-java-4.5.1/debian/control
--- libjna-java-4.5.0/debian/control 2017-11-29 16:19:23.000000000 +0000
+++ libjna-java-4.5.1/debian/control 2018-01-09 23:22:34.000000000 +0000
@@ -16,7 +16,7 @@
libxt-dev,
maven-repo-helper (>= 1.5~),
pkg-config
-Standards-Version: 4.1.1
+Standards-Version: 4.1.3
Vcs-Git: https://anonscm.debian.org/git/pkg-java/libjna-java.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/libjna-java.git
Homepage: https://github.com/twall/jna
diff -Nru libjna-java-4.5.0/debian/patches/03-dynlink-and-cflags.patch libjna-java-4.5.1/debian/patches/03-dynlink-and-cflags.patch
--- libjna-java-4.5.0/debian/patches/03-dynlink-and-cflags.patch 2017-09-15 12:40:41.000000000 +0000
+++ libjna-java-4.5.1/debian/patches/03-dynlink-and-cflags.patch 2018-01-09 23:23:39.000000000 +0000
@@ -3,7 +3,7 @@
--- a/build.xml
+++ b/build.xml
-@@ -936,6 +936,19 @@
+@@ -946,6 +946,19 @@
@@ -23,7 +23,7 @@
diff -Nru libjna-java-4.5.0/debian/patches/06-remove-gjdoc-inexistent-options.patch libjna-java-4.5.1/debian/patches/06-remove-gjdoc-inexistent-options.patch
--- libjna-java-4.5.0/debian/patches/06-remove-gjdoc-inexistent-options.patch 2017-09-15 12:40:44.000000000 +0000
+++ libjna-java-4.5.1/debian/patches/06-remove-gjdoc-inexistent-options.patch 1970-01-01 00:00:00.000000000 +0000
@@ -1,14 +0,0 @@
-Author: Jan Dittberner
-Subject: disable javadoc options that are not supported by gjdoc
-
---- a/build.xml
-+++ b/build.xml
-@@ -1225,7 +1225,7 @@
-
-
-
--
-+
-
-
-
diff -Nru libjna-java-4.5.0/debian/patches/09-javadoc.patch libjna-java-4.5.1/debian/patches/09-javadoc.patch
--- libjna-java-4.5.0/debian/patches/09-javadoc.patch 2017-09-15 12:40:46.000000000 +0000
+++ libjna-java-4.5.1/debian/patches/09-javadoc.patch 2018-01-09 23:23:45.000000000 +0000
@@ -2,7 +2,7 @@
--- a/build.xml
+++ b/build.xml
-@@ -1208,7 +1208,7 @@
+@@ -1218,7 +1218,7 @@
JNA API Documentation${header}${footer}
diff -Nru libjna-java-4.5.0/debian/patches/10-disable-full-jar.patch libjna-java-4.5.1/debian/patches/10-disable-full-jar.patch
--- libjna-java-4.5.0/debian/patches/10-disable-full-jar.patch 2017-09-15 12:40:47.000000000 +0000
+++ libjna-java-4.5.1/debian/patches/10-disable-full-jar.patch 2018-01-09 23:23:47.000000000 +0000
@@ -3,7 +3,7 @@
Forwarded: not-needed
--- a/build.xml
+++ b/build.xml
-@@ -414,6 +414,7 @@
+@@ -424,6 +424,7 @@
@@ -11,7 +11,7 @@
@@ -24,7 +24,7 @@
-@@ -560,6 +563,7 @@
+@@ -570,6 +573,7 @@
diff -Nru libjna-java-4.5.0/debian/patches/13-reproducible-javadoc.patch libjna-java-4.5.1/debian/patches/13-reproducible-javadoc.patch
--- libjna-java-4.5.0/debian/patches/13-reproducible-javadoc.patch 2017-09-15 12:40:50.000000000 +0000
+++ libjna-java-4.5.1/debian/patches/13-reproducible-javadoc.patch 1970-01-01 00:00:00.000000000 +0000
@@ -1,15 +0,0 @@
-Description: Set the locale and remove the timestamps when generating the javadoc to make it reproducible
-Author: Emmanuel Bourg
-Forwarded: no
---- a/build.xml
-+++ b/build.xml
-@@ -1206,7 +1206,8 @@
- maxmemory="256m"
- packagenames="com.sun.jna,com.sun.jna.ptr,com.sun.jna.types,com.sun.jna.platform,com.sun.jna.platform.win32"
- overview="${src}/com/sun/jna/overview.html"
-- additionalparam="${javadoc.opts}"
-+ additionalparam="${javadoc.opts} -notimestamp"
-+ locale="en"
- destdir="${javadoc}">
-
- JNA API Documentation
diff -Nru libjna-java-4.5.0/debian/patches/series libjna-java-4.5.1/debian/patches/series
--- libjna-java-4.5.0/debian/patches/series 2017-11-29 16:09:48.000000000 +0000
+++ libjna-java-4.5.1/debian/patches/series 2018-01-09 23:30:21.000000000 +0000
@@ -1,10 +1,8 @@
#01-nbproject.patch
03-dynlink-and-cflags.patch
04-load-native-code-from-fs.patch
-06-remove-gjdoc-inexistent-options.patch
09-javadoc.patch
10-disable-full-jar.patch
12-structure-backward-compatibility.patch
-13-reproducible-javadoc.patch
14-rename-native-library.patch
15-java9-compatibility.patch
diff -Nru libjna-java-4.5.0/nbproject/project.xml libjna-java-4.5.1/nbproject/project.xml
--- libjna-java-4.5.0/nbproject/project.xml 2017-09-13 20:12:57.000000000 +0000
+++ libjna-java-4.5.1/nbproject/project.xml 2017-12-27 19:27:16.000000000 +0000
@@ -33,9 +33,9 @@
UTF-8
-
+
java
- ant-elfanalyser-src
+ ant-tools-srcUTF-8
@@ -68,8 +68,8 @@
test
-
- ant-elfanalyser-src
+
+ ant-tools-srcbuild.xml
@@ -98,7 +98,7 @@
1.5
- ant-elfanalyser-src
+ ant-tools-srcsrc:lib/ant.jar1.5
diff -Nru libjna-java-4.5.0/README.md libjna-java-4.5.1/README.md
--- libjna-java-4.5.0/README.md 2017-09-13 20:12:57.000000000 +0000
+++ libjna-java-4.5.1/README.md 2017-12-27 19:27:16.000000000 +0000
@@ -5,7 +5,7 @@
Java Native Access (JNA)
========================
-The definitive JNA reference (including an overview and usage details) is in the [JavaDoc](http://java-native-access.github.io/jna/4.5.0/javadoc/). Please read the [overview](http://java-native-access.github.io/jna/4.5.0/javadoc/overview-summary.html#overview_description). Questions, comments, or exploratory conversations should begin on the [mailing list](http://groups.google.com/group/jna-users), although you may find it easier to find answers to already-solved problems on [StackOverflow](http://stackoverflow.com/questions/tagged/jna).
+The definitive JNA reference (including an overview and usage details) is in the [JavaDoc](http://java-native-access.github.io/jna/4.5.1/javadoc/). Please read the [overview](http://java-native-access.github.io/jna/4.5.1/javadoc/overview-summary.html#overview_description). Questions, comments, or exploratory conversations should begin on the [mailing list](http://groups.google.com/group/jna-users), although you may find it easier to find answers to already-solved problems on [StackOverflow](http://stackoverflow.com/questions/tagged/jna).
JNA provides Java programs easy access to native shared libraries without writing anything but Java code - no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes.
@@ -58,13 +58,13 @@
Download
========
-Version 4.5.0
+Version 4.5.1
* [![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.java.dev.jna/jna/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.java.dev.jna/jna)
- [jna.jar](http://repo1.maven.org/maven2/net/java/dev/jna/jna/4.5.0/jna-4.5.0.jar)
+ [jna.jar](http://repo1.maven.org/maven2/net/java/dev/jna/jna/4.5.1/jna-4.5.1.jar)
* [![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.java.dev.jna/jna-platform/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.java.dev.jna/jna-platform)
- [jna-platform.jar](http://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/4.5.0/jna-platform-4.5.0.jar)
+ [jna-platform.jar](http://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/4.5.1/jna-platform-4.5.1.jar)
Features
========
@@ -125,12 +125,12 @@
* [Platform Library](https://github.com/java-native-access/jna/blob/master/www/PlatformLibrary.md)
* [Direct Method Mapping](https://github.com/java-native-access/jna/blob/master/www/DirectMapping.md) (Optimization)
* [Frequently Asked Questions (FAQ)](https://github.com/java-native-access/jna/blob/master/www/FrequentlyAskedQuestions.md)
-* [Avoiding Crashes](http://java-native-access.github.io/jna/4.5.0/javadoc/overview-summary.html#crash-protection)
+* [Avoiding Crashes](http://java-native-access.github.io/jna/4.5.1/javadoc/overview-summary.html#crash-protection)
Primary Documentation (JavaDoc)
===============================
-The definitive JNA reference is in the [JavaDoc](http://java-native-access.github.io/jna/4.5.0/javadoc/).
+The definitive JNA reference is in the [JavaDoc](http://java-native-access.github.io/jna/4.5.1/javadoc/).
Developers
==========
diff -Nru libjna-java-4.5.0/src/com/sun/jna/ELFAnalyser.java libjna-java-4.5.1/src/com/sun/jna/ELFAnalyser.java
--- libjna-java-4.5.0/src/com/sun/jna/ELFAnalyser.java 2017-09-13 20:12:57.000000000 +0000
+++ libjna-java-4.5.1/src/com/sun/jna/ELFAnalyser.java 2017-12-27 19:27:16.000000000 +0000
@@ -104,37 +104,45 @@
}
private void runDetection() throws IOException {
- // run precheck - only of if the file at least hold an ELF header parsing
- // runs further.
RandomAccessFile raf = new RandomAccessFile(filename, "r");
- if (raf.length() > 4) {
- byte[] magic = new byte[4];
- raf.seek(0);
- raf.read(magic);
- if (Arrays.equals(magic, ELF_MAGIC)) {
- ELF = true;
+ try {
+ // run precheck - only of if the file at least hold an ELF header parsing
+ // runs further.
+ if (raf.length() > 4) {
+ byte[] magic = new byte[4];
+ raf.seek(0);
+ raf.read(magic);
+ if (Arrays.equals(magic, ELF_MAGIC)) {
+ ELF = true;
+ }
}
- }
- if (!ELF) {
- return;
- }
- raf.seek(4);
- // The total header size depends on the pointer size of the platform
- // so before the header is loaded the pointer size has to be determined
- byte sizeIndicator = raf.readByte();
- _64Bit = sizeIndicator == EI_CLASS_64BIT;
- raf.seek(0);
- ByteBuffer headerData = ByteBuffer.allocate(_64Bit ? 64 : 52);
- raf.getChannel().read(headerData, 0);
- bigEndian = headerData.get(5) == EI_DATA_BIG_ENDIAN;
- headerData.order(bigEndian ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN);
+ if (!ELF) {
+ return;
+ }
+ raf.seek(4);
+ // The total header size depends on the pointer size of the platform
+ // so before the header is loaded the pointer size has to be determined
+ byte sizeIndicator = raf.readByte();
+ _64Bit = sizeIndicator == EI_CLASS_64BIT;
+ raf.seek(0);
+ ByteBuffer headerData = ByteBuffer.allocate(_64Bit ? 64 : 52);
+ raf.getChannel().read(headerData, 0);
+ bigEndian = headerData.get(5) == EI_DATA_BIG_ENDIAN;
+ headerData.order(bigEndian ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN);
+
+ arm = headerData.get(0x12) == E_MACHINE_ARM;
- arm = headerData.get(0x12) == E_MACHINE_ARM;
-
- if(arm) {
- int flags = headerData.getInt(_64Bit ? 0x30 : 0x24);
- armSoftFloat = (flags & EF_ARM_ABI_FLOAT_SOFT) == EF_ARM_ABI_FLOAT_SOFT;
- armHardFloat = (flags & EF_ARM_ABI_FLOAT_HARD) == EF_ARM_ABI_FLOAT_HARD;
+ if(arm) {
+ int flags = headerData.getInt(_64Bit ? 0x30 : 0x24);
+ armHardFloat = (flags & EF_ARM_ABI_FLOAT_HARD) == EF_ARM_ABI_FLOAT_HARD;
+ armSoftFloat = !armHardFloat;
+ }
+ } finally {
+ try {
+ raf.close();
+ } catch (IOException ex) {
+ // Swallow - closing
+ }
}
}
}
diff -Nru libjna-java-4.5.0/src/com/sun/jna/Platform.java libjna-java-4.5.1/src/com/sun/jna/Platform.java
--- libjna-java-4.5.0/src/com/sun/jna/Platform.java 2017-09-13 20:12:57.000000000 +0000
+++ libjna-java-4.5.1/src/com/sun/jna/Platform.java 2017-12-27 19:27:16.000000000 +0000
@@ -130,7 +130,7 @@
C_LIBRARY_NAME = osType == WINDOWS ? "msvcrt" : osType == WINDOWSCE ? "coredll" : "c";
MATH_LIBRARY_NAME = osType == WINDOWS ? "msvcrt" : osType == WINDOWSCE ? "coredll" : "m";
HAS_DLL_CALLBACKS = osType == WINDOWS;
- ARCH = getCanonicalArchitecture(System.getProperty("os.arch"));
+ ARCH = getCanonicalArchitecture(System.getProperty("os.arch"), osType);
RESOURCE_PREFIX = getNativeLibraryResourcePrefix();
}
private Platform() { }
@@ -236,7 +236,7 @@
return false;
}
- static String getCanonicalArchitecture(String arch) {
+ static String getCanonicalArchitecture(String arch, int platform) {
arch = arch.toLowerCase().trim();
if ("powerpc".equals(arch)) {
arch = "ppc";
@@ -256,7 +256,7 @@
arch = "ppc64le";
}
// Map arm to armel if the binary is running as softfloat build
- if("arm".equals(arch) && isSoftFloat()) {
+ if("arm".equals(arch) && platform == Platform.LINUX && isSoftFloat()) {
arch = "armel";
}
@@ -300,7 +300,7 @@
*/
static String getNativeLibraryResourcePrefix(int osType, String arch, String name) {
String osPrefix;
- arch = getCanonicalArchitecture(arch);
+ arch = getCanonicalArchitecture(arch, osType);
switch(osType) {
case Platform.ANDROID:
if (arch.startsWith("arm")) {
diff -Nru libjna-java-4.5.0/test/com/sun/jna/ELFAnalyserTest.java libjna-java-4.5.1/test/com/sun/jna/ELFAnalyserTest.java
--- libjna-java-4.5.0/test/com/sun/jna/ELFAnalyserTest.java 2017-09-13 20:12:57.000000000 +0000
+++ libjna-java-4.5.1/test/com/sun/jna/ELFAnalyserTest.java 2017-12-27 19:27:16.000000000 +0000
@@ -1,11 +1,7 @@
package com.sun.jna;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.io.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.junit.AfterClass;
@@ -16,13 +12,13 @@
public class ELFAnalyserTest {
-
- private static File testResources = new File("build/test-resources");
- private static File win32Lib = new File(testResources, "win32-x86-64.dll");
- private static File linuxArmelLib = new File(testResources, "linux-armel.so");
- private static File linuxArmhfLib = new File(testResources, "linux-armhf.so");
- private static File linuxAmd64Lib = new File(testResources, "linux-amd64.so");
+ private static final File TEST_RESOURCES = new File("build/test-resources");
+ private static final File WIN32_LIB = new File(TEST_RESOURCES, "win32-x86-64.dll");
+ private static final File LINUX_ARMEL_LIB = new File(TEST_RESOURCES, "linux-armel.so");
+ private static final File LINUX_ARMEL_NOFLAG_LIG = new File(TEST_RESOURCES, "linux-armel-noflag.so");
+ private static final File LINUX_ARMHF_LIB = new File(TEST_RESOURCES, "linux-armhf.so");
+ private static final File LINUX_AMD64_LIB = new File(TEST_RESOURCES, "linux-amd64.so");
@BeforeClass
public static void initClass() throws IOException {
@@ -31,23 +27,24 @@
File linuxArmhfZip = new File("dist/linux-arm.jar");
File linuxAmd64Zip = new File("dist/linux-x86-64.jar");
- testResources.mkdirs();
+ TEST_RESOURCES.mkdirs();
- extractFileFromZip(win32Zip, "jnidispatch.dll", win32Lib);
- extractFileFromZip(linuxArmelZip, "libjnidispatch.so", linuxArmelLib);
- extractFileFromZip(linuxArmhfZip, "libjnidispatch.so", linuxArmhfLib);
- extractFileFromZip(linuxAmd64Zip, "libjnidispatch.so", linuxAmd64Lib);
+ extractFileFromZip(win32Zip, "jnidispatch.dll", WIN32_LIB);
+ extractFileFromZip(linuxArmelZip, "libjnidispatch.so", LINUX_ARMEL_LIB);
+ extractFileFromZip(linuxArmhfZip, "libjnidispatch.so", LINUX_ARMHF_LIB);
+ extractFileFromZip(linuxAmd64Zip, "libjnidispatch.so", LINUX_AMD64_LIB);
+ makeLinuxArmelNoflagLib(LINUX_ARMEL_LIB, LINUX_ARMEL_NOFLAG_LIG);
}
@Test
public void testNonELF() throws IOException {
- ELFAnalyser ahfd = ELFAnalyser.analyse(win32Lib.getAbsolutePath());
+ ELFAnalyser ahfd = ELFAnalyser.analyse(WIN32_LIB.getAbsolutePath());
assertFalse(ahfd.isELF());
}
@Test
public void testNonArm() throws IOException {
- ELFAnalyser ahfd = ELFAnalyser.analyse(linuxAmd64Lib.getAbsolutePath());
+ ELFAnalyser ahfd = ELFAnalyser.analyse(LINUX_AMD64_LIB.getAbsolutePath());
assertTrue(ahfd.isELF());
assertFalse(ahfd.isArm());
assertTrue(ahfd.is64Bit());
@@ -55,7 +52,7 @@
@Test
public void testArmhf() throws IOException {
- ELFAnalyser ahfd = ELFAnalyser.analyse(linuxArmhfLib.getAbsolutePath());
+ ELFAnalyser ahfd = ELFAnalyser.analyse(LINUX_ARMHF_LIB.getAbsolutePath());
assertTrue(ahfd.isELF());
assertTrue(ahfd.isArm());
assertFalse(ahfd.is64Bit());
@@ -65,7 +62,17 @@
@Test
public void testArmel() throws IOException {
- ELFAnalyser ahfd = ELFAnalyser.analyse(linuxArmelLib.getAbsolutePath());
+ ELFAnalyser ahfd = ELFAnalyser.analyse(LINUX_ARMEL_LIB.getAbsolutePath());
+ assertTrue(ahfd.isELF());
+ assertTrue(ahfd.isArm());
+ assertFalse(ahfd.is64Bit());
+ assertTrue(ahfd.isArmSoftFloat());
+ assertFalse(ahfd.isArmHardFloat());
+ }
+
+ @Test
+ public void testArmelNoflag() throws IOException {
+ ELFAnalyser ahfd = ELFAnalyser.analyse(LINUX_ARMEL_NOFLAG_LIG.getAbsolutePath());
assertTrue(ahfd.isELF());
assertTrue(ahfd.isArm());
assertFalse(ahfd.is64Bit());
@@ -75,11 +82,12 @@
@AfterClass
public static void afterClass() throws IOException {
- linuxAmd64Lib.delete();
- linuxArmhfLib.delete();
- linuxArmelLib.delete();
- win32Lib.delete();
- testResources.delete();
+ LINUX_AMD64_LIB.delete();
+ LINUX_ARMHF_LIB.delete();
+ LINUX_ARMEL_LIB.delete();
+ WIN32_LIB.delete();
+ LINUX_ARMEL_NOFLAG_LIG.delete();
+ TEST_RESOURCES.delete();
}
private static void extractFileFromZip(File zipTarget, String zipEntryName, File outputFile) throws IOException {
@@ -92,11 +100,7 @@
InputStream is = zip.getInputStream(entry); // Implicitly closed by closing ZipFile
OutputStream os = new FileOutputStream(outputFile);
try {
- int read;
- byte[] buffer = new byte[1024 * 1024];
- while((read = is.read(buffer)) > 0) {
- os.write(buffer, 0, read);
- }
+ copyStream(is, os);
} finally {
os.close();
}
@@ -104,5 +108,49 @@
zip.close();
}
}
+
+ // The e_flags for elf arm binaries begin at an offset of 0x24 bytes.
+ // The procedure call standard is coded on the second byte.
+ private static void makeLinuxArmelNoflagLib(File sourceFile, File outputFile) throws IOException {
+ final int POS_ABI_FLOAT_BIT = (byte) 0x25;
+ copyFile(sourceFile, outputFile);
+
+ RandomAccessFile out = new RandomAccessFile(outputFile, "rw");
+
+ out.seek(POS_ABI_FLOAT_BIT);
+ out.write(0);
+
+ out.close();
+ }
+
+ private static void copyFile(File sourceFile, File outputFile) throws IOException {
+ InputStream inputStream = null;
+ OutputStream outputStream = null;
+ try {
+ inputStream = new FileInputStream(sourceFile);
+ outputStream = new FileOutputStream(outputFile);
+ copyStream(inputStream, outputStream);
+ } finally {
+ closeSilently(inputStream);
+ closeSilently(outputStream);
+ }
+ }
+
+ private static void copyStream(InputStream is, OutputStream os) throws IOException {
+ int read;
+ byte[] buffer = new byte[1024 * 1024];
+ while ((read = is.read(buffer)) > 0) {
+ os.write(buffer, 0, read);
+ }
+ }
+
+ private static void closeSilently(Closeable closeable) {
+ if(closeable == null) {
+ return;
+ }
+ try {
+ closeable.close();
+ } catch (IOException ex) {}
+ }
}