@Test public void stripLeadingAndTrailingQuotes() throws Exception { assertEquals("", CommonUtils.stripLeadingAndTrailingQuotes("")); assertEquals("\"", CommonUtils.stripLeadingAndTrailingQuotes("\"")); assertEquals("", CommonUtils.stripLeadingAndTrailingQuotes("\"\"")); assertEquals("\"", CommonUtils.stripLeadingAndTrailingQuotes("\"\"\"")); assertEquals("\"\"", CommonUtils.stripLeadingAndTrailingQuotes("\"\"\"\"")); assertEquals("noquote", CommonUtils.stripLeadingAndTrailingQuotes("noquote")); assertEquals( "\"singlequote", CommonUtils.stripLeadingAndTrailingQuotes("\"singlequote")); assertEquals( "singlequote\"", CommonUtils.stripLeadingAndTrailingQuotes("singlequote\"")); assertEquals("quoted", CommonUtils.stripLeadingAndTrailingQuotes("\"quoted\"")); assertEquals("\"quoted\"", CommonUtils.stripLeadingAndTrailingQuotes("\"\"quoted\"\"")); }
public static String stripLeadingAndTrailingQuotes(String str) { int length = str.length(); if (length > 1 && str.startsWith("\"") && str.endsWith("\"")) { str = str.substring(1, length - 1); } return str; }
CommonUtils { public static String stripLeadingAndTrailingQuotes(String str) { int length = str.length(); if (length > 1 && str.startsWith("\"") && str.endsWith("\"")) { str = str.substring(1, length - 1); } return str; } }
CommonUtils { public static String stripLeadingAndTrailingQuotes(String str) { int length = str.length(); if (length > 1 && str.startsWith("\"") && str.endsWith("\"")) { str = str.substring(1, length - 1); } return str; } private  CommonUtils(); }
CommonUtils { public static String stripLeadingAndTrailingQuotes(String str) { int length = str.length(); if (length > 1 && str.startsWith("\"") && str.endsWith("\"")) { str = str.substring(1, length - 1); } return str; } private  CommonUtils(); static Thread createProgressThread(PrintStream stream); static Thread createProgressThread(final long intervalMs, final PrintStream stream); static long getCurrentMs(); static int getJavaVersion(); static String getTmpDir(List<String> tmpDirs); static String getWorkerDataDirectory(String storageDir, AlluxioConfiguration conf); static String listToString(List<T> list); static String argsToString(String separator, T... args); static String[] toStringArray(ArrayList<String> src); static String randomAlphaNumString(int length); static byte[] randomBytes(int length); static void sleepMs(long timeMs); static void sleepMs(Logger logger, long timeMs); static void warmUpLoop(); static T createNewClassInstance(Class<T> cls, Class<?>[] ctorClassArgs,
      Object[] ctorArgs); static List<String> getUnixGroups(String user); static void waitFor(String description, Supplier<Boolean> condition); static void waitFor(String description, Supplier<Boolean> condition,
      WaitForOptions options); static T waitForResult(String description, Supplier<T> objectSupplier,
                                    Function<T, Boolean> condition); static T waitForResult(String description, Supplier<T> objectSupplier,
                                    Function<T, Boolean> condition, WaitForOptions options); static String getPrimaryGroupName(String userName, AlluxioConfiguration conf); static List<String> getGroups(String userName, AlluxioConfiguration conf); static String stripSuffixIfPresent(final String key, final String suffix); static String stripPrefixIfPresent(final String key, final String prefix); static String stripLeadingAndTrailingQuotes(String str); @Nullable static String getValueFromStaticMapping(String mapping, String key); static Throwable getRootCause(Throwable e); static IOException castToIOException(Throwable e); static Iterator<T> singleElementIterator(final T element); static void invokeAll(List<Callable<T>> callables, long timeoutMs); static void invokeAll(ExecutorService service, List<Callable<T>> callables,
      long timeoutMs); static RuntimeException closeAndRethrow(Closer closer, Throwable t); static RuntimeException closeAndRethrowRuntimeException(Closer closer, Throwable t); static void unwrapResponse(Protocol.Response response); static void unwrapResponseFrom(Protocol.Response response, Channel channel); static boolean isLocalHost(WorkerNetAddress address, AlluxioConfiguration conf); static String convertMsToDate(long millis, String dateFormatPattern); static String convertMsToClockTime(long millis); static Map<String, ByteString> convertToByteString(Map<String, byte[]> input); static Map<String, byte[]> convertFromByteString(Map<String, ByteString> input); static Supplier<T> memoize(Supplier<T> original); static List<List<T>> partition(List<T> list, int numLists); static boolean isAddressReachable(String hostname, int port); static List<File> recursiveListLocalDir(File dir); static int parseMajorVersion(String version); }
