diff options
author | Sergio Giro <sgiro@google.com> | 2016-04-18 13:11:29 +0100 |
---|---|---|
committer | Sergio Giro <sgiro@google.com> | 2016-04-18 13:25:32 +0100 |
commit | cf7021d93b868e5f72781d0f49b56447fc226639 (patch) | |
tree | cab2ce408b2fd18218ddc90bcb4e0009a6f0c5c2 | |
parent | 42e7f905614a16dff5dff2bc6408f705a7660202 (diff) | |
download | bouncycastle-cf7021d93b868e5f72781d0f49b56447fc226639.tar.gz |
Revert "Strings: hardcode "\n" as the line separator"
This reverts commit 7ddf37c01b68ff9d2de3a9dcb637d2b962b442ef.
Not needed anymore because of:
d4fa9f4ddc1c1f193b623c8da80384b4c510a1b4
Bug: 27265238
Bug: 28108158
Bug: 28174137
Change-Id: Icce1fd747459f07fbe5a4991897083315f78153d
-rw-r--r-- | bcprov/src/main/java/org/bouncycastle/util/Strings.java | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/util/Strings.java b/bcprov/src/main/java/org/bouncycastle/util/Strings.java index a9bbc9fc..a42830b3 100644 --- a/bcprov/src/main/java/org/bouncycastle/util/Strings.java +++ b/bcprov/src/main/java/org/bouncycastle/util/Strings.java @@ -13,42 +13,35 @@ import java.util.Vector; */ public final class Strings { - // BEGIN android-changed - // Was: private static String LINE_SEPARATOR; - // It was using the static block below to initialize, calling System.getProperty, which caused - // BouncyCastleProvider not to be compile-time initializable, thus causing performance problems - // (see b/28108158 ). Anyway, this is already hardcoded in System.java - private static String LINE_SEPARATOR = "\n"; - // END android-changed - // BEGIN android-removed - // static - // { - // try - // { - // LINE_SEPARATOR = AccessController.doPrivileged(new PrivilegedAction<String>() - // { - // public String run() - // { - // // the easy way - // return System.getProperty("line.separator"); - // } - // }); - - // } - // catch (Exception e) - // { - // try - // { - // // the harder way - // LINE_SEPARATOR = String.format("%n"); - // } - // catch (Exception ef) - // { - // LINE_SEPARATOR = "\n"; // we're desperate use this... - // } - // } - // } - // END android-removed + private static String LINE_SEPARATOR; + + static + { + try + { + LINE_SEPARATOR = AccessController.doPrivileged(new PrivilegedAction<String>() + { + public String run() + { + // the easy way + return System.getProperty("line.separator"); + } + }); + + } + catch (Exception e) + { + try + { + // the harder way + LINE_SEPARATOR = String.format("%n"); + } + catch (Exception ef) + { + LINE_SEPARATOR = "\n"; // we're desperate use this... + } + } + } public static String fromUTF8ByteArray(byte[] bytes) { |