@Test public void userAgentWithNullVendorName() { String vendorName = System.getProperty("java.vendor"); System.clearProperty("java.vendor"); String userAgent = VersionInfoUtils.userAgent(); System.setProperty("java.vendor", vendorName); assertThat(userAgent, containsString("vendor/unknown")); }
static String userAgent() { String ua = InternalConfig.Factory.getInternalConfig() .getUserAgentTemplate(); if (ua == null) { return "aws-sdk-java"; } ua = ua .replace("{platform}", StringUtils.lowerCase(getPlatform())) .replace("{version}", getVersion()) .replace("{os.name}", replaceSpaces(System.getProperty("os.name"))) .replace("{os.version}", replaceSpaces(System.getProperty("os.version"))) .replace("{java.vm.name}", replaceSpaces(System.getProperty("java.vm.name"))) .replace("{java.vm.version}", replaceSpaces(System.getProperty("java.vm.version"))) .replace("{java.version}", replaceSpaces(System.getProperty("java.version"))) .replace("{java.vendor}", replaceSpaces(System.getProperty("java.vendor"))) ; if (ua.contains("{additional.languages}")) { ua = ua.replace("{additional.languages}", getAdditionalJvmLanguages()); } String language = System.getProperty("user.language"); String region = System.getProperty("user.region"); String languageAndRegion = ""; if (language != null && region != null) { languageAndRegion = " " + replaceSpaces(language) + "_" + replaceSpaces(region); } ua = ua.replace("{language.and.region}", languageAndRegion); return ua; }
VersionInfoUtils { static String userAgent() { String ua = InternalConfig.Factory.getInternalConfig() .getUserAgentTemplate(); if (ua == null) { return "aws-sdk-java"; } ua = ua .replace("{platform}", StringUtils.lowerCase(getPlatform())) .replace("{version}", getVersion()) .replace("{os.name}", replaceSpaces(System.getProperty("os.name"))) .replace("{os.version}", replaceSpaces(System.getProperty("os.version"))) .replace("{java.vm.name}", replaceSpaces(System.getProperty("java.vm.name"))) .replace("{java.vm.version}", replaceSpaces(System.getProperty("java.vm.version"))) .replace("{java.version}", replaceSpaces(System.getProperty("java.version"))) .replace("{java.vendor}", replaceSpaces(System.getProperty("java.vendor"))) ; if (ua.contains("{additional.languages}")) { ua = ua.replace("{additional.languages}", getAdditionalJvmLanguages()); } String language = System.getProperty("user.language"); String region = System.getProperty("user.region"); String languageAndRegion = ""; if (language != null && region != null) { languageAndRegion = " " + replaceSpaces(language) + "_" + replaceSpaces(region); } ua = ua.replace("{language.and.region}", languageAndRegion); return ua; } }
VersionInfoUtils { static String userAgent() { String ua = InternalConfig.Factory.getInternalConfig() .getUserAgentTemplate(); if (ua == null) { return "aws-sdk-java"; } ua = ua .replace("{platform}", StringUtils.lowerCase(getPlatform())) .replace("{version}", getVersion()) .replace("{os.name}", replaceSpaces(System.getProperty("os.name"))) .replace("{os.version}", replaceSpaces(System.getProperty("os.version"))) .replace("{java.vm.name}", replaceSpaces(System.getProperty("java.vm.name"))) .replace("{java.vm.version}", replaceSpaces(System.getProperty("java.vm.version"))) .replace("{java.version}", replaceSpaces(System.getProperty("java.version"))) .replace("{java.vendor}", replaceSpaces(System.getProperty("java.vendor"))) ; if (ua.contains("{additional.languages}")) { ua = ua.replace("{additional.languages}", getAdditionalJvmLanguages()); } String language = System.getProperty("user.language"); String region = System.getProperty("user.region"); String languageAndRegion = ""; if (language != null && region != null) { languageAndRegion = " " + replaceSpaces(language) + "_" + replaceSpaces(region); } ua = ua.replace("{language.and.region}", languageAndRegion); return ua; }  }
VersionInfoUtils { static String userAgent() { String ua = InternalConfig.Factory.getInternalConfig() .getUserAgentTemplate(); if (ua == null) { return "aws-sdk-java"; } ua = ua .replace("{platform}", StringUtils.lowerCase(getPlatform())) .replace("{version}", getVersion()) .replace("{os.name}", replaceSpaces(System.getProperty("os.name"))) .replace("{os.version}", replaceSpaces(System.getProperty("os.version"))) .replace("{java.vm.name}", replaceSpaces(System.getProperty("java.vm.name"))) .replace("{java.vm.version}", replaceSpaces(System.getProperty("java.vm.version"))) .replace("{java.version}", replaceSpaces(System.getProperty("java.version"))) .replace("{java.vendor}", replaceSpaces(System.getProperty("java.vendor"))) ; if (ua.contains("{additional.languages}")) { ua = ua.replace("{additional.languages}", getAdditionalJvmLanguages()); } String language = System.getProperty("user.language"); String region = System.getProperty("user.region"); String languageAndRegion = ""; if (language != null && region != null) { languageAndRegion = " " + replaceSpaces(language) + "_" + replaceSpaces(region); } ua = ua.replace("{language.and.region}", languageAndRegion); return ua; }  static String getVersion(); static String getPlatform(); static String getUserAgent(); }
VersionInfoUtils { static String userAgent() { String ua = InternalConfig.Factory.getInternalConfig() .getUserAgentTemplate(); if (ua == null) { return "aws-sdk-java"; } ua = ua .replace("{platform}", StringUtils.lowerCase(getPlatform())) .replace("{version}", getVersion()) .replace("{os.name}", replaceSpaces(System.getProperty("os.name"))) .replace("{os.version}", replaceSpaces(System.getProperty("os.version"))) .replace("{java.vm.name}", replaceSpaces(System.getProperty("java.vm.name"))) .replace("{java.vm.version}", replaceSpaces(System.getProperty("java.vm.version"))) .replace("{java.version}", replaceSpaces(System.getProperty("java.version"))) .replace("{java.vendor}", replaceSpaces(System.getProperty("java.vendor"))) ; if (ua.contains("{additional.languages}")) { ua = ua.replace("{additional.languages}", getAdditionalJvmLanguages()); } String language = System.getProperty("user.language"); String region = System.getProperty("user.region"); String languageAndRegion = ""; if (language != null && region != null) { languageAndRegion = " " + replaceSpaces(language) + "_" + replaceSpaces(region); } ua = ua.replace("{language.and.region}", languageAndRegion); return ua; }  static String getVersion(); static String getPlatform(); static String getUserAgent();  }