r1808930 forbidden-api checks and imports

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

r1808930 forbidden-api checks and imports

Allison, Timothy B.
Dominik,
Thank you for fixing my new PrintStreams so that the forbidden-api checks would pass...head in hands.  I noticed that imports were shortened to wildcards.  Should I flip back to listing all?
Thank you, again!

      Best,

                  Tim

-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
+import java.io.*;
 import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -39,14 +33,14 @@
     private static PrintStream SYSTEM_OUT;
     @BeforeClass
-    public static void setUp() {
+    public static void setUp() throws UnsupportedEncodingException {
         SYSTEM_OUT = System.out;
         System.setOut(new PrintStream(new OutputStream() {
             @Override
             public void write(int b) throws IOException {
             }
-        }));
+        }, false, "UTF-8"));

Reply | Threaded
Open this post in threaded view
|

Re: r1808930 forbidden-api checks and imports

Dominik Stadler
Argh,

the import-statement handling is a great sucker in Java in my opinion as
every IDE has a different setting of how they are combined and so every
change flips these back and forth. I need to adjust the settings every time
I create a new project somewhere.

I will disabled the automatic collapsing on my current setup for POI,
hopefully it will stay in place for some time so I do not collapse these
more.

Dominik.

On Thu, Sep 21, 2017 at 5:41 PM, Allison, Timothy B. <[hidden email]>
wrote:

> Dominik,
> Thank you for fixing my new PrintStreams so that the forbidden-api checks
> would pass...head in hands.  I noticed that imports were shortened to
> wildcards.  Should I flip back to listing all?
> Thank you, again!
>
>       Best,
>
>                   Tim
>
> -import java.io.ByteArrayInputStream;
> -import java.io.ByteArrayOutputStream;
> -import java.io.File;
> -import java.io.FileOutputStream;
> -import java.io.IOException;
> -import java.io.OutputStream;
> -import java.io.PrintStream;
> +import java.io.*;
>  import org.junit.AfterClass;
> import org.junit.BeforeClass;
> @@ -39,14 +33,14 @@
>      private static PrintStream SYSTEM_OUT;
>      @BeforeClass
> -    public static void setUp() {
> +    public static void setUp() throws UnsupportedEncodingException {
>          SYSTEM_OUT = System.out;
>          System.setOut(new PrintStream(new OutputStream() {
>              @Override
>              public void write(int b) throws IOException {
>              }
> -        }));
> +        }, false, "UTF-8"));
>
>