You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2014/03/31 13:34:05 UTC
svn commit: r1583302 [3/4] - in /lucene/dev/trunk:
lucene/analysis/common/src/java/org/apache/lucene/analysis/br/
lucene/analysis/common/src/java/org/apache/lucene/analysis/ckb/
lucene/analysis/common/src/java/org/apache/lucene/analysis/cz/ lucene/anal...
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java Mon Mar 31 11:34:01 2014
@@ -60,6 +60,7 @@ import org.apache.lucene.search.FieldCac
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.NumericUtils;
import org.apache.lucene.util.TestUtil;
@@ -139,7 +140,7 @@ public class TestFieldCache extends Luce
try {
FieldCache cache = FieldCache.DEFAULT;
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
- cache.setInfoStream(new PrintStream(bos, false, "UTF-8"));
+ cache.setInfoStream(new PrintStream(bos, false, IOUtils.UTF_8));
cache.getDoubles(reader, "theDouble", false);
cache.getFloats(reader, "theDouble", new FieldCache.FloatParser() {
@Override
@@ -151,7 +152,7 @@ public class TestFieldCache extends Luce
return NumericUtils.sortableIntToFloat((int) NumericUtils.prefixCodedToLong(term));
}
}, false);
- assertTrue(bos.toString("UTF-8").indexOf("WARNING") != -1);
+ assertTrue(bos.toString(IOUtils.UTF_8).indexOf("WARNING") != -1);
} finally {
FieldCache.DEFAULT.purgeAllCaches();
}
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestPositionIncrement.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestPositionIncrement.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestPositionIncrement.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestPositionIncrement.java Mon Mar 31 11:34:01 2014
@@ -20,6 +20,7 @@ package org.apache.lucene.search;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
+import java.nio.charset.StandardCharsets;
import java.util.Collection;
import org.apache.lucene.analysis.*;
@@ -249,7 +250,7 @@ public class TestPositionIncrement exten
for (byte[] bytes : payloads) {
count++;
if (VERBOSE) {
- System.out.println(" payload: " + new String(bytes, "UTF-8"));
+ System.out.println(" payload: " + new String(bytes, StandardCharsets.UTF_8));
}
}
}
@@ -276,7 +277,7 @@ public class TestPositionIncrement exten
Collection<byte[]> pls = psu.getPayloadsForQuery(snq);
count = pls.size();
for (byte[] bytes : pls) {
- String s = new String(bytes, "UTF-8");
+ String s = new String(bytes, StandardCharsets.UTF_8);
//System.out.println(s);
sawZero |= s.equals("pos: 0");
}
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java Mon Mar 31 11:34:01 2014
@@ -18,6 +18,7 @@ package org.apache.lucene.search.spans;
*/
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -80,7 +81,7 @@ public class TestBasics extends LuceneTe
@Override
public boolean incrementToken() throws IOException {
if (input.incrementToken()) {
- payloadAttr.setPayload(new BytesRef(("pos: " + pos).getBytes("UTF-8")));
+ payloadAttr.setPayload(new BytesRef(("pos: " + pos).getBytes(StandardCharsets.UTF_8)));
pos++;
return true;
} else {
@@ -482,7 +483,7 @@ public class TestBasics extends LuceneTe
@Test
public void testSpanPayloadCheck() throws Exception {
SpanTermQuery term1 = new SpanTermQuery(new Term("field", "five"));
- BytesRef pay = new BytesRef(("pos: " + 5).getBytes("UTF-8"));
+ BytesRef pay = new BytesRef(("pos: " + 5).getBytes(StandardCharsets.UTF_8));
SpanQuery query = new SpanPayloadCheckQuery(term1, Collections.singletonList(pay.bytes));
checkHits(query, new int[]
{1125, 1135, 1145, 1155, 1165, 1175, 1185, 1195, 1225, 1235, 1245, 1255, 1265, 1275, 1285, 1295, 1325, 1335, 1345, 1355, 1365, 1375, 1385, 1395, 1425, 1435, 1445, 1455, 1465, 1475, 1485, 1495, 1525, 1535, 1545, 1555, 1565, 1575, 1585, 1595, 1625, 1635, 1645, 1655, 1665, 1675, 1685, 1695, 1725, 1735, 1745, 1755, 1765, 1775, 1785, 1795, 1825, 1835, 1845, 1855, 1865, 1875, 1885, 1895, 1925, 1935, 1945, 1955, 1965, 1975, 1985, 1995});
@@ -497,8 +498,8 @@ public class TestBasics extends LuceneTe
clauses[0] = term1;
clauses[1] = term2;
snq = new SpanNearQuery(clauses, 0, true);
- pay = new BytesRef(("pos: " + 0).getBytes("UTF-8"));
- pay2 = new BytesRef(("pos: " + 1).getBytes("UTF-8"));
+ pay = new BytesRef(("pos: " + 0).getBytes(StandardCharsets.UTF_8));
+ pay2 = new BytesRef(("pos: " + 1).getBytes(StandardCharsets.UTF_8));
list = new ArrayList<>();
list.add(pay.bytes);
list.add(pay2.bytes);
@@ -510,9 +511,9 @@ public class TestBasics extends LuceneTe
clauses[1] = term2;
clauses[2] = new SpanTermQuery(new Term("field", "five"));
snq = new SpanNearQuery(clauses, 0, true);
- pay = new BytesRef(("pos: " + 0).getBytes("UTF-8"));
- pay2 = new BytesRef(("pos: " + 1).getBytes("UTF-8"));
- BytesRef pay3 = new BytesRef(("pos: " + 2).getBytes("UTF-8"));
+ pay = new BytesRef(("pos: " + 0).getBytes(StandardCharsets.UTF_8));
+ pay2 = new BytesRef(("pos: " + 1).getBytes(StandardCharsets.UTF_8));
+ BytesRef pay3 = new BytesRef(("pos: " + 2).getBytes(StandardCharsets.UTF_8));
list = new ArrayList<>();
list.add(pay.bytes);
list.add(pay2.bytes);
@@ -541,10 +542,10 @@ public class TestBasics extends LuceneTe
checkHits(query, new int[]{1103, 1203,1303,1403,1503,1603,1703,1803,1903});
Collection<byte[]> payloads = new ArrayList<>();
- BytesRef pay = new BytesRef(("pos: " + 0).getBytes("UTF-8"));
- BytesRef pay2 = new BytesRef(("pos: " + 1).getBytes("UTF-8"));
- BytesRef pay3 = new BytesRef(("pos: " + 3).getBytes("UTF-8"));
- BytesRef pay4 = new BytesRef(("pos: " + 4).getBytes("UTF-8"));
+ BytesRef pay = new BytesRef(("pos: " + 0).getBytes(StandardCharsets.UTF_8));
+ BytesRef pay2 = new BytesRef(("pos: " + 1).getBytes(StandardCharsets.UTF_8));
+ BytesRef pay3 = new BytesRef(("pos: " + 3).getBytes(StandardCharsets.UTF_8));
+ BytesRef pay4 = new BytesRef(("pos: " + 4).getBytes(StandardCharsets.UTF_8));
payloads.add(pay.bytes);
payloads.add(pay2.bytes);
payloads.add(pay3.bytes);
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java Mon Mar 31 11:34:01 2014
@@ -19,6 +19,7 @@ package org.apache.lucene.search.spans;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
+import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -276,7 +277,7 @@ public class TestPayloadSpans extends Lu
Collection<byte[]> payloads = spans.getPayload();
for (final byte [] payload : payloads) {
- payloadSet.add(new String(payload, "UTF-8"));
+ payloadSet.add(new String(payload, StandardCharsets.UTF_8));
}
}
}
@@ -311,7 +312,7 @@ public class TestPayloadSpans extends Lu
while (spans.next()) {
Collection<byte[]> payloads = spans.getPayload();
for (final byte[] payload : payloads) {
- payloadSet.add(new String(payload, "UTF-8"));
+ payloadSet.add(new String(payload, StandardCharsets.UTF_8));
}
}
}
@@ -347,7 +348,7 @@ public class TestPayloadSpans extends Lu
Collection<byte[]> payloads = spans.getPayload();
for (final byte [] payload : payloads) {
- payloadSet.add(new String(payload, "UTF-8"));
+ payloadSet.add(new String(payload, StandardCharsets.UTF_8));
}
}
}
@@ -382,7 +383,7 @@ public class TestPayloadSpans extends Lu
if(VERBOSE) {
System.out.println("Num payloads:" + payloads.size());
for (final byte [] bytes : payloads) {
- System.out.println(new String(bytes, "UTF-8"));
+ System.out.println(new String(bytes, StandardCharsets.UTF_8));
}
}
reader.close();
@@ -455,7 +456,7 @@ public class TestPayloadSpans extends Lu
System.out.println("payloads for span:" + payload.size());
for (final byte [] bytes : payload) {
System.out.println("doc:" + spans.doc() + " s:" + spans.start() + " e:" + spans.end() + " "
- + new String(bytes, "UTF-8"));
+ + new String(bytes, StandardCharsets.UTF_8));
}
}
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/TestOfflineSorter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/TestOfflineSorter.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/TestOfflineSorter.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/TestOfflineSorter.java Mon Mar 31 11:34:01 2014
@@ -21,6 +21,7 @@ import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
@@ -60,7 +61,7 @@ public class TestOfflineSorter extends L
public void testSingleLine() throws Exception {
checkSort(new OfflineSorter(), new byte [][] {
- "Single line only.".getBytes("UTF-8")
+ "Single line only.".getBytes(StandardCharsets.UTF_8)
});
}
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/automaton/TestDeterminizeLexicon.java Mon Mar 31 11:34:01 2014
@@ -17,6 +17,7 @@ package org.apache.lucene.util.automaton
* limitations under the License.
*/
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -56,7 +57,7 @@ public class TestDeterminizeLexicon exte
}
final ByteRunAutomaton lexByte = new ByteRunAutomaton(lex);
for (String s : terms) {
- byte bytes[] = s.getBytes("UTF-8");
+ byte bytes[] = s.getBytes(StandardCharsets.UTF_8);
assertTrue(lexByte.run(bytes, 0, bytes.length));
}
}
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java Mon Mar 31 11:34:01 2014
@@ -22,6 +22,7 @@ import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.UnicodeUtil;
+import java.nio.charset.StandardCharsets;
import java.util.Random;
public class TestUTF32ToUTF8 extends LuceneTestCase {
@@ -184,7 +185,7 @@ public class TestUTF32ToUTF8 extends Luc
assertTrue(cra.run(input));
- byte[] bytes = input.getBytes("UTF-8");
+ byte[] bytes = input.getBytes(StandardCharsets.UTF_8);
assertTrue(bra.run(bytes, 0, bytes.length)); // this one fails!
}
@@ -197,7 +198,7 @@ public class TestUTF32ToUTF8 extends Luc
assertTrue(cra.run(input));
- byte[] bytes = input.getBytes("UTF-8");
+ byte[] bytes = input.getBytes(StandardCharsets.UTF_8);
assertTrue(bra.run(bytes, 0, bytes.length));
}
@@ -232,7 +233,7 @@ public class TestUTF32ToUTF8 extends Luc
throw e;
}
}
- byte bytes[] = string.getBytes("UTF-8");
+ byte bytes[] = string.getBytes(StandardCharsets.UTF_8);
assertEquals(cra.run(string), bra.run(bytes, 0, bytes.length));
}
}
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java Mon Mar 31 11:34:01 2014
@@ -63,6 +63,7 @@ import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -474,7 +475,7 @@ public class TestFSTs extends LuceneTest
protected abstract T getOutput(IntsRef input, int ord) throws IOException;
public void run(int limit, boolean verify, boolean verifyByOutput) throws IOException {
- BufferedReader is = new BufferedReader(new InputStreamReader(new FileInputStream(wordsFileIn), "UTF-8"), 65536);
+ BufferedReader is = new BufferedReader(new InputStreamReader(new FileInputStream(wordsFileIn), StandardCharsets.UTF_8), 65536);
try {
final IntsRef intsRef = new IntsRef(10);
long tStart = System.currentTimeMillis();
@@ -517,7 +518,7 @@ public class TestFSTs extends LuceneTest
System.out.println(ord + " terms; " + fst.getNodeCount() + " nodes; " + fst.getArcCount() + " arcs; " + fst.getArcWithOutputCount() + " arcs w/ output; tot size " + fst.sizeInBytes());
if (fst.getNodeCount() < 100) {
- Writer w = new OutputStreamWriter(new FileOutputStream("out.dot"), "UTF-8");
+ Writer w = new OutputStreamWriter(new FileOutputStream("out.dot"), StandardCharsets.UTF_8);
Util.toDot(fst, w, false, false);
w.close();
System.out.println("Wrote FST to out.dot");
@@ -544,7 +545,7 @@ public class TestFSTs extends LuceneTest
while(true) {
for(int iter=0;iter<2;iter++) {
is.close();
- is = new BufferedReader(new InputStreamReader(new FileInputStream(wordsFileIn), "UTF-8"), 65536);
+ is = new BufferedReader(new InputStreamReader(new FileInputStream(wordsFileIn), StandardCharsets.UTF_8), 65536);
ord = 0;
tStart = System.currentTimeMillis();
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java Mon Mar 31 11:34:01 2014
@@ -20,8 +20,10 @@ package org.apache.lucene.util.junitcomp
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.util.List;
+import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures;
import org.apache.lucene.util.TestRuleIgnoreTestSuites;
@@ -121,9 +123,9 @@ public abstract class WithNestedTests {
try {
sysout = new ByteArrayOutputStream();
- System.setOut(new PrintStream(sysout, true, "UTF-8"));
+ System.setOut(new PrintStream(sysout, true, IOUtils.UTF_8));
syserr = new ByteArrayOutputStream();
- System.setErr(new PrintStream(syserr, true, "UTF-8"));
+ System.setErr(new PrintStream(syserr, true, IOUtils.UTF_8));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
@@ -146,20 +148,12 @@ public abstract class WithNestedTests {
protected String getSysOut() {
Assert.assertTrue(suppressOutputStreams);
System.out.flush();
- try {
- return new String(sysout.toByteArray(), "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
+ return new String(sysout.toByteArray(), StandardCharsets.UTF_8);
}
protected String getSysErr() {
Assert.assertTrue(suppressOutputStreams);
System.err.flush();
- try {
- return new String(syserr.toByteArray(), "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
+ return new String(syserr.toByteArray(), StandardCharsets.UTF_8);
}
}
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java Mon Mar 31 11:34:01 2014
@@ -38,6 +38,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.Date;
/** Index all text files under a directory.
@@ -191,7 +192,7 @@ public class IndexFiles {
// so that the text of the file is tokenized and indexed, but not stored.
// Note that FileReader expects the file to be in UTF-8 encoding.
// If that's not the case searching for special characters will fail.
- doc.add(new TextField("contents", new BufferedReader(new InputStreamReader(fis, "UTF-8"))));
+ doc.add(new TextField("contents", new BufferedReader(new InputStreamReader(fis, StandardCharsets.UTF_8))));
if (writer.getConfig().getOpenMode() == OpenMode.CREATE) {
// New index, so we just add the document (no old document can be there):
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java Mon Mar 31 11:34:01 2014
@@ -22,6 +22,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.Date;
import org.apache.lucene.analysis.Analyzer;
@@ -95,9 +96,9 @@ public class SearchFiles {
BufferedReader in = null;
if (queries != null) {
- in = new BufferedReader(new InputStreamReader(new FileInputStream(queries), "UTF-8"));
+ in = new BufferedReader(new InputStreamReader(new FileInputStream(queries), StandardCharsets.UTF_8));
} else {
- in = new BufferedReader(new InputStreamReader(System.in, "UTF-8"));
+ in = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
}
// :Post-Release-Update-Version.LUCENE_XY:
QueryParser parser = new QueryParser(Version.LUCENE_50, field, analyzer);
Modified: lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java (original)
+++ lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java Mon Mar 31 11:34:01 2014
@@ -21,9 +21,11 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.Enumeration;
import java.util.Properties;
import java.util.StringTokenizer;
+
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
@@ -49,7 +51,6 @@ import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.Version;
/**
@@ -136,7 +137,7 @@ public class FormBasedXmlQueryDemo exten
IndexWriterConfig iwConfig = new IndexWriterConfig(Version.LUCENE_CURRENT, analyzer);
IndexWriter writer = new IndexWriter(rd, iwConfig);
InputStream dataIn = getServletContext().getResourceAsStream("/WEB-INF/data.tsv");
- BufferedReader br = new BufferedReader(new InputStreamReader(dataIn, IOUtils.CHARSET_UTF_8));
+ BufferedReader br = new BufferedReader(new InputStreamReader(dataIn, StandardCharsets.UTF_8));
String line = br.readLine();
final FieldType textNoNorms = new FieldType(TextField.TYPE_STORED);
textNoNorms.setOmitNorms(true);
Modified: lucene/dev/trunk/lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptCompiler.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptCompiler.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptCompiler.java (original)
+++ lucene/dev/trunk/lucene/expressions/src/java/org/apache/lucene/expressions/js/JavascriptCompiler.java Mon Mar 31 11:34:01 2014
@@ -22,6 +22,7 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Collections;
@@ -503,7 +504,7 @@ public class JavascriptCompiler {
try {
final Properties props = new Properties();
try (Reader in = IOUtils.getDecodingReader(JavascriptCompiler.class,
- JavascriptCompiler.class.getSimpleName() + ".properties", IOUtils.CHARSET_UTF_8)) {
+ JavascriptCompiler.class.getSimpleName() + ".properties", StandardCharsets.UTF_8)) {
props.load(in);
}
for (final String call : props.stringPropertyNames()) {
Modified: lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetCounts.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetCounts.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetCounts.java (original)
+++ lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetCounts.java Mon Mar 31 11:34:01 2014
@@ -132,8 +132,8 @@ public class TestTaxonomyFacetCounts ext
// Smoke test PrintTaxonomyStats:
ByteArrayOutputStream bos = new ByteArrayOutputStream();
- PrintTaxonomyStats.printStats(taxoReader, new PrintStream(bos, false, "UTF-8"), true);
- String result = bos.toString("UTF-8");
+ PrintTaxonomyStats.printStats(taxoReader, new PrintStream(bos, false, IOUtils.UTF_8), true);
+ String result = bos.toString(IOUtils.UTF_8);
assertTrue(result.indexOf("/Author: 4 immediate children; 5 total categories") != -1);
assertTrue(result.indexOf("/Publish Date: 3 immediate children; 12 total categories") != -1);
// Make sure at least a few nodes of the tree came out:
Modified: lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/TestCharBlockArray.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/TestCharBlockArray.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/TestCharBlockArray.java (original)
+++ lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/TestCharBlockArray.java Mon Mar 31 11:34:01 2014
@@ -8,11 +8,11 @@ import java.io.FileOutputStream;
import java.nio.ByteBuffer;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
+import java.nio.charset.StandardCharsets;
import org.apache.lucene.facet.FacetTestCase;
-import org.apache.lucene.util.IOUtils;
-import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.TestUtil;
+
import org.junit.Test;
/*
@@ -47,7 +47,7 @@ public class TestCharBlockArray extends
int size = 1 + random().nextInt(50);
// This test is turning random bytes into a string,
// this is asking for trouble.
- CharsetDecoder decoder = IOUtils.CHARSET_UTF_8.newDecoder()
+ CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE);
String s = decoder.decode(ByteBuffer.wrap(buffer, 0, size)).toString();
@@ -60,7 +60,7 @@ public class TestCharBlockArray extends
int size = 1 + random().nextInt(50);
// This test is turning random bytes into a string,
// this is asking for trouble.
- CharsetDecoder decoder = IOUtils.CHARSET_UTF_8.newDecoder()
+ CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE);
String s = decoder.decode(ByteBuffer.wrap(buffer, 0, size)).toString();
@@ -73,7 +73,7 @@ public class TestCharBlockArray extends
int size = 1 + random().nextInt(50);
// This test is turning random bytes into a string,
// this is asking for trouble.
- CharsetDecoder decoder = IOUtils.CHARSET_UTF_8.newDecoder()
+ CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE);
String s = decoder.decode(ByteBuffer.wrap(buffer, 0, size)).toString();
Modified: lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/TestCompactLabelToOrdinal.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/TestCompactLabelToOrdinal.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/TestCompactLabelToOrdinal.java (original)
+++ lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/writercache/TestCompactLabelToOrdinal.java Mon Mar 31 11:34:01 2014
@@ -4,15 +4,15 @@ import java.io.File;
import java.nio.ByteBuffer;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.apache.lucene.facet.FacetTestCase;
import org.apache.lucene.facet.taxonomy.FacetLabel;
-import org.apache.lucene.util.IOUtils;
-import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.TestUtil;
+
import org.junit.Test;
/*
@@ -53,7 +53,7 @@ public class TestCompactLabelToOrdinal e
// This test is turning random bytes into a string,
// this is asking for trouble.
- CharsetDecoder decoder = IOUtils.CHARSET_UTF_8.newDecoder()
+ CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder()
.onUnmappableCharacter(CodingErrorAction.REPLACE)
.onMalformedInput(CodingErrorAction.REPLACE);
uniqueValues[i] = decoder.decode(ByteBuffer.wrap(buffer, 0, size)).toString();
Modified: lucene/dev/trunk/lucene/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java (original)
+++ lucene/dev/trunk/lucene/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java Mon Mar 31 11:34:01 2014
@@ -20,12 +20,14 @@ package org.apache.lucene.search.highlig
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.Reader;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -1512,7 +1514,7 @@ public class HighlighterTest extends Bas
// now an ugly built of XML parsing to test the snippet is encoded OK
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
- org.w3c.dom.Document doc = db.parse(new ByteArrayInputStream(xhtml.getBytes("UTF-8")));
+ org.w3c.dom.Document doc = db.parse(new ByteArrayInputStream(xhtml.getBytes(StandardCharsets.UTF_8)));
Element root = doc.getDocumentElement();
NodeList nodes = root.getElementsByTagName("body");
Element body = (Element) nodes.item(0);
Modified: lucene/dev/trunk/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighter.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighter.java (original)
+++ lucene/dev/trunk/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighter.java Mon Mar 31 11:34:01 2014
@@ -20,6 +20,7 @@ package org.apache.lucene.search.posting
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.text.BreakIterator;
import java.util.Arrays;
import java.util.Map;
@@ -489,7 +490,7 @@ public class TestPostingsHighlighter ext
public void testCambridgeMA() throws Exception {
BufferedReader r = new BufferedReader(new InputStreamReader(
- this.getClass().getResourceAsStream("CambridgeMA.utf8"), "UTF-8"));
+ this.getClass().getResourceAsStream("CambridgeMA.utf8"), StandardCharsets.UTF_8));
String text = r.readLine();
r.close();
Directory dir = newDirectory();
Modified: lucene/dev/trunk/lucene/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java (original)
+++ lucene/dev/trunk/lucene/memory/src/test/org/apache/lucene/index/memory/MemoryIndexTest.java Mon Mar 31 11:34:01 2014
@@ -21,6 +21,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.Set;
@@ -100,7 +101,7 @@ public class MemoryIndexTest extends Bas
private Set<String> readQueries(String resource) throws IOException {
Set<String> queries = new HashSet<>();
InputStream stream = getClass().getResourceAsStream(resource);
- BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
String line = null;
while ((line = reader.readLine()) != null) {
line = line.trim();
Modified: lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java (original)
+++ lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java Mon Mar 31 11:34:01 2014
@@ -45,6 +45,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.List;
@@ -63,7 +64,7 @@ public class TestParser extends LuceneTe
builder = new CorePlusExtensionsParser("contents", analyzer);
BufferedReader d = new BufferedReader(new InputStreamReader(
- TestParser.class.getResourceAsStream("reuters21578.txt"), "US-ASCII"));
+ TestParser.class.getResourceAsStream("reuters21578.txt"), StandardCharsets.US_ASCII));
dir = newDirectory();
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
String line = d.readLine();
Modified: lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeFilterBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeFilterBuilder.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeFilterBuilder.java (original)
+++ lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeFilterBuilder.java Mon Mar 31 11:34:01 2014
@@ -33,9 +33,11 @@ import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
public class TestNumericRangeFilterBuilder extends LuceneTestCase {
@@ -203,7 +205,7 @@ public class TestNumericRangeFilterBuild
private static Document getDocumentFromString(String str)
throws SAXException, IOException, ParserConfigurationException {
- InputStream is = new ByteArrayInputStream(str.getBytes("UTF-8"));
+ InputStream is = new ByteArrayInputStream(str.getBytes(StandardCharsets.UTF_8));
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Modified: lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeQueryBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeQueryBuilder.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeQueryBuilder.java (original)
+++ lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeQueryBuilder.java Mon Mar 31 11:34:01 2014
@@ -27,9 +27,11 @@ import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
public class TestNumericRangeQueryBuilder extends LuceneTestCase {
@@ -166,7 +168,7 @@ public class TestNumericRangeQueryBuilde
private static Document getDocumentFromString(String str)
throws SAXException, IOException, ParserConfigurationException {
- InputStream is = new ByteArrayInputStream(str.getBytes("UTF-8"));
+ InputStream is = new ByteArrayInputStream(str.getBytes(StandardCharsets.UTF_8));
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Modified: lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/TestSlowFuzzyQuery2.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/TestSlowFuzzyQuery2.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/TestSlowFuzzyQuery2.java (original)
+++ lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/TestSlowFuzzyQuery2.java Mon Mar 31 11:34:01 2014
@@ -20,6 +20,7 @@ package org.apache.lucene.sandbox.querie
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.MockTokenizer;
@@ -83,7 +84,7 @@ public class TestSlowFuzzyQuery2 extends
System.out.println("TEST: codePointTable=" + codePointTable);
}
InputStream stream = getClass().getResourceAsStream("fuzzyTestData.txt");
- BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
int bits = Integer.parseInt(reader.readLine());
int terms = (int) Math.pow(2, bits);
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java Mon Mar 31 11:34:01 2014
@@ -22,6 +22,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import java.nio.charset.StandardCharsets;
import org.apache.lucene.search.suggest.InputIterator;
import org.apache.lucene.util.BytesRef;
@@ -47,7 +48,7 @@ public class PlainTextDictionary impleme
* NOTE: content is treated as UTF-8
*/
public PlainTextDictionary(File file) throws IOException {
- in = new BufferedReader(IOUtils.getDecodingReader(file, IOUtils.CHARSET_UTF_8));
+ in = new BufferedReader(IOUtils.getDecodingReader(file, StandardCharsets.UTF_8));
}
/**
@@ -56,7 +57,7 @@ public class PlainTextDictionary impleme
* NOTE: content is treated as UTF-8
*/
public PlainTextDictionary(InputStream dictFile) {
- in = new BufferedReader(IOUtils.getDecodingReader(dictFile, IOUtils.CHARSET_UTF_8));
+ in = new BufferedReader(IOUtils.getDecodingReader(dictFile, StandardCharsets.UTF_8));
}
/**
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/FileDictionary.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/FileDictionary.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/FileDictionary.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/FileDictionary.java Mon Mar 31 11:34:01 2014
@@ -19,6 +19,7 @@ package org.apache.lucene.search.suggest
import java.io.*;
+import java.nio.charset.StandardCharsets;
import java.util.Set;
import org.apache.lucene.search.spell.Dictionary;
@@ -102,7 +103,7 @@ public class FileDictionary implements D
* NOTE: content is treated as UTF-8
*/
public FileDictionary(InputStream dictFile, String fieldDelimiter) {
- in = new BufferedReader(IOUtils.getDecodingReader(dictFile, IOUtils.CHARSET_UTF_8));
+ in = new BufferedReader(IOUtils.getDecodingReader(dictFile, StandardCharsets.UTF_8));
this.fieldDelimiter = fieldDelimiter;
}
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FuzzySuggester.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FuzzySuggester.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FuzzySuggester.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FuzzySuggester.java Mon Mar 31 11:34:01 2014
@@ -17,6 +17,7 @@ package org.apache.lucene.search.suggest
*/
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
@@ -192,7 +193,7 @@ public final class FuzzySuggester extend
Automaton levA = convertAutomaton(toLevenshteinAutomata(lookupAutomaton));
/*
- Writer w = new OutputStreamWriter(new FileOutputStream("out.dot"), "UTF-8");
+ Writer w = new OutputStreamWriter(new FileOutputStream("out.dot"), StandardCharsets.UTF_8);
w.write(levA.toDot());
w.close();
System.out.println("Wrote LevA to out.dot");
Modified: lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java Mon Mar 31 11:34:01 2014
@@ -33,7 +33,7 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Locale;
import java.util.Vector;
@@ -224,15 +224,13 @@ public class JaspellTernarySearchTrie {
BufferedReader in;
if (compression)
in = new BufferedReader(IOUtils.getDecodingReader(new GZIPInputStream(
- new FileInputStream(file)), IOUtils.CHARSET_UTF_8));
+ new FileInputStream(file)), StandardCharsets.UTF_8));
else in = new BufferedReader(IOUtils.getDecodingReader((new FileInputStream(
- file)), IOUtils.CHARSET_UTF_8));
+ file)), StandardCharsets.UTF_8));
String word;
int pos;
Float occur, one = new Float(1);
- int numWords = 0;
while ((word = in.readLine()) != null) {
- numWords++;
pos = word.indexOf("\t");
occur = one;
if (pos != -1) {
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/FileDictionaryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/FileDictionaryTest.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/FileDictionaryTest.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/FileDictionaryTest.java Mon Mar 31 11:34:01 2014
@@ -3,6 +3,7 @@ package org.apache.lucene.search.suggest
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.List;
@@ -74,7 +75,7 @@ public class FileDictionaryTest extends
@Test
public void testFileWithTerm() throws IOException {
Map.Entry<List<List<String>>,String> fileInput = generateFileInput(atLeast(100), FileDictionary.DEFAULT_FIELD_DELIMITER, false, false);
- InputStream inputReader = new ByteArrayInputStream(fileInput.getValue().getBytes("UTF-8"));
+ InputStream inputReader = new ByteArrayInputStream(fileInput.getValue().getBytes(StandardCharsets.UTF_8));
FileDictionary dictionary = new FileDictionary(inputReader);
List<List<String>> entries = fileInput.getKey();
InputIterator inputIter = dictionary.getEntryIterator();
@@ -96,7 +97,7 @@ public class FileDictionaryTest extends
@Test
public void testFileWithWeight() throws IOException {
Map.Entry<List<List<String>>,String> fileInput = generateFileInput(atLeast(100), FileDictionary.DEFAULT_FIELD_DELIMITER, true, false);
- InputStream inputReader = new ByteArrayInputStream(fileInput.getValue().getBytes("UTF-8"));
+ InputStream inputReader = new ByteArrayInputStream(fileInput.getValue().getBytes(StandardCharsets.UTF_8));
FileDictionary dictionary = new FileDictionary(inputReader);
List<List<String>> entries = fileInput.getKey();
InputIterator inputIter = dictionary.getEntryIterator();
@@ -118,7 +119,7 @@ public class FileDictionaryTest extends
@Test
public void testFileWithWeightAndPayload() throws IOException {
Map.Entry<List<List<String>>,String> fileInput = generateFileInput(atLeast(100), FileDictionary.DEFAULT_FIELD_DELIMITER, true, true);
- InputStream inputReader = new ByteArrayInputStream(fileInput.getValue().getBytes("UTF-8"));
+ InputStream inputReader = new ByteArrayInputStream(fileInput.getValue().getBytes(StandardCharsets.UTF_8));
FileDictionary dictionary = new FileDictionary(inputReader);
List<List<String>> entries = fileInput.getKey();
InputIterator inputIter = dictionary.getEntryIterator();
@@ -144,7 +145,7 @@ public class FileDictionaryTest extends
@Test
public void testFileWithOneEntry() throws IOException {
Map.Entry<List<List<String>>,String> fileInput = generateFileInput(1, FileDictionary.DEFAULT_FIELD_DELIMITER, true, true);
- InputStream inputReader = new ByteArrayInputStream(fileInput.getValue().getBytes("UTF-8"));
+ InputStream inputReader = new ByteArrayInputStream(fileInput.getValue().getBytes(StandardCharsets.UTF_8));
FileDictionary dictionary = new FileDictionary(inputReader);
List<List<String>> entries = fileInput.getKey();
InputIterator inputIter = dictionary.getEntryIterator();
@@ -171,7 +172,7 @@ public class FileDictionaryTest extends
@Test
public void testFileWithDifferentDelimiter() throws IOException {
Map.Entry<List<List<String>>,String> fileInput = generateFileInput(atLeast(100), " , ", true, true);
- InputStream inputReader = new ByteArrayInputStream(fileInput.getValue().getBytes("UTF-8"));
+ InputStream inputReader = new ByteArrayInputStream(fileInput.getValue().getBytes(StandardCharsets.UTF_8));
FileDictionary dictionary = new FileDictionary(inputReader, " , ");
List<List<String>> entries = fileInput.getKey();
InputIterator inputIter = dictionary.getEntryIterator();
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/LookupBenchmarkTest.java Mon Mar 31 11:34:01 2014
@@ -22,6 +22,7 @@ import java.io.InputStreamReader;
import java.lang.reflect.Constructor;
import java.net.URL;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -92,7 +93,7 @@ public class LookupBenchmarkTest extends
LookupBenchmarkTest.benchmarkInput = input;
}
- static final Charset UTF_8 = Charset.forName("UTF-8");
+ static final Charset UTF_8 = StandardCharsets.UTF_8;
/**
* Collect the multilingual input for benchmarks/ tests.
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java Mon Mar 31 11:34:01 2014
@@ -17,6 +17,7 @@ package org.apache.lucene.search.suggest
* limitations under the License.
*/
+import java.nio.charset.StandardCharsets;
import java.util.*;
import org.apache.lucene.search.suggest.Lookup.LookupResult;
@@ -144,7 +145,7 @@ public class FSTCompletionTest extends L
public void testThreeByte() throws Exception {
String key = new String(new byte[] {
- (byte) 0xF0, (byte) 0xA4, (byte) 0xAD, (byte) 0xA2}, "UTF-8");
+ (byte) 0xF0, (byte) 0xA4, (byte) 0xAD, (byte) 0xA2}, StandardCharsets.UTF_8);
FSTCompletionBuilder builder = new FSTCompletionBuilder();
builder.add(new BytesRef(key), 0);
Modified: lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/LargeInputFST.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/LargeInputFST.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/LargeInputFST.java (original)
+++ lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/LargeInputFST.java Mon Mar 31 11:34:01 2014
@@ -23,6 +23,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.OfflineSorter;
@@ -43,7 +44,7 @@ public class LargeInputFST {
BufferedReader reader = new BufferedReader(
new InputStreamReader(
- new FileInputStream(input), "UTF-8"));
+ new FileInputStream(input), StandardCharsets.UTF_8));
BytesRef scratch = new BytesRef();
String line;
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java Mon Mar 31 11:34:01 2014
@@ -25,6 +25,7 @@ import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
+import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.CountDownLatch;
@@ -892,7 +893,7 @@ public abstract class BaseTokenStreamTes
}
protected void toDotFile(Analyzer a, String inputText, String localFileName) throws IOException {
- Writer w = new OutputStreamWriter(new FileOutputStream(localFileName), "UTF-8");
+ Writer w = new OutputStreamWriter(new FileOutputStream(localFileName), StandardCharsets.UTF_8);
final TokenStream ts = a.tokenStream("field", inputText);
ts.reset();
new TokenStreamToDot(inputText, ts, new PrintWriter(w)).toDot();
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockPayloadAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockPayloadAnalyzer.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockPayloadAnalyzer.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockPayloadAnalyzer.java Mon Mar 31 11:34:01 2014
@@ -24,6 +24,7 @@ import org.apache.lucene.util.BytesRef;
import java.io.IOException;
import java.io.Reader;
+import java.nio.charset.StandardCharsets;
/**
@@ -68,7 +69,7 @@ final class MockPayloadFilter extends To
@Override
public boolean incrementToken() throws IOException {
if (input.incrementToken()) {
- payloadAttr.setPayload(new BytesRef(("pos: " + pos).getBytes("UTF-8")));
+ payloadAttr.setPayload(new BytesRef(("pos: " + pos).getBytes(StandardCharsets.UTF_8)));
int posIncr;
if (pos == 0 || i % 2 == 1) {
posIncr = 1;
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/VocabularyAssert.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/VocabularyAssert.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/VocabularyAssert.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/VocabularyAssert.java Mon Mar 31 11:34:01 2014
@@ -22,6 +22,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.zip.ZipFile;
import org.apache.lucene.analysis.Analyzer;
@@ -34,9 +35,9 @@ public class VocabularyAssert {
public static void assertVocabulary(Analyzer a, InputStream voc, InputStream out)
throws IOException {
BufferedReader vocReader = new BufferedReader(
- new InputStreamReader(voc, "UTF-8"));
+ new InputStreamReader(voc, StandardCharsets.UTF_8));
BufferedReader outputReader = new BufferedReader(
- new InputStreamReader(out, "UTF-8"));
+ new InputStreamReader(out, StandardCharsets.UTF_8));
String inputWord = null;
while ((inputWord = vocReader.readLine()) != null) {
String expectedWord = outputReader.readLine();
@@ -49,7 +50,7 @@ public class VocabularyAssert {
public static void assertVocabulary(Analyzer a, InputStream vocOut)
throws IOException {
BufferedReader vocReader = new BufferedReader(
- new InputStreamReader(vocOut, "UTF-8"));
+ new InputStreamReader(vocOut, StandardCharsets.UTF_8));
String inputLine = null;
while ((inputLine = vocReader.readLine()) != null) {
if (inputLine.startsWith("#") || inputLine.trim().length() == 0)
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java Mon Mar 31 11:34:01 2014
@@ -18,6 +18,7 @@ package org.apache.lucene.index;
*/
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -351,7 +352,7 @@ public abstract class BaseStoredFieldsFo
ft.freeze();
final String string = TestUtil.randomSimpleString(random(), 50);
- final byte[] bytes = string.getBytes("UTF-8");
+ final byte[] bytes = string.getBytes(StandardCharsets.UTF_8);
final long l = random().nextBoolean() ? random().nextInt(42) : random().nextLong();
final int i = random().nextBoolean() ? random().nextInt(42) : random().nextInt();
final float f = random().nextFloat();
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java Mon Mar 31 11:34:01 2014
@@ -29,6 +29,7 @@ import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
+import java.nio.charset.StandardCharsets;
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.GZIPInputStream;
@@ -133,7 +134,7 @@ public class LineFileDocs implements Clo
} while (b >= 0 && b != 13 && b != 10);
}
- CharsetDecoder decoder = IOUtils.CHARSET_UTF_8.newDecoder()
+ CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder()
.onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
reader = new BufferedReader(new InputStreamReader(is, decoder), BUFFER_SIZE);
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java Mon Mar 31 11:34:01 2014
@@ -217,15 +217,15 @@ public final class TestUtil {
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
CheckIndex checker = new CheckIndex(dir);
checker.setCrossCheckTermVectors(crossCheckTermVectors);
- checker.setInfoStream(new PrintStream(bos, false, "UTF-8"), false);
+ checker.setInfoStream(new PrintStream(bos, false, IOUtils.UTF_8), false);
CheckIndex.Status indexStatus = checker.checkIndex(null);
if (indexStatus == null || indexStatus.clean == false) {
System.out.println("CheckIndex failed");
- System.out.println(bos.toString("UTF-8"));
+ System.out.println(bos.toString(IOUtils.UTF_8));
throw new RuntimeException("CheckIndex failed");
} else {
if (LuceneTestCase.INFOSTREAM) {
- System.out.println(bos.toString("UTF-8"));
+ System.out.println(bos.toString(IOUtils.UTF_8));
}
return indexStatus;
}
@@ -241,7 +241,7 @@ public final class TestUtil {
public static void checkReader(AtomicReader reader, boolean crossCheckTermVectors) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
- PrintStream infoStream = new PrintStream(bos, false, "UTF-8");
+ PrintStream infoStream = new PrintStream(bos, false, IOUtils.UTF_8);
FieldNormStatus fieldNormStatus = CheckIndex.testFieldNorms(reader, infoStream);
TermIndexStatus termIndexStatus = CheckIndex.testPostings(reader, infoStream);
@@ -255,11 +255,11 @@ public final class TestUtil {
termVectorStatus.error != null ||
docValuesStatus.error != null) {
System.out.println("CheckReader failed");
- System.out.println(bos.toString("UTF-8"));
+ System.out.println(bos.toString(IOUtils.UTF_8));
throw new RuntimeException("CheckReader failed");
} else {
if (LuceneTestCase.INFOSTREAM) {
- System.out.println(bos.toString("UTF-8"));
+ System.out.println(bos.toString(IOUtils.UTF_8));
}
}
}
Modified: lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java (original)
+++ lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java Mon Mar 31 11:34:01 2014
@@ -41,6 +41,7 @@ import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -58,6 +59,7 @@ import java.util.TreeMap;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -200,7 +202,7 @@ public class GetMavenDependenciesTask ex
Writer writer = null;
try {
FileOutputStream outputStream = new FileOutputStream(mavenDependenciesFiltersFile);
- writer = new OutputStreamWriter(outputStream, "ISO-8859-1");
+ writer = new OutputStreamWriter(outputStream, StandardCharsets.ISO_8859_1);
allProperties.store(writer, null);
} catch (FileNotFoundException e) {
throw new BuildException("Can't find file: '" + mavenDependenciesFiltersFile.getPath() + "'", e);
@@ -808,7 +810,7 @@ public class GetMavenDependenciesTask ex
throw new BuildException("Properties file does not exist: " + file.getPath());
}
// Properties files are encoded as Latin-1
- final Reader reader = new InputStreamReader(stream, Charset.forName("ISO-8859-1"));
+ final Reader reader = new InputStreamReader(stream, StandardCharsets.ISO_8859_1);
final Properties properties = new Properties();
try {
properties.load(reader);
Modified: lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/validation/LibVersionsCheckTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/validation/LibVersionsCheckTask.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/validation/LibVersionsCheckTask.java (original)
+++ lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/validation/LibVersionsCheckTask.java Mon Mar 31 11:34:01 2014
@@ -33,6 +33,7 @@ import org.xml.sax.helpers.DefaultHandle
import org.xml.sax.helpers.XMLReaderFactory;
import javax.xml.parsers.ParserConfigurationException;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@@ -44,6 +45,7 @@ import java.io.Reader;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
+import java.nio.charset.StandardCharsets;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Locale;
@@ -188,7 +190,7 @@ public class LibVersionsCheckTask extend
+ centralizedVersionsFile.getPath());
}
// Properties files are encoded as Latin-1
- final Reader reader = new InputStreamReader(stream, Charset.forName("ISO-8859-1"));
+ final Reader reader = new InputStreamReader(stream, StandardCharsets.ISO_8859_1);
final BufferedReader bufferedReader = new BufferedReader(reader);
String line = null;
Modified: lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/validation/LicenseCheckTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/validation/LicenseCheckTask.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/validation/LicenseCheckTask.java (original)
+++ lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/validation/LicenseCheckTask.java Mon Mar 31 11:34:01 2014
@@ -22,14 +22,13 @@ import java.io.FileInputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
-
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -302,7 +301,7 @@ outer:
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader
- (new FileInputStream(f), "UTF-8"));
+ (new FileInputStream(f), StandardCharsets.UTF_8));
try {
String checksum = reader.readLine();
if (null == checksum || 0 == checksum.length()) {
Modified: lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SimplePropertiesWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SimplePropertiesWriter.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SimplePropertiesWriter.java (original)
+++ lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/SimplePropertiesWriter.java Mon Mar 31 11:34:01 2014
@@ -26,6 +26,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -192,7 +193,7 @@ public class SimplePropertiesWriter exte
filePath += File.separator;
}
filePath += filename;
- propOutput = new OutputStreamWriter(new FileOutputStream(filePath), IOUtils.CHARSET_UTF_8);
+ propOutput = new OutputStreamWriter(new FileOutputStream(filePath), StandardCharsets.UTF_8);
existingProps.store(propOutput, null);
log.info("Wrote last indexed time to " + filename);
} catch (Exception e) {
@@ -214,7 +215,7 @@ public class SimplePropertiesWriter exte
}
filePath += filename;
propInput = new FileInputStream(filePath);
- props.load(new InputStreamReader(propInput, IOUtils.CHARSET_UTF_8));
+ props.load(new InputStreamReader(propInput, StandardCharsets.UTF_8));
log.info("Read " + filename);
} catch (Exception e) {
log.warn("Unable to read: " + filename);
Modified: lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ZKPropertiesWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ZKPropertiesWriter.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ZKPropertiesWriter.java (original)
+++ lucene/dev/trunk/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ZKPropertiesWriter.java Mon Mar 31 11:34:01 2014
@@ -18,10 +18,10 @@ package org.apache.solr.handler.dataimpo
import java.io.StringReader;
import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Properties;
-import org.apache.lucene.util.IOUtils;
import org.apache.solr.common.cloud.SolrZkClient;
import org.apache.zookeeper.KeeperException.NodeExistsException;
import org.slf4j.Logger;
@@ -67,7 +67,7 @@ public class ZKPropertiesWriter extends
StringWriter output = new StringWriter();
try {
existing.store(output, null);
- byte[] bytes = output.toString().getBytes(IOUtils.CHARSET_UTF_8);
+ byte[] bytes = output.toString().getBytes(StandardCharsets.UTF_8);
if (!zkClient.exists(path, false)) {
try {
zkClient.makePath(path, false);
Modified: lucene/dev/trunk/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/RegexRulesPasswordProvider.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/RegexRulesPasswordProvider.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/RegexRulesPasswordProvider.java (original)
+++ lucene/dev/trunk/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/RegexRulesPasswordProvider.java Mon Mar 31 11:34:01 2014
@@ -20,6 +20,7 @@ package org.apache.solr.handler.extracti
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import java.util.regex.Pattern;
@@ -73,7 +74,7 @@ public class RegexRulesPasswordProvider
*/
public static LinkedHashMap<Pattern,String> parseRulesFile(InputStream is) {
LinkedHashMap<Pattern,String> rules = new LinkedHashMap<>();
- BufferedReader br = new BufferedReader(IOUtils.getDecodingReader(is, IOUtils.CHARSET_UTF_8));
+ BufferedReader br = new BufferedReader(IOUtils.getDecodingReader(is, StandardCharsets.UTF_8));
String line;
try {
int linenum = 0;
Modified: lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java (original)
+++ lucene/dev/trunk/solr/contrib/velocity/src/java/org/apache/solr/response/VelocityResponseWriter.java Mon Mar 31 11:34:01 2014
@@ -17,21 +17,29 @@
package org.apache.solr.response;
-import org.apache.lucene.util.IOUtils;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.nio.charset.StandardCharsets;
+import java.util.Properties;
+
import org.apache.solr.client.solrj.SolrResponse;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.client.solrj.response.SolrResponseBase;
-import org.apache.solr.common.SolrException;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.tools.generic.*;
-
-import java.io.*;
-import java.util.Properties;
+import org.apache.velocity.tools.generic.ComparisonDateTool;
+import org.apache.velocity.tools.generic.EscapeTool;
+import org.apache.velocity.tools.generic.ListTool;
+import org.apache.velocity.tools.generic.MathTool;
+import org.apache.velocity.tools.generic.NumberTool;
+import org.apache.velocity.tools.generic.SortTool;
public class VelocityResponseWriter implements QueryResponseWriter {
@@ -132,7 +140,7 @@ public class VelocityResponseWriter impl
try {
is = resourceLoader.getResourceStream(propFile);
Properties props = new Properties();
- props.load(new InputStreamReader(is, IOUtils.CHARSET_UTF_8));
+ props.load(new InputStreamReader(is, StandardCharsets.UTF_8));
engine.init(props);
}
finally {
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/SolrZkServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/SolrZkServer.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/SolrZkServer.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/SolrZkServer.java Mon Mar 31 11:34:01 2014
@@ -25,11 +25,11 @@ import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
+import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Properties;
import java.util.Map.Entry;
-import org.apache.lucene.util.IOUtils;
import org.apache.solr.common.SolrException;
import org.apache.zookeeper.server.ServerConfig;
import org.apache.zookeeper.server.ZooKeeperServerMain;
@@ -179,7 +179,7 @@ class SolrZkServerProps extends QuorumPe
Properties cfg = new Properties();
FileInputStream in = new FileInputStream(configFile);
try {
- cfg.load(new InputStreamReader(in, IOUtils.CHARSET_UTF_8));
+ cfg.load(new InputStreamReader(in, StandardCharsets.UTF_8));
} finally {
in.close();
}
@@ -461,7 +461,7 @@ class SolrZkServerProps extends QuorumPe
+ " file is missing");
}
- BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(myIdFile), IOUtils.CHARSET_UTF_8));
+ BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(myIdFile), StandardCharsets.UTF_8));
String myIdString;
try {
myIdString = br.readLine();
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkCLI.java Mon Mar 31 11:34:01 2014
@@ -20,10 +20,12 @@ import org.apache.zookeeper.data.ACL;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.concurrent.TimeoutException;
@@ -253,7 +255,7 @@ public class ZkCLI {
System.out.println("-" + PUT + " requires two args - the path to create and the data string");
System.exit(1);
}
- zkClient.create(arglist.get(0).toString(), arglist.get(1).toString().getBytes("UTF-8"),
+ zkClient.create(arglist.get(0).toString(), arglist.get(1).toString().getBytes(StandardCharsets.UTF_8),
acl, CreateMode.PERSISTENT, true);
} else if (line.getOptionValue(CMD).equals(PUT_FILE)) {
List arglist = line.getArgList();
@@ -276,7 +278,7 @@ public class ZkCLI {
System.exit(1);
}
byte [] data = zkClient.getData(arglist.get(0).toString(), null, null, true);
- System.out.println(new String(data, "UTF-8"));
+ System.out.println(new String(data, StandardCharsets.UTF_8));
} else if (line.getOptionValue(CMD).equals(GET_FILE)) {
List arglist = line.getArgList();
if (arglist.size() != 2) {
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java Mon Mar 31 11:34:01 2014
@@ -31,6 +31,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.Locale;
import java.util.Properties;
@@ -213,7 +214,7 @@ public class CoreDescriptor {
try {
in = new FileInputStream(propertiesFile);
Properties externalProps = new Properties();
- externalProps.load(new InputStreamReader(in, "UTF-8"));
+ externalProps.load(new InputStreamReader(in, StandardCharsets.UTF_8));
coreProperties.putAll(externalProps);
} catch (IOException e) {
String message = String.format(Locale.ROOT, "Could not load properties from %s: %s:",
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrCore.java Mon Mar 31 11:34:01 2014
@@ -99,6 +99,7 @@ import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
+
import java.io.Closeable;
import java.io.File;
import java.io.FileNotFoundException;
@@ -108,6 +109,7 @@ import java.io.InputStreamReader;
import java.io.Writer;
import java.lang.reflect.Constructor;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.nio.file.NoSuchFileException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -274,7 +276,7 @@ public final class SolrCore implements S
if (input != null) {
final InputStream is = new PropertiesInputStream(input);
try {
- p.load(new InputStreamReader(is, "UTF-8"));
+ p.load(new InputStreamReader(is, StandardCharsets.UTF_8));
String s = p.getProperty("index");
if (s != null && s.trim().length() > 0) {
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java Mon Mar 31 11:34:01 2014
@@ -48,6 +48,7 @@ import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.naming.NoInitialContextException;
+
import java.io.Closeable;
import java.io.File;
import java.io.FileFilter;
@@ -61,6 +62,7 @@ import java.net.URL;
import java.net.URLClassLoader;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -93,7 +95,7 @@ public class SolrResourceLoader implemen
private final List<SolrCoreAware> waitingForCore = Collections.synchronizedList(new ArrayList<SolrCoreAware>());
private final List<SolrInfoMBean> infoMBeans = Collections.synchronizedList(new ArrayList<SolrInfoMBean>());
private final List<ResourceLoaderAware> waitingForResources = Collections.synchronizedList(new ArrayList<ResourceLoaderAware>());
- private static final Charset UTF_8 = Charset.forName("UTF-8");
+ private static final Charset UTF_8 = StandardCharsets.UTF_8;
//TODO: Solr5. Remove this completely when you obsolete putting <core> tags in solr.xml (See Solr-4196)
private final Properties coreProperties;
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrXMLSerializer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrXMLSerializer.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrXMLSerializer.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/SolrXMLSerializer.java Mon Mar 31 11:34:01 2014
@@ -28,6 +28,7 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
@@ -37,6 +38,7 @@ import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.nio.channels.FileChannel;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -169,7 +171,7 @@ public class SolrXMLSerializer {
tmpFile = File.createTempFile("solr", ".xml", file.getParentFile());
java.io.FileOutputStream out = new java.io.FileOutputStream(tmpFile);
- Writer writer = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"));
+ Writer writer = new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8));
try {
persist(writer, solrXMLDef);
} finally {
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java?rev=1583302&r1=1583301&r2=1583302&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java Mon Mar 31 11:34:01 2014
@@ -26,6 +26,7 @@ import java.io.OutputStream;
import java.io.Writer;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
+import java.nio.charset.StandardCharsets;
import java.nio.file.NoSuchFileException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -81,8 +82,6 @@ import org.apache.solr.util.plugin.SolrC
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.apache.lucene.util.IOUtils.CHARSET_UTF_8;
-
/**
* <p> A Handler which provides a REST API for replication and serves replication requests from Slaves. <p/> </p>
* <p>When running on the master, it provides the following commands <ol> <li>Get the current replicable index version
@@ -823,7 +822,7 @@ public class ReplicationHandler extends
try {
final InputStream is = new PropertiesInputStream(input);
Properties props = new Properties();
- props.load(new InputStreamReader(is, CHARSET_UTF_8));
+ props.load(new InputStreamReader(is, StandardCharsets.UTF_8));
return props;
} finally {
input.close();