Skip to content

Commit be058f6

Browse files
committed
Fix: bug in JXTreeTable.getEditingRow
org.jdesktop.swingx.JXTreeTable contains the following (decompiled) methods public boolean isHierarchical(int column) { if (column >= 0 && column < this.getColumnCount()) { return this.getHierarchicalColumn() == column; } else { throw new IllegalArgumentException("column must be valid, was" + column); } } public int getEditingRow() { if (this.editingRow == -1) { return -1; } else { return this.isHierarchical(this.editingColumn) ? -1 : this.editingRow; } } Exceptions are thrown, especially on macOS clients, when getEditingRow is called while not editing, causing isHeirarchical to be called when editingColumn is -1. This commit overrides getEditingRow to protect against that condition. Issue: #272 Signed-off-by: Tony Germano <tony@germano.name>
1 parent be1072d commit be058f6

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

client/src/com/mirth/connect/client/ui/SortableTreeTable.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
/*
2-
* Copyright (c) Mirth Corporation. All rights reserved.
3-
*
4-
* http://www.mirthcorp.com
5-
*
6-
* The software in this package is published under the terms of the MPL license a copy of which has
7-
* been included with this distribution in the LICENSE.txt file.
8-
*/
1+
// SPDX-License-Identifier: MPL-2.0
2+
// SPDX-FileCopyrightText: Mirth Corporation
3+
// SPDX-FileCopyrightText: 2026 Tony Germano <tony@germano.name>
94

105
package com.mirth.connect.client.ui;
116

@@ -135,6 +130,18 @@ public void setSortOrder(int columnIndex, SortOrder sortOrder) {
135130
sortModel.setSortOptions(sortModel.getColumnName(columnIndex), order);
136131
}
137132

133+
// This fixes a bug in the super implementation where isHierarchical(int) can be
134+
// called when editingColumn has a value of -1, which causes an exception to be
135+
// thrown.
136+
@Override
137+
public int getEditingRow() {
138+
if (editingRow == -1 || editingColumn == -1 || isHierarchical(editingColumn)) {
139+
return -1;
140+
} else {
141+
return editingRow;
142+
}
143+
}
144+
138145
// ======================================================= private methods
139146

140147
private void getSortParams() {
@@ -145,4 +152,4 @@ private void getSortParams() {
145152
sortColumn = sortModel.getSortColumnIndex();
146153
}
147154

148-
}
155+
}

0 commit comments

Comments
 (0)