mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 04:05:39 +00:00
GT-2698 - fix html escaping to use simpler method.
This commit is contained in:
parent
6448f0da8f
commit
fa7173f9ab
@ -162,7 +162,7 @@ public class SampleTableProvider extends ComponentProviderAdapter implements Opt
|
||||
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("Writing the following objects to file: ");
|
||||
buffer.append(HTMLUtilities.friendlyEncodeHTML(fileChooserPanel.getFileName()));
|
||||
buffer.append(HTMLUtilities.escapeHTML(fileChooserPanel.getFileName()));
|
||||
|
||||
List<FunctionStatsRowObject> selectedObjects = filterTable.getSelectedRowObjects();
|
||||
for (FunctionStatsRowObject stats : selectedObjects) {
|
||||
|
@ -156,8 +156,8 @@ public class ConflictInfoPanel extends JPanel {
|
||||
}
|
||||
|
||||
private void addAddress(StringBuffer buf, Address addr) {
|
||||
buf.append("<font color=\"#990000\">" + HTMLUtilities.friendlyEncodeHTML(addr.toString()) +
|
||||
"</font>");
|
||||
buf.append(
|
||||
"<font color=\"#990000\">" + HTMLUtilities.escapeHTML(addr.toString()) + "</font>");
|
||||
}
|
||||
|
||||
private void updateWest() {
|
||||
|
@ -524,9 +524,9 @@ public class VariousChoicesPanel extends ConflictPanel {
|
||||
(displayedFont != null) ? getFontMetrics(displayedFont) : null;
|
||||
int stringWidth =
|
||||
(fontMetrics != null) ? fontMetrics.stringWidth(displayedText) : 0;
|
||||
setToolTipText((stringWidth > displayedWidth)
|
||||
? "<html>" + HTMLUtilities.friendlyEncodeHTML(text)
|
||||
: null);
|
||||
setToolTipText(
|
||||
(stringWidth > displayedWidth) ? "<html>" + HTMLUtilities.escapeHTML(text)
|
||||
: null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -480,9 +480,9 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
||||
(displayedFont != null) ? getFontMetrics(displayedFont) : null;
|
||||
int stringWidth =
|
||||
(fontMetrics != null) ? fontMetrics.stringWidth(displayedText) : 0;
|
||||
setToolTipText((stringWidth > displayedWidth)
|
||||
? "<html>" + HTMLUtilities.friendlyEncodeHTML(text)
|
||||
: null);
|
||||
setToolTipText(
|
||||
(stringWidth > displayedWidth) ? "<html>" + HTMLUtilities.escapeHTML(text)
|
||||
: null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -240,7 +240,7 @@ public class ConflictUtility {
|
||||
*/
|
||||
public static String getAddressString(Address address) {
|
||||
return colorString(ADDRESS_COLOR,
|
||||
((address != null) ? HTMLUtilities.friendlyEncodeHTML(address.toString()) : ""));
|
||||
((address != null) ? HTMLUtilities.escapeHTML(address.toString()) : ""));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -251,8 +251,7 @@ public class ConflictUtility {
|
||||
*/
|
||||
public static String getAddressString(Address address, boolean showAddressSpace) {
|
||||
return colorString(ADDRESS_COLOR,
|
||||
((address != null)
|
||||
? HTMLUtilities.friendlyEncodeHTML(address.toString(showAddressSpace))
|
||||
((address != null) ? HTMLUtilities.escapeHTML(address.toString(showAddressSpace))
|
||||
: ""));
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
buffy.append("<TR>");
|
||||
buffy.append("<TD>");
|
||||
buffy.append(specialFontOpen);
|
||||
buffy.append(HTMLUtilities.friendlyEncodeHTML(program.getName()));
|
||||
buffy.append(HTMLUtilities.escapeHTML(program.getName()));
|
||||
buffy.append(specialFontClose);
|
||||
buffy.append("</TD>");
|
||||
buffy.append("<TD>");
|
||||
@ -325,7 +325,7 @@ class AnalyzeAllOpenProgramsTask extends Task {
|
||||
for (Program program : invalidList) {
|
||||
buffy.append("<TR>");
|
||||
buffy.append("<TD>");
|
||||
buffy.append(HTMLUtilities.friendlyEncodeHTML(program.getName()));
|
||||
buffy.append(HTMLUtilities.escapeHTML(program.getName()));
|
||||
buffy.append("</TD>");
|
||||
buffy.append("<TD>");
|
||||
buffy.append(program.getLanguageID());
|
||||
|
@ -1098,7 +1098,7 @@ public class AutoAnalysisManager implements DomainObjectListener, DomainObjectCl
|
||||
}
|
||||
if (GhidraProgramUtilities.shouldAskToAnalyze(program)) {
|
||||
int answer = OptionDialog.showYesNoDialog(tool.getToolFrame(), "Analyze",
|
||||
"<html>" + HTMLUtilities.friendlyEncodeHTML(program.getDomainFile().getName()) +
|
||||
"<html>" + HTMLUtilities.escapeHTML(program.getDomainFile().getName()) +
|
||||
" has not been analyzed. Would you like to analyze it now?");
|
||||
boolean analyzed = answer == OptionDialog.OPTION_ONE;
|
||||
GhidraProgramUtilities.setAnalyzedFlag(program, analyzed);
|
||||
|
@ -118,11 +118,11 @@ public class BookmarkNavigator {
|
||||
String cat = bookmarks[i].getCategory();
|
||||
if (cat != null && cat.length() != 0) {
|
||||
buf.append(" [");
|
||||
buf.append(HTMLUtilities.friendlyEncodeHTML(cat));
|
||||
buf.append(HTMLUtilities.escapeHTML(cat));
|
||||
buf.append("]");
|
||||
}
|
||||
buf.append(": ");
|
||||
buf.append(HTMLUtilities.friendlyEncodeHTML(bookmarks[i].getComment()));
|
||||
buf.append(HTMLUtilities.escapeHTML(bookmarks[i].getComment()));
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class ProgramAddressRelationshipListingHover extends AbstractConfigurable
|
||||
|
||||
MemoryBlock block = program.getMemory().getBlock(loc);
|
||||
long memblockOffset = loc.subtract(block.getStart());
|
||||
appendTableRow(sb, "Memory Block Offset", HTMLUtilities.friendlyEncodeHTML(block.getName()),
|
||||
appendTableRow(sb, "Memory Block Offset", HTMLUtilities.escapeHTML(block.getName()),
|
||||
memblockOffset);
|
||||
|
||||
addFunctionInfo(program, loc, sb);
|
||||
@ -143,8 +143,8 @@ public class ProgramAddressRelationshipListingHover extends AbstractConfigurable
|
||||
Function function = program.getFunctionManager().getFunctionContaining(loc);
|
||||
if (function != null) {
|
||||
long functionOffset = loc.subtract(function.getEntryPoint());
|
||||
appendTableRow(sb, "Function Offset",
|
||||
HTMLUtilities.friendlyEncodeHTML(function.getName()), functionOffset);
|
||||
appendTableRow(sb, "Function Offset", HTMLUtilities.escapeHTML(function.getName()),
|
||||
functionOffset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1466,7 +1466,7 @@ public abstract class CompEditorModel extends CompositeEditorModel {
|
||||
originalIsChanging = true;
|
||||
try {
|
||||
if (hadChanges) {
|
||||
String message = "<html>" + HTMLUtilities.friendlyEncodeHTML(oldName) +
|
||||
String message = "<html>" + HTMLUtilities.escapeHTML(oldName) +
|
||||
" has changed outside the editor.<br>" +
|
||||
"Discard edits & reload the " + getTypeName() + "?";
|
||||
String title = "Reload " + getTypeName() + " Editor?";
|
||||
@ -1570,7 +1570,7 @@ public abstract class CompEditorModel extends CompositeEditorModel {
|
||||
consideringReplacedDataType = true;
|
||||
try {
|
||||
String message =
|
||||
"<html>" + HTMLUtilities.friendlyEncodeHTML(oldPath.getPath()) +
|
||||
"<html>" + HTMLUtilities.escapeHTML(oldPath.getPath()) +
|
||||
" has changed outside the editor.<br>" +
|
||||
"Discard edits & reload the " + getTypeName() + "?";
|
||||
String title = "Reload " + getTypeName() + " Editor?";
|
||||
|
@ -302,7 +302,7 @@ public class CParserPlugin extends ProgramPlugin {
|
||||
list.add(openDTmanagers[i]);
|
||||
if (!(openDTmanagers[i] instanceof BuiltInDataTypeManager)) {
|
||||
htmlNamesList += "<li><b>" +
|
||||
HTMLUtilities.friendlyEncodeHTML(openDTmanagers[i].getName()) + "</b></li>";
|
||||
HTMLUtilities.escapeHTML(openDTmanagers[i].getName()) + "</b></li>";
|
||||
}
|
||||
}
|
||||
openDTmanagers = list.toArray(new DataTypeManager[0]);
|
||||
|
@ -569,8 +569,7 @@ public class CreateStructureDialog extends DialogComponentProvider {
|
||||
message = EXISITING_STRUCTURE_STATUS_PREFIX;
|
||||
}
|
||||
|
||||
setStatusText(
|
||||
"<HTML>" + message + "<BR>\"" + HTMLUtilities.friendlyEncodeHTML(name) + "\"");
|
||||
setStatusText("<HTML>" + message + "<BR>\"" + HTMLUtilities.escapeHTML(name) + "\"");
|
||||
}
|
||||
|
||||
// this class is used instead of a cell renderer so that sorting will
|
||||
|
@ -53,7 +53,7 @@ public class DataOrganizationDialog extends DialogComponentProvider {
|
||||
|
||||
JPanel headerPanel = new JPanel();
|
||||
headerPanel.add(new GHtmlLabel("<HTML>Alignment Information for <b>" +
|
||||
HTMLUtilities.friendlyEncodeHTML(dataTypeManager.getName()) + "</b>.</HTML>"));
|
||||
HTMLUtilities.escapeHTML(dataTypeManager.getName()) + "</b>.</HTML>"));
|
||||
|
||||
alignPanel = new DataOrganizationPanel();
|
||||
alignPanel.setOrganization(dataOrganization);
|
||||
|
@ -65,8 +65,8 @@ class DataTypeComparePanel extends JPanel {
|
||||
leftPanelLabel.setBorder(BorderFactory.createEmptyBorder(2, 8, 2, 0));
|
||||
rightPanelLabel.setBorder(BorderFactory.createEmptyBorder(2, 8, 2, 0));
|
||||
|
||||
setLabelText(leftPanelLabel, HTMLUtilities.friendlyEncodeHTML(clientName) + ":");
|
||||
setLabelText(rightPanelLabel, HTMLUtilities.friendlyEncodeHTML(sourceName) + ":");
|
||||
setLabelText(leftPanelLabel, HTMLUtilities.escapeHTML(clientName) + ":");
|
||||
setLabelText(rightPanelLabel, HTMLUtilities.escapeHTML(sourceName) + ":");
|
||||
|
||||
add(leftPanel);
|
||||
add(rightPanel);
|
||||
|
@ -334,8 +334,8 @@ public class DataTypeSynchronizer {
|
||||
|
||||
buffy.append("<TR BORDER=LEFT>");
|
||||
buffy.append("<TD VALIGN=\"TOP\">");
|
||||
buffy.append("<B>").append(
|
||||
HTMLUtilities.friendlyEncodeHTML(dataTypeManager.getName())).append("</B><HR NOSHADE>");
|
||||
buffy.append("<B>").append(HTMLUtilities.escapeHTML(dataTypeManager.getName())).append(
|
||||
"</B><HR NOSHADE>");
|
||||
buffy.append(htmlContent);
|
||||
|
||||
// horizontal spacer below the inner table in order to force a minimum width
|
||||
@ -347,8 +347,8 @@ public class DataTypeSynchronizer {
|
||||
buffy.append("</TD>");
|
||||
|
||||
buffy.append("<TD VALIGN=\"TOP\">");
|
||||
buffy.append("<B>").append(
|
||||
HTMLUtilities.friendlyEncodeHTML(sourceArchive.getName())).append("</B><HR NOSHADE>");
|
||||
buffy.append("<B>").append(HTMLUtilities.escapeHTML(sourceArchive.getName())).append(
|
||||
"</B><HR NOSHADE>");
|
||||
|
||||
buffy.append(otherContent);
|
||||
|
||||
|
@ -197,8 +197,8 @@ class OpenDomainFileTask extends Task {
|
||||
if (dfile.isInWritableProject() && dfile.canRecover()) {
|
||||
Runnable r = () -> {
|
||||
int option = OptionDialog.showYesNoDialog(null, "Crash Recovery Data Found",
|
||||
"<html>" + HTMLUtilities.friendlyEncodeHTML(dfile.getName()) +
|
||||
" has crash data.<br>" + "Would you like to recover unsaved changes?");
|
||||
"<html>" + HTMLUtilities.escapeHTML(dfile.getName()) + " has crash data.<br>" +
|
||||
"Would you like to recover unsaved changes?");
|
||||
recoverFile[0] = (option == OptionDialog.OPTION_ONE);
|
||||
};
|
||||
SwingUtilities.invokeAndWait(r);
|
||||
|
@ -62,7 +62,7 @@ public class CreatePointerAction extends DockingAction {
|
||||
Msg.showInfo(getClass(), gTree, "Pointers Filter Enabled",
|
||||
"<html>Newly created pointer is filtered out of view.<br><br>Toggle the " +
|
||||
"<b>Filter Pointers " + "Action</b> to view the pointer<br>Pointer: " +
|
||||
HTMLUtilities.friendlyEncodeHTML(newManager.getName() + newPath));
|
||||
HTMLUtilities.escapeHTML(newManager.getName() + newPath));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ public class DeleteArchiveAction extends DockingAction {
|
||||
if (OptionDialog.showOptionDialogWithCancelAsDefaultButton(gTree,
|
||||
"Confirm Delete Operation",
|
||||
"<html><b>Are you sure you want to delete archive: " +
|
||||
HTMLUtilities.friendlyEncodeHTML(node.getName()) + "?<br><br>" +
|
||||
HTMLUtilities.escapeHTML(node.getName()) + "?<br><br>" +
|
||||
"<font color=\"red\">(WARNING: This action will permanently " +
|
||||
"delete the file from disk.)</font></b>",
|
||||
"Yes", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {
|
||||
|
@ -77,7 +77,7 @@ public class RemoveInvalidArchiveFromProgramAction extends DockingAction {
|
||||
|
||||
if (OptionDialog.showOptionDialog(gtree, "Confirm Remove Invalid Archive(s)",
|
||||
"<html><b>Are you sure you want to delete archive: " +
|
||||
HTMLUtilities.friendlyEncodeHTML(invalidArchiveNode.getName()) +
|
||||
HTMLUtilities.escapeHTML(invalidArchiveNode.getName()) +
|
||||
" from the program?<br><br>" +
|
||||
"<font color=\"red\">(WARNING: This action will disassociate " +
|
||||
"all datatypes in the program from this archive.)</font></b>",
|
||||
|
@ -398,8 +398,8 @@ public class EnumEditorProvider extends ComponentProviderAdapter
|
||||
newVal = "Missing";
|
||||
}
|
||||
msg.append(String.format("<li>%s: 0x%s \u2192 <font color=#ff0000>%s</font></li>",
|
||||
HTMLUtilities.friendlyEncodeHTML(field),
|
||||
Long.toHexString(originalEnum.getValue(field)), newVal));
|
||||
HTMLUtilities.escapeHTML(field), Long.toHexString(originalEnum.getValue(field)),
|
||||
newVal));
|
||||
}
|
||||
msg.append("</ul>");
|
||||
msg.append(
|
||||
|
@ -140,7 +140,7 @@ public class CategoryNode extends GTreeLazyNode implements DataTypeTreeNode {
|
||||
|
||||
@Override
|
||||
public String getToolTip() {
|
||||
return "<html>" + HTMLUtilities.friendlyEncodeHTML(category.getCategoryPathName());
|
||||
return "<html>" + HTMLUtilities.escapeHTML(category.getCategoryPathName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,7 +103,7 @@ public class DomainFileArchiveNode extends ArchiveNode {
|
||||
public String getToolTip() {
|
||||
DomainFile file = ((DomainFileArchive) archive).getDomainFile();
|
||||
if (file != null) {
|
||||
return "<html>" + HTMLUtilities.friendlyEncodeHTML(file.getPathname());
|
||||
return "<html>" + HTMLUtilities.escapeHTML(file.getPathname());
|
||||
}
|
||||
return "[Unsaved New Domain File Archive]";
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class FileArchiveNode extends ArchiveNode {
|
||||
public String getToolTip() {
|
||||
ResourceFile file = fileArchive.getFile();
|
||||
if (file != null) {
|
||||
return "<html>" + HTMLUtilities.friendlyEncodeHTML(file.getAbsolutePath());
|
||||
return "<html>" + HTMLUtilities.escapeHTML(file.getAbsolutePath());
|
||||
}
|
||||
return "[Unsaved New Archive]";
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class InvalidArchiveNode extends ArchiveNode {
|
||||
ArchiveType archiveType = ((InvalidFileArchive) archive).getArchiveType();
|
||||
String type = archiveType == ArchiveType.FILE ? "File" : "Project";
|
||||
return "<html>Unable to locate " + type + " data type archive: " +
|
||||
HTMLUtilities.friendlyEncodeHTML(archive.getName());
|
||||
HTMLUtilities.escapeHTML(archive.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +29,7 @@ public class ProgramArchiveNode extends DomainFileArchiveNode {
|
||||
public String getToolTip() {
|
||||
DomainFile file = ((ProgramArchive) archive).getDomainFile();
|
||||
if (file != null) {
|
||||
return "<html>" + HTMLUtilities.friendlyEncodeHTML(file.getPathname());
|
||||
return "<html>" + HTMLUtilities.escapeHTML(file.getPathname());
|
||||
}
|
||||
return "[Unsaved New Program Archive]";
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class ProjectArchiveNode extends DomainFileArchiveNode {
|
||||
public String getToolTip() {
|
||||
DomainFile file = ((ProjectArchive) archive).getDomainFile();
|
||||
if (file != null) {
|
||||
return "<html>" + HTMLUtilities.friendlyEncodeHTML(file.getPathname());
|
||||
return "<html>" + HTMLUtilities.escapeHTML(file.getPathname());
|
||||
}
|
||||
return "[Unsaved New Project Archive]";
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ public class DisassembledViewPlugin extends ProgramPlugin implements DomainObjec
|
||||
setFont(font);
|
||||
|
||||
setToolTipText(TOOLTIP_TEXT_PREPEND +
|
||||
HTMLUtilities.friendlyEncodeHTML(currentLocation.getAddress().toString()));
|
||||
HTMLUtilities.escapeHTML(currentLocation.getAddress().toString()));
|
||||
|
||||
// make sure the first value is highlighted to indicate
|
||||
// that it is the selected program location
|
||||
|
@ -321,10 +321,9 @@ abstract class FlowArrow {
|
||||
}
|
||||
|
||||
public String getDisplayString() {
|
||||
return "<html><table><tr><td>start</td><td>" +
|
||||
HTMLUtilities.friendlyEncodeHTML(start.toString()) + "</td><tr><td>end</td><td>" +
|
||||
HTMLUtilities.friendlyEncodeHTML(end.toString()) + "</td><tr><td>ref type</td><td>" +
|
||||
refType + "</td></tr></table>";
|
||||
return "<html><table><tr><td>start</td><td>" + HTMLUtilities.escapeHTML(start.toString()) +
|
||||
"</td><tr><td>end</td><td>" + HTMLUtilities.escapeHTML(end.toString()) +
|
||||
"</td><tr><td>ref type</td><td>" + refType + "</td></tr></table>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,7 +50,7 @@ public class FunctionTagList extends JList<FunctionTag> {
|
||||
return "<no comment set>";
|
||||
}
|
||||
|
||||
return "<html>" + HTMLUtilities.friendlyEncodeHTML(tag.getComment());
|
||||
return "<html>" + HTMLUtilities.escapeHTML(tag.getComment());
|
||||
}
|
||||
|
||||
return "";
|
||||
|
@ -90,11 +90,11 @@ public class AddressTypeOverviewColorService
|
||||
AddressType addressType = getAddressType(address);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("<b>");
|
||||
buffer.append(HTMLUtilities.friendlyEncodeHTML(getName()));
|
||||
buffer.append(HTMLUtilities.escapeHTML(getName()));
|
||||
buffer.append("</b>\n");
|
||||
buffer.append(addressType.getDescription());
|
||||
buffer.append(" (");
|
||||
buffer.append(HTMLUtilities.friendlyEncodeHTML(getBlockName(address)));
|
||||
buffer.append(HTMLUtilities.escapeHTML(getBlockName(address)));
|
||||
buffer.append(" ");
|
||||
buffer.append(address);
|
||||
buffer.append(" )");
|
||||
|
@ -88,17 +88,17 @@ public class EntropyOverviewColorService implements OverviewColorService {
|
||||
double entropy = (entropyScaled * 8.0d) / 255; // convert back from palette scale to original entropy value
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("<b>");
|
||||
buffer.append(HTMLUtilities.friendlyEncodeHTML(getName()));
|
||||
buffer.append(HTMLUtilities.escapeHTML(getName()));
|
||||
buffer.append("</b>\n");
|
||||
buffer.append(" ");
|
||||
buffer.append(formatter.format(entropy));
|
||||
buffer.append(" ");
|
||||
buffer.append(HTMLUtilities.friendlyEncodeHTML(getKnotName(entropyScaled)));
|
||||
buffer.append(HTMLUtilities.escapeHTML(getKnotName(entropyScaled)));
|
||||
buffer.append(" ");
|
||||
buffer.append("    (");
|
||||
buffer.append(HTMLUtilities.friendlyEncodeHTML(getBlockName(address)));
|
||||
buffer.append(HTMLUtilities.escapeHTML(getBlockName(address)));
|
||||
buffer.append(" ");
|
||||
buffer.append(HTMLUtilities.friendlyEncodeHTML(address.toString()));
|
||||
buffer.append(HTMLUtilities.escapeHTML(address.toString()));
|
||||
buffer.append(" )");
|
||||
return HTMLUtilities.toWrappedHTML(buffer.toString(), 0);
|
||||
}
|
||||
|
@ -558,7 +558,7 @@ public class ProgramManagerPlugin extends Plugin implements ProgramManager {
|
||||
Program program = context.getProgram();
|
||||
String programName = "'" + program.getDomainFile().getName() + "'";
|
||||
getMenuBarData().setMenuItemName("&Close " + programName);
|
||||
setDescription("<html>Close " + HTMLUtilities.friendlyEncodeHTML(programName));
|
||||
setDescription("<html>Close " + HTMLUtilities.escapeHTML(programName));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -266,7 +266,7 @@ class ProgramSaveManager {
|
||||
if (!df.isInWritableProject()) {
|
||||
return OptionDialog.showOptionDialog(tool.getToolFrame(), "Program Changed",
|
||||
HTMLUtilities.lineWrapWithHTMLLineBreaks(
|
||||
"<html>Viewed file '" + HTMLUtilities.friendlyEncodeHTML(filename) +
|
||||
"<html>Viewed file '" + HTMLUtilities.escapeHTML(filename) +
|
||||
"' has been changed. \n" + "If you continue, your changes will be lost!"),
|
||||
"Continue", OptionDialog.QUESTION_MESSAGE) != OptionDialog.CANCEL_OPTION;
|
||||
}
|
||||
@ -274,16 +274,15 @@ class ProgramSaveManager {
|
||||
if (df.isReadOnly()) {
|
||||
return OptionDialog.showOptionDialog(tool.getToolFrame(), "Program Changed",
|
||||
HTMLUtilities.lineWrapWithHTMLLineBreaks(
|
||||
"<html>Read-only file '" + HTMLUtilities.friendlyEncodeHTML(filename) +
|
||||
"<html>Read-only file '" + HTMLUtilities.escapeHTML(filename) +
|
||||
"' has been changed. \n" + "If you continue, your changes will be lost!"),
|
||||
"Continue", OptionDialog.QUESTION_MESSAGE) != OptionDialog.CANCEL_OPTION;
|
||||
|
||||
}
|
||||
|
||||
int result = OptionDialog.showOptionDialog(tool.getToolFrame(), "Save Program?",
|
||||
HTMLUtilities.lineWrapWithHTMLLineBreaks(
|
||||
"<html>" + HTMLUtilities.friendlyEncodeHTML(filename) +
|
||||
" has changed.\nDo you want to save it?"),
|
||||
HTMLUtilities.lineWrapWithHTMLLineBreaks("<html>" + HTMLUtilities.escapeHTML(filename) +
|
||||
" has changed.\nDo you want to save it?"),
|
||||
"&Save", "Do&n't Save", OptionDialog.QUESTION_MESSAGE);
|
||||
|
||||
if (result == OptionDialog.CANCEL_OPTION) {
|
||||
|
@ -69,7 +69,7 @@ public class RedoAction extends ProgramContextAction {
|
||||
String programName = program.getDomainFile().getName();
|
||||
getMenuBarData().setMenuItemName("Redo " + programName);
|
||||
String tip = HTMLUtilities.toWrappedHTML(
|
||||
"Redo " + HTMLUtilities.friendlyEncodeHTML(program.getRedoName()));
|
||||
"Redo " + HTMLUtilities.escapeHTML(program.getRedoName()));
|
||||
setDescription(tip);
|
||||
return true;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class UndoAction extends ProgramContextAction {
|
||||
String programName = program.getDomainFile().getName();
|
||||
getMenuBarData().setMenuItemName("Undo " + programName);
|
||||
String tip = HTMLUtilities.toWrappedHTML(
|
||||
"Undo " + HTMLUtilities.friendlyEncodeHTML(program.getUndoName()));
|
||||
"Undo " + HTMLUtilities.escapeHTML(program.getUndoName()));
|
||||
setDescription(tip);
|
||||
return true;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class SymbolNode extends GTreeSlowLoadingNode implements SymbolTreeNode {
|
||||
|
||||
@Override
|
||||
public String getToolTip() {
|
||||
return "<html>" + HTMLUtilities.friendlyEncodeHTML(symbol.getName(true));
|
||||
return "<html>" + HTMLUtilities.escapeHTML(symbol.getName(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -388,7 +388,7 @@ public abstract class GhidraScript extends FlatProgramAPI {
|
||||
protected boolean promptToKeepChangesOnException() {
|
||||
|
||||
String message = "<html>Encountered exception running script \"" +
|
||||
HTMLUtilities.friendlyEncodeHTML(sourceFile.getName()) +
|
||||
HTMLUtilities.escapeHTML(sourceFile.getName()) +
|
||||
"\".<br><br>Keep the changes to the program?";
|
||||
//@formatter:off
|
||||
int choice =
|
||||
|
@ -434,22 +434,20 @@ public class ScriptInfo {
|
||||
*/
|
||||
public String getToolTipText() {
|
||||
String htmlDescription = (description == null) ? "No Description"
|
||||
: HTMLUtilities.friendlyEncodeHTML(description).replaceAll("\n",
|
||||
: HTMLUtilities.escapeHTML(description).replaceAll("\n",
|
||||
HTML_NEW_LINE + HTML_SPACE);
|
||||
String htmlAuthor = HTMLUtilities.bold("Author:") + HTML_SPACE +
|
||||
HTMLUtilities.friendlyEncodeHTML(toToolTip(author));
|
||||
String htmlCategory =
|
||||
HTMLUtilities.bold("Category:") + HTML_SPACE + HTMLUtilities.friendlyEncodeHTML(
|
||||
toToolTip(StringUtilities.convertStringArray(category, ".")));
|
||||
HTMLUtilities.escapeHTML(toToolTip(author));
|
||||
String htmlCategory = HTMLUtilities.bold("Category:") + HTML_SPACE +
|
||||
HTMLUtilities.escapeHTML(toToolTip(StringUtilities.convertStringArray(category, ".")));
|
||||
String htmlKeyBinding =
|
||||
HTMLUtilities.bold("Key Binding:") + HTML_SPACE + getKeybindingToolTip();
|
||||
String htmlMenuPath =
|
||||
HTMLUtilities.bold("Menu Path:") + HTML_SPACE + HTMLUtilities.friendlyEncodeHTML(
|
||||
toToolTip(StringUtilities.convertStringArray(menupath, ".")));
|
||||
String htmlMenuPath = HTMLUtilities.bold("Menu Path:") + HTML_SPACE +
|
||||
HTMLUtilities.escapeHTML(toToolTip(StringUtilities.convertStringArray(menupath, ".")));
|
||||
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("<h3>").append(HTML_SPACE).append(
|
||||
HTMLUtilities.friendlyEncodeHTML(getName())).append("</h3>");
|
||||
buffer.append("<h3>").append(HTML_SPACE).append(HTMLUtilities.escapeHTML(getName())).append(
|
||||
"</h3>");
|
||||
buffer.append(HTML_NEW_LINE);
|
||||
buffer.append(HTML_SPACE).append(htmlDescription);
|
||||
buffer.append(HTML_NEW_LINE);
|
||||
|
@ -314,7 +314,7 @@ public class CParserUtils {
|
||||
// -remove newlines because the line wrapping utility always breaks on those
|
||||
parseMessage = errorMessage.replaceAll("\n", " ");
|
||||
parseMessage = HTMLUtilities.lineWrapWithHTMLLineBreaks(
|
||||
HTMLUtilities.friendlyEncodeHTML(parseMessage), 80);
|
||||
HTMLUtilities.escapeHTML(parseMessage), 80);
|
||||
parseMessage = "<br><br>" + parseMessage + "<br>";
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class DefaultDataTypeHTMLRepresentation extends HTMLDataTypeRepresentatio
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
|
||||
String headerText = header.getText();
|
||||
String encodedHeaderText = HTMLUtilities.friendlyEncodeHTML(headerText);
|
||||
String encodedHeaderText = HTMLUtilities.escapeHTML(headerText);
|
||||
headerText = wrapStringInColor(encodedHeaderText, header.getTextColor());
|
||||
buffer.append(headerText);
|
||||
|
||||
|
@ -135,7 +135,7 @@ public abstract class HTMLDataTypeRepresentation {
|
||||
if (comment == null) {
|
||||
comment = dataType.getDescription();
|
||||
}
|
||||
return comment == null ? "" : HTMLUtilities.friendlyEncodeHTML(comment);
|
||||
return comment == null ? "" : HTMLUtilities.escapeHTML(comment);
|
||||
}
|
||||
|
||||
protected static String truncateAsNecessary(String string) {
|
||||
@ -327,7 +327,7 @@ public abstract class HTMLDataTypeRepresentation {
|
||||
|
||||
// put the path info in
|
||||
CategoryPath path = dataType.getCategoryPath();
|
||||
headerLines.add(new TextLine(HTMLUtilities.friendlyEncodeHTML(path.getPath())));
|
||||
headerLines.add(new TextLine(HTMLUtilities.escapeHTML(path.getPath())));
|
||||
headerLines.add(new TextLine(BR));
|
||||
|
||||
return headerLines;
|
||||
|
@ -29,7 +29,7 @@ public class MissingArchiveDataTypeHTMLRepresentation extends HTMLDataTypeRepres
|
||||
return "<i>Could not find data type archive</i>";
|
||||
}
|
||||
return "<i>Could not access data type archive: " +
|
||||
HTMLUtilities.friendlyEncodeHTML(sourceArchive.getName()) + "</i>";
|
||||
HTMLUtilities.escapeHTML(sourceArchive.getName()) + "</i>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -253,7 +253,7 @@ public class OpenProgramTask extends Task {
|
||||
|
||||
SystemUtilities.runSwingNow(() -> {
|
||||
int option = OptionDialog.showYesNoDialog(null, "Crash Recovery Data Found",
|
||||
"<html>" + HTMLUtilities.friendlyEncodeHTML(filename) + " has crash data.<br>" +
|
||||
"<html>" + HTMLUtilities.escapeHTML(filename) + " has crash data.<br>" +
|
||||
"Would you like to recover unsaved changes?");
|
||||
result.set(option == OptionDialog.OPTION_ONE);
|
||||
});
|
||||
|
@ -43,14 +43,14 @@ public class HorizontalRuleAction extends DockingAction {
|
||||
// '&' of the replacement html entity (like '<') will be consumed by the menudata deity
|
||||
// and lost forever.
|
||||
setMenuBarData(new MenuData(new String[] {
|
||||
"<HTML><CENTER><FONT SIZE=2 COLOR=SILVER>" + HTMLUtilities.friendlyEncodeHTML(topName) +
|
||||
"<BR>" + HTMLUtilities.friendlyEncodeHTML(bottomName) + "</FONT></CENTER>" }));
|
||||
"<HTML><CENTER><FONT SIZE=2 COLOR=SILVER>" + HTMLUtilities.escapeHTML(topName) +
|
||||
"<BR>" + HTMLUtilities.escapeHTML(bottomName) + "</FONT></CENTER>" }));
|
||||
|
||||
// the description is meant to be used for the tooltip and is larger
|
||||
String padding = " ";
|
||||
setDescription("<HTML><CENTER><B>" + padding + HTMLUtilities.friendlyEncodeHTML(topName) +
|
||||
padding + "<B><HR><B>" + padding + HTMLUtilities.friendlyEncodeHTML(bottomName) +
|
||||
padding + "</B></CENTER>");
|
||||
setDescription("<HTML><CENTER><B>" + padding + HTMLUtilities.escapeHTML(topName) + padding +
|
||||
"<B><HR><B>" + padding + HTMLUtilities.escapeHTML(bottomName) + padding +
|
||||
"</B></CENTER>");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -176,7 +176,7 @@ class DiffActionManager {
|
||||
openCloseProgram2Action.setDescription(
|
||||
"<html><center>Close Diff View</center><br>" +
|
||||
"Current diff: " +
|
||||
"<b>"+HTMLUtilities.friendlyEncodeHTML(firstName)+"</b> to <b>" +HTMLUtilities.friendlyEncodeHTML(secondName)+"</b>");
|
||||
"<b>"+HTMLUtilities.escapeHTML(firstName)+"</b> to <b>" +HTMLUtilities.escapeHTML(secondName)+"</b>");
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
|
@ -119,10 +119,9 @@ public class ApplyBlockedMatchAction extends DockingAction {
|
||||
|
||||
private String getAssociationDisplayString(VTAssociation association) {
|
||||
return association.getType().toString() + " match with source of <b>" +
|
||||
HTMLUtilities.friendlyEncodeHTML(association.getSourceAddress().toString()) +
|
||||
HTMLUtilities.escapeHTML(association.getSourceAddress().toString()) +
|
||||
"</b> and destination of <b>" +
|
||||
HTMLUtilities.friendlyEncodeHTML(association.getDestinationAddress().toString()) +
|
||||
"</b>";
|
||||
HTMLUtilities.escapeHTML(association.getDestinationAddress().toString()) + "</b>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -99,8 +99,8 @@ public class SummaryPanel extends AbstractMageJPanel<VTWizardStateKey> {
|
||||
// source program
|
||||
|
||||
label.append("Source Program:");
|
||||
summary.append(sourceProgramName == null ? "(null)"
|
||||
: HTMLUtilities.friendlyEncodeHTML(sourceProgramName));
|
||||
summary.append(
|
||||
sourceProgramName == null ? "(null)" : HTMLUtilities.escapeHTML(sourceProgramName));
|
||||
label.append("<br>");
|
||||
summary.append("<br>");
|
||||
|
||||
@ -108,7 +108,7 @@ public class SummaryPanel extends AbstractMageJPanel<VTWizardStateKey> {
|
||||
|
||||
label.append("Destination Program:");
|
||||
summary.append(destinationProgramName == null ? "(null)"
|
||||
: HTMLUtilities.friendlyEncodeHTML(destinationProgramName));
|
||||
: HTMLUtilities.escapeHTML(destinationProgramName));
|
||||
label.append("<br>");
|
||||
summary.append("<br>");
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class VTWizardUtils {
|
||||
String filename = domainFile.getName();
|
||||
int result = OptionDialog.showYesNoDialog(parent, "Save Version Tracking Changes?",
|
||||
"<html>Unsaved Version Tracking changes found for session: " +
|
||||
HTMLUtilities.friendlyEncodeHTML(filename) + ". <br>" +
|
||||
HTMLUtilities.escapeHTML(filename) + ". <br>" +
|
||||
"Would you like to save these changes?");
|
||||
|
||||
boolean doSave = result == OptionDialog.YES_OPTION;
|
||||
@ -100,7 +100,7 @@ public class VTWizardUtils {
|
||||
String filename = domainFile.getName();
|
||||
int result = OptionDialog.showYesNoCancelDialog(parent, "Save Version Tracking Changes?",
|
||||
"<html>Unsaved Version Tracking changes found for session: " +
|
||||
HTMLUtilities.friendlyEncodeHTML(filename) + ". <br>" +
|
||||
HTMLUtilities.escapeHTML(filename) + ". <br>" +
|
||||
"Would you like to save these changes?");
|
||||
|
||||
if (result == OptionDialog.CANCEL_OPTION) {
|
||||
|
@ -138,7 +138,7 @@ public class OptionsPanel extends JPanel {
|
||||
Options currentOptions = getSelectedOptions();
|
||||
|
||||
int userChoice = OptionDialog.showOptionDialog(viewPanel, "Restore Defaults?",
|
||||
"<html>Restore <b>" + HTMLUtilities.friendlyEncodeHTML(currentOptions.getName()) +
|
||||
"<html>Restore <b>" + HTMLUtilities.escapeHTML(currentOptions.getName()) +
|
||||
"</b> to default option values <b>and erase current settings?</b>",
|
||||
"Restore Defaults");
|
||||
if (userChoice == OptionDialog.CANCEL_OPTION) {
|
||||
|
@ -127,7 +127,7 @@ public class FileDropDownSelectionDataModel implements DropDownTextFieldDataMode
|
||||
public String getDescription(File file) {
|
||||
boolean isDir = file.isDirectory();
|
||||
return "<html><table>" + "<tr><td>" + (isDir ? "Directory: " : "File: ") + "</td><td>" +
|
||||
"<b>" + HTMLUtilities.friendlyEncodeHTML(file.getName()) + "</b>" + "</td></tr>" +
|
||||
"<b>" + HTMLUtilities.escapeHTML(file.getName()) + "</b>" + "</td></tr>" +
|
||||
"<tr><td>Size:</td><td>" + (isDir ? "0" : file.length()) + " bytes" + "</td></tr>" +
|
||||
"<tr><td>Last modified:</td><td>" +
|
||||
GhidraFileChooser.format.format(new Date(file.lastModified())) + "</td></tr>" +
|
||||
|
@ -125,11 +125,10 @@ public class FileLocker {
|
||||
for (String name : PROPERTY_KEYS) {
|
||||
buf.append("<tr><td>");
|
||||
buf.append(" ");
|
||||
buf.append(HTMLUtilities.friendlyEncodeHTML(name));
|
||||
buf.append(HTMLUtilities.escapeHTML(name));
|
||||
buf.append(": ");
|
||||
buf.append("</td><td>");
|
||||
buf.append(
|
||||
HTMLUtilities.friendlyEncodeHTML(existingLockProperties.get(name).toString()));
|
||||
buf.append(HTMLUtilities.escapeHTML(existingLockProperties.get(name).toString()));
|
||||
buf.append("</td></tr>");
|
||||
}
|
||||
buf.append("</table>");
|
||||
|
@ -1191,7 +1191,7 @@ public class FrontEndPlugin extends Plugin
|
||||
// assume no tools in the tool chest
|
||||
Msg.showInfo(this, tool.getToolFrame(), "Cannot Find Tool",
|
||||
"<html>Cannot find tool to open file: <b>" +
|
||||
HTMLUtilities.friendlyEncodeHTML(domainFile.getName()) +
|
||||
HTMLUtilities.escapeHTML(domainFile.getName()) +
|
||||
"</b>.<br><br>Make sure you have an appropriate tool installed <br>from the " +
|
||||
"<b>Tools->Import Default Tools...</b> menu. Alternatively, you can " +
|
||||
"use <b>Tool->Set Tool Associations</b> menu to change how Ghidra " +
|
||||
|
@ -139,13 +139,13 @@ class ToolButton extends EmptyBorderButton implements Draggable, Droppable {
|
||||
public String getToolTipText(MouseEvent event) {
|
||||
if (associatedRunningTool != null) {
|
||||
if (associatedRunningTool instanceof PluginTool) {
|
||||
return "<html>" + HTMLUtilities.friendlyEncodeHTML(
|
||||
return "<html>" + HTMLUtilities.escapeHTML(
|
||||
((PluginTool) associatedRunningTool).getToolFrame().getTitle());
|
||||
}
|
||||
|
||||
return "<html>" + HTMLUtilities.friendlyEncodeHTML(associatedRunningTool.getName());
|
||||
return "<html>" + HTMLUtilities.escapeHTML(associatedRunningTool.getName());
|
||||
}
|
||||
return "<html>" + HTMLUtilities.friendlyEncodeHTML(template.getName());
|
||||
return "<html>" + HTMLUtilities.escapeHTML(template.getName());
|
||||
}
|
||||
|
||||
public void launchTool(DomainFile domainFile) {
|
||||
|
@ -90,7 +90,7 @@ public class ProjectDataDeleteAction extends ProjectDataContextAction {
|
||||
if (!selectedFiles.isEmpty()) {
|
||||
DomainFile file = CollectionUtils.any(selectedFiles);
|
||||
return "<HTML>Are you sure you want to <B><U>permanently</U></B> delete \"" +
|
||||
HTMLUtilities.friendlyEncodeHTML(file.getName()) + "\"?";
|
||||
HTMLUtilities.escapeHTML(file.getName()) + "\"?";
|
||||
}
|
||||
|
||||
// only folders are selected, but they contain files
|
||||
|
@ -33,7 +33,7 @@ public class ProjectDataOpenToolAction extends ProjectDataContextAction {
|
||||
public ProjectDataOpenToolAction(String owner, String group, String toolName, Icon icon) {
|
||||
super("Open" + toolName, owner);
|
||||
this.toolName = toolName;
|
||||
String[] menuPath = { "Open With", HTMLUtilities.friendlyEncodeHTML(toolName) };
|
||||
String[] menuPath = { "Open With", HTMLUtilities.escapeHTML(toolName) };
|
||||
setPopupMenuData(new MenuData(menuPath, icon, "Open"));
|
||||
setHelpLocation(new HelpLocation(owner, "Open_File_With"));
|
||||
|
||||
|
@ -175,7 +175,7 @@ public abstract class AbstractDetailsPanel extends JPanel {
|
||||
buffer.append("<B>");
|
||||
}
|
||||
|
||||
buffer.append(HTMLUtilities.friendlyEncodeHTML(string));
|
||||
buffer.append(HTMLUtilities.escapeHTML(string));
|
||||
|
||||
if (isBold) {
|
||||
buffer.append("</B>");
|
||||
|
@ -720,7 +720,7 @@ public class KeyBindingsPanel extends JPanel {
|
||||
if (description == null || description.trim().isEmpty()) {
|
||||
description = actions.get(0).getName();
|
||||
}
|
||||
statusLabel.setText("<html>" + HTMLUtilities.friendlyEncodeHTML(description));
|
||||
statusLabel.setText("<html>" + HTMLUtilities.escapeHTML(description));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
statusLabel.setText("");
|
||||
|
@ -142,9 +142,9 @@ class PluginInstallerTableModel
|
||||
if (pluginsThatUseTarget.isEmpty() ||
|
||||
OptionDialog.showYesNoDialog(parentComponent, "Confirm plugin removal",
|
||||
"<html>Other plugins depend on " +
|
||||
HTMLUtilities.friendlyEncodeHTML(targetPluginDescription.getName()) +
|
||||
"<p><p>" + "Removing it will also remove:" + dependenciesToUnloadHtmlList +
|
||||
"<p><p>" + "Continue?") == OptionDialog.YES_OPTION) {
|
||||
HTMLUtilities.escapeHTML(targetPluginDescription.getName()) + "<p><p>" +
|
||||
"Removing it will also remove:" + dependenciesToUnloadHtmlList + "<p><p>" +
|
||||
"Continue?") == OptionDialog.YES_OPTION) {
|
||||
model.removePlugin(targetPluginDescription);
|
||||
}
|
||||
|
||||
|
@ -209,9 +209,8 @@ public class DefaultProject implements Project {
|
||||
return null;
|
||||
}
|
||||
|
||||
String projectStr = "Project: " + HTMLUtilities.friendlyEncodeHTML(locator.getLocation()) +
|
||||
System.getProperty("file.separator") +
|
||||
HTMLUtilities.friendlyEncodeHTML(locator.getName());
|
||||
String projectStr = "Project: " + HTMLUtilities.escapeHTML(locator.getLocation()) +
|
||||
System.getProperty("file.separator") + HTMLUtilities.escapeHTML(locator.getName());
|
||||
String lockInformation = lock.getExistingLockFileInformation();
|
||||
if (!lock.canForceLock()) {
|
||||
Msg.showInfo(getClass(), null, "Project Locked",
|
||||
|
@ -57,9 +57,8 @@ public class SelectChangedToolDialog extends DialogComponentProvider {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
|
||||
String toolName = toolList.get(0).getToolName();
|
||||
JLabel descriptionLabel =
|
||||
new GHtmlLabel(HTMLUtilities.toHTML("There are multiple changed instances of " +
|
||||
HTMLUtilities.friendlyEncodeHTML(toolName) +
|
||||
JLabel descriptionLabel = new GHtmlLabel(HTMLUtilities.toHTML(
|
||||
"There are multiple changed instances of " + HTMLUtilities.escapeHTML(toolName) +
|
||||
" running.<p>Which one would like to save to your tool chest?"));
|
||||
descriptionLabel.setIconTextGap(15);
|
||||
descriptionLabel.setIcon(OptionDialog.getIconForMessageType(OptionDialog.WARNING_MESSAGE));
|
||||
|
Loading…
Reference in New Issue
Block a user