diff options
| author | Mario Torre <neugens@limasoftware.net> | 2006-12-19 01:14:22 +0000 |
|---|---|---|
| committer | Mario Torre <neugens@limasoftware.net> | 2006-12-19 01:14:22 +0000 |
| commit | 3d6a7e2db41965692e56ca44e3116c68973a1a98 (patch) | |
| tree | 9068d63fcac5050bf538c52e5b9c3ab790f7b0a3 /java/text | |
| parent | ec47f739052b575319d8f1d9f51941a0a7b694d4 (diff) | |
| download | classpath-3d6a7e2db41965692e56ca44e3116c68973a1a98.tar.gz | |
2006-12-19 Mario Torre <neugens@limasoftware.net>
* javax/imageio/spi/ServiceRegistry.java: fixed Empty control-flow
statement.
* tools/gnu/classpath/tools/rmid/ActivationSystemImpl.java: likewise.
* gnu/java/io/Base64InputStream.java (read): likewise.
* gnu/javax/swing/text/html/CharacterAttributeTranslator.java: likewise.
* java/util/zip/DeflaterEngine.java (findLongestMatch): likewise.
* java/util/zip/ZipInputStream.java (closeEntry): likewise.
* java/util/zip/DeflaterHuffman.java (Tree.buildLength): likewise.
* org/omg/CORBA/ORB.java: likewise.
* javax/swing/plaf/metal/MetalFileChooserUI.java: likewise.
* gnu/javax/imageio/png/PNGICCProfile.java (PNGICCProfile): likewise.
* tools/external/asm/org/objectweb/asm/xml/ASMContentHandler.java: likewise.
* java/text/MessageFormat.java (MessageFormatElement.setLocale): likewise.
* java/text/BreakIterator.java (preceding): likewise.
* gnu/javax/net/ssl/provider/SSLEngineImpl.java: likewise.
* gnu/javax/net/ssl/provider/SSLRSASignatureImpl.java (engineVerify):
likewise.
* java/beans/XMLEncoder.java (writeObject): likewise.
* gnu/java/beans/encoder/ScanEngine.java (ScanEngine): likewise.
* java/util/Collections.java (binarySearch): likewise.
* java/util/StringTokenizer.java (nextToken): likewise.
* java/util/PriorityQueue.java (.next): likewise.
* java/util/EnumMap.java (..next): likewise.
* java/util/BitSet.java (length): likewise.
* java/util/Date.java (parse): likewise.
* javax/swing/text/html/CSSParser.java (parse): likewise.
* javax/swing/plaf/basic/BasicTabbedPaneUI.java
(TabbedPaneScrollLayout.calculateTabRects): likewise.
* java/lang/Character.java (UnicodeBlock): likewise.
* java/lang/String.java (trim): likewise.
* java/lang/StrictMath.java (remPiOver2): likewise.
* javax/swing/JFormattedTextField.java (commitEdit): likewise.
* javax/swing/JComponent.java (paintImmediately2): likewise.
(paintChildren): likewise.
* javax/swing/JToolTip.java (paramString): likewise.
* javax/swing/JEditorPane.java (JEditorPane): likewise.
* gnu/CORBA/Poa/gnuPOA.java: likewise.
* gnu/javax/security/auth/login/ConfigFileParser.java
(parseAppOrOtherEntry): likewise.
(parse): likewise.
* java/math/BigInteger.java (setBitOp): likewise.
(add): likewise.
(BigInteger): likewise.
* gnu/java/lang/management/BeanImpl.java (translate): likewise.
* javax/swing/text/DefaultStyledDocument.java (ElementBuffer.insertUpdate):
likewise.
* javax/swing/text/AbstractDocument.java (BranchElement): likewise.
* javax/swing/text/JTextComponent.java (getScrollableTracksViewportWidth):
likewise.
* javax/swing/text/FieldView.java (checkContainer): likewise.
* javax/swing/text/AsyncBoxView.java (ChildLocator.updateChildOffsets):
likewise.
* java/text/DecimalFormat.java (formatToCharacterIterator): likewise.
(parse): small refactoring.
Diffstat (limited to 'java/text')
| -rw-r--r-- | java/text/BreakIterator.java | 2 | ||||
| -rw-r--r-- | java/text/DecimalFormat.java | 14 | ||||
| -rw-r--r-- | java/text/MessageFormat.java | 128 |
3 files changed, 73 insertions, 71 deletions
diff --git a/java/text/BreakIterator.java b/java/text/BreakIterator.java index 7ba116870..475352847 100644 --- a/java/text/BreakIterator.java +++ b/java/text/BreakIterator.java @@ -341,7 +341,7 @@ public abstract class BreakIterator implements Cloneable if (following (pos) == DONE) last (); while (previous () >= pos) - ; + continue; return current (); } diff --git a/java/text/DecimalFormat.java b/java/text/DecimalFormat.java index 529e57133..24c397ae8 100644 --- a/java/text/DecimalFormat.java +++ b/java/text/DecimalFormat.java @@ -439,8 +439,8 @@ public class DecimalFormat extends NumberFormat FieldPosition pos = (FieldPosition) attributes.get(i); Format.Field attribute = pos.getFieldAttribute(); - as.addAttribute(attribute, attribute, pos.getBeginIndex(), pos - .getEndIndex()); + as.addAttribute(attribute, attribute, pos.getBeginIndex(), + pos.getEndIndex()); } // return the CharacterIterator from AttributedString @@ -723,25 +723,25 @@ public class DecimalFormat extends NumberFormat // now we have to check the suffix, done here after number parsing // or the index will not be updated correctly... - boolean isNegativeSuffix = str.endsWith(this.negativeSuffix); - boolean isPositiveSuffix = str.endsWith(this.positiveSuffix); + boolean hasNegativeSuffix = str.endsWith(this.negativeSuffix); + boolean hasPositiveSuffix = str.endsWith(this.positiveSuffix); boolean positiveEqualsNegative = negativeSuffix.equals(positiveSuffix); positiveLen = positiveSuffix.length(); negativeLen = negativeSuffix.length(); - if (isNegative && !isNegativeSuffix) + if (isNegative && !hasNegativeSuffix) { pos.setErrorIndex(i); return null; } - else if (isNegativeSuffix && + else if (hasNegativeSuffix && !positiveEqualsNegative && (negativeLen > positiveLen)) { isNegative = true; } - else if (!isPositiveSuffix) + else if (!hasPositiveSuffix) { pos.setErrorIndex(i); return null; diff --git a/java/text/MessageFormat.java b/java/text/MessageFormat.java index 3d428ac7e..ab71cecea 100644 --- a/java/text/MessageFormat.java +++ b/java/text/MessageFormat.java @@ -82,70 +82,72 @@ public class MessageFormat extends Format // Recompute the locale-based formatter. void setLocale (Locale loc) { - if (type == null) - ; - else if (type.equals("number")) + if (type != null) { - formatClass = java.lang.Number.class; - - if (style == null) - format = NumberFormat.getInstance(loc); - else if (style.equals("currency")) - format = NumberFormat.getCurrencyInstance(loc); - else if (style.equals("percent")) - format = NumberFormat.getPercentInstance(loc); - else if (style.equals("integer")) - { - NumberFormat nf = NumberFormat.getNumberInstance(loc); - nf.setMaximumFractionDigits(0); - nf.setGroupingUsed(false); - format = nf; - } - else - { - format = NumberFormat.getNumberInstance(loc); - DecimalFormat df = (DecimalFormat) format; - df.applyPattern(style); - } - } - else if (type.equals("time") || type.equals("date")) - { - formatClass = java.util.Date.class; - - int val = DateFormat.DEFAULT; - boolean styleIsPattern = false; - if (style == null) - ; - else if (style.equals("short")) - val = DateFormat.SHORT; - else if (style.equals("medium")) - val = DateFormat.MEDIUM; - else if (style.equals("long")) - val = DateFormat.LONG; - else if (style.equals("full")) - val = DateFormat.FULL; - else - styleIsPattern = true; - - if (type.equals("time")) - format = DateFormat.getTimeInstance(val, loc); - else - format = DateFormat.getDateInstance(val, loc); - - if (styleIsPattern) - { - SimpleDateFormat sdf = (SimpleDateFormat) format; - sdf.applyPattern(style); - } - } - else if (type.equals("choice")) - { - formatClass = java.lang.Number.class; - - if (style == null) - throw new - IllegalArgumentException ("style required for choice format"); - format = new ChoiceFormat (style); + if (type.equals("number")) + { + formatClass = java.lang.Number.class; + + if (style == null) + format = NumberFormat.getInstance(loc); + else if (style.equals("currency")) + format = NumberFormat.getCurrencyInstance(loc); + else if (style.equals("percent")) + format = NumberFormat.getPercentInstance(loc); + else if (style.equals("integer")) + { + NumberFormat nf = NumberFormat.getNumberInstance(loc); + nf.setMaximumFractionDigits(0); + nf.setGroupingUsed(false); + format = nf; + } + else + { + format = NumberFormat.getNumberInstance(loc); + DecimalFormat df = (DecimalFormat) format; + df.applyPattern(style); + } + } + else if (type.equals("time") || type.equals("date")) + { + formatClass = java.util.Date.class; + + int val = DateFormat.DEFAULT; + boolean styleIsPattern = false; + if (style != null) + { + if (style.equals("short")) + val = DateFormat.SHORT; + else if (style.equals("medium")) + val = DateFormat.MEDIUM; + else if (style.equals("long")) + val = DateFormat.LONG; + else if (style.equals("full")) + val = DateFormat.FULL; + else + styleIsPattern = true; + } + + if (type.equals("time")) + format = DateFormat.getTimeInstance(val, loc); + else + format = DateFormat.getDateInstance(val, loc); + + if (styleIsPattern) + { + SimpleDateFormat sdf = (SimpleDateFormat) format; + sdf.applyPattern(style); + } + } + else if (type.equals("choice")) + { + formatClass = java.lang.Number.class; + + if (style == null) + throw new + IllegalArgumentException ("style required for choice format"); + format = new ChoiceFormat (style); + } } } } |
