diff options
author | Clément DAVID <clement.david@scilab.org> | 2010-05-21 10:39:27 +0200 |
---|---|---|
committer | Clément DAVID <clement.david@scilab.org> | 2010-05-21 10:39:27 +0200 |
commit | 1c8c296b2825367d8bce5033507983a72bf010a7 (patch) | |
tree | 59e7f7e7ac5352e4107b58ea827686e563744d3b /scilab/modules | |
parent | e1d96a875a8f28fca3967d49384ce3328a213fab (diff) | |
download | scilab-1c8c296b2825367d8bce5033507983a72bf010a7.zip scilab-1c8c296b2825367d8bce5033507983a72bf010a7.tar.gz |
Xcos: fix a StringIndexOutOfBoundsException when using empty string on a text block.
Change-Id: I9ea86e67c0919da4d48b40f79901700052a11c4e
Diffstat (limited to 'scilab/modules')
-rw-r--r-- | scilab/modules/graph/src/java/org/scilab/modules/graph/view/SupportedLabelType.java | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/scilab/modules/graph/src/java/org/scilab/modules/graph/view/SupportedLabelType.java b/scilab/modules/graph/src/java/org/scilab/modules/graph/view/SupportedLabelType.java index b987124..e5a790d 100644 --- a/scilab/modules/graph/src/java/org/scilab/modules/graph/view/SupportedLabelType.java +++ b/scilab/modules/graph/src/java/org/scilab/modules/graph/view/SupportedLabelType.java | |||
@@ -89,23 +89,24 @@ public enum SupportedLabelType { | |||
89 | public static SupportedLabelType getFromHTML(String html) { | 89 | public static SupportedLabelType getFromHTML(String html) { |
90 | if (html.length() > 0 && html.charAt(0) == '<') { | 90 | if (html.length() > 0 && html.charAt(0) == '<') { |
91 | 91 | ||
92 | StringBuilder content; | 92 | final StringBuilder content = new StringBuilder(mxUtils |
93 | content = new StringBuilder(mxUtils.getBodyMarkup(html, false)); | 93 | .getBodyMarkup(html, false)); |
94 | 94 | ||
95 | ScilabGraphUtils.removeBlanks(content); | 95 | ScilabGraphUtils.removeBlanks(content); |
96 | 96 | ||
97 | if ((content.charAt(0) == LATEX_TAG) && ( | 97 | if ((content.length() > 0) && (content.charAt(0) == LATEX_TAG) |
98 | content.charAt(content.length() - 1) == LATEX_TAG)) { | 98 | && (content.charAt(content.length() - 1) == LATEX_TAG)) { |
99 | return Latex; | 99 | return Latex; |
100 | } else if ((content.charAt(0) == MATHML_TAG) && ( | 100 | } else if ((content.length() > 0) |
101 | content.charAt(content.length() - 1) == MATHML_TAG)) { | 101 | && (content.charAt(0) == MATHML_TAG) |
102 | LoadClassPath.loadOnUse(CLASSPATH_MATHML_NAME); | 102 | && (content.charAt(content.length() - 1) == MATHML_TAG)) { |
103 | return MathML; | 103 | LoadClassPath.loadOnUse(CLASSPATH_MATHML_NAME); |
104 | } | 104 | return MathML; |
105 | } | ||
105 | } else { | 106 | } else { |
106 | return getFromText(html); | 107 | return getFromText(html); |
107 | } | 108 | } |
108 | 109 | ||
109 | return HTML; | 110 | return HTML; |
110 | } | 111 | } |
111 | 112 | ||