Add bugfixes from testing
Build and Test j3270 / Build JAR & Run Tests (Java 21) (push) Successful in 37s
Release j3270 / Build & Publish Release (push) Successful in 43s
Build and Test j3270 / Build JAR & Run Tests (Java 11) (push) Successful in 1m14s
Build and Test j3270 / Build JAR & Run Tests (Java 17) (push) Successful in 1m12s

This commit is contained in:
2026-09-12 17:21:21 -04:00
parent bdfe6eec2a
commit 14bf7ba4b1
3 changed files with 97 additions and 17 deletions
@@ -435,6 +435,14 @@ public class ConnectionConfig {
}
}
// Parse [lu@]host[:port] (e.g. "00C2@mvs.host.com:1023")
String parsedLu = null;
int atIdx = s.indexOf('@');
if (atIdx > 0 && atIdx < s.length() - 1) {
parsedLu = s.substring(0, atIdx).trim();
s = s.substring(atIdx + 1).trim();
}
String host = s;
int port = (defaultPort > 0) ? defaultPort : (tls ? 992 : 23);
@@ -458,6 +466,9 @@ public class ConnectionConfig {
}
ConnectionConfig config = new ConnectionConfig(host, port, defaultModel != null ? defaultModel : TerminalModel.IBM_3279_4);
if (parsedLu != null && !parsedLu.isEmpty()) {
config.setLuName(parsedLu);
}
config.setUseTls(tls);
config.setTn3270eEnabled(tn3270e);
config.setKeepAliveEnabled(keepAlive);
@@ -70,8 +70,22 @@ public class TelnetFSM {
private List<String> getCandidateTerminalTypes() {
List<String> list = new ArrayList<>();
String currentLu = null;
List<String> lus = config.getLuNames();
if (lus != null && !lus.isEmpty() && luIndex < lus.size()) {
currentLu = lus.get(luIndex);
} else if (config.getLuName() != null && !config.getLuName().trim().isEmpty()) {
currentLu = config.getLuName().trim();
}
if (config.getTerminalName() != null && !config.getTerminalName().trim().isEmpty()) {
list.add(config.getTerminalName().trim());
String tName = config.getTerminalName().trim();
if (currentLu != null && !currentLu.isEmpty() && !tName.contains("@")) {
list.add(tName + "@" + currentLu);
list.add(tName);
} else {
list.add(tName);
}
return list;
}
if (config.isDynamicModel()) {
@@ -82,24 +96,41 @@ public class TelnetFSM {
list.add("IBM-3279-2");
list.add("IBM-3278-2");
list.add("UNKNOWN");
return list;
} else {
TerminalModel model = config.getModel();
list.add(model.getTerminalType());
list.add(model.getBaseTerminalType());
if (model.isColor()) {
try {
TerminalModel mono = TerminalModel.forModel(model.getModelNumber(), false);
list.add(mono.getTerminalType());
list.add(mono.getBaseTerminalType());
} catch (Exception ignored) {}
}
if (model.getModelNumber() != 2) {
list.add("IBM-3279-2-E");
list.add("IBM-3279-2");
list.add("IBM-3278-2");
}
list.add("UNKNOWN");
}
TerminalModel model = config.getModel();
list.add(model.getTerminalType());
list.add(model.getBaseTerminalType());
if (model.isColor()) {
try {
TerminalModel mono = TerminalModel.forModel(model.getModelNumber(), false);
list.add(mono.getTerminalType());
list.add(mono.getBaseTerminalType());
} catch (Exception ignored) {}
if (currentLu != null && !currentLu.isEmpty()) {
List<String> luCandidates = new ArrayList<>();
for (String item : list) {
if (!"UNKNOWN".equalsIgnoreCase(item) && !item.contains("@")) {
luCandidates.add(item + "@" + currentLu);
}
}
for (String item : list) {
if (!"UNKNOWN".equalsIgnoreCase(item)) {
luCandidates.add(item);
}
}
luCandidates.add("UNKNOWN");
return luCandidates;
}
if (model.getModelNumber() != 2) {
list.add("IBM-3279-2-E");
list.add("IBM-3279-2");
list.add("IBM-3278-2");
}
list.add("UNKNOWN");
return list;
}
@@ -589,6 +620,9 @@ public class TelnetFSM {
out.write(IAC);
out.write(SE);
sendBytes(out.toByteArray());
if (termType.contains("@")) {
connectedLu = termType.substring(termType.indexOf('@') + 1).trim();
}
log.warning(">>> SENT SB TTYPE IS " + termType + " SE");
}
}