@Test public void testExtractQueryParameters_Empty() throws Exception { final Properties properties = ModelUtils.extractQueryPropertiesFromURI(new URI("file: assertTrue(properties.isEmpty()); }
@Nonnull public static Properties extractQueryPropertiesFromURI(@Nonnull final URI uri) { final Properties result = new Properties(); final String rawQuery = uri.getRawQuery(); if (rawQuery != null) { final Matcher matcher = URI_QUERY_PARAMETERS.matcher(rawQuery); try { while (matcher.find()) { final String key = URLDecoder.decode(matcher.group(1), "UTF-8"); final String value = URLDecoder.decode(matcher.group(2), "UTF-8"); result.put(key, value); } } catch (UnsupportedEncodingException ex) { LOGGER.error("Can't decode URI query", ex); throw new Error("Unexpected exception, can't find UTF-8 charset!"); } } return result; }
ModelUtils { @Nonnull public static Properties extractQueryPropertiesFromURI(@Nonnull final URI uri) { final Properties result = new Properties(); final String rawQuery = uri.getRawQuery(); if (rawQuery != null) { final Matcher matcher = URI_QUERY_PARAMETERS.matcher(rawQuery); try { while (matcher.find()) { final String key = URLDecoder.decode(matcher.group(1), "UTF-8"); final String value = URLDecoder.decode(matcher.group(2), "UTF-8"); result.put(key, value); } } catch (UnsupportedEncodingException ex) { LOGGER.error("Can't decode URI query", ex); throw new Error("Unexpected exception, can't find UTF-8 charset!"); } } return result; } }
ModelUtils { @Nonnull public static Properties extractQueryPropertiesFromURI(@Nonnull final URI uri) { final Properties result = new Properties(); final String rawQuery = uri.getRawQuery(); if (rawQuery != null) { final Matcher matcher = URI_QUERY_PARAMETERS.matcher(rawQuery); try { while (matcher.find()) { final String key = URLDecoder.decode(matcher.group(1), "UTF-8"); final String value = URLDecoder.decode(matcher.group(2), "UTF-8"); result.put(key, value); } } catch (UnsupportedEncodingException ex) { LOGGER.error("Can't decode URI query", ex); throw new Error("Unexpected exception, can't find UTF-8 charset!"); } } return result; } private  ModelUtils(); }
ModelUtils { @Nonnull public static Properties extractQueryPropertiesFromURI(@Nonnull final URI uri) { final Properties result = new Properties(); final String rawQuery = uri.getRawQuery(); if (rawQuery != null) { final Matcher matcher = URI_QUERY_PARAMETERS.matcher(rawQuery); try { while (matcher.find()) { final String key = URLDecoder.decode(matcher.group(1), "UTF-8"); final String value = URLDecoder.decode(matcher.group(2), "UTF-8"); result.put(key, value); } } catch (UnsupportedEncodingException ex) { LOGGER.error("Can't decode URI query", ex); throw new Error("Unexpected exception, can't find UTF-8 charset!"); } } return result; } private  ModelUtils(); static int calcCharsOnStart(final char chr, @Nonnull final String text); static boolean onlyFromChar(@Nonnull final String line, final char chr); @Nonnull @MustNotContainNull static Object[] joinArrays(@Nonnull @MustNotContainNull final Object[]... arrs); @Nonnull static String makePreBlock(@Nonnull final String text); @Nonnull static String escapeTextForPreBlock(@Nonnull final String text); @Nonnull static String makeMDCodeBlock(@Nonnull final String text); @Nonnull static String escapeMarkdownStr(@Nonnull final String text); static int calcMaxLengthOfBacktickQuotesSubstr(@Nullable final String text); static void writeChar(@Nonnull final Appendable out, final char chr, final int times); @Nonnull static String unescapeMarkdownStr(@Nonnull final String text); @Nonnull static String makeShortTextVersion(@Nonnull String text, final int maxLength); static int countLines(@Nonnull final String text); @Nonnull @MustNotContainNull static String[] breakToLines(@Nonnull final String text); @Nonnull static String makeQueryStringForURI(@Nullable final Properties properties); @Nonnull static Properties extractQueryPropertiesFromURI(@Nonnull final URI uri); @Nonnull static String encodeForURI(@Nonnull final String s); @Nullable static File makeFileForPath(@Nullable final String path); @Nonnull static String escapeURIPath(@Nonnull final String text); @Nonnull static String removeISOControls(@Nonnull final String text); @Nullable static URI toURI(@Nullable final Path path); @Nonnull static File toFile(@Nonnull final URI uri); }
ModelUtils { @Nonnull public static Properties extractQueryPropertiesFromURI(@Nonnull final URI uri) { final Properties result = new Properties(); final String rawQuery = uri.getRawQuery(); if (rawQuery != null) { final Matcher matcher = URI_QUERY_PARAMETERS.matcher(rawQuery); try { while (matcher.find()) { final String key = URLDecoder.decode(matcher.group(1), "UTF-8"); final String value = URLDecoder.decode(matcher.group(2), "UTF-8"); result.put(key, value); } } catch (UnsupportedEncodingException ex) { LOGGER.error("Can't decode URI query", ex); throw new Error("Unexpected exception, can't find UTF-8 charset!"); } } return result; } private  ModelUtils(); static int calcCharsOnStart(final char chr, @Nonnull final String text); static boolean onlyFromChar(@Nonnull final String line, final char chr); @Nonnull @MustNotContainNull static Object[] joinArrays(@Nonnull @MustNotContainNull final Object[]... arrs); @Nonnull static String makePreBlock(@Nonnull final String text); @Nonnull static String escapeTextForPreBlock(@Nonnull final String text); @Nonnull static String makeMDCodeBlock(@Nonnull final String text); @Nonnull static String escapeMarkdownStr(@Nonnull final String text); static int calcMaxLengthOfBacktickQuotesSubstr(@Nullable final String text); static void writeChar(@Nonnull final Appendable out, final char chr, final int times); @Nonnull static String unescapeMarkdownStr(@Nonnull final String text); @Nonnull static String makeShortTextVersion(@Nonnull String text, final int maxLength); static int countLines(@Nonnull final String text); @Nonnull @MustNotContainNull static String[] breakToLines(@Nonnull final String text); @Nonnull static String makeQueryStringForURI(@Nullable final Properties properties); @Nonnull static Properties extractQueryPropertiesFromURI(@Nonnull final URI uri); @Nonnull static String encodeForURI(@Nonnull final String s); @Nullable static File makeFileForPath(@Nullable final String path); @Nonnull static String escapeURIPath(@Nonnull final String text); @Nonnull static String removeISOControls(@Nonnull final String text); @Nullable static URI toURI(@Nullable final Path path); @Nonnull static File toFile(@Nonnull final URI uri); static final Comparator<String> STRING_COMPARATOR; }