@Test public void testJavascriptEscape() { assertEquals("", ImageMapUtilities.javascriptEscape("")); assertEquals("abc", ImageMapUtilities.javascriptEscape("abc")); assertEquals("\\\'", ImageMapUtilities.javascriptEscape("\'")); assertEquals("\\\"", ImageMapUtilities.javascriptEscape("\"")); assertEquals("\\\\", ImageMapUtilities.javascriptEscape("\\")); }
public static String javascriptEscape(String input) { if (input == null) { throw new IllegalArgumentException("Null 'input' argument."); } StringBuilder result = new StringBuilder(); int length = input.length(); for (int i = 0; i < length; i++) { char c = input.charAt(i); if (c == '\"') { result.append("\\\""); } else if (c == '\'') { result.append("\\'"); } else if (c == '\\') { result.append("\\\\"); } else { result.append(c); } } return result.toString(); }
ImageMapUtilities { public static String javascriptEscape(String input) { if (input == null) { throw new IllegalArgumentException("Null 'input' argument."); } StringBuilder result = new StringBuilder(); int length = input.length(); for (int i = 0; i < length; i++) { char c = input.charAt(i); if (c == '\"') { result.append("\\\""); } else if (c == '\'') { result.append("\\'"); } else if (c == '\\') { result.append("\\\\"); } else { result.append(c); } } return result.toString(); } }
ImageMapUtilities { public static String javascriptEscape(String input) { if (input == null) { throw new IllegalArgumentException("Null 'input' argument."); } StringBuilder result = new StringBuilder(); int length = input.length(); for (int i = 0; i < length; i++) { char c = input.charAt(i); if (c == '\"') { result.append("\\\""); } else if (c == '\'') { result.append("\\'"); } else if (c == '\\') { result.append("\\\\"); } else { result.append(c); } } return result.toString(); }  }
ImageMapUtilities { public static String javascriptEscape(String input) { if (input == null) { throw new IllegalArgumentException("Null 'input' argument."); } StringBuilder result = new StringBuilder(); int length = input.length(); for (int i = 0; i < length; i++) { char c = input.charAt(i); if (c == '\"') { result.append("\\\""); } else if (c == '\'') { result.append("\\'"); } else if (c == '\\') { result.append("\\\\"); } else { result.append(c); } } return result.toString(); }  static void writeImageMap(PrintWriter writer, String name,
            ChartRenderingInfo info); static void writeImageMap(PrintWriter writer,
            String name, ChartRenderingInfo info,
            boolean useOverLibForToolTips); static void writeImageMap(PrintWriter writer, String name,
            ChartRenderingInfo info,
            ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
            URLTagFragmentGenerator urlTagFragmentGenerator); static String getImageMap(String name, ChartRenderingInfo info); static String getImageMap(String name, ChartRenderingInfo info,
            ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
            URLTagFragmentGenerator urlTagFragmentGenerator); static String htmlEscape(String input); static String javascriptEscape(String input); }
ImageMapUtilities { public static String javascriptEscape(String input) { if (input == null) { throw new IllegalArgumentException("Null 'input' argument."); } StringBuilder result = new StringBuilder(); int length = input.length(); for (int i = 0; i < length; i++) { char c = input.charAt(i); if (c == '\"') { result.append("\\\""); } else if (c == '\'') { result.append("\\'"); } else if (c == '\\') { result.append("\\\\"); } else { result.append(c); } } return result.toString(); }  static void writeImageMap(PrintWriter writer, String name,
            ChartRenderingInfo info); static void writeImageMap(PrintWriter writer,
            String name, ChartRenderingInfo info,
            boolean useOverLibForToolTips); static void writeImageMap(PrintWriter writer, String name,
            ChartRenderingInfo info,
            ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
            URLTagFragmentGenerator urlTagFragmentGenerator); static String getImageMap(String name, ChartRenderingInfo info); static String getImageMap(String name, ChartRenderingInfo info,
            ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
            URLTagFragmentGenerator urlTagFragmentGenerator); static String htmlEscape(String input); static String javascriptEscape(String input);  }