diff options
author | Pekka Enberg <penberg@kernel.org> | 2011-03-14 19:35:48 +0000 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2011-03-14 19:35:48 +0000 |
commit | 28789fb0abb54b1d4451516ec459edd71f37a72b (patch) | |
tree | c5cac6caab7c23f95fa17aa46943fe95f9c3c3b3 /javax | |
parent | c66bb894bbb5b92fee599155b29d9081567e379a (diff) | |
download | classpath-28789fb0abb54b1d4451516ec459edd71f37a72b.tar.gz |
Fix Use ArrayList.set() in StyleSheet.resolveStyle
The following cleanup patch:
More warning fixes.
2009-03-09 Andrew John Hughes <ahughes@redhat.com>
[snip]
* javax/swing/text/html/StyleSheet.java:
Add generic typing.
changed the code to do ArrayList.set() on an instance thats allocated like this:
List<Map<String,String>> attributes =
new ArrayList<Map<String,String>>(count);
This is, however, broken as ArrayList constructor only ensures capacity but
doesn't allow you to set() elements outside of ArrayList.size(). This causes
the following exception to happen upon JPC start-up:
penberg@jaguar:~/testing/jato$ /usr/local/jamvm/bin/jamvm -jar JPCApplication.jar
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.lang.VMClass.forName(Native Method)
at java.lang.Class.forName(Class.java:233)
at jamvm.java.lang.JarLauncher.main(JarLauncher.java:46)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.raiseBoundsError(ArrayList.java:504)
at java.util.ArrayList.checkBoundExclusive(ArrayList.java:490)
at java.util.ArrayList.set(ArrayList.java:323)
at javax.swing.text.html.StyleSheet.resolveStyle(StyleSheet.java:417)
at javax.swing.text.html.StyleSheet.getResolvedStyle(StyleSheet.java:376)
at javax.swing.text.html.StyleSheet.getRule(StyleSheet.java:358)
at javax.swing.text.html.ViewAttributeSet.<init>(ViewAttributeSet.java:112)
at javax.swing.text.html.StyleSheet.getViewAttributes(StyleSheet.java:562)
[snip]
Fix that up.
2011-03-14 Pekka Enberg <penberg@kernel.org>
* javax/swing/text/html/StyleSheet.java:
(resolveStyle()): Fix misuse of ArrayList.set().
Diffstat (limited to 'javax')
-rw-r--r-- | javax/swing/text/html/StyleSheet.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/javax/swing/text/html/StyleSheet.java b/javax/swing/text/html/StyleSheet.java index 5cf015bc5..31879b2b2 100644 --- a/javax/swing/text/html/StyleSheet.java +++ b/javax/swing/text/html/StyleSheet.java @@ -414,11 +414,12 @@ public class StyleSheet extends StyleContext tags[i] = t.toString(); else tags[i] = null; - attributes.set(i, attributeSetToMap(atts)); + attributes.add(attributeSetToMap(atts)); } else { tags[i] = null; + attributes.add(null); } } tags[0] = tag.toString(); |