Bug - Fixed [patch included] When using Flatlaf themes, SVNManager message boxes render HTML incorrectly

philmasterplus

Active member
KoLmafia revision: r20806

When svn checkout or svn update warns about overwriting files, the popup dialog usually looks like this:
svn-popup-system-theme.png

When I'm using one of the FlatLaf themes added in r20534, the HTML in the dialog is broken:
svn-popup-flatlaf-theme.png
(current theme is 'Light Owl')

After some experimentation, I discovered that passing a plain String object instead of a StringBuilder object to JOptionPane.showConfirmationDialog() fixes the problem:
Diff:
--- a/src/net/sourceforge/kolmafia/svn/SVNManager.java	(revision 20806)
+++ b/src/net/sourceforge/kolmafia/svn/SVNManager.java	(date 1627901041016)
@@ -898,7 +898,7 @@
 			}
 			message.append( "<br><b>Only click yes if you trust the author.</b>"
 				+ "<p>Clicking no will stop the files from being added locally. (until you checkout the project again)" );
-			if ( JOptionPane.showConfirmDialog( null, message, "SVN wants to add new files", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE ) == JOptionPane.YES_OPTION )
+			if ( JOptionPane.showConfirmDialog( null, message.toString(), "SVN wants to add new files", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE ) == JOptionPane.YES_OPTION )
 			{
 				skipFiles.clear();
 			}
@@ -1018,7 +1018,7 @@
 			}
 			message.append( "<br>Checking out this project will result in some local files (described above) being overwritten."
 				+ "<p>Click yes to overwrite them, no to skip installing them." );
-			if ( JOptionPane.showConfirmDialog( null, message, "SVN checkout wants to overwrite local files", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE ) == JOptionPane.YES_OPTION )
+			if ( JOptionPane.showConfirmDialog( null, message.toString(), "SVN checkout wants to overwrite local files", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE ) == JOptionPane.YES_OPTION )
 			{
 				skipFiles.clear();
 			}

After the fix, the popup renders the HTML correctly:
svn-popup-flatlaf-theme-fixed.png

I'm attaching a patch file which contains the changes above.
 

Attachments

  • philmasterplus-svn-dialog-fix.patch
    1.7 KB · Views: 1
Top