Skip to content

Commit

Permalink
Restore JDK6 compatibility for jna-platform
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasblaesing committed Aug 8, 2023
1 parent e96f301 commit d3093f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions contrib/platform/src/com/sun/jna/platform/win32/DBT.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.platform.win32.WinUser.HDEVNOTIFY;
import com.sun.jna.win32.W32APITypeMapper;
import java.nio.charset.StandardCharsets;
import java.io.UnsupportedEncodingException;
import java.util.logging.Logger;

/**
Expand Down Expand Up @@ -326,7 +326,13 @@ public String getDbcpName() {
if(W32APITypeMapper.DEFAULT == W32APITypeMapper.ASCII) {
return Native.toString(this.dbcp_name);
} else {
return new String(this.dbcp_name, StandardCharsets.UTF_16LE);
try {
return new String(this.dbcp_name, "UTF-16LE");
} catch (UnsupportedEncodingException ex) {
// UTF-16LE is documented to be present at least beginning
// with JDK 6
throw new RuntimeException(ex);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ public static final String QueryFullProcessImageName(int pid, int dwFlags) {
if (we == null) {
we = e;
} else {
we.addSuppressed(e);
we.addSuppressedReflected(e);
}
}
if (we != null) {
Expand Down

0 comments on commit d3093f9

Please sign in to comment.