diff options
author | Sergio Giro <sgiro@google.com> | 2016-04-12 13:30:34 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-04-12 13:30:34 +0000 |
commit | 2555bf678c9a758eb77b392e0bebdb97eadca7b8 (patch) | |
tree | d631120c8803d7cd9eee5067337d6f04ee1b93e2 | |
parent | 114ee8f9e2b2cb261c301838ea0689c499abd2cf (diff) | |
parent | 085aa6b569c01c382ae1af8fe424e9bd1eb13429 (diff) | |
download | bouncycastle-2555bf678c9a758eb77b392e0bebdb97eadca7b8.tar.gz |
Merge "Strings: hardcode "\n" as the line separator"
-rw-r--r-- | bcprov/src/main/java/org/bouncycastle/util/Strings.java | 65 |
1 files changed, 36 insertions, 29 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/util/Strings.java b/bcprov/src/main/java/org/bouncycastle/util/Strings.java index a42830b3..a9bbc9fc 100644 --- a/bcprov/src/main/java/org/bouncycastle/util/Strings.java +++ b/bcprov/src/main/java/org/bouncycastle/util/Strings.java @@ -13,35 +13,42 @@ import java.util.Vector; */ public final class Strings { - 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... - } - } - } + // 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 public static String fromUTF8ByteArray(byte[] bytes) { |