CommonUtils { public static String stripLeadingAndTrailingQuotes(String str) { int length = str.length(); if (length > 1 && str.startsWith("\"") && str.endsWith("\"")) { str = str.substring(1, length - 1); } return str; } private  CommonUtils(); static Thread createProgressThread(PrintStream stream); static Thread createProgressThread(final long intervalMs, final PrintStream stream); static long getCurrentMs(); static int getJavaVersion(); static String getTmpDir(List<String> tmpDirs); static String getWorkerDataDirectory(String storageDir, AlluxioConfiguration conf); static String listToString(List<T> list); static String argsToString(String separator, T... args); static String[] toStringArray(ArrayList<String> src); static String randomAlphaNumString(int length); static byte[] randomBytes(int length); static void sleepMs(long timeMs); static void sleepMs(Logger logger, long timeMs); static void warmUpLoop(); static T createNewClassInstance(Class<T> cls, Class<?>[] ctorClassArgs,
      Object[] ctorArgs); static List<String> getUnixGroups(String user); static void waitFor(String description, Supplier<Boolean> condition); static void waitFor(String description, Supplier<Boolean> condition,
      WaitForOptions options); static T waitForResult(String description, Supplier<T> objectSupplier,
                                    Function<T, Boolean> condition); static T waitForResult(String description, Supplier<T> objectSupplier,
                                    Function<T, Boolean> condition, WaitForOptions options); static String getPrimaryGroupName(String userName, AlluxioConfiguration conf); static List<String> getGroups(String userName, AlluxioConfiguration conf); static String stripSuffixIfPresent(final String key, final String suffix); static String stripPrefixIfPresent(final String key, final String prefix); static String stripLeadingAndTrailingQuotes(String str); @Nullable static String getValueFromStaticMapping(String mapping, String key); static Throwable getRootCause(Throwable e); static IOException castToIOException(Throwable e); static Iterator<T> singleElementIterator(final T element); static void invokeAll(List<Callable<T>> callables, long timeoutMs); static void invokeAll(ExecutorService service, List<Callable<T>> callables,
      long timeoutMs); static RuntimeException closeAndRethrow(Closer closer, Throwable t); static RuntimeException closeAndRethrowRuntimeException(Closer closer, Throwable t); static void unwrapResponse(Protocol.Response response); static void unwrapResponseFrom(Protocol.Response response, Channel channel); static boolean isLocalHost(WorkerNetAddress address, AlluxioConfiguration conf); static String convertMsToDate(long millis, String dateFormatPattern); static String convertMsToClockTime(long millis); static Map<String, ByteString> convertToByteString(Map<String, byte[]> input); static Map<String, byte[]> convertFromByteString(Map<String, ByteString> input); static Supplier<T> memoize(Supplier<T> original); static List<List<T>> partition(List<T> list, int numLists); static boolean isAddressReachable(String hostname, int port); static List<File> recursiveListLocalDir(File dir); static int parseMajorVersion(String version); static final AtomicReference<ProcessType> PROCESS_TYPE; }