You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried the default hello world example and it fails to read the XAuthority file on Ubuntu 22.04. Following code snippet seems to be working in reading the file and it does show window. Following code is based on https://stackoverflow.com/a/74840795
public static Optional<XAuthority> read(DataInput in) {
try {
int family = in.readUnsignedShort();
int addLength = in.readUnsignedShort();
List<Byte> host = readBytes(in, addLength);
int displayNoLength = in.readUnsignedShort(), displayNumber = 0;
if (displayNoLength != 0) {
List<Byte> displayNo = readBytes(in, displayNoLength);
}
int nameLength = in.readUnsignedShort();
List<Byte> authName = readBytes(in, nameLength);
int dataLength = in.readUnsignedShort();
List<Byte> authData = readBytes(in, dataLength);
XAuthority auth = new XAuthority(Family.getByCode(family), host, displayNumber, authName, authData);
return Optional.of(auth);
} catch (Exception e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
}
}
Since XClient constructor was private, I ended up using reflection to call the constructor using something like following
I tried with enedian settings both true and false. Result is still same. I get folowing exception
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Integer.parseInt(Integer.java:672)
at java.base/java.lang.Integer.parseInt(Integer.java:778)
at com.github.moaxcp.x11.protocol.XAuthority.read(XAuthority.java:101)
at com.github.moaxcp.x11.protocol.XAuthority.getAuthorities(XAuthority.java:161)
at com.github.moaxcp.x11.x11client.X11Connection.connect(X11Connection.java:148)
at com.github.moaxcp.x11.x11client.X11Client.connect(X11Client.java:74)
at com.paymentus.bfs.aggregation.x11.X11Driver.main(X11Driver.java:202)
I tried the default hello world example and it fails to read the XAuthority file on Ubuntu 22.04. Following code snippet seems to be working in reading the file and it does show window. Following code is based on https://stackoverflow.com/a/74840795
Since XClient constructor was private, I ended up using reflection to call the constructor using something like following
The text was updated successfully, but these errors were encountered: