Skip to content

Commit d3093f9

Browse files
Restore JDK6 compatibility for jna-platform
1 parent e96f301 commit d3093f9

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

contrib/platform/src/com/sun/jna/platform/win32/DBT.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import com.sun.jna.platform.win32.WinNT.HANDLE;
3333
import com.sun.jna.platform.win32.WinUser.HDEVNOTIFY;
3434
import com.sun.jna.win32.W32APITypeMapper;
35-
import java.nio.charset.StandardCharsets;
35+
import java.io.UnsupportedEncodingException;
3636
import java.util.logging.Logger;
3737

3838
/**
@@ -326,7 +326,13 @@ public String getDbcpName() {
326326
if(W32APITypeMapper.DEFAULT == W32APITypeMapper.ASCII) {
327327
return Native.toString(this.dbcp_name);
328328
} else {
329-
return new String(this.dbcp_name, StandardCharsets.UTF_16LE);
329+
try {
330+
return new String(this.dbcp_name, "UTF-16LE");
331+
} catch (UnsupportedEncodingException ex) {
332+
// UTF-16LE is documented to be present at least beginning
333+
// with JDK 6
334+
throw new RuntimeException(ex);
335+
}
330336
}
331337
}
332338
}

contrib/platform/src/com/sun/jna/platform/win32/Kernel32Util.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ public static final String QueryFullProcessImageName(int pid, int dwFlags) {
954954
if (we == null) {
955955
we = e;
956956
} else {
957-
we.addSuppressed(e);
957+
we.addSuppressedReflected(e);
958958
}
959959
}
960960
if (we != null) {

0 commit comments

Comments
 (0)