sonar fixes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1734337 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d1fe310b1a
commit
1b9523898d
@ -129,8 +129,7 @@ public class FromHowTo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void characters(char[] ch, int start, int length)
|
public void characters(char[] ch, int start, int length) throws SAXException { // NOSONAR
|
||||||
throws SAXException {
|
|
||||||
lastContents += new String(ch, start, length);
|
lastContents += new String(ch, start, length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,13 +294,11 @@ public class StringUtil {
|
|||||||
* An Iterator over an array of Strings.
|
* An Iterator over an array of Strings.
|
||||||
*/
|
*/
|
||||||
public static class StringsIterator implements Iterator<String> {
|
public static class StringsIterator implements Iterator<String> {
|
||||||
private String[] strings;
|
private String[] strings = {};
|
||||||
private int position = 0;
|
private int position = 0;
|
||||||
public StringsIterator(String[] strings) {
|
public StringsIterator(String[] strings) {
|
||||||
if(strings != null) {
|
if (strings != null) {
|
||||||
this.strings = strings;
|
this.strings = strings.clone();
|
||||||
} else {
|
|
||||||
this.strings = new String[0];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,8 +307,9 @@ public class StringUtil {
|
|||||||
}
|
}
|
||||||
public String next() {
|
public String next() {
|
||||||
int ourPos = position++;
|
int ourPos = position++;
|
||||||
if(ourPos >= strings.length)
|
if(ourPos >= strings.length) {
|
||||||
throw new ArrayIndexOutOfBoundsException(ourPos);
|
throw new ArrayIndexOutOfBoundsException(ourPos);
|
||||||
|
}
|
||||||
return strings[ourPos];
|
return strings[ourPos];
|
||||||
}
|
}
|
||||||
public void remove() {}
|
public void remove() {}
|
||||||
|
@ -17,24 +17,25 @@
|
|||||||
|
|
||||||
package org.apache.poi.util;
|
package org.apache.poi.util;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
import org.apache.poi.util.StringUtil.StringsIterator;
|
import org.apache.poi.util.StringUtil.StringsIterator;
|
||||||
|
import org.junit.Test;
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit test for StringUtil
|
* Unit test for StringUtil
|
||||||
*
|
|
||||||
* @author Marc Johnson (mjohnson at apache dot org
|
|
||||||
* @author Glen Stampoultzis (glens at apache.org)
|
|
||||||
* @author Sergei Kozello (sergeikozello at mail.ru)
|
|
||||||
*/
|
*/
|
||||||
public final class TestStringUtil extends TestCase {
|
public class TestStringUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test getFromUnicodeHigh for symbols with code below and more 127
|
* test getFromUnicodeHigh for symbols with code below and more 127
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testGetFromUnicodeHighSymbolsWithCodesMoreThan127() {
|
public void testGetFromUnicodeHighSymbolsWithCodesMoreThan127() {
|
||||||
byte[] test_data = new byte[]{0x22, 0x04,
|
byte[] test_data = new byte[]{0x22, 0x04,
|
||||||
0x35, 0x04,
|
0x35, 0x04,
|
||||||
@ -52,6 +53,7 @@ public final class TestStringUtil extends TestCase {
|
|||||||
StringUtil.getFromUnicodeLE( test_data ) );
|
StringUtil.getFromUnicodeLE( test_data ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testPutCompressedUnicode() {
|
public void testPutCompressedUnicode() {
|
||||||
byte[] output = new byte[100];
|
byte[] output = new byte[100];
|
||||||
byte[] expected_output =
|
byte[] expected_output =
|
||||||
@ -87,6 +89,7 @@ public final class TestStringUtil extends TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testPutUncompressedUnicode() {
|
public void testPutUncompressedUnicode() {
|
||||||
byte[] output = new byte[100];
|
byte[] output = new byte[100];
|
||||||
String input = "Hello World";
|
String input = "Hello World";
|
||||||
@ -124,6 +127,7 @@ public final class TestStringUtil extends TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testStringsIterator() {
|
public void testStringsIterator() {
|
||||||
StringsIterator i;
|
StringsIterator i;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user