You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by tf...@apache.org on 2021/03/05 23:29:34 UTC

[lucene-solr] 02/02: SOLR-15154: Minor test fix for Java 8

This is an automated email from the ASF dual-hosted git repository.

tflobbe pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit fa4ee1ea74f8a9a5cb3ef7d8f2e51246496fd1b2
Author: Tomas Fernandez Lobbe <tf...@apache.org>
AuthorDate: Fri Mar 5 15:15:23 2021 -0800

    SOLR-15154: Minor test fix for Java 8
---
 .../solrj/impl/PreemptiveBasicAuthClientBuilderFactoryTest.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientBuilderFactoryTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientBuilderFactoryTest.java
index 2da0def..ba3df09 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientBuilderFactoryTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/PreemptiveBasicAuthClientBuilderFactoryTest.java
@@ -17,14 +17,15 @@
 
 package org.apache.solr.client.solrj.impl;
 
-import org.apache.solr.SolrTestCase;
-
+import java.io.BufferedWriter;
 import java.io.File;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
 import java.util.Properties;
 
+import org.apache.solr.SolrTestCase;
+
 public class PreemptiveBasicAuthClientBuilderFactoryTest extends SolrTestCase {
 
     private void assertIllegalArgumentException(ThrowingRunnable executable, String expectedMessage) {
@@ -67,7 +68,7 @@ public class PreemptiveBasicAuthClientBuilderFactoryTest extends SolrTestCase {
         p.setProperty("httpBasicAuthUser", "foo");
         p.setProperty("httpBasicAuthPassword", "bar");
         File f = createTempFile().toFile();
-        try (FileWriter fw = new FileWriter(f, StandardCharsets.UTF_8)) {
+        try (BufferedWriter fw = Files.newBufferedWriter(f.toPath(), StandardCharsets.UTF_8)) {
             p.store(fw, "tmp properties file for PreemptiveBasicAuthClientBuilderFactoryTest.testCredentialsFromConfigFile");
         }
         System.setProperty(PreemptiveBasicAuthClientBuilderFactory.SYS_PROP_HTTP_CLIENT_CONFIG, f.getAbsolutePath());