Index: modules/swing/src/main/java/common/org/apache/harmony/x/swing/BlitSupport.java =================================================================== --- modules/swing/src/main/java/common/org/apache/harmony/x/swing/BlitSupport.java (revision 509560) +++ modules/swing/src/main/java/common/org/apache/harmony/x/swing/BlitSupport.java (working copy) @@ -34,7 +34,9 @@ import org.apache.harmony.awt.ComponentInternals; import org.apache.harmony.awt.gl.MultiRectArea; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** * Blit engine which allows to 'repaint' moving components using Graphics.copyArea() (blitting mode). * To use this class a component and its parent should be JComponent. @@ -170,7 +172,7 @@ private boolean initialize() { if (blitingComponent == null) { - throw new IllegalStateException("Component is not defined yet"); + throw new IllegalStateException(Messages.getString("swing.71")); } if (parent == null) { Index: modules/swing/src/main/java/common/org/apache/harmony/x/swing/Utilities.java =================================================================== --- modules/swing/src/main/java/common/org/apache/harmony/x/swing/Utilities.java (revision 509560) +++ modules/swing/src/main/java/common/org/apache/harmony/x/swing/Utilities.java (working copy) @@ -60,6 +60,8 @@ import javax.swing.plaf.basic.BasicGraphicsUtils; import javax.swing.text.Position; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** * SwingUtilities extension. This class provides utility * methods which are widely used in Swing classes. @@ -98,11 +100,11 @@ public static int getNextMatch(final ListModelAccessor model, final String prefix, final int startIndex, final Position.Bias bias) { if (prefix == null) { - throw new IllegalArgumentException("Prefix must be not null"); + throw new IllegalArgumentException(Messages.getString("swing.6F")); } if (startIndex < 0 || startIndex >= model.getSize()) { - throw new IllegalArgumentException("Incorrect start index"); + throw new IllegalArgumentException(Messages.getString("swing.6D")); } String ucPrefix = prefix.toUpperCase(); @@ -1139,4 +1141,4 @@ result += box.y; return result; } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties =================================================================== --- modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties (revision 509560) +++ modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties (working copy) @@ -17,6 +17,187 @@ # messages for EN locale swing.00=Invalid axis: {0} swing.01=fromIndex must be <= toIndex -swing.02=Invalid verticalScrollBarPolicy -swing.03=Invalid horizontalScrollBarPolicy -swing.04=ComboBox is null +swing.02=Invalid '{0}' +swing.03='{0}' is null +swing.04=Invalid action number found in internal parse table +swing.05=threshhold must be >= 0 +swing.06=Ancestor shouldn't be null +swing.07=Invalid range properties +swing.08=Incorrect selection mode is specified +swing.09=Incorrect range for grayscale factor +swing.0A=Panel to remove can not be found +swing.0B=Cannot modify immutable data model +swing.0C=Selected index should in the range of available indices +swing.0D=For '{0}' condition ComponentInputMap has to be provided +swing.0E={0} was asked to deinstall() {1} when it only knows about {2} +swing.0F=Invalid start position +swing.10=index == {0} +swing.11=Incorrect dialog type is specified +swing.12=Incorrect file selection mode is specified +swing.13=must be one of: +swing.14=Invalid index is specified +swing.15=data model must be not null +swing.16=Model cannot be null +swing.17=Selection model must be not null +swing.18=DnD could not be used in headless environment +swing.19=Incorect layout orientation is specified +swing.1A=Visible region should be not null +swing.1B=Incorrect orientation is specified +swing.1C=Delay must be positive +swing.1D=Incorrect type of the etched border +swing.1E='{0}': parentComponent does not have a valid parent +swing.1F='{0}': type must be one of +swing.20=Illegal Option Type +swing.21=index must be positive +swing.22=index is greater than the number of items +swing.23={0} is not a valid title justification. +swing.24={0} is not a valid title position. +swing.25=Incorrect vertical policy is specified +swing.26=Incorrect key {0} is invalid +swing.27=Not implemented +swing.28=orientation must be one of: VERTICAL, HORIZONTAL +swing.29=argument must be VERTICAL or HORIZONTAL +swing.2A=increment must be > 0 +swing.2B=start is out of range +swing.2C=model not a '{0}' +swing.2D=Illegal startingRow is specified. Must be in the valid range +swing.2E={0} is not supported on this platform. +swing.2F=null model +swing.30=null editor +swing.31=Illegal selection interval is specified. Should be in [0, {0}] +swing.32=Incorrect resize weight is specified +swing.33=Incorrect proportional location is specified +swing.34=Component not found in the tabbed pane +swing.35=index < -1 || index >= tab count +swing.36=invalid tabLayoutPolicy +swing.37=invalid tabPlacement +swing.38=Row height must be positive +swing.39=Column does not exist +swing.3A=Model must be not null +swing.3B=Column model must be not null +swing.3C=rows: {0} +swing.3D=columns: {0} +swing.3E=Negative line +swing.3F=No such line +swing.40=Can't translate offset to line +swing.41=Invalid orientation: {0} +swing.42=Invalid insert +swing.43=Invalid remove +swing.44=end before start +swing.45=columns less than zero. +swing.46=rows less than zero. +swing.47=orientation must be VERTICAL or HORIZONTAL +swing.48=Model must be StyledDocument. +swing.49=Kit isn't a StyledEditorKit +swing.4A={0} is not a legal orientation +swing.4B=No next element in enumeration +swing.4C=Prefix must be specified +swing.4D=ComponentInputMap must have a ComponentInputMap parent associated with the same component +swing.4E=focusCycleRoot must not be null +swing.4F=component must not be null +swing.50=Cannot happen +swing.51=can't set +swing.52=Popup content should be specified +swing.53=Factory should be not null +swing.54=Container is not a focus cycle root +swing.55='{0}' must be specified +swing.56=Component must be in a cycle root of the specified container +swing.57=ComponentInputMaps must be associated with a non-null JComponent +swing.58=invalid sequence element +swing.59=(start <= value <= end) is false +swing.5A=invalid calendarField +swing.5B=illegal value +swing.5C=SpinnerListModel(List) expects non-null non-empty List +swing.5D=SpinnerListModel(Object[]) expects non-null non-empty Object[] +swing.5E=value and stepSize must be non-null +swing.5F=(minimum <= value <= maximum) is false +swing.60=null stepSize +swing.61=Cannot convert point from null-component +swing.62=Cannot convert point to null-component +swing.63=Invalid initial delay: {0} +swing.64=Invalid delay: {0} +swing.65=Incorrect initial delay: {0} +swing.66=Incorrect dismiss delay: {0} +swing.67=Incorrect reshow delay: {0} +swing.68=Color should not be null +swing.69=path is not found +swing.6A=index is invalid +swing.6B=null delegate +swing.6C=Singleton +swing.6D=Incorrect start index +swing.6E=Incorrect direction is specified! +swing.6F=Prefix must be not null +swing.70=Incorrect layout orientation +swing.71=Component is not defined yet +swing.72=Null child not allowed +swing.73=illegal argument +swing.74=constraints must be String +swing.75=Index {0} is out of the specified range +swing.76=path in TreePath must not be null +swing.77=not text component +swing.78=Column must be not null +swing.79=Specified index is out of range +swing.7A=Identifier must be not null +swing.7B=Identifier is not found +swing.7C=Model must be not-null +swing.7D=Null model cannot be used +swing.7E=Document cannot be modified from listener handler +swing.7F=Invalid remove position +swing.80=Invalid remove length +swing.81=Invalid axis +swing.82=path in TreePath must be not null and not empty +swing.83=View representing {0} not found +swing.84=Invalid direction +swing.85=Invalid position offset +swing.86=Error creating instance +swing.87=Default painter of GlyphView can't paint composed text. +swing.88=This view doesn't represent offset {0} +swing.89=Invalid position: {0} +swing.8A=Empty attribute set +swing.8B=Not applicable to Layout Pool +swing.8C=Length must be non-negative +swing.8D=Invalid start position +swing.8E=Invalid insert position +swing.8F=the value is outside the min/max +swing.90=Wrong parameters : {0}, {1} +swing.91=bad position: {0} +swing.92=Cann't parse value +swing.93=Cann't parse String +swing.94=stringToValue passed invalid value +swing.95=incorrect position: {0} +swing.96=incorrect positions: +swing.97=row height must be positive value +swing.98=invalid position: +swing.99=The number of characters to remove must be non-negative +swing.9A=The enumeration has no more elements to provide +swing.9B=No attribute set count field. +swing.9C=Invalid tab index {0} +swing.9D=Parser should be set +swing.9E=Can't insert HTML text after start of a leaf element +swing.9F=Not implemented tag: +swing.A0=Document must be HTMLDocument +swing.A1=Editor kit must be HTMLEditorKit +swing.A2=Position cannot be negative +swing.A3=Must insert inside body element +swing.A4=Invalid side {0} +swing.A5=CSS parser required! +swing.A6=Children are not allowed for this node +swing.A7=specified child node is null or an ancestor of the current node +swing.A8=child must be not null +swing.A9=specified child is null or is not a child of this node +swing.AA=no more elements in enumeration +swing.AB=Specified ancestor is not an ancestor of this node +swing.AC=Node has no children +swing.AD=Specified child is not a child of this node +swing.AF=node doesn't have a parent +swing.B0=modification mode is incorrect + +swing.err.01=Illegal request +swing.err.02=BoxLayout should be used for one container only +swing.err.03=OverlayLayout can't be shared +swing.err.04=Invalid axis +swing.err.05=WARNING: HTML/RTF is not supported yet. Plain text will be shown +swing.err.06=ERROR: UIDefaults.getUI() failed: {0} +swing.err.07=font-size: can't resolve relative value. Unknown relative unit +swing.err.08=FloatValue: can't resolve relative value. Unknown relative unit +swing.err.09=Graphics is not instance of Graphics2D Index: modules/swing/src/main/java/common/javax/swing/JTabbedPane.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JTabbedPane.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JTabbedPane.java (working copy) @@ -36,6 +36,8 @@ import org.apache.harmony.luni.util.NotImplementedException; import org.apache.harmony.x.swing.StringConstants; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* JTabbedPane @@ -546,7 +548,7 @@ public void setSelectedComponent(Component comp) { int index = indexOfComponent(comp); if (index == NOT_FOUND) { - throw new IllegalArgumentException("Component not found in the tabbed pane"); + throw new IllegalArgumentException(Messages.getString("swing.34")); } setSelectedIndex(index); } @@ -557,7 +559,7 @@ public void setSelectedIndex(int index) { if (index < -1 || index >= getTabCount()) { - throw new IndexOutOfBoundsException("index < -1 || index >= tab count"); + throw new IndexOutOfBoundsException(Messages.getString("swing.35")); } getModel().setSelectedIndex(index); } @@ -568,7 +570,7 @@ public void setTabLayoutPolicy(int tabLayoutPolicy) { if (tabLayoutPolicy != WRAP_TAB_LAYOUT && tabLayoutPolicy != SCROLL_TAB_LAYOUT) { - throw new IllegalArgumentException("invalid tabLayoutPolicy"); + throw new IllegalArgumentException(Messages.getString("swing.36")); } int oldValue = this.tabLayoutPolicy; this.tabLayoutPolicy = tabLayoutPolicy; @@ -582,7 +584,7 @@ public void setTabPlacement(int tabPlacement) { if (tabPlacement != TOP && tabPlacement != BOTTOM && tabPlacement != LEFT && tabPlacement != RIGHT) { - throw new IllegalArgumentException("invalid tabPlacement"); + throw new IllegalArgumentException(Messages.getString("swing.37")); } int oldValue = this.tabPlacement; this.tabPlacement = tabPlacement; Index: modules/swing/src/main/java/common/javax/swing/AbstractButton.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/AbstractButton.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/AbstractButton.java (working copy) @@ -50,6 +50,7 @@ import org.apache.harmony.x.swing.ButtonCommons; import org.apache.harmony.x.swing.StringConstants; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; /** *

@@ -803,7 +804,7 @@ public void setMultiClickThreshhold(long threshold) { if (threshold < 0) { - throw new IllegalArgumentException("threshhold must be >= 0"); + throw new IllegalArgumentException(Messages.getString("swing.05")); } multiClickThreshhold = threshold; } @@ -853,7 +854,7 @@ public void setDisplayedMnemonicIndex(int index) throws IllegalArgumentException { if (index < -1 || index >= 0 && (text == null || index >= text.length())) { - throw new IllegalArgumentException("index == " + index); + throw new IllegalArgumentException(Messages.getString("swing.10",index)); } int oldValue = mnemonicIndex; mnemonicIndex = index; Index: modules/swing/src/main/java/common/javax/swing/JToolTip.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JToolTip.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JToolTip.java (working copy) @@ -25,6 +25,8 @@ import javax.accessibility.AccessibleRole; import javax.swing.plaf.ToolTipUI; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JToolTip extends JComponent implements Accessible { private static final String COMPONENT = "component"; private static final String TIP_TEXT = "tiptext"; @@ -33,10 +35,10 @@ protected class AccessibleJToolTip extends AccessibleJComponent { public String getAccessibleDescription() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleRole getAccessibleRole() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } } Index: modules/swing/src/main/java/common/javax/swing/GrayFilter.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/GrayFilter.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/GrayFilter.java (working copy) @@ -28,6 +28,8 @@ import java.awt.image.FilteredImageSource; import java.awt.image.RGBImageFilter; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class GrayFilter extends RGBImageFilter { private static final float INTERVAL_BOUND = 1f / 3; @@ -41,7 +43,7 @@ public GrayFilter(boolean bright, int grayPercentage) { if (grayPercentage < 0 || grayPercentage > 100) { - throw new IllegalArgumentException("Incorrect range for grayscale factor"); + throw new IllegalArgumentException(Messages.getString("swing.09")); } canFilterIndexColorModel = true; Index: modules/swing/src/main/java/common/javax/swing/JColorChooser.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JColorChooser.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JColorChooser.java (working copy) @@ -36,6 +36,7 @@ import javax.swing.colorchooser.DefaultColorSelectionModel; import javax.swing.plaf.ColorChooserUI; +import org.apache.harmony.x.swing.internal.nls.Messages; /** *

* JColorChooser @@ -251,7 +252,7 @@ } } if (panelToRemove == null) { - throw new IllegalArgumentException("panel to remove can not be found"); + throw new IllegalArgumentException(Messages.getString("swing.0A")); } AbstractColorChooserPanel[] newChooserPanels = new AbstractColorChooserPanel[chooserPanels.length - 1]; System.arraycopy(chooserPanels, 0, newChooserPanels, 0, index); Index: modules/swing/src/main/java/common/javax/swing/ToolTipManager.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/ToolTipManager.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/ToolTipManager.java (working copy) @@ -31,7 +31,9 @@ import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class ToolTipManager extends MouseAdapter implements MouseMotionListener { protected class insideTimerAction implements ActionListener { public void actionPerformed(final ActionEvent e) { @@ -105,7 +107,7 @@ public void setInitialDelay(final int milliseconds) { if (milliseconds < 0) { - throw new IllegalArgumentException("Incorrect initial delay: " + milliseconds); + throw new IllegalArgumentException(Messages.getString("swing.65", milliseconds)); } initialDelay = milliseconds; } @@ -116,7 +118,7 @@ public void setDismissDelay(final int milliseconds) { if (milliseconds < 0) { - throw new IllegalArgumentException("Incorrect dismiss delay: " + milliseconds); + throw new IllegalArgumentException(Messages.getString("swing.66", milliseconds)); } dismissDelay = milliseconds; } @@ -127,7 +129,7 @@ public void setReshowDelay(final int milliseconds) { if (milliseconds < 0) { - throw new IllegalArgumentException("Incorrect reshow delay: " + milliseconds); + throw new IllegalArgumentException(Messages.getString("swing.67", milliseconds)); } reshowDelay = milliseconds; } Index: modules/swing/src/main/java/common/javax/swing/JViewport.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JViewport.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JViewport.java (working copy) @@ -46,7 +46,9 @@ import org.apache.harmony.x.swing.BlitSupport; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JViewport extends JComponent implements Accessible { private static final long serialVersionUID = -633250949788872287L; @@ -142,7 +144,7 @@ @Override public final void setBorder(final Border b) { if (b != null) { - throw new IllegalArgumentException("method is not implemented"); + throw new IllegalArgumentException(Messages.getString("swing.27")); } } @@ -450,4 +452,4 @@ removeAll(); } } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/javax/swing/JMenuItem.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JMenuItem.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JMenuItem.java (working copy) @@ -37,7 +37,9 @@ import org.apache.harmony.x.swing.StringConstants; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JMenuItem extends AbstractButton implements Accessible, MenuElement { // TODO implement @@ -52,7 +54,7 @@ } public void stateChanged(final ChangeEvent e) { - throw new UnsupportedOperationException("not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } } Index: modules/swing/src/main/java/common/javax/swing/JTextPane.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JTextPane.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JTextPane.java (working copy) @@ -41,7 +41,9 @@ import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JTextPane extends JEditorPane implements ImageObserver, MenuContainer, Serializable, Accessible, Scrollable { @@ -63,7 +65,7 @@ if (doc instanceof StyledDocument) { super.setDocument(doc); } else { - throw new IllegalArgumentException("Model must be StyledDocument."); + throw new IllegalArgumentException(Messages.getString("swing.48")); } } @@ -216,7 +218,7 @@ if (kit instanceof StyledEditorKit) { super.setEditorKit(kit); } else { - throw new IllegalArgumentException("Kit isn't a StyledEditorKit"); + throw new IllegalArgumentException(Messages.getString("swing.49")); } } Index: modules/swing/src/main/java/common/javax/swing/LayoutFocusTraversalPolicy.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/LayoutFocusTraversalPolicy.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/LayoutFocusTraversalPolicy.java (working copy) @@ -30,6 +30,8 @@ import java.io.Serializable; import java.util.Comparator; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class LayoutFocusTraversalPolicy extends SortingFocusTraversalPolicy implements Serializable { private static final long serialVersionUID = 3761404205428127289L; @@ -41,10 +43,10 @@ public Component getComponentBefore(final Container focusCycleRoot, final Component component) { if (focusCycleRoot == null) { - throw new IllegalArgumentException("focusCycleRoot must not be null"); + throw new IllegalArgumentException(Messages.getString("swing.4E")); } if (component == null) { - throw new IllegalArgumentException("component must not be null"); + throw new IllegalArgumentException(Messages.getString("swing.4F")); } ((LayoutComparator)getComparator()).setOrientation(focusCycleRoot.getComponentOrientation()); return super.getComponentBefore(focusCycleRoot, component); @@ -52,10 +54,10 @@ public Component getComponentAfter(final Container focusCycleRoot, final Component component) { if (focusCycleRoot == null) { - throw new IllegalArgumentException("focusCycleRoot must not be null"); + throw new IllegalArgumentException(Messages.getString("swing.4E")); } if (component == null) { - throw new IllegalArgumentException("component must not be null"); + throw new IllegalArgumentException(Messages.getString("swing.4F")); } ((LayoutComparator)getComparator()).setOrientation(focusCycleRoot.getComponentOrientation()); return super.getComponentAfter(focusCycleRoot, component); @@ -63,7 +65,7 @@ public Component getLastComponent(final Container focusCycleRoot) { if (focusCycleRoot == null) { - throw new IllegalArgumentException("focusCycleRoot must not be null"); + throw new IllegalArgumentException(Messages.getString("swing.4E")); } ((LayoutComparator)getComparator()).setOrientation(focusCycleRoot.getComponentOrientation()); return super.getLastComponent(focusCycleRoot); @@ -71,7 +73,7 @@ public Component getFirstComponent(final Container focusCycleRoot) { if (focusCycleRoot == null) { - throw new IllegalArgumentException("focusCycleRoot must not be null"); + throw new IllegalArgumentException(Messages.getString("swing.4E")); } ((LayoutComparator)getComparator()).setOrientation(focusCycleRoot.getComponentOrientation()); return super.getFirstComponent(focusCycleRoot); @@ -133,7 +135,7 @@ return TRCompare(c1, c2); } - throw new IllegalStateException("Cannot happen"); + throw new IllegalStateException(Messages.getString("swing.50")); } private int LTCompare(final Component c1, final Component c2) { Index: modules/swing/src/main/java/common/javax/swing/JOptionPane.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JOptionPane.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JOptionPane.java (working copy) @@ -39,7 +39,9 @@ import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JOptionPane extends JComponent implements Accessible { protected class AccessibleJOptionPane extends AccessibleJComponent { @@ -400,7 +402,7 @@ JDesktopPane desktop = JOptionPane.getDesktopPaneForComponent(parentComponent); Container parent = (desktop != null) ? desktop : parentComponent.getParent(); if (parent == null) { - throw new RuntimeException("JOptionPane: parentComponent does not have a valid parent"); + throw new RuntimeException(Messages.getString("swing.1E","JOptionPane")); } JInternalFrame frame = new JInternalFrame(title); @@ -512,7 +514,7 @@ firePropertyChange(MESSAGE_TYPE_PROPERTY, oldValue, type); break; default: - throw new RuntimeException("JOptionPane: type must be one of " + + throw new RuntimeException(Messages.getString("swing.1F","JOptionPane") + "JOptionPane.ERROR_MESSAGE, JOptionPane.INFORMATION_MESSAGE, " + "JOptionPane.WARNING_MESSAGE, JOptionPane.QUESTION_MESSAGE " + "or JOptionPane.PLAIN_MESSAGE"); @@ -534,7 +536,7 @@ firePropertyChange(OPTION_TYPE_PROPERTY, oldValue, newType); break; default: - throw new RuntimeException("Illegal Option Type"); + throw new RuntimeException(Messages.getString("swing.20")); } } @@ -637,4 +639,4 @@ } dialog.getRootPane().setWindowDecorationStyle(messageTypeToRootPaneDecoration(messageType)); } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/javax/swing/JToggleButton.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JToggleButton.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JToggleButton.java (working copy) @@ -27,6 +27,8 @@ import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleRole; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JToggleButton extends AbstractButton implements Accessible { // TODO implement @@ -39,7 +41,7 @@ } public void itemStateChanged(final ItemEvent e) { - throw new UnsupportedOperationException("Not yet implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } }; Index: modules/swing/src/main/java/common/javax/swing/JSpinner.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JSpinner.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JSpinner.java (working copy) @@ -52,6 +52,8 @@ import org.apache.harmony.x.swing.StringConstants; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* JSpinner @@ -340,7 +342,7 @@ public DateEditor(JSpinner spinner) { super(spinner); if (!(spinner.getModel() instanceof SpinnerDateModel)) { - throw new IllegalArgumentException("model not a SpinnerDateModel"); + throw new IllegalArgumentException(Messages.getString("swing.2C","SpinnerDateModel")); } format = new SimpleDateFormat(); initTextField(); @@ -349,7 +351,7 @@ public DateEditor(JSpinner spinner, String dateFormatPattern) { super(spinner); if (!(spinner.getModel() instanceof SpinnerDateModel)) { - throw new IllegalArgumentException("model not a SpinnerDateModel"); + throw new IllegalArgumentException(Messages.getString("swing.2C","SpinnerDateModel")); } format = new SimpleDateFormat(dateFormatPattern); initTextField(); @@ -453,7 +455,7 @@ public ListEditor(JSpinner spinner) { super(spinner); if (!(spinner.getModel() instanceof SpinnerListModel)) { - throw new IllegalArgumentException("model not a SpinnerListModel"); + throw new IllegalArgumentException(Messages.getString("swing.2C","SpinnerListModel")); } SpinnerListFormatter formatter = new SpinnerListFormatter(this.getModel(), this .getTextField()); @@ -514,7 +516,7 @@ public NumberEditor(JSpinner spinner) { super(spinner); if (!(spinner.getModel() instanceof SpinnerNumberModel)) { - throw new IllegalArgumentException("model not a SpinnerNumberModel"); + throw new IllegalArgumentException(Messages.getString("swing.2C","SpinnerNumberModel")); } format = new DecimalFormat(); initTextField(); @@ -523,7 +525,7 @@ public NumberEditor(JSpinner spinner, String decimalFormatPattern) { super(spinner); if (!(spinner.getModel() instanceof SpinnerNumberModel)) { - throw new IllegalArgumentException("model not a SpinnerNumberModel"); + throw new IllegalArgumentException(Messages.getString("swing.2C","SpinnerNumberModel")); } format = new DecimalFormat(decimalFormatPattern); initTextField(); @@ -623,7 +625,7 @@ public void setModel(SpinnerModel model) { if (model == null) { - throw new IllegalArgumentException("null model"); + throw new IllegalArgumentException(Messages.getString("swing.2F")); } SpinnerModel oldModel = this.model; oldModel.removeChangeListener(changeListener); @@ -680,7 +682,7 @@ public void setEditor(JComponent editor) { if (editor == null) { - throw new IllegalArgumentException("null editor"); + throw new IllegalArgumentException(Messages.getString("swing.30")); } JComponent oldEditor = this.editor; if (oldEditor == editor) { Index: modules/swing/src/main/java/common/javax/swing/JEditorPane.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JEditorPane.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JEditorPane.java (working copy) @@ -57,6 +57,8 @@ import org.apache.harmony.luni.util.NotImplementedException; import org.apache.harmony.x.swing.StringConstants; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* JEditorPane @@ -559,7 +561,7 @@ public final void setContentType(final String type) { if (type == null) { - throw new NullPointerException("Content type is null"); + throw new NullPointerException(Messages.getString("swing.03","Content type")); } int index = contentTypes.indexOf(type); @@ -677,7 +679,7 @@ public void setPage(final URL page) throws IOException { if (page == null) { - throw new IOException("Page is null"); + throw new IOException(Messages.getString("swing.03","Page")); } String url = page.toString(); Index: modules/swing/src/main/java/common/javax/swing/DefaultListSelectionModel.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/DefaultListSelectionModel.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/DefaultListSelectionModel.java (working copy) @@ -24,6 +24,8 @@ import javax.swing.event.ListSelectionListener; import org.apache.harmony.awt.gl.MultiRectArea; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* DefaultListSelectionModel @@ -326,7 +328,7 @@ public void setSelectionMode(int selectionMode) { if (selectionMode != SINGLE_SELECTION && selectionMode != SINGLE_INTERVAL_SELECTION && selectionMode != MULTIPLE_INTERVAL_SELECTION) { - throw new IllegalArgumentException("Incorrect selection mode is specified"); + throw new IllegalArgumentException(Messages.getString("swing.08")); } this.selectionMode = selectionMode; } Index: modules/swing/src/main/java/common/javax/swing/JFormattedTextField.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JFormattedTextField.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JFormattedTextField.java (working copy) @@ -41,6 +41,8 @@ import javax.swing.text.NumberFormatter; import javax.swing.text.TextAction; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* JFormattedTextField @@ -455,7 +457,7 @@ public void setFocusLostBehavior(final int behavior) { if (behavior != COMMIT && behavior != COMMIT_OR_REVERT && behavior != PERSIST && behavior != REVERT) { - throw new IllegalArgumentException("setFocusLostBehavior " + "must be one of: " + throw new IllegalArgumentException("setFocusLostBehavior" + Messages.getString("swing.13") + "JFormattedTextField.COMMIT, " + "JFormattedTextField.COMMIT_OR_" + "REVERT, " + "JFormattedTextField.PERSIST " + "or JFormattedTextField.REVERT"); @@ -584,4 +586,4 @@ docListener = new DocumentListenerImpl(); } } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/javax/swing/JTree.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JTree.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JTree.java (working copy) @@ -73,6 +73,8 @@ import javax.swing.tree.TreeSelectionModel; import org.apache.harmony.luni.util.NotImplementedException; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* JTree @@ -1007,7 +1009,7 @@ public TreePath nextElement() { if (nextElement == null) { - throw new NoSuchElementException("No next element in enumeration"); + throw new NoSuchElementException(Messages.getString("swing.4B")); } TreePath currentValue = nextElement; nextElement = getNextExpandedPath(); @@ -1317,11 +1319,10 @@ public TreePath getNextMatch(String prefix, int startingRow, Position.Bias bias) { if (prefix == null) { - throw new IllegalArgumentException("Prefix must be specified"); + throw new IllegalArgumentException(Messages.getString("swing.4C")); } if (startingRow < 0 || startingRow >= getRowCount()) { - throw new IllegalArgumentException( - "Illegal startingRow is specified. Must be in the valid range"); + throw new IllegalArgumentException(Messages.getString("swing.2D")); } if (bias == Position.Bias.Forward) { int rowCount = getRowCount(); @@ -1440,7 +1441,7 @@ public TreePath nextElement() { if (nextElement == null) { - throw new NoSuchElementException("No next element in enumeration"); + throw new NoSuchElementException(Messages.getString("swing.4B")); } TreePath currentValue = nextElement; nextElement = getNextDescendPath(); Index: modules/swing/src/main/java/common/javax/swing/JScrollPane.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JScrollPane.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JScrollPane.java (working copy) @@ -42,7 +42,9 @@ import org.apache.harmony.x.swing.StringConstants; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JScrollPane extends JComponent implements ScrollPaneConstants, Accessible { //TODO: implement protected class AccessibleJScrollPane extends AccessibleJComponent implements ChangeListener, PropertyChangeListener { @@ -184,7 +186,7 @@ && policy != VERTICAL_SCROLLBAR_NEVER && policy != VERTICAL_SCROLLBAR_ALWAYS) { - throw new IllegalArgumentException("Incorrect vertical policy is psecified"); + throw new IllegalArgumentException(Messages.getString("swing.25")); } if (this.verticalScrollBarPolicy != policy) { int oldValue = this.verticalScrollBarPolicy; @@ -202,7 +204,7 @@ && policy != HORIZONTAL_SCROLLBAR_NEVER && policy != HORIZONTAL_SCROLLBAR_ALWAYS) { - throw new IllegalArgumentException("Incorrect vertical policy is specified"); + throw new IllegalArgumentException(Messages.getString("swing.25")); } if (this.horizontalScrollBarPolicy != policy) { int oldValue = this.horizontalScrollBarPolicy; @@ -399,7 +401,7 @@ upperRight = corner; updateComponent(JScrollPane.UPPER_RIGHT_CORNER, oldValue, corner, JScrollPane.UPPER_RIGHT_CORNER); } else { - throw new IllegalArgumentException("Incorrect key " + key + " is invalid"); + throw new IllegalArgumentException(Messages.getString("swing.26", key)); } } Index: modules/swing/src/main/java/common/javax/swing/tree/FixedHeightLayoutCache.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/tree/FixedHeightLayoutCache.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/tree/FixedHeightLayoutCache.java (working copy) @@ -25,6 +25,8 @@ import javax.swing.event.TreeModelEvent; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class FixedHeightLayoutCache extends AbstractLayoutCache { public FixedHeightLayoutCache() { setRowHeight(1); @@ -32,7 +34,7 @@ public void setRowHeight(final int rowHeight) { if (rowHeight <= 0) { - throw new IllegalArgumentException("row height must be positive value"); + throw new IllegalArgumentException(Messages.getString("swing.97")); } super.setRowHeight(rowHeight); } Index: modules/swing/src/main/java/common/javax/swing/tree/TreePath.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/tree/TreePath.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/tree/TreePath.java (working copy) @@ -24,7 +24,9 @@ import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class TreePath implements Serializable { private Object[] elements; @@ -33,7 +35,7 @@ public TreePath(final Object[] path) { if (Utilities.isEmptyArray(path)) { - throw new IllegalArgumentException("path in TreePath must be not null and not empty"); + throw new IllegalArgumentException(Messages.getString("swing.82")); } pathCount = path.length; @@ -44,7 +46,7 @@ public TreePath(final Object singlePath) { if (singlePath == null) { - throw new IllegalArgumentException("path in TreePath must not be null"); + throw new IllegalArgumentException(Messages.getString("swing.76")); } elements = new Object[] {singlePath}; pathCount = 1; @@ -66,7 +68,7 @@ protected TreePath(final TreePath parentPath, final Object lastElement) { if (lastElement == null) { - throw new IllegalArgumentException("path in TreePath must not be null."); + throw new IllegalArgumentException(Messages.getString("swing.76")); } elements = new Object[] {lastElement}; @@ -129,7 +131,7 @@ public Object getPathComponent(final int element) { final int pathCount = getPathCount(); if (element < 0 || element >= pathCount) { - throw new IllegalArgumentException("Index " + element + " is out of the specified range"); + throw new IllegalArgumentException(Messages.getString("swing.75", element)); } if (parent == null) { return elements[element]; @@ -164,7 +166,7 @@ public TreePath pathByAddingChild(final Object child) { if (child == null) { - throw new NullPointerException("Null child not allowed"); + throw new NullPointerException(Messages.getString("swing.72")); } return new TreePath(this, child); @@ -188,4 +190,4 @@ return "[" + result + "]"; } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/javax/swing/tree/DefaultMutableTreeNode.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/tree/DefaultMutableTreeNode.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/tree/DefaultMutableTreeNode.java (working copy) @@ -28,6 +28,8 @@ import java.util.NoSuchElementException; import java.util.Vector; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class DefaultMutableTreeNode implements Cloneable, MutableTreeNode, Serializable { public static final Enumeration EMPTY_ENUMERATION = new Vector().elements(); @@ -51,10 +53,10 @@ public void insert(final MutableTreeNode child, final int childIndex) { if (!getAllowsChildren()) { - throw new IllegalStateException("Children are not allowed for this node"); + throw new IllegalStateException(Messages.getString("swing.A6")); } if (child == null || isNodeAncestor(child)) { - throw new IllegalArgumentException("specified child node is null or an ancestor of the current node"); + throw new IllegalArgumentException(Messages.getString("swing.A7")); } if (child.getParent() instanceof MutableTreeNode) { @@ -87,7 +89,7 @@ public int getIndex(final TreeNode child) { if (child == null) { - throw new IllegalArgumentException("child must be not null"); + throw new IllegalArgumentException(Messages.getString("swing.A8")); } return children != null ? children.indexOf(child) : -1; @@ -125,7 +127,7 @@ public void remove(final MutableTreeNode child) { int index = -1; if (child == null || children == null || (index = children.indexOf(child)) == -1) { - throw new IllegalArgumentException("specified child is null or is not a child of this node"); + throw new IllegalArgumentException(Messages.getString("swing.A9")); } remove(index); } @@ -288,7 +290,7 @@ if (children == null || !children.hasMoreElements()) { if (nextLevelChildren.isEmpty()) { - throw new NoSuchElementException("no more elements in enumeration"); + throw new NoSuchElementException(Messages.getString("swing.AA")); } else { children = (Enumeration)nextLevelChildren.remove(0); } @@ -314,7 +316,7 @@ public Enumeration pathFromAncestorEnumeration(final TreeNode ancestor) { if (!isNodeAncestor(ancestor)) { - throw new IllegalArgumentException("Specified ancestor is not an ancestor of this node"); + throw new IllegalArgumentException(Messages.getString("swing.AB")); } return new Enumeration() { @@ -327,7 +329,7 @@ } if (previousAncestor == DefaultMutableTreeNode.this) { - throw new NoSuchElementException("no more elements in enumeration"); + throw new NoSuchElementException(Messages.getString("swing.AA")); } TreeNode nextNode = DefaultMutableTreeNode.this; while (nextNode.getParent() != previousAncestor) { @@ -350,7 +352,7 @@ public TreeNode getFirstChild() { if (children == null || children.isEmpty()) { - throw new NoSuchElementException("Node has no children"); + throw new NoSuchElementException(Messages.getString("swing.AC")); } return (TreeNode)children.get(0); @@ -358,7 +360,7 @@ public TreeNode getLastChild() { if (children == null || children.isEmpty()) { - throw new NoSuchElementException("Node has no children"); + throw new NoSuchElementException(Messages.getString("swing.AC")); } return (TreeNode)children.get(children.size() - 1); @@ -367,7 +369,7 @@ public TreeNode getChildAfter(final TreeNode child) { int index = -1; if (child == null || (index = getIndex(child)) == -1) { - throw new IllegalArgumentException("Specified child is not a child of this node"); + throw new IllegalArgumentException(Messages.getString("swing.AD")); } return index + 1 < getChildCount() ? getChildAt(index + 1) : null; @@ -376,7 +378,7 @@ public TreeNode getChildBefore(final TreeNode child) { int index = -1; if (child == null || (index = getIndex(child)) == -1) { - throw new IllegalArgumentException("Specified child is not a child of this node"); + throw new IllegalArgumentException(Messages.getString("swing.AD")); } return index > 0 ? getChildAt(index - 1) : null; @@ -548,7 +550,7 @@ return subChildren.nextElement(); } - throw new NoSuchElementException("no more elements in enumeration"); + throw new NoSuchElementException(Messages.getString("swing.AA")); } public boolean hasMoreElements() { @@ -575,7 +577,7 @@ children = null; return root; } else { - throw new NoSuchElementException("no more elements in enumeration"); + throw new NoSuchElementException(Messages.getString("swing.AA")); } } Index: modules/swing/src/main/java/common/javax/swing/tree/DefaultTreeModel.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/tree/DefaultTreeModel.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/tree/DefaultTreeModel.java (working copy) @@ -30,7 +30,9 @@ import org.apache.harmony.x.swing.TreeCommons; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class DefaultTreeModel implements TreeModel, Serializable { protected boolean asksAllowsChildren; @@ -132,7 +134,7 @@ final int index) { if (newChild == null) { - throw new IllegalArgumentException("new child is null"); + throw new IllegalArgumentException(Messages.getString("swing.03","new child")); } parent.insert(newChild, index); nodesWereInserted(parent, new int[] {index}); @@ -141,7 +143,7 @@ public void removeNodeFromParent(final MutableTreeNode node) { MutableTreeNode parent = (MutableTreeNode)node.getParent(); if (parent == null) { - throw new IllegalArgumentException("node doesn't have a parent"); + throw new IllegalArgumentException(Messages.getString("swing.AF")); } int index = parent.getIndex(node); parent.remove(node); Index: modules/swing/src/main/java/common/javax/swing/tree/DefaultTreeSelectionModel.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/tree/DefaultTreeSelectionModel.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/tree/DefaultTreeSelectionModel.java (working copy) @@ -35,7 +35,9 @@ import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeSelectionModel { public static final String SELECTION_MODE_PROPERTY = "selectionMode"; @@ -397,7 +399,7 @@ selection = getUniquePathArray(combined); break; default: - throw new IllegalArgumentException("modification mode is incorrect"); + throw new IllegalArgumentException(Messages.getString("swing.B0")); } } Index: modules/swing/src/main/java/common/javax/swing/filechooser/FileSystemView.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/filechooser/FileSystemView.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/filechooser/FileSystemView.java (working copy) @@ -37,6 +37,8 @@ import org.apache.harmony.x.swing.filechooser.PlatformFile; import org.apache.harmony.x.swing.filechooser.PlatformFileManager; +import org.apache.harmony.x.swing.internal.nls.Messages; + public abstract class FileSystemView { private static FileSystemView instance; @@ -383,6 +385,6 @@ protected File createFileSystemRoot(final File f) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } } Index: modules/swing/src/main/java/common/javax/swing/LookAndFeel.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/LookAndFeel.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/LookAndFeel.java (working copy) @@ -46,7 +46,9 @@ import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public abstract class LookAndFeel { private static Map classToSettersMap = new HashMap(); @@ -181,16 +183,16 @@ } Method setter = getSetter(propertyName, c.getClass()); if (setter == null) { - throw new IllegalArgumentException("can't set " + propertyName); + throw new IllegalArgumentException(Messages.getString("swing.51") + propertyName); } try { setter.invoke(c, new Object[] {propertyValue}); } catch (IllegalArgumentException e) { throw new ClassCastException(); } catch (IllegalAccessException e) { - throw new IllegalArgumentException("can't set " + propertyName); + throw new IllegalArgumentException(Messages.getString("swing.51") + propertyName); } catch (InvocationTargetException e) { - throw new IllegalArgumentException("can't set " + propertyName); + throw new IllegalArgumentException(Messages.getString("swing.51") + propertyName); } c.installablePropertiesExcluded.remove(propertyName); } Index: modules/swing/src/main/java/common/javax/swing/JList.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JList.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JList.java (working copy) @@ -64,7 +64,9 @@ import org.apache.harmony.x.swing.StringConstants; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JList extends JComponent implements Scrollable, Accessible { public static final int VERTICAL = 0; public static final int VERTICAL_WRAP = 1; @@ -395,7 +397,7 @@ public JList(final ListModel model) { if (model == null) { - throw new IllegalArgumentException("data model must be not null"); + throw new IllegalArgumentException(Messages.getString("swing.15")); } this.model = model; this.selectionModel = createSelectionModel(); @@ -407,7 +409,7 @@ public void setModel(final ListModel model) { if (model == null) { - throw new IllegalArgumentException("Model cannot be null"); + throw new IllegalArgumentException(Messages.getString("swing.16")); } if (this.model != model) { @@ -424,7 +426,7 @@ public void setSelectionModel(final ListSelectionModel selectionModel) { if (selectionModel == null) { - throw new IllegalArgumentException("Selection model must be not null"); + throw new IllegalArgumentException(Messages.getString("swing.17")); } if (this.selectionModel != selectionModel) { @@ -522,7 +524,7 @@ public void setDragEnabled(final boolean dragEnabled) { if (dragEnabled && GraphicsEnvironment.isHeadless()) { - throw new HeadlessException("DnD could not be used in headless environment"); + throw new HeadlessException(Messages.getString("swing.18")); } this.dragEnabled = dragEnabled; @@ -564,7 +566,7 @@ && layoutOrientation != VERTICAL_WRAP && layoutOrientation != HORIZONTAL_WRAP) { - throw new IllegalArgumentException("Incorect layout orientation is specified"); + throw new IllegalArgumentException(Messages.getString("swing.19")); } if (this.layoutOrientation != layoutOrientation) { @@ -856,10 +858,10 @@ public int getScrollableBlockIncrement(final Rectangle visibleRect, final int orientation, final int direction) { if (visibleRect == null) { - throw new IllegalArgumentException("Visible region should be not null"); + throw new IllegalArgumentException(Messages.getString("swing.1A")); } if (orientation != SwingConstants.VERTICAL && orientation != SwingConstants.HORIZONTAL) { - throw new IllegalArgumentException("Incorrect orientation is specified"); + throw new IllegalArgumentException(Messages.getString("swing.1B")); } if (orientation == SwingConstants.VERTICAL) { @@ -909,10 +911,10 @@ public int getScrollableUnitIncrement(final Rectangle visibleRect, final int orientation, final int direction) { if (visibleRect == null) { - throw new IllegalArgumentException("Visible region should be not null"); + throw new IllegalArgumentException(Messages.getString("swing.1A")); } if (orientation != SwingConstants.VERTICAL && orientation != SwingConstants.HORIZONTAL) { - throw new IllegalArgumentException("Incorrect orientation is specified"); + throw new IllegalArgumentException(Messages.getString("swing.1B")); } if (orientation == SwingConstants.HORIZONTAL) { Index: modules/swing/src/main/java/common/javax/swing/SpinnerDateModel.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/SpinnerDateModel.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/SpinnerDateModel.java (working copy) @@ -26,7 +26,9 @@ import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class SpinnerDateModel extends AbstractSpinnerModel implements Serializable { private static final int DEFAULT_CALENDAR_FIELD = Calendar.DAY_OF_MONTH; @@ -42,16 +44,16 @@ public SpinnerDateModel(final Date value, final Comparable start, final Comparable end, final int calendarField) { if (value == null) { - throw new IllegalArgumentException("value is null"); + throw new IllegalArgumentException(Messages.getString("swing.03","value")); } if (start != null && start.compareTo(value) > 0) { - throw new IllegalArgumentException("(start <= value <= end) is false"); + throw new IllegalArgumentException(Messages.getString("swing.59")); } if (end != null && end.compareTo(value) < 0) { - throw new IllegalArgumentException("(start <= value <= end) is false"); + throw new IllegalArgumentException(Messages.getString("swing.59")); } if (!isValidCalendarField(calendarField)) { - throw new IllegalArgumentException("invalid calendarField"); + throw new IllegalArgumentException(Messages.getString("swing.5A")); } this.value = value; @@ -84,7 +86,7 @@ public void setCalendarField(final int calendarField) { if (!isValidCalendarField(calendarField)) { - throw new IllegalArgumentException("invalid calendarField"); + throw new IllegalArgumentException(Messages.getString("swing.5A")); } if (this.calendarField != calendarField) { this.calendarField = calendarField; @@ -114,7 +116,7 @@ public void setValue(final Object value) { if (!(value instanceof Date)) { - throw new IllegalArgumentException("illegal value"); + throw new IllegalArgumentException(Messages.getString("swing.5B")); } if (this.value != value) { this.value = (Date)value; Index: modules/swing/src/main/java/common/javax/swing/Popup.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/Popup.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/Popup.java (working copy) @@ -25,7 +25,9 @@ import org.apache.harmony.awt.ComponentInternals; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class Popup { class PopupWindow extends JWindow { public PopupWindow(final Window owner) { @@ -63,7 +65,7 @@ protected Popup(final Component owner, final Component content, final int x, final int y) { if (content == null) { - throw new IllegalArgumentException("Popup content should be specified"); + throw new IllegalArgumentException(Messages.getString("swing.52")); } Window ownerWindow = owner instanceof Window ? (Window)owner : SwingUtilities.getWindowAncestor(owner); Index: modules/swing/src/main/java/common/javax/swing/table/JTableHeader.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/table/JTableHeader.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/table/JTableHeader.java (working copy) @@ -54,11 +54,13 @@ import javax.swing.event.TableColumnModelListener; import javax.swing.plaf.TableHeaderUI; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JTableHeader extends JComponent implements TableColumnModelListener, Accessible { protected class AccessibleJTableHeader extends AccessibleJComponent { protected class AccessibleJTableHeaderEntry extends AccessibleContext implements Accessible, AccessibleComponent { public AccessibleJTableHeaderEntry(final int c, final JTableHeader p, final JTable t) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleContext getAccessibleContext() { @@ -66,179 +68,179 @@ } public String getAccessibleName() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void setAccessibleName(final String s) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public String getAccessibleDescription() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void setAccessibleDescription(final String s) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleRole getAccessibleRole() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleStateSet getAccessibleStateSet() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public int getAccessibleIndexInParent() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public int getAccessibleChildrenCount() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Accessible getAccessibleChild(final int i) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Locale getLocale() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void addPropertyChangeListener(final PropertyChangeListener l) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void removePropertyChangeListener(final PropertyChangeListener l) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleAction getAccessibleAction() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleComponent getAccessibleComponent() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleSelection getAccessibleSelection() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleText getAccessibleText() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleValue getAccessibleValue() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Color getBackground() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void setBackground(final Color c) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Color getForeground() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void setForeground(final Color c) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Cursor getCursor() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void setCursor(final Cursor c) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Font getFont() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void setFont(final Font f) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public FontMetrics getFontMetrics(final Font f) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public boolean isEnabled() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void setEnabled(final boolean b) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public boolean isVisible() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void setVisible(final boolean b) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public boolean isShowing() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public boolean contains(final Point p) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Point getLocationOnScreen() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Point getLocation() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void setLocation(final Point p) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Rectangle getBounds() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void setBounds(final Rectangle r) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Dimension getSize() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void setSize(final Dimension d) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Accessible getAccessibleAt(final Point p) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public boolean isFocusTraversable() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void requestFocus() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void addFocusListener(final FocusListener l) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void removeFocusListener(final FocusListener l) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } } @@ -247,15 +249,15 @@ } public Accessible getAccessibleAt(final Point p) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public int getAccessibleChildrenCount() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Accessible getAccessibleChild(final int i) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } } @@ -437,7 +439,7 @@ public void setColumnModel(final TableColumnModel cm) { if (cm == null) { - throw new IllegalArgumentException("Null model cannot be used"); + throw new IllegalArgumentException(Messages.getString("swing.7D")); } columnModel.removeColumnModelListener(this); Index: modules/swing/src/main/java/common/javax/swing/table/DefaultTableColumnModel.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/table/DefaultTableColumnModel.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/table/DefaultTableColumnModel.java (working copy) @@ -38,6 +38,8 @@ import javax.swing.event.TableColumnModelEvent; import javax.swing.event.TableColumnModelListener; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class DefaultTableColumnModel implements TableColumnModel, PropertyChangeListener, ListSelectionListener, Serializable { protected Vector tableColumns = new Vector(); protected ListSelectionModel selectionModel; @@ -55,7 +57,7 @@ public void addColumn(final TableColumn column) { if (column == null) { - throw new IllegalArgumentException("Column must be not null"); + throw new IllegalArgumentException(Messages.getString("swing.78")); } tableColumns.add(column); totalColumnWidth = -1; @@ -78,7 +80,7 @@ if (columnIndex < 0 || columnIndex >= getColumnCount() || newIndex < 0 || newIndex > getColumnCount()) { - throw new IllegalArgumentException("Specified index is out of range"); + throw new IllegalArgumentException(Messages.getString("swing.79")); } if (columnIndex != newIndex) { @@ -120,7 +122,7 @@ public int getColumnIndex(final Object identifier) { if (identifier == null) { - throw new IllegalArgumentException("Identifier must be not null"); + throw new IllegalArgumentException(Messages.getString("swing.7A")); } for (int i = 0; i < getColumnCount(); i++) { @@ -130,7 +132,7 @@ } } - throw new IllegalArgumentException("Identifier is not found"); + throw new IllegalArgumentException(Messages.getString("swing.7B")); } public TableColumn getColumn(final int columnIndex) { @@ -160,7 +162,7 @@ public void setSelectionModel(final ListSelectionModel model) { if (model == null) { - throw new IllegalArgumentException("Model must be not-null"); + throw new IllegalArgumentException(Messages.getString("swing.7C")); } selectionModel.removeListSelectionListener(this); Index: modules/swing/src/main/java/common/javax/swing/JToolBar.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JToolBar.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JToolBar.java (working copy) @@ -33,17 +33,19 @@ import javax.accessibility.AccessibleStateSet; import javax.swing.plaf.ToolBarUI; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JToolBar extends JComponent implements SwingConstants, Accessible { private static final Insets DEFAULT_MARGIN = new Insets(0, 0, 0, 0); // TODO: implement accessibility protected class AccessibleJToolBar extends AccessibleJComponent { public AccessibleStateSet getAccessibleStateSet() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleRole getAccessibleRole() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } } @@ -275,8 +277,7 @@ private void checkOrientation(final int o) { if (o != HORIZONTAL && o != VERTICAL) { - throw new IllegalArgumentException( - "orientation must be HORIZONTAL or VERTICAL"); + throw new IllegalArgumentException(Messages.getString("swing.47")); } } Index: modules/swing/src/main/java/common/javax/swing/Timer.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/Timer.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/Timer.java (working copy) @@ -23,6 +23,8 @@ import javax.swing.event.EventListenerList; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* Timer @@ -109,7 +111,7 @@ public void setInitialDelay(final int initialDelay) { if (initialDelay < 0) { - throw new IllegalArgumentException("Invalid initial delay: " + initialDelay); + throw new IllegalArgumentException(Messages.getString("swing.63", initialDelay)); } this.initialDelay = initialDelay; } @@ -120,7 +122,7 @@ public void setDelay(final int delay) { if (delay < 0) { - throw new IllegalArgumentException("Invalid delay: " + delay); + throw new IllegalArgumentException(Messages.getString("swing.64", delay)); } this.delay = delay; } @@ -209,4 +211,4 @@ private static int getPositiveDelay(final int d) { return (d > 0) ? d : 1; } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/javax/swing/ComponentInputMap.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/ComponentInputMap.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/ComponentInputMap.java (working copy) @@ -17,6 +17,8 @@ package javax.swing; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* ComponentInputMap @@ -34,8 +36,7 @@ public ComponentInputMap(JComponent component) { if (component == null) { - throw new IllegalArgumentException( - "ComponentInputMaps must be associated with a non-null JComponent"); + throw new IllegalArgumentException(Messages.getString("swing.57")); } this.component = component; } @@ -63,8 +64,7 @@ if (parent != null && (!(parent instanceof ComponentInputMap) || (((ComponentInputMap) parent) .getComponent() != component))) { - throw new IllegalArgumentException( - "ComponentInputMap must have a ComponentInputMap parent associated with the same component"); + throw new IllegalArgumentException(Messages.getString("swing.4D")); } super.setParent(parent); if (component != null) { Index: modules/swing/src/main/java/common/javax/swing/DefaultBoundedRangeModel.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/DefaultBoundedRangeModel.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/DefaultBoundedRangeModel.java (working copy) @@ -22,6 +22,8 @@ import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* DefaultBoundedRangeModel @@ -57,7 +59,7 @@ public DefaultBoundedRangeModel(int value, int extent, int min, int max) { if (min > value || value > value + extent || value + extent > max) { - throw new IllegalArgumentException("invalid range properties"); + throw new IllegalArgumentException(Messages.getString("swing.07")); } this.min = min; this.max = max; Index: modules/swing/src/main/java/common/javax/swing/BoxLayout.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/BoxLayout.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/BoxLayout.java (working copy) @@ -24,6 +24,8 @@ import java.awt.LayoutManager2; import java.io.Serializable; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BoxLayout implements LayoutManager2, Serializable { private static final long serialVersionUID = -2474455742719112368L; @@ -119,7 +121,7 @@ : LayoutParameters.HORIZONTAL_ALIGNMENT; } } else { - throw new AWTError("Invalid axis"); + throw new AWTError(Messages.getString("swing.err.04")); } return alignment; } @@ -131,7 +133,7 @@ */ private void checkTarget(final Container target) { if (this.target != target) { - throw new AWTError("BoxLayout should be used for one container only"); + throw new AWTError(Messages.getString("swing.err.02")); } } } Index: modules/swing/src/main/java/common/javax/swing/ScrollPaneLayout.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/ScrollPaneLayout.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/ScrollPaneLayout.java (working copy) @@ -125,7 +125,7 @@ if (x != ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED && x != ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS && x != ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER) { - throw new IllegalArgumentException(Messages.getString("swing.02")); + throw new IllegalArgumentException(Messages.getString("swing.02","verticalScrollBarPolicy")); } vsbPolicy = x; } @@ -138,7 +138,7 @@ if (x != ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED && x != ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER && x != ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) { - throw new IllegalArgumentException(Messages.getString("swing.03")); + throw new IllegalArgumentException(Messages.getString("swing.02","horizontalScrollBarPolicy")); } hsbPolicy = x; } Index: modules/swing/src/main/java/common/javax/swing/JTextField.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JTextField.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JTextField.java (working copy) @@ -49,6 +49,8 @@ import org.apache.harmony.awt.text.PropertyNames; import org.apache.harmony.awt.text.TextFieldKit; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** * Note: serialVersionUID fields in this class and its inner * classes are added as a performance optimization but not as a guarantee of @@ -200,7 +202,7 @@ public JTextField(final Document doc, final String text, final int c) { super(); if (c < 0) { - throw new IllegalArgumentException("columns less than zero."); + throw new IllegalArgumentException(Messages.getString("swing.45")); } Document document = doc; if (doc == null) { @@ -455,7 +457,7 @@ public void setColumns(final int c) { if (c < 0) { - throw new IllegalArgumentException("columns less than zero."); + throw new IllegalArgumentException(Messages.getString("swing.45")); } columns = c; invalidate(); @@ -480,7 +482,7 @@ public void setHorizontalAlignment(final int alignment) { if (alignment != LEFT && alignment != RIGHT && alignment != CENTER && alignment != LEADING && alignment != TRAILING) { - throw new IllegalArgumentException("horizontalAlignment"); + throw new IllegalArgumentException(Messages.getString("horizontalAlignment")); } int old = horizontalAlignment; horizontalAlignment = alignment; @@ -495,4 +497,4 @@ getHorizontalVisibility().setValue(scrollOffset); } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/javax/swing/text/ParagraphView.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/ParagraphView.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/ParagraphView.java (working copy) @@ -29,7 +29,9 @@ import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class ParagraphView extends FlowView implements TabExpander { private static final int DEFAULT_TAB = 72; private static final int MIN_TEXT_CHUNK = 10; @@ -269,7 +271,7 @@ final int rowIndex, final int x) throws BadLocationException { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } protected float getPartialSize(final int startOffset, @@ -341,7 +343,7 @@ final Bias[] biasRet) throws BadLocationException { if (true) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } return TextUtils.getNextVisualPositionFrom(getTextKit(), this, pos, b, a, @@ -350,7 +352,7 @@ protected boolean flipEastAndWestAtEnds(final int position, final Bias bias) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } protected TabSet getTabSet() { Index: modules/swing/src/main/java/common/javax/swing/text/StringContent.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/StringContent.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/StringContent.java (working copy) @@ -29,11 +29,12 @@ import javax.swing.text.AbstractDocument.Content; import javax.swing.undo.UndoableEdit; +import org.apache.harmony.x.swing.internal.nls.Messages; + public final class StringContent implements Content, Serializable { - private static final String INVALID_START_POSITION_MESSAGE = - "Invalid start position"; + private static final String INVALID_START_POSITION_MESSAGE = Messages.getString("swing.0F"); private final class StringContentEdit extends AbstractContentUndoableEdit implements UndoableEdit { @@ -160,8 +161,7 @@ private void checkInvalidOnRemove(final int where, final int nitems) throws BadLocationException { if (nitems < 0) { - throw new BadLocationException("The number of characters to remove " - + "must be non-negative", + throw new BadLocationException(Messages.getString("swing.99"), length); } @@ -174,7 +174,7 @@ private void checkInvalidOnGetChars(final int where, final int len) throws BadLocationException { if (len < 0) { - throw new BadLocationException("Length must be non-negative", + throw new BadLocationException(Messages.getString("swing.8C"), length); } @@ -271,4 +271,4 @@ private void writeObject(final ObjectOutputStream oos) throws IOException { oos.defaultWriteObject(); } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/javax/swing/text/AbstractDocument.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/AbstractDocument.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/AbstractDocument.java (working copy) @@ -51,7 +51,9 @@ import org.apache.harmony.awt.text.TextUtils; import org.apache.harmony.x.swing.StringConstants; +import org.apache.harmony.x.swing.internal.nls.Messages; + public abstract class AbstractDocument implements Document, Serializable { public abstract class AbstractElement @@ -878,8 +880,7 @@ public final synchronized void writeLock() { if (callingListeners) { - throw new IllegalStateException("Document cannot be modified " - + "from listener handler"); + throw new IllegalStateException(Messages.getString("swing.7E")); } final Thread thread = Thread.currentThread(); @@ -1368,11 +1369,11 @@ } if (offset < 0 || offset > getLength()) { - throw new BadLocationException("Invalid remove position", offset); + throw new BadLocationException(Messages.getString("swing.7F"), offset); } if (offset + length > getLength()) { - throw new BadLocationException("Invalid remove length", + throw new BadLocationException(Messages.getString("swing.80"), offset + length); } Index: modules/swing/src/main/java/common/javax/swing/text/Segment.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/Segment.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/Segment.java (working copy) @@ -18,6 +18,8 @@ import java.text.CharacterIterator; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class Segment implements Cloneable, CharacterIterator { public char[] array; @@ -121,7 +123,7 @@ public char setIndex(final int position) { if (position < 0 || position > offset + count) { - throw new IllegalArgumentException("invalid position: " + position); + throw new IllegalArgumentException(Messages.getString("swing.89", position)); } pos = position; Index: modules/swing/src/main/java/common/javax/swing/text/InternationalFormatter.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/InternationalFormatter.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/InternationalFormatter.java (working copy) @@ -34,8 +34,10 @@ import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class InternationalFormatter extends DefaultFormatter { private static final String DECREMENT_ACTION_NAME = "decrement"; private static final String INCREMENT_ACTION_NAME = "increment"; @@ -179,7 +181,7 @@ } if (!checkRange(result)) { - throw new ParseException("the value is outside the min/max ", 0); + throw new ParseException(Messages.getString("swing.8F"), 0); } return result; } Index: modules/swing/src/main/java/common/javax/swing/text/PasswordView.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/PasswordView.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/PasswordView.java (working copy) @@ -29,7 +29,9 @@ import org.apache.harmony.awt.text.TextFieldKit; import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class PasswordView extends FieldView { private static final char DEFAULT_ECHO_CHAR = '*'; @@ -82,7 +84,7 @@ if (echoCharIsSet()) { String text = getText(); if (pos < 0 || pos > text.length()) { - throw new BadLocationException("incorrect position: " + pos, + throw new BadLocationException(Messages.getString("swing.95", pos), pos); } if (shape == null) { @@ -151,9 +153,9 @@ final int y) throws BadLocationException { int length = getTextLength(); if (p0 < 0) { - throw new BadLocationException("incorrect positions: ", p0); + throw new BadLocationException(Messages.getString("swing.96"), p0); } else if (p1 < p0 || p1 > length) { - throw new BadLocationException("incorrect positions: ", p1); + throw new BadLocationException(Messages.getString("swing.96"), p1); } Color old = g.getColor(); Index: modules/swing/src/main/java/common/javax/swing/text/PlainViewI18N.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/PlainViewI18N.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/PlainViewI18N.java (working copy) @@ -34,7 +34,9 @@ import org.apache.harmony.awt.text.TextKit; import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** * Represents view for displaying bidirectional text. */ @@ -59,7 +61,7 @@ final int end = getEndOffset(); if (pos < start || pos > end) { - throw new BadLocationException("Invalid position", pos); + throw new BadLocationException(Messages.getString("swing.98"), pos); } getDocument().getText(pos, end - pos, paintParams.buffer); @@ -160,7 +162,7 @@ final int start = getStartOffset(); if (pos < start || pos > getEndOffset()) { - throw new BadLocationException("Invalid position", pos); + throw new BadLocationException(Messages.getString("swing.98"), pos); } getDocument().getText(start, pos - start, paintParams.buffer); Index: modules/swing/src/main/java/common/javax/swing/text/DefaultCaret.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/DefaultCaret.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/DefaultCaret.java (working copy) @@ -58,6 +58,8 @@ import org.apache.harmony.awt.text.TextUtils; import org.apache.harmony.x.swing.StringConstants; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class DefaultCaret extends Rectangle implements Caret, FocusListener, MouseListener, MouseMotionListener { @@ -983,7 +985,7 @@ */ public void setBlinkRate(final int i) { if (i < 0) { - throw new IllegalArgumentException("Invalid delay: " + i); + throw new IllegalArgumentException(Messages.getString("swing.64", i)); } blinkRate = i; stopTimer(blinkTimer); Index: modules/swing/src/main/java/common/javax/swing/text/DefaultGlyphPainter.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/DefaultGlyphPainter.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/DefaultGlyphPainter.java (working copy) @@ -43,6 +43,8 @@ import org.apache.harmony.awt.text.TextKit; import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** * Default GlyphPainter which is used when a GlyphView needs a painter but * none was set. @@ -86,10 +88,7 @@ throws BadLocationException { if (true) { - throw new UnsupportedOperationException("Default painter of " - + "GlyphView can't " - + "paint composed " - + "text."); + throw new UnsupportedOperationException(Messages.getString("swing.87")); } return x; } @@ -161,8 +160,7 @@ throws BadLocationException { if (offset < v.getStartOffset() || offset > v.getEndOffset()) { - throw new BadLocationException("This view doesn't represent " - + "offset " + offset, offset); + throw new BadLocationException(Messages.getString("swing.88", offset), offset); } final Segment text = v.getText(v.getStartOffset(), offset); Index: modules/swing/src/main/java/common/javax/swing/text/MaskFormatter.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/MaskFormatter.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/MaskFormatter.java (working copy) @@ -28,7 +28,9 @@ import javax.swing.text.DocumentFilter.FilterBypass; import javax.swing.text.Position.Bias; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class MaskFormatter extends DefaultFormatter { private String mask; private String placeholder; @@ -211,7 +213,7 @@ if (maskLength - escapeLength - (valueContainsLiteralCharacters ? 0 : literalsLength) < length) { - throw new ParseException("Cann't parse value", 0); + throw new ParseException(Messages.getString("swing.92"), 0); } int index = 0; int maskIndex = 0; @@ -243,7 +245,7 @@ if (!acceptCharacter(maskCharacter, textCharacter, isLiteral)) { - throw new ParseException("Cann't parse String", index); + throw new ParseException(Messages.getString("swing.93"), index); } } @@ -300,7 +302,7 @@ int maskLength = mask.length(); int index = 0; if (maskLength - length != escapeMask.cardinality()) { - throw new ParseException("stringToValue passed invalid value", 0); + throw new ParseException(Messages.getString("swing.94"), 0); } int accumulator = 0; String result = ""; Index: modules/swing/src/main/java/common/javax/swing/text/JTextComponent.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/JTextComponent.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/JTextComponent.java (working copy) @@ -92,7 +92,9 @@ import org.apache.harmony.awt.text.TextUtils; import org.apache.harmony.x.swing.StringConstants; +import org.apache.harmony.x.swing.internal.nls.Messages; + public abstract class JTextComponent extends JComponent implements Scrollable, Accessible { @@ -159,8 +161,7 @@ private void checkPositions(final int i1, final int i2, final int length) { if (i1 < 0 || i2 < i1 || i2 > length) { - throw new IllegalArgumentException("Wrong parameters :" - + i1 + ", " + i2); + throw new IllegalArgumentException(Messages.getString("swing.90",i1, i2)); } } @@ -1138,8 +1139,7 @@ } else if (orientation == SwingConstants.VERTICAL) { return rect.height; } else { - throw new IllegalArgumentException("Invalid orientation: " - + orientation); + throw new IllegalArgumentException(Messages.getString("swing.41", orientation)); } } @@ -1170,8 +1170,7 @@ } else if (orientation == SwingConstants.VERTICAL) { return rect.height / DEFAULT_UNIT_NUMBER; } else { - throw new IllegalArgumentException("Invalid orientation: " - + orientation); + throw new IllegalArgumentException(Messages.getString("swing.41", orientation)); } } @@ -1242,7 +1241,7 @@ return; } if (pos < 0 || pos > document.getLength()) { - throw new IllegalArgumentException("bad position: " + pos); + throw new IllegalArgumentException(Messages.getString("swing.91", pos)); } caret.moveDot(pos); } @@ -1369,7 +1368,7 @@ return; } if (pos < 0 || pos > document.getLength()) { - throw new IllegalArgumentException("bad position: " + pos); + throw new IllegalArgumentException(Messages.getString("swing.91", pos)); } caret.setDot(pos); } Index: modules/swing/src/main/java/common/javax/swing/text/WrappedPlainView.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/WrappedPlainView.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/WrappedPlainView.java (working copy) @@ -32,6 +32,8 @@ import org.apache.harmony.awt.text.TextKit; import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class WrappedPlainView extends BoxView implements TabExpander { private class LineView extends View { @@ -72,7 +74,7 @@ int end = getEndOffset() - 1; if (pos < start || pos > end) { - throw new BadLocationException("Invalid position", pos); + throw new BadLocationException(Messages.getString("swing.98"), pos); } int lineNo = 0; Index: modules/swing/src/main/java/common/javax/swing/text/DefaultHighlighter.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/DefaultHighlighter.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/DefaultHighlighter.java (working copy) @@ -30,8 +30,10 @@ import org.apache.harmony.awt.text.TextKit; import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class DefaultHighlighter extends LayeredHighlighter { // This vector contains all highlights @@ -379,10 +381,10 @@ private void checkBoundaries(final int start, final int end) throws BadLocationException { if (start < 0) { - throw new BadLocationException("Invalid position: " + start, end); + throw new BadLocationException(Messages.getString("swing.89", start), end); } if (end < start) { - throw new BadLocationException("Invalid position: " + start, end); + throw new BadLocationException(Messages.getString("swing.89", start), end); } } Index: modules/swing/src/main/java/common/javax/swing/text/StyleContext.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/StyleContext.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/StyleContext.java (working copy) @@ -44,6 +44,8 @@ import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class StyleContext implements Serializable, AbstractDocument.AttributeContext { @@ -300,9 +302,7 @@ public Object nextElement() { if (count >= attributes.length) { - new NoSuchElementException("The enumeration has " - + "no more elements " - + "to provide"); + new NoSuchElementException(Messages.getString("swing.9A")); } Object next = attributes[count++]; @@ -729,7 +729,7 @@ if (key instanceof Integer) { count = ((Integer)key).intValue(); } else { - throw new IOException("No attribute set count field."); + throw new IOException(Messages.getString("swing.9B")); } while (count-- > 0) { Index: modules/swing/src/main/java/common/javax/swing/text/TabSet.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/TabSet.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/TabSet.java (working copy) @@ -24,7 +24,9 @@ import org.apache.harmony.misc.HashCode; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class TabSet implements Serializable { private TabStop[] tabs; @@ -52,7 +54,7 @@ public TabStop getTab(final int i) { if (i < 0 || i >= tabs.length) { - throw new IllegalArgumentException("Invalid tab index " + i); + throw new IllegalArgumentException(Messages.getString("swing.9C", i)); } return tabs[i]; } Index: modules/swing/src/main/java/common/javax/swing/text/BoxView.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/BoxView.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/BoxView.java (working copy) @@ -29,6 +29,8 @@ import org.apache.harmony.x.swing.SizeRequirementsHelper; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BoxView extends CompositeView { private static final int[] EMPTY_INT_ARRAY = new int[0]; private static final SizeRequirements[] EMPTY_REQUIREMENTS_ARRAY = @@ -484,7 +486,7 @@ private void isAxisValid(final int axis) { if (axis != X_AXIS && axis != Y_AXIS) { - throw new IllegalArgumentException("Invalid axis"); + throw new IllegalArgumentException(Messages.getString("swing.81")); } } Index: modules/swing/src/main/java/common/javax/swing/text/IconView.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/IconView.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/IconView.java (working copy) @@ -29,6 +29,8 @@ import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class IconView extends View { public IconView(final Element element) { @@ -74,7 +76,7 @@ private void isAxisValid(final int axis) { if (axis != X_AXIS && axis != Y_AXIS) { - throw new IllegalArgumentException("Invalid axis: " + axis); + throw new IllegalArgumentException(Messages.getString("swing.00", axis)); } } - } \ No newline at end of file + } Index: modules/swing/src/main/java/common/javax/swing/text/html/MinimalHTMLWriter.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/html/MinimalHTMLWriter.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/html/MinimalHTMLWriter.java (working copy) @@ -39,6 +39,8 @@ import javax.swing.text.StyleContext; import javax.swing.text.StyledDocument; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class MinimalHTMLWriter extends AbstractWriter { private static final AttributeSet EMPTY_ATTR_SET = new SimpleAttributeSet(); private Vector openEmbeddedTags = new Vector(); @@ -222,7 +224,7 @@ protected void writeStyles() throws IOException { if (!(getDocument() instanceof DefaultStyledDocument)) { // XXX: it's not clear what to do in this case - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.9F")); } StyledDocument styledDocument = (StyledDocument)getDocument(); Index: modules/swing/src/main/java/common/javax/swing/text/html/CascadedStyle.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/html/CascadedStyle.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/html/CascadedStyle.java (working copy) @@ -33,6 +33,8 @@ import javax.swing.text.Style; import javax.swing.text.StyleConstants; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** * Storage for all the attributes applicable for the * {@link javax.swing.text.Element} for which CascadedStyle @@ -124,27 +126,27 @@ } public void removeAttribute(final Object arg0) { -// throw new UnsupportedOperationException("Not implemented yet"); +// throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void removeAttributes(final Enumeration arg0) { -// throw new UnsupportedOperationException("Not implemented yet"); +// throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void addAttributes(final AttributeSet arg0) { -// throw new UnsupportedOperationException("Not implemented yet"); +// throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void removeAttributes(final AttributeSet arg0) { -// throw new UnsupportedOperationException("Not implemented yet"); +// throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void setResolveParent(final AttributeSet arg0) { -// throw new UnsupportedOperationException("Not implemented yet"); +// throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void addAttribute(final Object arg0, final Object arg1) { -// throw new UnsupportedOperationException("Not implemented yet"); +// throw new UnsupportedOperationException(Messages.getString("swing.27")); } public int getAttributeCount() { @@ -223,7 +225,7 @@ } public AttributeSet copyAttributes() { - throw new UnsupportedOperationException("Not implemented yet"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AttributeSet getResolveParent() { Index: modules/swing/src/main/java/common/javax/swing/text/html/StyleSheet.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/html/StyleSheet.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/html/StyleSheet.java (working copy) @@ -71,6 +71,8 @@ import org.apache.harmony.x.swing.text.html.cssparser.metamodel.RuleSet; import org.apache.harmony.x.swing.text.html.cssparser.metamodel.Sheet; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** * Implementation of this class is based on CSS1. */ @@ -132,7 +134,7 @@ updateProperties(); if (!(g instanceof Graphics2D)) { - System.err.println("Graphics is not instance of Graphics2D"); + System.err.println(Messages.getString("swing.err.09")); } Graphics2D g2d = (Graphics2D)g; @@ -307,7 +309,7 @@ return CSS.LEFT_SIDE; default: - throw new IllegalArgumentException("Invalid side " + side); + throw new IllegalArgumentException(Messages.getString("swing.A4", side)); } } @@ -1148,7 +1150,7 @@ } private void parseSheet(final boolean asResolver) { -// throw new UnsupportedOperationException("CSS parser required!"); +// throw new UnsupportedOperationException(Messages.getString("swing.A5")); Sheet ss = null; try { ss = parser.parse(); Index: modules/swing/src/main/java/common/javax/swing/text/html/ObjectView.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/html/ObjectView.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/html/ObjectView.java (working copy) @@ -24,14 +24,16 @@ import javax.swing.text.ComponentView; import javax.swing.text.Element; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class ObjectView extends ComponentView { public ObjectView(final Element elem) { super(elem); - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.9F")); } protected Component createComponent() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.9F")); } } Index: modules/swing/src/main/java/common/javax/swing/text/html/HTMLDocument.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/html/HTMLDocument.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/html/HTMLDocument.java (working copy) @@ -59,6 +59,8 @@ import org.apache.harmony.x.swing.text.html.form.FormTextModel; import org.apache.harmony.x.swing.text.html.form.FormToggleButtonModel; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class HTMLDocument extends DefaultStyledDocument { public class BlockElement extends BranchElement { @@ -1226,7 +1228,7 @@ int numRemovingElements = elem.getElementCount(); insertHTMLText(elem, elem.getStartOffset(), htmlText); removeElements(elem, elem.getElementCount() - numRemovingElements, numRemovingElements); - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void setOuterHTML(final Element elem, final String htmlText) @@ -1242,7 +1244,7 @@ final int numElementsBefore = parent.getElementCount(); insertHTMLText(elem.getParentElement(), elem.getStartOffset(), htmlText); removeElements(parent, indexBefore + (parent.getElementCount() - numElementsBefore), 1); - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public void processHTMLFrameHyperlinkEvent(final HTMLFrameHyperlinkEvent event) { @@ -1383,13 +1385,13 @@ private void checkParser() { if (parser == null) { - throw new IllegalStateException("Parser should be set"); + throw new IllegalStateException(Messages.getString("swing.9D")); } } private void checkLeaf(final Element elem) { if (elem.isLeaf()) { - throw new IllegalArgumentException("Can't insert HTML text after start of a leaf element"); + throw new IllegalArgumentException(Messages.getString("swing.9E")); } } Index: modules/swing/src/main/java/common/javax/swing/text/html/parser/ParserCup.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/html/parser/ParserCup.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/html/parser/ParserCup.java (working copy) @@ -28,6 +28,8 @@ import java.util.List; import java.math.BigInteger; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** CUP v0.11a beta 20060102 generated parser. * @version Wed Dec 20 21:02:26 ART 2006 */ @@ -1144,8 +1146,7 @@ /* . . . . . .*/ default: - throw new Exception( - "Invalid action number found in internal parse table"); + throw new Exception(Messages.getString("swing.04")); } } Index: modules/swing/src/main/java/common/javax/swing/text/html/parser/Parser.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/html/parser/Parser.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/html/parser/Parser.java (working copy) @@ -30,6 +30,8 @@ import javax.swing.text.html.HTML.Tag; import javax.swing.tree.DefaultMutableTreeNode; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** * This class attempts to read and parse an HTML file, which it gets via an * Input Stream. The parsing is based on a Documet Type Definition @@ -123,7 +125,7 @@ * @param omitted determines whether the end tag may be omitted or not. */ protected void endTag(final boolean omitted) { - throw new UnsupportedOperationException("not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); // XXX: Perhaps depending on the boolean value, an endtag.missing // error may be thrown //handleEndTag(currentTag); @@ -302,7 +304,7 @@ * */ protected void handleEOFInComment() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.9F")); } /** @@ -375,7 +377,7 @@ */ protected void markFirstTime(final Element elem) { // TODO review this - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.9F")); } /** @@ -1428,4 +1430,4 @@ } } } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/javax/swing/text/html/HTMLEditorKit.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/html/HTMLEditorKit.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/html/HTMLEditorKit.java (working copy) @@ -67,6 +67,8 @@ import org.apache.harmony.awt.text.TextUtils; import org.apache.harmony.x.swing.StringConstants; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class HTMLEditorKit extends StyledEditorKit implements Accessible { public static class HTMLFactory implements ViewFactory { @@ -146,7 +148,7 @@ // TODO: uncomment the next line and remove throw // when all tags are supported // return new LabelView(elem); - throw new UnsupportedOperationException("Not implemented tag: " + tag); + throw new UnsupportedOperationException(Messages.getString("swing.9F") + tag); } } @@ -201,7 +203,7 @@ if (doc instanceof HTMLDocument) { return (HTMLDocument)doc; } - throw new IllegalArgumentException("Document must be HTMLDocument"); + throw new IllegalArgumentException(Messages.getString("swing.A0")); } protected HTMLEditorKit getHTMLEditorKit(final JEditorPane pane) { @@ -209,7 +211,7 @@ if (editorKit instanceof HTMLEditorKit) { return (HTMLEditorKit)editorKit; } - throw new IllegalArgumentException("Editor kit must be HTMLEditorKit"); + throw new IllegalArgumentException(Messages.getString("swing.A1")); } } @@ -569,7 +571,7 @@ final Bias[] biasRet) throws BadLocationException { if (direction != NORTH && direction != SOUTH && direction != EAST && direction != WEST) { - throw new IllegalArgumentException("Invalid direction"); + throw new IllegalArgumentException(Messages.getString("swing.84")); } biasRet[0] = Position.Bias.Forward; return getEndOffset(); @@ -621,7 +623,7 @@ public AccessibleContext getAccessibleContext() { // TODO: implement - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.9F")); } public Action[] getActions() { @@ -706,7 +708,7 @@ final int pushDepth, final HTML.Tag insertTag) throws BadLocationException, IOException { if (offset > doc.getLength()) { - throw new BadLocationException("Invalid position", offset); + throw new BadLocationException(Messages.getString("swing.98"), offset); } ParserCallback htmlReader = doc.getReader(offset, popDepth, @@ -783,17 +785,17 @@ private static void checkReadPosition(final HTMLDocument doc, final int pos) throws BadLocationException { if (pos < 0) { - throw new RuntimeException("Position cannot be negative"); + throw new RuntimeException(Messages.getString("swing.A2")); } if (pos > doc.getLength()) { - throw new BadLocationException("Invalid position", pos); + throw new BadLocationException(Messages.getString("swing.98"), pos); } if (doc.getLength() != 0) { Element body = doc.getElement(doc.getDefaultRootElement(), StyleConstants.NameAttribute, HTML.Tag.BODY); if (pos < body.getStartOffset() || pos > body.getEndOffset()) { - throw new RuntimeException("Must insert inside body element"); + throw new RuntimeException(Messages.getString("swing.A3")); } } } Index: modules/swing/src/main/java/common/javax/swing/text/html/CSS.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/html/CSS.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/html/CSS.java (working copy) @@ -42,6 +42,7 @@ import javax.swing.text.View; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; public class CSS implements Serializable { public static final class Attribute { @@ -1689,8 +1690,7 @@ return new Integer(fontSize * 120 / 100); default: - System.err.println("font-size: can't resolve relative value. " - + "Unknown relative unit"); + System.err.println(Messages.getString("swing.err.07")); } return getDefaultValue(); } @@ -2163,8 +2163,7 @@ return new Float(width * theValue.floatValue() / 100); default: - System.err.println("FloatValue: can't resolve relative value. " - + "Unknown relative unit"); + System.err.println(Messages.getString("swing.err.07")); } return ZERO; } Index: modules/swing/src/main/java/common/javax/swing/text/html/FormView.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/html/FormView.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/html/FormView.java (working copy) @@ -49,12 +49,14 @@ import org.apache.harmony.x.swing.text.html.form.FormToggleButtonModel; import org.apache.harmony.x.swing.internal.nls.Messages; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class FormView extends ComponentView implements ActionListener { private static final int EMPTY_SPAN = 0; protected class MouseEventListener extends MouseAdapter { public void mouseReleased(final MouseEvent evt) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } } @@ -253,12 +255,12 @@ protected void imageSubmit(final String imageData) { // TODO implement imageSubmit - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } protected void submitData(final String data) { // TODO implement submitData - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } private void determineValidControls(final Form form) { @@ -280,7 +282,7 @@ case FormAttributes.TEXTAREA_TYPE_INDEX : case FormAttributes.SELECT_LIST_TYPE_INDEX : case FormAttributes.SELECT_COMBOBOX_TYPE_INDEX : - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); default : // Do nothing break; @@ -355,4 +357,4 @@ //CHECKED model.setSelected(attrs.getAttribute(HTML.Attribute.CHECKED) != null); } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/javax/swing/text/ComponentView.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/ComponentView.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/ComponentView.java (working copy) @@ -33,6 +33,8 @@ import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class ComponentView extends View { private static final class ComponentViewLayout implements LayoutManager { @@ -185,9 +187,9 @@ private void isAxisValid(final int axis) { if (axis != X_AXIS && axis != Y_AXIS) { - throw new IllegalArgumentException("Invalid axis: " + axis); + throw new IllegalArgumentException(Messages.getString("swing.00", axis)); } } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/javax/swing/text/EmptyAttributeSet.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/EmptyAttributeSet.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/EmptyAttributeSet.java (working copy) @@ -24,6 +24,8 @@ import java.util.Enumeration; import java.util.NoSuchElementException; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** * Implementation of empty attribute set. * @@ -65,7 +67,7 @@ return false; } public Object nextElement() { - throw new NoSuchElementException("Empty attribute set"); + throw new NoSuchElementException(Messages.getString("swing.8A")); } }; } Index: modules/swing/src/main/java/common/javax/swing/text/GapContent.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/GapContent.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/GapContent.java (working copy) @@ -29,6 +29,8 @@ import javax.swing.text.ContentPositions.DocumentMark; import javax.swing.undo.UndoableEdit; +import org.apache.harmony.x.swing.internal.nls.Messages; + @SuppressWarnings("serial") public class GapContent implements AbstractDocument.Content, Serializable { @@ -140,11 +142,11 @@ throws BadLocationException { if (length < 0) { - throw new BadLocationException("Length must be non-negative", + throw new BadLocationException(Messages.getString("swing.8C"), length); } if (offset < 0 || length > length() - offset) { - throw new BadLocationException("Invalid start position", offset); + throw new BadLocationException(Messages.getString("swing.8D"), offset); } if (offset + length <= gapStart) { @@ -366,7 +368,7 @@ throws BadLocationException { if (where < 0 || where > length()) { - throw new BadLocationException("Invalid insert position", where); + throw new BadLocationException(Messages.getString("swing.8E"), where); } shiftGap(where); @@ -396,7 +398,7 @@ if (where < 0 || where + nitems >= length()) { - throw new BadLocationException("Invalid remove position", where); + throw new BadLocationException(Messages.getString("swing.7F"), where); } if (where + nitems == gapStart) { Index: modules/swing/src/main/java/common/javax/swing/text/FlowView.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/FlowView.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/FlowView.java (working copy) @@ -29,6 +29,8 @@ import javax.swing.event.DocumentEvent; import javax.swing.text.Position.Bias; +import org.apache.harmony.x.swing.internal.nls.Messages; + public abstract class FlowView extends BoxView { public static class FlowStrategy { private static FlowStrategy sharedStrategy; @@ -232,8 +234,7 @@ } public void paint(final Graphics g, final Shape shape) { - throw new UnsupportedOperationException("Not applicable to " - + "Layout Pool"); + throw new UnsupportedOperationException(Messages.getString("swing.8B")); } public void preferenceChanged(final View child, @@ -272,8 +273,7 @@ protected View getViewAtPoint(final int x, final int y, final Rectangle alloc) { - throw new UnsupportedOperationException("Not applicable to " - + "Layout Pool"); + throw new UnsupportedOperationException(Messages.getString("swing.8B")); } protected int getViewIndexAtPosition(final int pos) { @@ -285,14 +285,12 @@ protected boolean isAfter(final int x, final int y, final Rectangle rc) { - throw new UnsupportedOperationException("Not applicable to " - + "Layout Pool"); + throw new UnsupportedOperationException(Messages.getString("swing.8B")); } protected boolean isBefore(final int x, final int y, final Rectangle rc) { - throw new UnsupportedOperationException("Not applicable to " - + "Layout Pool"); + throw new UnsupportedOperationException(Messages.getString("swing.8B")); } private float getSpanX() { Index: modules/swing/src/main/java/common/javax/swing/text/DefaultFormatter.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/DefaultFormatter.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/DefaultFormatter.java (working copy) @@ -26,6 +26,8 @@ import javax.swing.SwingUtilities; import javax.swing.text.DocumentFilter.FilterBypass; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* DefaultFormatter @@ -280,7 +282,7 @@ } Object result = stringToValue(string, valueClass); if (result == null) { - throw new ParseException("Error creating instance", 0); + throw new ParseException(Messages.getString("swing.86"), 0); } return result; } Index: modules/swing/src/main/java/common/javax/swing/text/ContentPositions.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/ContentPositions.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/ContentPositions.java (working copy) @@ -29,6 +29,8 @@ import java.util.List; import java.util.Vector; +import org.apache.harmony.x.swing.internal.nls.Messages; + abstract class ContentPositions { public final class DocumentMark implements Position, Comparable { protected int index; @@ -131,7 +133,7 @@ throws BadLocationException { if (offset < 0) { - throw new BadLocationException("Invalid position offset", offset); + throw new BadLocationException(Messages.getString("swing.85"), offset); } return new WeakPosition(offset); Index: modules/swing/src/main/java/common/javax/swing/text/StyledEditorKit.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/StyledEditorKit.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/StyledEditorKit.java (working copy) @@ -26,6 +26,8 @@ import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* StyledEditorKit @@ -294,7 +296,7 @@ static final class ViewFactoryImpl implements ViewFactory { public View create(final Element element) { // if (true) { -// throw new UnsupportedOperationException("Not implemented"); +// throw new UnsupportedOperationException(Messages.getString("swing.27")); // } // return null; //This code committed-out temporarily (while these views is not Index: modules/swing/src/main/java/common/javax/swing/text/CompositeView.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/CompositeView.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/CompositeView.java (working copy) @@ -27,7 +27,9 @@ import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; + public abstract class CompositeView extends View { private View[] children; private final Rectangle rect = new Rectangle(); @@ -125,8 +127,7 @@ getChildAllocation(index, shape), bias); } - throw new BadLocationException("View representing " + pos - + " not found", pos); + throw new BadLocationException(Messages.getString("swing.83", pos), pos); } @Override @@ -137,14 +138,12 @@ // TODO should throw IllegalArgumentException for invalid bias arg int index1 = getViewIndex(p1, b1); if (index1 == -1) { - throw new BadLocationException("View representing " + p1 - + " not found", p1); + throw new BadLocationException(Messages.getString("swing.83", p1), p1); } int index2 = getViewIndex(p2, b2); if (index2 == -1) { - throw new BadLocationException("View representing " + p2 - + " not found", p2); + throw new BadLocationException(Messages.getString("swing.83", p2), p2); } Rectangle rc1; @@ -220,7 +219,7 @@ direction, biasRet); } - throw new IllegalArgumentException("Invalid direction"); + throw new IllegalArgumentException(Messages.getString("swing.84")); } protected void loadChildren(final ViewFactory factory) { @@ -329,7 +328,7 @@ biasRet); } - throw new IllegalArgumentException("Invalid direction"); + throw new IllegalArgumentException(Messages.getString("swing.84")); } protected int getNextNorthSouthVisualPositionFrom(final int pos, @@ -346,7 +345,7 @@ biasRet); } - throw new IllegalArgumentException("Invalid direction"); + throw new IllegalArgumentException(Messages.getString("swing.84")); } protected boolean flipEastAndWestAtEnds(final int position, Index: modules/swing/src/main/java/common/javax/swing/text/PlainView.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/PlainView.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/text/PlainView.java (working copy) @@ -33,6 +33,7 @@ import org.apache.harmony.awt.text.TextKit; import org.apache.harmony.awt.text.TextUtils; +import org.apache.harmony.x.swing.internal.nls.Messages; public class PlainView extends View implements TabExpander { protected FontMetrics metrics; @@ -59,7 +60,7 @@ return metrics.getHeight() * getElement().getElementCount(); default: - throw new IllegalArgumentException("Invalid axis (" + axis + ")"); + throw new IllegalArgumentException(Messages.getString("swing.00", axis)); } } @@ -91,7 +92,7 @@ throws BadLocationException { if (pos < 0 || pos > getDocument().getLength() + 1) { - throw new BadLocationException("Invalid position", pos); + throw new BadLocationException(Messages.getString("swing.98"), pos); } final int lineNo = getElement().getElementIndex(pos); Index: modules/swing/src/main/java/common/javax/swing/UIManager.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/UIManager.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/UIManager.java (working copy) @@ -39,6 +39,8 @@ import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* UIManager @@ -243,7 +245,7 @@ return; } if (!laf.isSupportedLookAndFeel()) { - throw new UnsupportedLookAndFeelException(laf + " is not supported on this platform."); + throw new UnsupportedLookAndFeelException(Messages.getString("swing.2E",laf)); } LookAndFeel oldValue = lookAndFeel; if (lookAndFeel != null) { Index: modules/swing/src/main/java/common/javax/swing/JSplitPane.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JSplitPane.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JSplitPane.java (working copy) @@ -32,6 +32,8 @@ import javax.accessibility.AccessibleValue; import javax.swing.plaf.SplitPaneUI; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JSplitPane extends JComponent implements Accessible { public static final String BOTTOM = "bottom"; public static final String TOP = "top"; @@ -52,27 +54,27 @@ protected class AccessibleJSplitPane extends AccessibleJComponent implements AccessibleValue { public AccessibleStateSet getAccessibleStateSet() { - throw new UnsupportedOperationException("Not implemented yet"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleValue getAccessibleValue() { - throw new UnsupportedOperationException("Not implemented yet"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Number getCurrentAccessibleValue() { - throw new UnsupportedOperationException("Not implemented yet"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public boolean setCurrentAccessibleValue(final Number n) { - throw new UnsupportedOperationException("Not implemented yet"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Number getMinimumAccessibleValue() { - throw new UnsupportedOperationException("Not implemented yet"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Number getMaximumAccessibleValue() { - throw new UnsupportedOperationException("Not implemented yet"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleRole getAccessibleRole() { @@ -240,7 +242,7 @@ public void setResizeWeight(final double weight) { if (weight < 0 || weight > 1) { - throw new IllegalArgumentException("Incorrect resize weight is specified"); + throw new IllegalArgumentException(Messages.getString("swing.32")); } if (resizeWeight != weight) { double oldValue = resizeWeight; @@ -259,7 +261,7 @@ public void setDividerLocation(final double proportionalLocation) { if (proportionalLocation < 0 || proportionalLocation > 1) { - throw new IllegalArgumentException("Incorrect proportional location is specified"); + throw new IllegalArgumentException(Messages.getString("swing.33")); } int size; @@ -375,7 +377,7 @@ private void checkOrientation(final int orientation) { if (orientation != HORIZONTAL_SPLIT && orientation != VERTICAL_SPLIT) { - throw new IllegalArgumentException("Incorrect orientation is specified"); + throw new IllegalArgumentException(Messages.getString("swing.1B")); } } Index: modules/swing/src/main/java/common/javax/swing/JComponent.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JComponent.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JComponent.java (working copy) @@ -82,6 +82,7 @@ import javax.swing.plaf.ComponentUI; import org.apache.harmony.awt.ClipRegion; import org.apache.harmony.awt.gl.MultiRectArea; +import org.apache.harmony.x.swing.internal.nls.Messages; import org.apache.harmony.x.swing.StringConstants; import org.apache.harmony.x.swing.Utilities; @@ -681,8 +682,7 @@ public final void setInputMap(int condition, InputMap map) { if (condition == WHEN_IN_FOCUSED_WINDOW && !(map instanceof ComponentInputMap) && map != null) { - throw new IllegalArgumentException("For WHEN_IN_FOCUSED_WINDOW condition " - + "ComponentInputMap has to be provided"); + throw new IllegalArgumentException(Messages.getString("swing.0D","WHEN_IN_FOCUSED_WINDOW")); } if (condition < FIRST_INPUT_MAP_INDEX || condition > LAST_INPUT_MAP_INDEX) { throw new IllegalArgumentException(ILLEGAL_CONDITION_MESSAGE); Index: modules/swing/src/main/java/common/javax/swing/OverlayLayout.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/OverlayLayout.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/OverlayLayout.java (working copy) @@ -27,6 +27,8 @@ import java.awt.LayoutManager2; import java.io.Serializable; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class OverlayLayout implements LayoutManager2, Serializable { private final Container target; @@ -101,7 +103,7 @@ */ private void checkTarget(final Container target) { if (this.target != target) { - throw new AWTError("OverlayLayout can't be shared"); + throw new AWTError(Messages.getString("swing.err.03")); } } Index: modules/swing/src/main/java/common/javax/swing/SwingUtilities.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/SwingUtilities.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/SwingUtilities.java (working copy) @@ -47,7 +47,9 @@ import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class SwingUtilities implements SwingConstants { private static final Rectangle auxRect = new Rectangle(); @@ -116,14 +118,14 @@ public static void convertPointToScreen(final Point point, final Component component) { if (component == null) { - throw new NullPointerException("Cannot convert point from null-component"); + throw new NullPointerException(Messages.getString("swing.61")); } translateRelatedPoint(point, component, 1, false); } public static void convertPointFromScreen(final Point point, final Component component) { if (component == null) { - throw new NullPointerException("Cannot convert point to null-component"); + throw new NullPointerException(Messages.getString("swing.62")); } translateRelatedPoint(point, component, -1, false); } Index: modules/swing/src/main/java/common/javax/swing/BequestedFocusTraversalPolicy.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/BequestedFocusTraversalPolicy.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/BequestedFocusTraversalPolicy.java (working copy) @@ -21,6 +21,8 @@ import java.awt.Container; import java.awt.FocusTraversalPolicy; +import org.apache.harmony.x.swing.internal.nls.Messages; + class BequestedFocusTraversalPolicy extends FocusTraversalPolicy { private final FocusTraversalPolicy ancestor; @@ -41,7 +43,7 @@ super(); this.ancestor = ancestor; if (this.ancestor == null) { - throw new IllegalArgumentException("Ancestor shouldn't be null"); + throw new IllegalArgumentException(Messages.getString("swing.06")); } this.fixedComponent = fixedComponent; this.fixedNextComponent = fixedNextComponent; Index: modules/swing/src/main/java/common/javax/swing/border/TitledBorder.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/border/TitledBorder.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/border/TitledBorder.java (working copy) @@ -36,7 +36,9 @@ import org.apache.harmony.awt.gl.MultiRectArea; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class TitledBorder extends AbstractBorder { public static final int DEFAULT_POSITION = 0; @@ -284,7 +286,7 @@ public void setTitlePosition(final int pos) { if (pos < DEFAULT_POSITION || BELOW_BOTTOM < pos) { - throw new IllegalArgumentException(pos + " is not a valid title position."); + throw new IllegalArgumentException(Messages.getString("swing.24",pos)); } titlePosition = pos; } @@ -295,7 +297,7 @@ public void setTitleJustification(final int justification) { if (justification < DEFAULT_JUSTIFICATION || TRAILING < justification) { - throw new IllegalArgumentException(justification + " is not a valid title justification."); + throw new IllegalArgumentException(Messages.getString("swing.23",justification)); } titleJustification = justification; } Index: modules/swing/src/main/java/common/javax/swing/border/EtchedBorder.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/border/EtchedBorder.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/border/EtchedBorder.java (working copy) @@ -26,6 +26,8 @@ import java.awt.Insets; import java.security.InvalidParameterException; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class EtchedBorder extends AbstractBorder { public static final int RAISED = 0; @@ -36,7 +38,7 @@ protected Color shadow; private static final int INSETS_SIZE = 2; - private static final String INCORRECT_BORDER_TYPE_EXCEPTION_TEXT = "Incorrect type of the etched border"; + private static final String INCORRECT_BORDER_TYPE_EXCEPTION_TEXT = Messages.getString("swing.1D"); public EtchedBorder() { } Index: modules/swing/src/main/java/common/javax/swing/border/BevelBorder.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/border/BevelBorder.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/border/BevelBorder.java (working copy) @@ -25,7 +25,9 @@ import java.awt.Graphics; import java.awt.Insets; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BevelBorder extends AbstractBorder { public static final int RAISED = 0; @@ -49,7 +51,7 @@ if (highlightOuterColor == null || highlightInnerColor == null || shadowOuterColor == null || shadowInnerColor == null) { - throw new NullPointerException("Color should not be null"); + throw new NullPointerException(Messages.getString("swing.68")); } highlightOuter = highlightOuterColor; highlightInner = highlightInnerColor; @@ -177,4 +179,4 @@ return bevelType; } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/javax/swing/JTable.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JTable.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JTable.java (working copy) @@ -78,6 +78,8 @@ import org.apache.harmony.luni.util.NotImplementedException; import org.apache.harmony.x.swing.StringConstants; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* JTable @@ -857,7 +859,7 @@ public void setRowHeight(int rowHeight) { if (rowHeight <= 0) { - throw new IllegalArgumentException("Row height must be positive"); + throw new IllegalArgumentException(Messages.getString("swing.38")); } int oldValue = this.rowHeight; this.rowHeight = rowHeight; @@ -870,7 +872,7 @@ public void setRowHeight(int row, int height) { if (height <= 0) { - throw new IllegalArgumentException("Row height must be positive"); + throw new IllegalArgumentException(Messages.getString("swing.38")); } if (rowHeights.size() <= row) { rowHeights.setSize(row + 1); @@ -1193,7 +1195,7 @@ public TableColumn getColumn(Object identifier) { int index = getColumnModel().getColumnIndex(identifier); if (index == -1) { - throw new IllegalArgumentException("Column does not exist"); + throw new IllegalArgumentException(Messages.getString("swing.39")); } return getColumnModel().getColumn(index); } @@ -1435,7 +1437,7 @@ public void setModel(TableModel model) { if (model == null) { - throw new IllegalArgumentException("Model must be not null"); + throw new IllegalArgumentException(Messages.getString("swing.3A")); } TableModel oldValue = dataModel; if (oldValue != null) { @@ -1457,7 +1459,7 @@ public void setColumnModel(TableColumnModel model) { if (model == null) { - throw new IllegalArgumentException("Column model must be not null"); + throw new IllegalArgumentException(Messages.getString("swing.3B")); } TableColumnModel oldValue = columnModel; if (oldValue != null) { @@ -1478,7 +1480,7 @@ public void setSelectionModel(ListSelectionModel model) { if (model == null) { - throw new IllegalArgumentException("Selection model must be not null"); + throw new IllegalArgumentException(Messages.getString("swing.17")); } ListSelectionModel oldValue = selectionModel; if (oldValue != null) { @@ -1870,9 +1872,7 @@ private void checkSelectionInterval(int start, int end, int bound) { if (start < 0 || end < 0 || start >= bound || end >= bound) { - throw new IllegalArgumentException( - "Illegal selection interval is specified. Should be in [0, " + (bound - 1) - + "]"); + throw new IllegalArgumentException(Messages.getString("swing.31", (bound - 1))); } } Index: modules/swing/src/main/java/common/javax/swing/UIDefaults.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/UIDefaults.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/UIDefaults.java (working copy) @@ -44,6 +44,8 @@ import javax.swing.plaf.ComponentUI; import javax.swing.plaf.UIResource; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class UIDefaults extends Hashtable { public static interface ActiveValue { @@ -408,7 +410,7 @@ } protected void getUIError(final String message) { - System.err.println("ERROR: UIDefaults.getUI() failed: " + message); + System.err.println(Messages.getString("swing.err.06",message)); } private Object getFromResourceBundles(final Object key, final Locale locale) { Index: modules/swing/src/main/java/common/javax/swing/JMenu.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JMenu.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JMenu.java (working copy) @@ -34,6 +34,8 @@ import org.apache.harmony.luni.util.NotImplementedException; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* JMenu @@ -331,7 +333,7 @@ public void setDelay(int delay) { if (delay < 0) { - throw new IllegalArgumentException("Delay must be positive"); + throw new IllegalArgumentException(Messages.getString("swing.1C")); } this.delay = delay; } Index: modules/swing/src/main/java/common/javax/swing/JTextArea.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JTextArea.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JTextArea.java (working copy) @@ -35,6 +35,8 @@ import org.apache.harmony.x.swing.StringConstants; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JTextArea extends JTextComponent { protected class AccessibleJTextArea extends JTextComponent.AccessibleJTextComponent { @@ -68,10 +70,10 @@ final int c) { super(); if (r < 0) { - throw new IllegalArgumentException("rows: " + r); + throw new IllegalArgumentException(Messages.getString("swing.3C", r)); } if (c < 0) { - throw new IllegalArgumentException("columns: " + c); + throw new IllegalArgumentException(Messages.getString("swing.3D", c)); } Document document = doc; if (document == null) { @@ -125,10 +127,10 @@ private int checkLineCount(final int line) throws BadLocationException { int count = getDocument().getDefaultRootElement().getElementCount(); if (line < 0) { - throw new BadLocationException("Negative line", line); + throw new BadLocationException(Messages.getString("swing.3E"), line); } if (line >= count) { - throw new BadLocationException("No such line", line); + throw new BadLocationException(Messages.getString("swing.3F"), line); } return count; } @@ -196,7 +198,7 @@ Document doc = getDocument(); int length = doc.getLength(); if (offset < 0 || offset > length) { - throw new BadLocationException("Can't translate offset to line", + throw new BadLocationException(Messages.getString("swing.40"), offset); } readLock(doc); @@ -264,8 +266,7 @@ if (orientation == SwingConstants.VERTICAL) { return rowHeight; } - throw new IllegalArgumentException("Invalid orientation: " - + orientation); + throw new IllegalArgumentException(Messages.getString("swing.41", orientation)); } public int getTabSize() { @@ -287,7 +288,7 @@ } int length = doc.getLength(); if (pos < 0 || pos > length) { - throw new IllegalArgumentException("Invalid insert"); + throw new IllegalArgumentException(Messages.getString("swing.42")); } try { doc.insertString(pos, s, null); @@ -332,10 +333,10 @@ } int length = doc.getLength(); if (start < 0 || end > length) { - throw new IllegalArgumentException("Invalid remove"); + throw new IllegalArgumentException(Messages.getString("swing.43")); } if (start > end) { - throw new IllegalArgumentException("end before start"); + throw new IllegalArgumentException(Messages.getString("swing.44")); } try { @@ -349,7 +350,7 @@ public void setColumns(final int c) { if (c < 0) { - throw new IllegalArgumentException("columns less than zero."); + throw new IllegalArgumentException(Messages.getString("swing.45")); } columns = c; invalidate(); @@ -372,7 +373,7 @@ public void setRows(final int r) { if (r < 0) { - throw new IllegalArgumentException("rows less than zero."); + throw new IllegalArgumentException(Messages.getString("swing.46")); } rows = r; invalidate(); Index: modules/swing/src/main/java/common/javax/swing/Box.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/Box.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/Box.java (working copy) @@ -26,6 +26,8 @@ import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleRole; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class Box extends JComponent implements Accessible { private static final long serialVersionUID = 1525417495883046342L; @@ -117,7 +119,7 @@ @Override public void setLayout(LayoutManager layout) { - throw new AWTError("Illegal request"); + throw new AWTError(Messages.getString("swing.err.01")); } public static Component createRigidArea(Dimension size) { Index: modules/swing/src/main/java/common/javax/swing/JLabel.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JLabel.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JLabel.java (working copy) @@ -33,6 +33,8 @@ import org.apache.harmony.x.swing.StringConstants; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* JLabel @@ -294,7 +296,7 @@ public void setDisplayedMnemonicIndex(final int index) { if (index < -1 || index >= 0 && (text == null || index >= text.length())) { - throw new IllegalArgumentException("Invalid index is specified"); + throw new IllegalArgumentException(Messages.getString("swing.14")); } int oldValue = this.displayedMnemonicIndex; this.displayedMnemonicIndex = index; Index: modules/swing/src/main/java/common/javax/swing/JSlider.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JSlider.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JSlider.java (working copy) @@ -38,28 +38,30 @@ import javax.swing.plaf.SliderUI; import javax.swing.plaf.UIResource; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JSlider extends JComponent implements SwingConstants, Accessible { protected class AccessibleJSlider extends AccessibleJComponent implements AccessibleValue { public AccessibleStateSet getAccessibleStateSet() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleRole getAccessibleRole() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public AccessibleValue getAccessibleValue() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Number getCurrentAccessibleValue() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public boolean setCurrentAccessibleValue(final Number n) { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Number getMinimumAccessibleValue() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } public Number getMaximumAccessibleValue() { - throw new UnsupportedOperationException("Not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } } @@ -138,7 +140,7 @@ private static int checkOrientation(final int orientation) { if (orientation != VERTICAL && orientation != HORIZONTAL) { - throw new IllegalArgumentException("orientation must be one of: VERTICAL, HORIZONTAL"); + throw new IllegalArgumentException(Messages.getString("swing.28")); } return orientation; } @@ -253,7 +255,7 @@ public void setOrientation(final int orientation) { if (orientation != VERTICAL && orientation != HORIZONTAL) { - throw new IllegalArgumentException("argument must be VERTICAL or HORIZONTAL"); + throw new IllegalArgumentException(Messages.getString("swing.29")); } if (orientation != this.orientation) { int oldValue = this.orientation; @@ -301,10 +303,10 @@ public Hashtable createStandardLabels(final int increment, final int start) { if (increment <= 0) { - throw new IllegalArgumentException("increment must be > 0"); + throw new IllegalArgumentException(Messages.getString("swing.2A")); } if (start < sliderModel.getMinimum() || start > sliderModel.getMaximum()) { - throw new IllegalArgumentException("start is out of range"); + throw new IllegalArgumentException(Messages.getString("swing.2B")); } Hashtable result = new Hashtable(); Index: modules/swing/src/main/java/common/javax/swing/JPopupMenu.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JPopupMenu.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JPopupMenu.java (working copy) @@ -47,7 +47,9 @@ import org.apache.harmony.x.swing.StringConstants; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JPopupMenu extends JComponent implements Accessible, MenuElement { public static class Separator extends JSeparator { @@ -65,7 +67,7 @@ } public void propertyChange(final PropertyChangeEvent event) { - throw new UnsupportedOperationException("not implemented"); + throw new UnsupportedOperationException(Messages.getString("swing.27")); } } @@ -226,7 +228,7 @@ public void insert(final Component c, final int i) { if (i < 0) { - throw new IllegalArgumentException("index must be positive"); + throw new IllegalArgumentException(Messages.getString("swing.21")); } if (i <= getComponentCount()) { super.add(c, i); @@ -235,17 +237,17 @@ public void insert(final Action action, final int i) { if (i < 0) { - throw new IllegalArgumentException("index must be positive"); + throw new IllegalArgumentException(Messages.getString("swing.21")); } insert(createActionComponent(action), i < getComponentCount() ? i : getComponentCount()); } public void remove(final int i) { if (i < 0) { - throw new IllegalArgumentException("index must be positive"); + throw new IllegalArgumentException(Messages.getString("swing.21")); } if (i >= getComponentCount()) { - throw new IllegalArgumentException("index is greater than the number of items"); + throw new IllegalArgumentException(Messages.getString("swing.22")); } super.remove(i); @@ -505,4 +507,4 @@ return p; } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextAreaUI.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextAreaUI.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextAreaUI.java (working copy) @@ -36,6 +36,8 @@ import org.apache.harmony.x.swing.StringConstants; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BasicTextAreaUI extends BasicTextUI { private static final String PLAIN_VIEW_I18N_CLASS = "javax.swing.text.PlainViewI18N"; @@ -88,7 +90,7 @@ @Override public Dimension getMinimumSize(final JComponent c) { if (!(c instanceof JTextComponent)) { - throw new IllegalArgumentException("not text component"); + throw new IllegalArgumentException(Messages.getString("swing.77")); } Dimension dim = super.getMinimumSize(c); Caret caret = ((JTextComponent)c).getCaret(); @@ -101,7 +103,7 @@ @Override public Dimension getPreferredSize(final JComponent c) { if (!(c instanceof JTextComponent)) { - throw new IllegalArgumentException("not text component"); + throw new IllegalArgumentException(Messages.getString("swing.77")); } Dimension dim = super.getPreferredSize(c); @@ -127,4 +129,4 @@ modelChanged(); } } -} \ No newline at end of file +} Index: modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicProgressBarUI.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicProgressBarUI.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicProgressBarUI.java (working copy) @@ -49,7 +49,9 @@ import org.apache.harmony.x.swing.StringConstants; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BasicProgressBarUI extends ProgressBarUI { public class ChangeHandler implements ChangeListener { @@ -338,7 +340,7 @@ protected void setAnimationIndex(final int newValue) { if (progressBar == null) { - throw new NullPointerException("progressBar is null"); + throw new NullPointerException(Messages.getString("swing.03","progressBar")); } animationIndex = newValue % maxAnimationIndex; } Index: modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicListUI.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicListUI.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicListUI.java (working copy) @@ -62,6 +62,8 @@ import org.apache.harmony.x.swing.StringConstants; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BasicListUI extends ListUI { protected int cellHeight = -1; protected int cellWidth = -1; @@ -1029,7 +1031,7 @@ result = new HorizontalWrapVisibleUnspecifiedLayoutStrategy(); } } else { - throw new IllegalArgumentException("Incorrect layout orientation"); + throw new IllegalArgumentException(Messages.getString("swing.70")); } return result; Index: modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicOptionPaneUI.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicOptionPaneUI.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicOptionPaneUI.java (working copy) @@ -63,7 +63,9 @@ import org.apache.harmony.x.swing.StringConstants; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BasicOptionPaneUI extends OptionPaneUI { public static class ButtonAreaLayout implements LayoutManager { @@ -568,7 +570,7 @@ protected Icon getIconForType(final int messageType) { if (optionPane == null) { - throw new NullPointerException("optionPane is null"); + throw new NullPointerException(Messages.getString("swing.03","optionPane")); } if (defaultIcons == null) { Index: modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicDesktopIconUI.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicDesktopIconUI.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicDesktopIconUI.java (working copy) @@ -46,6 +46,8 @@ import org.apache.harmony.x.swing.ComponentDragImplHelper; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BasicDesktopIconUI extends DesktopIconUI { private static final int INSETS_WIDTH = 5; @@ -128,7 +130,7 @@ public Insets getInsets(final JComponent c) { if (c == null) { - throw new NullPointerException("component is null"); + throw new NullPointerException(Messages.getString("swing.03","component")); } //return desktopIcon.getInsets(); return new Insets(INSETS_WIDTH, INSETS_WIDTH, Index: modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java (working copy) @@ -54,6 +54,8 @@ import org.apache.harmony.x.swing.StringConstants; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** * Note: serialVersionUID fields are added as * a performance optimization only but not as a guarantee of correct @@ -433,7 +435,7 @@ public void uninstallUI(final JComponent c) { if (c != slider) { // TODO Perform i18n after HARMONY-1320 is applied - throw new IllegalComponentStateException(this + " was asked to deinstall() " + c + " when it only knows about " + slider); + throw new IllegalComponentStateException(Messages.getString("swing.0E",new Object[]{this, c, slider})); } uninstallListeners(slider); uninstallKeyboardActions(slider); Index: modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboPopup.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboPopup.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboPopup.java (working copy) @@ -65,7 +65,9 @@ import org.apache.harmony.x.swing.StringConstants; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BasicComboPopup extends JPopupMenu implements ComboPopup { /** * This class is replaced with ActionMap/InputMap functionality and does nothing @@ -571,7 +573,7 @@ } else if (scrollDirection == SCROLL_DOWN) { autoScrollDown(); } else { - throw new IllegalArgumentException("Incorrect direction is specified!"); + throw new IllegalArgumentException(Messages.getString("swing.6E")); } } }); Index: modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSplitPaneUI.java (working copy) @@ -42,6 +42,8 @@ import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BasicSplitPaneUI extends SplitPaneUI { public class BasicHorizontalLayoutManager implements LayoutManager2 { @@ -159,7 +161,7 @@ && !JSplitPane.BOTTOM.equals(place) && !JSplitPane.RIGHT.equals(place) && !JSplitPane.DIVIDER.equals(place)) { - throw new IllegalArgumentException("illegal argument"); + throw new IllegalArgumentException(Messages.getString("swing.73")); } if (JSplitPane.DIVIDER.equals(place)) { components[DIVIDER_INDEX] = component; @@ -238,7 +240,7 @@ public void addLayoutComponent(final Component comp, final Object constraints) { if (!(constraints instanceof String)) { - throw new IllegalArgumentException("constraints must be String"); + throw new IllegalArgumentException(Messages.getString("swing.74")); } addLayoutComponent((String)constraints, comp); } @@ -722,7 +724,7 @@ @Override public int getDividerLocation(final JSplitPane jc) { if (jc == null) { // Fix for HARMONY-2661, for compatibility with RI - throw new NullPointerException("jc is null"); + throw new NullPointerException(Messages.getString("swing.03","jc")); } return dividerLocation; } Index: modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java (working copy) @@ -69,7 +69,9 @@ import org.apache.harmony.x.swing.internal.nls.Messages; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BasicComboBoxUI extends ComboBoxUI { public class ComboBoxLayoutManager implements LayoutManager { @@ -82,14 +84,14 @@ public Dimension preferredLayoutSize(final Container parent) { if (parent == null) { - throw new NullPointerException("parent is null"); + throw new NullPointerException(Messages.getString("swing.03","Parent")); } return new Dimension(0, 0); } public Dimension minimumLayoutSize(final Container parent) { if (parent == null) { - throw new NullPointerException("parent is null"); + throw new NullPointerException(Messages.getString("swing.03","Parent")); } return new Dimension(0, 0); } @@ -429,7 +431,7 @@ public void paintCurrentValueBackground(final Graphics g, final Rectangle bounds, final boolean hasFocus) { Color oldColor = g.getColor(); if (comboBox == null) { - throw new NullPointerException("comboBox is null"); + throw new NullPointerException(Messages.getString("swing.03","ComboBox")); } if (hasFocus) { g.setColor(UIManager.getColor("ComboBox.selectionBackground")); @@ -487,7 +489,7 @@ public int getAccessibleChildrenCount(final JComponent c) { if (comboBox == null) { - throw new NullPointerException(Messages.getString("swing.04")); //$NON-NLS-1$ + throw new NullPointerException(Messages.getString("swing.03","ComboBox")); //$NON-NLS-1$ } return 0; } Index: modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicMenuItemUI.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicMenuItemUI.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicMenuItemUI.java (working copy) @@ -60,7 +60,9 @@ import org.apache.harmony.x.swing.StringConstants; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BasicMenuItemUI extends MenuItemUI { protected class MouseInputHandler implements MouseInputListener { public void mouseEntered(final MouseEvent e) { @@ -304,7 +306,7 @@ public Dimension getMinimumSize(final JComponent c) { if (c == null) { - throw new NullPointerException("component is null"); + throw new NullPointerException(Messages.getString("swing.03","component")); } return null; } @@ -315,7 +317,7 @@ public Dimension getMaximumSize(final JComponent c) { if (c == null) { - throw new NullPointerException("component is null"); + throw new NullPointerException(Messages.getString("swing.03","component")); } return null; } Index: modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTableUI.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTableUI.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTableUI.java (working copy) @@ -54,7 +54,9 @@ import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BasicTableUI extends TableUI { public class FocusHandler implements FocusListener { public void focusGained(final FocusEvent e) { @@ -323,7 +325,7 @@ public void paint(final Graphics g, final JComponent c) { if (g == null) { - throw new NullPointerException("context is null"); + throw new NullPointerException(Messages.getString("swing.03","context")); } if (table.getColumnCount() == 0 || table.getRowCount() == 0) { return; Index: modules/swing/src/main/java/common/javax/swing/plaf/IconUIResource.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/plaf/IconUIResource.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/plaf/IconUIResource.java (working copy) @@ -27,12 +27,14 @@ import java.io.Serializable; import javax.swing.Icon; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class IconUIResource implements Icon, UIResource, Serializable { private Icon icon; public IconUIResource(final Icon icon) { if (icon == null) { - throw new IllegalArgumentException("null delegate"); + throw new IllegalArgumentException(Messages.getString("swing.6B")); } this.icon = icon; } Index: modules/swing/src/main/java/common/javax/swing/plaf/BorderUIResource.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/plaf/BorderUIResource.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/plaf/BorderUIResource.java (working copy) @@ -38,6 +38,8 @@ import javax.swing.border.MatteBorder; import javax.swing.border.TitledBorder; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class BorderUIResource implements Border, UIResource, Serializable { private static Border etched; private static Border blackLine; @@ -158,7 +160,7 @@ public BorderUIResource(final Border border) { if (border == null) { - throw new IllegalArgumentException("null delegate"); + throw new IllegalArgumentException(Messages.getString("swing.6B")); } this.border = border; } Index: modules/swing/src/main/java/common/javax/swing/JProgressBar.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JProgressBar.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JProgressBar.java (working copy) @@ -36,6 +36,7 @@ import org.apache.harmony.x.swing.StringConstants; +import org.apache.harmony.x.swing.internal.nls.Messages; public class JProgressBar extends JComponent implements SwingConstants, Accessible { protected int orientation = JProgressBar.HORIZONTAL; @@ -128,7 +129,7 @@ if (orientation != JProgressBar.HORIZONTAL && orientation != JProgressBar.VERTICAL) { - throw new IllegalArgumentException(orientation + " is not a legal orientation"); + throw new IllegalArgumentException(Messages.getString("swing.4A", orientation)); } int oldValue = this.orientation; this.orientation = orientation; Index: modules/swing/src/main/java/common/javax/swing/SpinnerNumberModel.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/SpinnerNumberModel.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/SpinnerNumberModel.java (working copy) @@ -24,6 +24,8 @@ import java.io.Serializable; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class SpinnerNumberModel extends AbstractSpinnerModel implements Serializable { private static final Number DEFAULT_VALUE = new Integer(0); @@ -36,13 +38,13 @@ public SpinnerNumberModel(final Number value, final Comparable minimum, final Comparable maximum, final Number stepSize) { if (value == null || stepSize == null) { - throw new IllegalArgumentException("value and stepSize must be non-null"); + throw new IllegalArgumentException(Messages.getString("swing.5E")); } if (minimum != null && minimum.compareTo(value) > 0) { - throw new IllegalArgumentException("(minimum <= value <= maximum) is false"); + throw new IllegalArgumentException(Messages.getString("swing.5F")); } if (maximum != null && maximum.compareTo(value) < 0) { - throw new IllegalArgumentException("(minimum <= value <= maximum) is false"); + throw new IllegalArgumentException(Messages.getString("swing.5F")); } this.value = value; this.minimum = minimum; @@ -86,7 +88,7 @@ public void setStepSize(final Number stepSize) { if (stepSize == null || !(stepSize instanceof Number)) { - throw new IllegalArgumentException("null stepSize"); + throw new IllegalArgumentException(Messages.getString("swing.60")); } if (this.stepSize != stepSize) { this.stepSize = stepSize; @@ -120,7 +122,7 @@ public void setValue(final Object value) { if (!(value instanceof Number)) { - throw new IllegalArgumentException("illegal value"); + throw new IllegalArgumentException(Messages.getString("swing.5B")); } if (this.value != value) { this.value = (Number)value; Index: modules/swing/src/main/java/common/javax/swing/JFileChooser.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JFileChooser.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JFileChooser.java (working copy) @@ -35,6 +35,8 @@ import javax.swing.plaf.FileChooserUI; import org.apache.harmony.x.swing.Utilities; +import org.apache.harmony.x.swing.internal.nls.Messages; + /** *

* JFileChooser @@ -387,7 +389,7 @@ public void setDialogType(final int dialogType) { if (dialogType != OPEN_DIALOG && dialogType != SAVE_DIALOG && dialogType != CUSTOM_DIALOG) { - throw new IllegalArgumentException("Incorrect dialog type is specified"); + throw new IllegalArgumentException(Messages.getString("swing.11")); } int oldValue = this.dialogType; this.dialogType = dialogType; @@ -418,7 +420,7 @@ public void setFileSelectionMode(final int mode) { if (mode != FILES_ONLY && mode != DIRECTORIES_ONLY && mode != FILES_AND_DIRECTORIES) { - throw new IllegalArgumentException("Incorrect file selection mode is psecified"); + throw new IllegalArgumentException(Messages.getString("swing.12")); } int oldValue = fileSelectionMode; fileSelectionMode = mode; Index: modules/swing/src/main/java/common/javax/swing/JComboBox.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JComboBox.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JComboBox.java (working copy) @@ -40,6 +40,7 @@ import javax.swing.event.PopupMenuListener; import javax.swing.plaf.ComboBoxUI; import org.apache.harmony.luni.util.NotImplementedException; +import org.apache.harmony.x.swing.internal.nls.Messages; import org.apache.harmony.x.swing.StringConstants; /** @@ -348,8 +349,7 @@ public void setSelectedIndex(int index) { if (index < -1 || index >= dataModel.getSize()) { - throw new IllegalArgumentException( - "Selected index should in the range of available indices"); + throw new IllegalArgumentException(Messages.getString("swing.0C")); } if (index == -1) { setSelectedItem(null); @@ -387,7 +387,7 @@ if (dataModel instanceof MutableComboBoxModel) { ((MutableComboBoxModel) dataModel).addElement(element); } else { - throw new RuntimeException("Cannot modify immutable data model"); + throw new RuntimeException(Messages.getString("swing.0B")); } } @@ -396,7 +396,7 @@ if (dataModel instanceof MutableComboBoxModel) { ((MutableComboBoxModel) dataModel).insertElementAt(element, index); } else { - throw new RuntimeException("Cannot modify immutable data model"); + throw new RuntimeException(Messages.getString("swing.0B")); } } @@ -405,7 +405,7 @@ if (dataModel instanceof MutableComboBoxModel) { ((MutableComboBoxModel) dataModel).removeElement(element); } else { - throw new RuntimeException("Cannot modify immutable data model"); + throw new RuntimeException(Messages.getString("swing.0B")); } } @@ -414,7 +414,7 @@ if (dataModel instanceof MutableComboBoxModel) { ((MutableComboBoxModel) dataModel).removeElementAt(index); } else { - throw new RuntimeException("Cannot modify immutable data model"); + throw new RuntimeException(Messages.getString("swing.0B")); } } @@ -426,7 +426,7 @@ model.removeElementAt(0); } } else { - throw new RuntimeException("Cannot modify immutable data model"); + throw new RuntimeException(Messages.getString("swing.0B")); } } Index: modules/swing/src/main/java/common/javax/swing/PopupFactory.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/PopupFactory.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/PopupFactory.java (working copy) @@ -33,6 +33,8 @@ import java.util.Map; import java.util.Set; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class PopupFactory { private static class ReleasedPopupStorage { private static final int STORAGE_CAPACITY = 5; @@ -154,7 +156,7 @@ public static void setSharedInstance(final PopupFactory factory) { if (factory == null) { - throw new IllegalArgumentException("Factory should be not null"); + throw new IllegalArgumentException(Messages.getString("swing.53")); } instance = factory; @@ -167,7 +169,7 @@ public Popup getPopup(final Component owner, final Component content, final int x, final int y) throws IllegalArgumentException { if (content == null) { - throw new IllegalArgumentException("Popup content should be specified"); + throw new IllegalArgumentException(Messages.getString("swing.52")); } Window ownerWindow = owner instanceof Window ? (Window)owner : SwingUtilities.getWindowAncestor(owner); Index: modules/swing/src/main/java/common/javax/swing/SpinnerListModel.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/SpinnerListModel.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/SpinnerListModel.java (working copy) @@ -24,6 +24,8 @@ import java.util.Arrays; import java.util.List; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class SpinnerListModel extends AbstractSpinnerModel implements Serializable { private static final String[] DEFAULT_VALUES = {"empty"}; private List values; @@ -35,14 +37,14 @@ public SpinnerListModel(final List values) { if (values == null || values.size() <= 0) { - throw new IllegalArgumentException("SpinnerListModel(List) expects non-null non-empty List"); + throw new IllegalArgumentException(Messages.getString("swing.5C")); } this.values = values; } public SpinnerListModel(final Object[] values) { if (values == null || values.length <= 0) { - throw new IllegalArgumentException("SpinnerListModel(Object[]) expects non-null non-empty Object[]"); + throw new IllegalArgumentException(Messages.getString("swing.5D")); } this.values = Arrays.asList(values); } @@ -66,7 +68,7 @@ public void setValue(final Object obj) { if (!values.contains(obj)) { - throw new IllegalArgumentException("invalid sequence element"); + throw new IllegalArgumentException(Messages.getString("swing.58")); } index = values.indexOf(obj); fireStateChanged(); Index: modules/swing/src/main/java/common/javax/swing/event/TreeSelectionEvent.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/event/TreeSelectionEvent.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/event/TreeSelectionEvent.java (working copy) @@ -24,6 +24,8 @@ import javax.swing.tree.TreePath; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class TreeSelectionEvent extends EventObject { protected TreePath[] paths; protected boolean[] areNew; @@ -68,12 +70,12 @@ return isAddedPath(i); } } - throw new IllegalArgumentException("path is not found"); + throw new IllegalArgumentException(Messages.getString("swing.69")); } public boolean isAddedPath(final int index) { if (index < 0 || index >= areNew.length) { - throw new IllegalArgumentException("index is invalid"); + throw new IllegalArgumentException(Messages.getString("swing.6A")); } return areNew[index]; } Index: modules/swing/src/main/java/common/javax/swing/JSeparator.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JSeparator.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JSeparator.java (working copy) @@ -25,6 +25,8 @@ import javax.accessibility.AccessibleRole; import javax.swing.plaf.SeparatorUI; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JSeparator extends JComponent implements SwingConstants, Accessible { protected class AccessibleJSeparator extends AccessibleJComponent { @@ -85,8 +87,7 @@ return; } - throw new IllegalArgumentException( - "orientation must VERTICAL or HORIZONTAL"); + throw new IllegalArgumentException(Messages.getString("swing.47")); } } Index: modules/swing/src/main/java/common/javax/swing/SortingFocusTraversalPolicy.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/SortingFocusTraversalPolicy.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/SortingFocusTraversalPolicy.java (working copy) @@ -29,6 +29,8 @@ import java.util.LinkedList; import java.util.List; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class SortingFocusTraversalPolicy extends InternalFrameFocusTraversalPolicy { private Comparator comparator; private boolean isImplicitDownCycleTraversal = true; @@ -231,18 +233,18 @@ private Component getComponentBeforeOrAfter(final NextComponentFinder finder) { checkCycleRootIsNotNull(finder.focusCycleRoot); if (!finder.focusCycleRoot.isFocusCycleRoot() && !finder.focusCycleRoot.isFocusTraversalPolicyProvider()) { - throw new IllegalArgumentException("Container is not a focus cycle root"); + throw new IllegalArgumentException(Messages.getString("swing.54")); } if (finder.currentComponent == null) { - throw new IllegalArgumentException("Component must be specified"); + throw new IllegalArgumentException(Messages.getString("swing.55","Component")); } if (finder.currentComponent != finder.focusCycleRoot && finder.currentComponent.getFocusCycleRootAncestor() != finder.focusCycleRoot && getPolicyProvider(finder.currentComponent) != finder.focusCycleRoot) { - throw new IllegalArgumentException("Component must be in a cycle root of the specified container"); + throw new IllegalArgumentException(Messages.getString("swing.56")); } List components = getAllAcceptableComponentsSorted(finder.focusCycleRoot, finder.currentComponent, true); @@ -267,7 +269,7 @@ private static void checkCycleRootIsNotNull(final Container focusCycleRoot) { if (focusCycleRoot == null) { - throw new IllegalArgumentException("Container must be specified"); + throw new IllegalArgumentException(Messages.getString("swing.55","Container")); } } Index: modules/swing/src/main/java/common/javax/swing/JScrollBar.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/JScrollBar.java (revision 509560) +++ modules/swing/src/main/java/common/javax/swing/JScrollBar.java (working copy) @@ -38,6 +38,8 @@ import javax.swing.event.EventListenerList; import javax.swing.plaf.ScrollBarUI; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class JScrollBar extends JComponent implements Adjustable, Accessible { protected class AccessibleJScrollBar extends JComponent.AccessibleJComponent implements AccessibleValue { @@ -121,7 +123,7 @@ model = new DefaultBoundedRangeModel(value, extent, min, max); if (orientation != HORIZONTAL && orientation != VERTICAL) { - throw new IllegalArgumentException("orientation must be HORIZONTAL or VERTICAL"); + throw new IllegalArgumentException(Messages.getString("swing.28")); } this.orientation = orientation; @@ -161,7 +163,7 @@ public void setOrientation(final int orientation) { if (orientation != VERTICAL && orientation != HORIZONTAL) { - throw new IllegalArgumentException("orientation must be HORIZONTAL or VERTICAL"); + throw new IllegalArgumentException(Messages.getString("swing.28")); } if (orientation != this.orientation) { int oldValue = this.orientation; Index: modules/swing/src/main/java/windows/org/apache/harmony/x/swing/filechooser/windows/WinFileManager.java =================================================================== --- modules/swing/src/main/java/windows/org/apache/harmony/x/swing/filechooser/windows/WinFileManager.java (revision 509560) +++ modules/swing/src/main/java/windows/org/apache/harmony/x/swing/filechooser/windows/WinFileManager.java (working copy) @@ -36,6 +36,8 @@ import org.apache.harmony.x.swing.filechooser.PlatformFile; import org.apache.harmony.x.swing.filechooser.PlatformFileManager; +import org.apache.harmony.x.swing.internal.nls.Messages; + public class WinFileManager implements PlatformFileManager { private static WinFileManager instance; @@ -55,7 +57,7 @@ public WinFileManager() { if (instance != null) { - throw new RuntimeException("Singleton"); + throw new RuntimeException(Messages.getString("swing.6C")); } instance = this; }