You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2007/10/31 09:42:35 UTC
svn commit: r590591 [12/12] - in /harmony/enhanced/classlib/branches/java6:
depends/build/platform/ depends/files/ depends/jars/icu4j_3.8/
depends/libs/freebsd.x86/ depends/manifests/icu4j_3.4.4/
depends/manifests/icu4j_3.8/ depends/manifests/icu4j_3.8...
Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/org/apache/harmony/x/swing/ExtendedListFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/org/apache/harmony/x/swing/ExtendedListFactory.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/org/apache/harmony/x/swing/ExtendedListFactory.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/org/apache/harmony/x/swing/ExtendedListFactory.java Wed Oct 31 01:42:07 2007
@@ -1,9 +1,10 @@
/*
- * Copyright 2005 - 2006 The Apache Software Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/multi/MultiLookAndFeelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/multi/MultiLookAndFeelTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/multi/MultiLookAndFeelTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/multi/MultiLookAndFeelTest.java Wed Oct 31 01:42:07 2007
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package javax.swing.plaf.multi;
import java.util.Vector;
Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/multi/SyserrButtonUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/multi/SyserrButtonUI.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/multi/SyserrButtonUI.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/multi/SyserrButtonUI.java Wed Oct 31 01:42:07 2007
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package javax.swing.plaf.multi;
import java.awt.Graphics;
Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/multi/SyserrLookAndFeel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/multi/SyserrLookAndFeel.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/multi/SyserrLookAndFeel.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/multi/SyserrLookAndFeel.java Wed Oct 31 01:42:07 2007
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package javax.swing.plaf.multi;
import javax.swing.LookAndFeel;
Modified: harmony/enhanced/classlib/branches/java6/modules/text/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/build.xml?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/build.xml Wed Oct 31 01:42:07 2007
@@ -55,25 +55,6 @@
<!-- internal target for local and global test run sequence -->
<target name="-test-module" depends="build, compile-tests, prepare-exclude, run-tests" />
- <!-- Build native code -->
- <target name="build-native" >
- <make dir="${hy.text.src.main.native}/text/${hy.os.family}" />
-
- <!-- Copy the built shared libs over to the jre/bin dir -->
- <copy todir="${hy.jdk}/jre/bin" overwrite="yes">
- <fileset dir="${hy.text.src.main.native}/text">
- <include name="*${shlib.suffix}*"/>
- <include name="*${progdb.suffix}*" if="is.windows" />
- <exclude name="*${manifest.suffix}"/>
- </fileset>
- </copy>
- </target>
-
- <!-- Clean natives -->
- <target name="clean-native">
- <make dir="${hy.text.src.main.native}/text/${hy.os.family}" target="clean" />
- </target>
-
<target name="clean">
<delete file="${hy.jdk}/jre/lib/boot/text.jar" />
<delete file="${hy.jdk}/jre/lib/boot/text-src.jar" />
Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Bidi.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Bidi.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Bidi.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/Bidi.java Wed Oct 31 01:42:07 2007
@@ -17,13 +17,6 @@
package java.text;
-import java.awt.font.NumericShaper;
-import java.awt.font.TextAttribute;
-import java.util.Arrays;
-import java.util.LinkedList;
-
-import org.apache.harmony.text.BidiRun;
-import org.apache.harmony.text.BidiWrapper;
import org.apache.harmony.text.internal.nls.Messages;
/**
@@ -45,25 +38,31 @@
public final class Bidi {
/**
* Constant that indicates the default base level. If there is no strong
- * character, then set the paragraph level to 0 (left-to-right).
+ * character, then set the paragraph level to left-to-right.
*/
- public static final int DIRECTION_DEFAULT_LEFT_TO_RIGHT = -2;
+ public static final int DIRECTION_DEFAULT_LEFT_TO_RIGHT = com.ibm.icu.text.Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT;
/**
* Constant that indicates the default base level. If there is no strong
- * character, then set the paragraph level to 1 (right-to-left).
+ * character, then set the paragraph level to right-to-left.
*/
- public static final int DIRECTION_DEFAULT_RIGHT_TO_LEFT = -1;
+ public static final int DIRECTION_DEFAULT_RIGHT_TO_LEFT = com.ibm.icu.text.Bidi.DIRECTION_DEFAULT_RIGHT_TO_LEFT;
/**
- * Constant that specifies the default base level as 0 (left-to-right).
+ * Constant that specifies the default base level as
+ * left-to-right.
*/
- public static final int DIRECTION_LEFT_TO_RIGHT = 0;
+ public static final int DIRECTION_LEFT_TO_RIGHT = com.ibm.icu.text.Bidi.DIRECTION_LEFT_TO_RIGHT;
/**
- * Constant that specifies the default base level as 1 (right-to-left).
+ * Constant that specifies the default base level right-to-left.
+ */
+ public static final int DIRECTION_RIGHT_TO_LEFT = com.ibm.icu.text.Bidi.DIRECTION_RIGHT_TO_LEFT;
+
+ /*
+ * Use an embedded ICU4J Bidi object to do all the work
*/
- public static final int DIRECTION_RIGHT_TO_LEFT = 1;
+ private com.ibm.icu.text.Bidi icuBidi;
/**
* Create a Bidi object from the AttributedCharacterIterator of a paragraph
@@ -97,64 +96,7 @@
throw new IllegalArgumentException(Messages.getString("text.14")); //$NON-NLS-1$
}
- int begin = paragraph.getBeginIndex();
- int end = paragraph.getEndIndex();
- int length = end - begin;
- char text[] = new char[length + 1]; // One more char for
- // AttributedCharacterIterator.DONE
-
- if (length != 0) {
- text[0] = paragraph.first();
- } else {
- paragraph.first();
- }
-
- // First check the RUN_DIRECTION attribute.
- int flags = DIRECTION_DEFAULT_LEFT_TO_RIGHT;
- Object direction = paragraph.getAttribute(TextAttribute.RUN_DIRECTION);
- if (direction != null && direction instanceof Boolean) {
- if (direction.equals(TextAttribute.RUN_DIRECTION_LTR)) {
- flags = DIRECTION_LEFT_TO_RIGHT;
- } else {
- flags = DIRECTION_RIGHT_TO_LEFT;
- }
- }
-
- // Retrieve the text and gather BIDI_EMBEDDINGS
- byte embeddings[] = null;
- for (int textLimit = 1, i = 1; i < length; textLimit = paragraph
- .getRunLimit(TextAttribute.BIDI_EMBEDDING)
- - begin + 1) {
- Object embedding = paragraph
- .getAttribute(TextAttribute.BIDI_EMBEDDING);
- if (embedding != null && embedding instanceof Integer) {
- int embLevel = ((Integer) embedding).intValue();
-
- if (embeddings == null) {
- embeddings = new byte[length];
- }
-
- for (; i < textLimit; i++) {
- text[i] = paragraph.next();
- embeddings[i - 1] = (byte) embLevel;
- }
- } else {
- for (; i < textLimit; i++) {
- text[i] = paragraph.next();
- }
- }
- }
-
- // Apply NumericShaper to the text
- Object numericShaper = paragraph
- .getAttribute(TextAttribute.NUMERIC_SHAPING);
- if (numericShaper != null && numericShaper instanceof NumericShaper) {
- ((NumericShaper) numericShaper).shape(text, 0, length);
- }
-
- long pBidi = createUBiDi(text, 0, embeddings, 0, length, flags);
- readBidiInfo(pBidi);
- BidiWrapper.ubidi_close(pBidi);
+ icuBidi = new com.ibm.icu.text.Bidi(paragraph);
}
/**
@@ -191,6 +133,17 @@
*/
public Bidi(char[] text, int textStart, byte[] embeddings, int embStart,
int paragraphLength, int flags) {
+
+ if (text == null || text.length - textStart < paragraphLength) {
+ throw new IllegalArgumentException();
+ }
+
+ if (embeddings != null) {
+ if (embeddings.length - embStart < paragraphLength) {
+ throw new IllegalArgumentException();
+ }
+ }
+
if (textStart < 0) {
// text.0D=Negative textStart value {0}
throw new IllegalArgumentException(Messages.getString(
@@ -206,10 +159,8 @@
throw new IllegalArgumentException(Messages.getString(
"text.11", paragraphLength)); //$NON-NLS-1$
}
- long pBidi = createUBiDi(text, textStart, embeddings, embStart,
- paragraphLength, flags);
- readBidiInfo(pBidi);
- BidiWrapper.ubidi_close(pBidi);
+
+ icuBidi = new com.ibm.icu.text.Bidi(text, textStart, embeddings, embStart, paragraphLength, flags);
}
/**
@@ -234,104 +185,18 @@
(paragraph == null ? 0 : paragraph.length()), flags);
}
- // create the native UBiDi struct, need to be closed with ubidi_close().
- private static long createUBiDi(char[] text, int textStart,
- byte[] embeddings, int embStart, int paragraphLength, int flags) {
- char[] realText = null;
-
- byte[] realEmbeddings = null;
-
- if (text == null || text.length - textStart < paragraphLength) {
- throw new IllegalArgumentException();
- }
- realText = new char[paragraphLength];
- System.arraycopy(text, textStart, realText, 0, paragraphLength);
-
- if (embeddings != null) {
- if (embeddings.length - embStart < paragraphLength) {
- throw new IllegalArgumentException();
- }
- if (paragraphLength > 0) {
- Bidi temp = new Bidi(text, textStart, null, 0, paragraphLength,
- flags);
- realEmbeddings = new byte[paragraphLength];
- System.arraycopy(temp.offsetLevel, 0, realEmbeddings, 0,
- paragraphLength);
- for (int i = 0; i < paragraphLength; i++) {
- byte e = embeddings[i];
- if (e < 0) {
- realEmbeddings[i] = (byte) (BidiWrapper.UBIDI_LEVEL_OVERRIDE - e);
- } else if (e > 0) {
- realEmbeddings[i] = e;
- } else {
- realEmbeddings[i] |= (byte) BidiWrapper.UBIDI_LEVEL_OVERRIDE;
- }
- }
- }
- }
-
- if (flags > 1 || flags < -2) {
- flags = 0;
- }
-
- long bidi = BidiWrapper.ubidi_open();
- BidiWrapper.ubidi_setPara(bidi, realText, paragraphLength,
- (byte) flags, realEmbeddings);
- return bidi;
- }
-
- // private constructor, used by createLineBidi()
- private Bidi(long pBidi) {
- readBidiInfo(pBidi);
- }
-
- // read info from the native UBiDi struct
- private void readBidiInfo(long pBidi) {
-
- length = BidiWrapper.ubidi_getLength(pBidi);
-
- offsetLevel = (length == 0) ? null : BidiWrapper.ubidi_getLevels(pBidi);
-
- baseLevel = BidiWrapper.ubidi_getParaLevel(pBidi);
-
- int runCount = BidiWrapper.ubidi_countRuns(pBidi);
- if (runCount == 0) {
- unidirectional = true;
- runs = null;
- } else if (runCount < 0) {
- runs = null;
- } else {
- runs = BidiWrapper.ubidi_getRuns(pBidi);
-
- // Simplified case for one run which has the base level
- if (runCount == 1 && runs[0].getLevel() == baseLevel) {
- unidirectional = true;
- runs = null;
- }
- }
-
- direction = BidiWrapper.ubidi_getDirection(pBidi);
+ /* private constructor used by createLineBidi() */
+ private Bidi(com.ibm.icu.text.Bidi bidi) {
+ this.icuBidi = bidi;
}
- private int baseLevel;
-
- private int length;
-
- private byte[] offsetLevel;
-
- private BidiRun[] runs;
-
- private int direction;
-
- private boolean unidirectional;
-
/**
* Return whether the base level is from left to right.
*
* @return true if the base level is from left to right.
*/
public boolean baseIsLeftToRight() {
- return baseLevel % 2 == 0 ? true : false;
+ return icuBidi.baseIsLeftToRight();
}
/**
@@ -346,29 +211,17 @@
* range from 0 to (limit - start - 1).
*/
public Bidi createLineBidi(int lineStart, int lineLimit) {
+ int length = icuBidi.getLength();
if (lineStart < 0 || lineLimit < 0 || lineLimit > length
|| lineStart > lineLimit) {
// text.12=Invalid ranges (start={0}, limit={1}, length={2})
throw new IllegalArgumentException(Messages.getString(
"text.12", new Object[] { lineStart, lineLimit, length })); //$NON-NLS-1$
}
- char[] text = new char[this.length];
- Arrays.fill(text, 'a');
- byte[] embeddings = new byte[this.length];
- for (int i = 0; i < embeddings.length; i++) {
- embeddings[i] = (byte) -this.offsetLevel[i];
- }
-
- int dir = this.baseIsLeftToRight() ? Bidi.DIRECTION_LEFT_TO_RIGHT
- : Bidi.DIRECTION_RIGHT_TO_LEFT;
-
- long parent = createUBiDi(text, 0, embeddings, 0, this.length, dir);
-
- long line = BidiWrapper.ubidi_setLine(parent, lineStart, lineLimit);
- Bidi result = new Bidi(line);
- BidiWrapper.ubidi_close(line);
- BidiWrapper.ubidi_close(parent);
- return result;
+
+ com.ibm.icu.text.Bidi lineBidi = icuBidi.createLineBidi(lineStart, lineLimit);
+ Bidi bidi = new Bidi(lineBidi);
+ return bidi;
}
/**
@@ -377,7 +230,7 @@
* @return the int value of the base level.
*/
public int getBaseLevel() {
- return baseLevel;
+ return icuBidi.getBaseLevel();
}
/**
@@ -386,7 +239,7 @@
* @return the int value of the length.
*/
public int getLength() {
- return length;
+ return icuBidi.getLength();
}
/**
@@ -398,9 +251,9 @@
*/
public int getLevelAt(int offset) {
try {
- return offsetLevel[offset] & ~BidiWrapper.UBIDI_LEVEL_OVERRIDE;
+ return icuBidi.getLevelAt(offset);
} catch (RuntimeException e) {
- return baseLevel;
+ return icuBidi.getBaseLevel();
}
}
@@ -410,7 +263,8 @@
* @return the int value of runs, at least 1.
*/
public int getRunCount() {
- return unidirectional ? 1 : runs.length;
+ int runCount = icuBidi.getRunCount();
+ return (runCount < 1) ? 1 : runCount;
}
/**
@@ -421,7 +275,11 @@
* @return the level of the run.
*/
public int getRunLevel(int run) {
- return unidirectional ? baseLevel : runs[run].getLevel();
+ if (icuBidi.getRunCount() == 0) {
+ return icuBidi.getBaseLevel();
+ } else {
+ return icuBidi.getRunLevel(run);
+ }
}
/**
@@ -432,7 +290,11 @@
* @return the limit offset of the run.
*/
public int getRunLimit(int run) {
- return unidirectional ? length : runs[run].getLimit();
+ if (icuBidi.getRunCount() == 0) {
+ return icuBidi.getLength();
+ } else {
+ return icuBidi.getRunLimit(run);
+ }
}
/**
@@ -443,7 +305,11 @@
* @return the start offset of the run.
*/
public int getRunStart(int run) {
- return unidirectional ? 0 : runs[run].getStart();
+ if (icuBidi.getRunCount() == 0) {
+ return 0;
+ } else {
+ return icuBidi.getRunStart(run);
+ }
}
/**
@@ -453,7 +319,7 @@
* @return true if the text is from left to right.
*/
public boolean isLeftToRight() {
- return direction == BidiWrapper.UBiDiDirection_UBIDI_LTR;
+ return icuBidi.isLeftToRight();
}
/**
@@ -462,7 +328,7 @@
* @return true if the text direction is mixed.
*/
public boolean isMixed() {
- return direction == BidiWrapper.UBiDiDirection_UBIDI_MIXED;
+ return icuBidi.isMixed();
}
/**
@@ -472,7 +338,7 @@
* @return true if the text is from right to left.
*/
public boolean isRightToLeft() {
- return direction == BidiWrapper.UBiDiDirection_UBIDI_RTL;
+ return icuBidi.isRightToLeft();
}
/**
@@ -504,17 +370,8 @@
new Object[] { levels.length, levelStart, objects.length,
objectStart, count }));
}
- byte[] realLevels = new byte[count];
- System.arraycopy(levels, levelStart, realLevels, 0, count);
- int[] indices = BidiWrapper.ubidi_reorderVisual(realLevels, count);
-
- LinkedList<Object> result = new LinkedList<Object>();
- for (int i = 0; i < count; i++) {
- result.addLast(objects[objectStart + indices[i]]);
- }
-
- System.arraycopy(result.toArray(), 0, objects, objectStart, count);
+ com.ibm.icu.text.Bidi.reorderVisually(levels, levelStart, objects, objectStart, count);
}
/**
@@ -530,12 +387,12 @@
* @return true if the range of characters requires a Bidi object.
*/
public static boolean requiresBidi(char[] text, int start, int limit) {
- int length = text.length;
- if (limit < 0 || start < 0 || start > limit || limit > length) {
+ //int length = text.length;
+ if (limit < 0 || start < 0 || start > limit || limit > text.length) {
throw new IllegalArgumentException();
}
- Bidi bidi = new Bidi(text, start, null, 0, limit - start, 0);
- return !bidi.isLeftToRight();
+
+ return com.ibm.icu.text.Bidi.requiresBidi(text, start, limit);
}
/**
@@ -545,8 +402,6 @@
*/
@Override
public String toString() {
- return super.toString()
- + "[direction: " + direction + " baselevel: " + baseLevel //$NON-NLS-1$ //$NON-NLS-2$
- + " length: " + length + " runs: " + (unidirectional ? "null" : runs.toString()) + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ return icuBidi.toString();
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/BidiTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/BidiTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/BidiTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/BidiTest.java Wed Oct 31 01:42:07 2007
@@ -781,7 +781,7 @@
}
public void testCreateLineBidi() {
- bd = new Bidi("a\u05D0a\na\u05D0\"\u05D0a".toCharArray(), 0,
+ bd = new Bidi("a\u05D0a\u05D0a\u05D0\"\u05D0a".toCharArray(), 0,
new byte[] { 0, 0, 0, -3, -3, 2, 2, 0, 3 }, 0, 9,
Bidi.DIRECTION_RIGHT_TO_LEFT);
Bidi line = bd.createLineBidi(2, 7);
@@ -789,14 +789,14 @@
assertEquals(1, line.getBaseLevel());
assertEquals(5, line.getLength());
assertEquals(2, line.getLevelAt(0));
- assertEquals(1, line.getLevelAt(1));
+ assertEquals(3, line.getLevelAt(1));
assertEquals(3, line.getLevelAt(2));
assertEquals(3, line.getLevelAt(3));
assertEquals(2, line.getLevelAt(4));
assertEquals(1, line.getLevelAt(1000));
- assertEquals(4, line.getRunCount());
- assertRunArrayEquals(new int[][] { { 0, 1, 2 }, { 1, 2, 1 },
- { 2, 4, 3 }, { 4, 5, 2 }, }, line);
+ assertEquals(3, line.getRunCount());
+ assertRunArrayEquals(new int[][] { { 0, 1, 2 }, { 1, 4, 3 },
+ { 4, 5, 2 }, }, line);
assertFalse(line.isLeftToRight());
assertTrue(line.isMixed());
assertFalse(line.isRightToLeft());
@@ -832,8 +832,12 @@
} catch (IllegalArgumentException e) {
// Expected
}
-
- bidi.createLineBidi(2, 2);
+
+ try {
+ bidi.createLineBidi(2, 2);
+ }catch (IllegalArgumentException e){
+ // Expected
+ }
try {
bidi.createLineBidi(2, 4);
@@ -961,18 +965,25 @@
bd = new Bidi("text", Bidi.DIRECTION_LEFT_TO_RIGHT);
try {
assertTrue(4 == bd.getRunLimit(-1));
- } catch (Exception e) {
- fail("Unexpected exception: " + e);
+ } catch (IllegalArgumentException e) {
+ // Expected for illegal run limit
+ return;
}
+
+ fail("Expected IllegalArgumentException to be thrown for invalid run limit");
}
+
public void testBidiConstructor_Iterator() {
AttributedString paragraph = new AttributedString("text");
bd = new Bidi(paragraph.getIterator());
try {
assertTrue(4 == bd.getRunLimit(1));
- } catch (Exception e) {
- fail("Unexpected exception: " + e);
+ } catch (IllegalArgumentException e) {
+ // Expected for illegal run limit
+ return;
}
+
+ fail("Expected IllegalArgumentException to be thrown for invalid run limit");
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DateFormatSymbolsTest.java Wed Oct 31 01:42:07 2007
@@ -30,11 +30,7 @@
public void test_Constructor() {
// Test for method java.text.DateFormatSymbols()
// Used in tests
- try {
- new DateFormatSymbols();
- } catch (Exception e) {
- fail("Constructor failed.");
- }
+ new DateFormatSymbols();
}
/**
@@ -42,11 +38,7 @@
*/
public void test_ConstructorLjava_util_Locale() {
// Test for method java.text.DateFormatSymbols(java.util.Locale)
- try {
- new DateFormatSymbols(new Locale("en", "us"));
- } catch (Exception e) {
- fail("Constructor failed.");
- }
+ new DateFormatSymbols(new Locale("en", "us"));
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/DecimalFormatTest.java Wed Oct 31 01:42:07 2007
@@ -1504,7 +1504,7 @@
/**
* @tests serialization compatibility with RI
*/
- public void test_serializationHarmonyRICompatible() {
+ public void test_serializationHarmonyRICompatible() throws Exception {
NumberFormat nf = NumberFormat.getInstance(Locale.FRANCE);
DecimalFormat df = null;
@@ -1522,8 +1522,6 @@
oinput = new ObjectInputStream(this.getClass().getResource(
"/serialization/java/text/DecimalFormat.ser").openStream());
deserializedDF = (DecimalFormat) oinput.readObject();
- } catch (Exception e) {
- fail("Error occurs during deserialization");
} finally {
try {
if (null != oinput) {
@@ -1594,11 +1592,7 @@
*/
public void testSetDecimalFormatSymbolsAsNull(){
// Regression for HARMONY-1070
- try {
- DecimalFormat format = (DecimalFormat)DecimalFormat.getInstance();
- format.setDecimalFormatSymbols(null);
- } catch (Exception e) {
- fail("Unexpected exception caught: " + e);
- }
+ DecimalFormat format = (DecimalFormat)DecimalFormat.getInstance();
+ format.setDecimalFormatSymbols(null);
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java Wed Oct 31 01:42:07 2007
@@ -128,22 +128,15 @@
assertEquals("Simple string", "Test message", new MessageFormat("Test message").format(
new Object[0]));
- try {
- result = new MessageFormat("Don't").format(new Object[0]);
- assertTrue("Should not throw IllegalArgumentException: " + result,
+ result = new MessageFormat("Don't").format(new Object[0]);
+ assertTrue("Should not throw IllegalArgumentException: " + result,
"Dont".equals(result));
- } catch (Exception e) {
- fail("Unexpected exception: " + e);
- }
try {
new MessageFormat("Invalid {1,foobar} format descriptor!");
fail("Expected test_ConstructorLjava_lang_String to throw IAE.");
} catch (IllegalArgumentException ex) {
// expected
- } catch (Throwable ex) {
- fail("Expected test_ConstructorLjava_lang_String to throw IAE, not a "
- + ex.getClass().getName());
}
try {
@@ -151,9 +144,6 @@
"Invalid {1,date,invalid-spec} format descriptor!");
} catch (IllegalArgumentException ex) {
// expected
- } catch (Throwable ex) {
- fail("Expected test_ConstructorLjava_lang_String to throw IAE, not a "
- + ex.getClass().getName());
}
checkSerialization(new MessageFormat(""));
Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/ParsePositionTest.java Wed Oct 31 01:42:07 2007
@@ -22,21 +22,15 @@
ParsePosition pp;
- /**
- * @tests java.text.ParsePosition#ParsePosition(int)
- */
- public void test_ConstructorI() {
- // Test for method java.text.ParsePosition(int)
- try {
- ParsePosition pp1 = new ParsePosition(Integer.MIN_VALUE);
- assertTrue("Initialization failed.",
- pp1.getIndex() == Integer.MIN_VALUE);
- assertEquals("Initialization failed.", -1, pp1.getErrorIndex());
- } catch (Exception e) {
- fail("Constructor failed.");
- }
-
- }
+ /**
+ * @tests java.text.ParsePosition#ParsePosition(int)
+ */
+ public void test_ConstructorI() {
+ // Test for method java.text.ParsePosition(int)
+ ParsePosition pp1 = new ParsePosition(Integer.MIN_VALUE);
+ assertTrue("Initialization failed.", pp1.getIndex() == Integer.MIN_VALUE);
+ assertEquals("Initialization failed.", -1, pp1.getErrorIndex());
+ }
/**
* @tests java.text.ParsePosition#equals(java.lang.Object)
Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java Wed Oct 31 01:42:07 2007
@@ -141,10 +141,7 @@
fail("Expected test_ConstructorLjava_lang_String to throw IAE.");
} catch (IllegalArgumentException ex) {
// expected
- } catch (Throwable ex) {
- fail("Expected test_ConstructorLjava_lang_String to throw IAE, not "
- + ex.getClass().getName());
- }
+ }
// Null string value
try {
@@ -152,10 +149,7 @@
fail("Expected test_ConstructorLjava_lang_String to throw NPE.");
} catch (NullPointerException ex) {
// expected
- } catch (Throwable ex) {
- fail("Expected test_ConstructorLjava_lang_String to throw NPE, not "
- + ex.getClass().getName());
- }
+ }
}
/**
@@ -504,9 +498,7 @@
fail("Expected test to throw NPE.");
} catch (NullPointerException ex) {
// expected
- } catch (Throwable ex) {
- fail("Expected test to throw NPE, not " + ex.getClass().getName());
- }
+ }
}
/**