public void setName(String name) { this.name = StringUtils.trimToNull(name); }
public void setName(String name) { this.name = StringUtils.trimToNull(name); }
public String getName() { return StringUtils.trimToNull(name); }
public String getName() { return StringUtils.trimToNull(name); }
private XmlPathConfig(JAXBObjectMapperFactory jaxbObjectMapperFactory, XmlParserType defaultParserType, XmlPathObjectDeserializer defaultDeserializer, String charset, Map<String, Boolean> features, Map<String, String> declaredNamespaces, Map<String, Object> properties, boolean validating, boolean namespaceAware, boolean allowDocTypeDeclaration) { charset = StringUtils.trimToNull(charset); if (charset == null) throw new IllegalArgumentException("Charset cannot be empty"); this.charset = charset; this.defaultDeserializer = defaultDeserializer; this.defaultParserType = defaultParserType; this.jaxbObjectMapperFactory = jaxbObjectMapperFactory; this.features = features; this.declaredNamespaces = declaredNamespaces; this.properties = properties; this.validating = validating; this.namespaceAware = namespaceAware; this.allowDocTypeDeclaration = allowDocTypeDeclaration; }
private XmlPathConfig(JAXBObjectMapperFactory jaxbObjectMapperFactory, XmlParserType defaultParserType, XmlPathObjectDeserializer defaultDeserializer, String charset, Map<String, Boolean> features, Map<String, String> declaredNamespaces, Map<String, Object> properties, boolean validating, boolean namespaceAware, boolean allowDocTypeDeclaration) { charset = StringUtils.trimToNull(charset); if (charset == null) throw new IllegalArgumentException("Charset cannot be empty"); this.charset = charset; this.defaultDeserializer = defaultDeserializer; this.defaultParserType = defaultParserType; this.jaxbObjectMapperFactory = jaxbObjectMapperFactory; this.features = features; this.declaredNamespaces = declaredNamespaces; this.properties = properties; this.validating = validating; this.namespaceAware = namespaceAware; this.allowDocTypeDeclaration = allowDocTypeDeclaration; }
private JsonPathConfig(NumberReturnType numberReturnType, JsonParserType parserType, GsonObjectMapperFactory gsonObjectMapperFactory, Jackson1ObjectMapperFactory jackson1ObjectMapperFactory, Jackson2ObjectMapperFactory jackson2ObjectMapperFactory, JsonPathObjectDeserializer defaultDeserializer, String charset) { if (numberReturnType == null) throw new IllegalArgumentException("numberReturnType cannot be null"); charset = StringUtils.trimToNull(charset); if (charset == null) throw new IllegalArgumentException("Charset cannot be empty"); this.charset = charset; this.numberReturnType = numberReturnType; this.defaultDeserializer = defaultDeserializer; this.defaultParserType = parserType; this.gsonObjectMapperFactory = gsonObjectMapperFactory; this.jackson1ObjectMapperFactory = jackson1ObjectMapperFactory; this.jackson2ObjectMapperFactory = jackson2ObjectMapperFactory; }
private JsonPathConfig(NumberReturnType numberReturnType, JsonParserType parserType, GsonObjectMapperFactory gsonObjectMapperFactory, Jackson1ObjectMapperFactory jackson1ObjectMapperFactory, Jackson2ObjectMapperFactory jackson2ObjectMapperFactory, JsonPathObjectDeserializer defaultDeserializer, String charset) { if (numberReturnType == null) throw new IllegalArgumentException("numberReturnType cannot be null"); charset = StringUtils.trimToNull(charset); if (charset == null) throw new IllegalArgumentException("Charset cannot be empty"); this.charset = charset; this.numberReturnType = numberReturnType; this.defaultDeserializer = defaultDeserializer; this.defaultParserType = parserType; this.gsonObjectMapperFactory = gsonObjectMapperFactory; this.jackson1ObjectMapperFactory = jackson1ObjectMapperFactory; this.jackson2ObjectMapperFactory = jackson2ObjectMapperFactory; }
private MultiPartConfig(String defaultControlName, String defaultFileName, String defaultSubtype, String defaultBoundary, String defaultCharset, boolean isUserConfigured) { this.defaultControlName = defaultControlName; this.defaultBoundary = defaultBoundary; this.defaultFileName = StringUtils.trimToNull(defaultFileName); this.defaultSubtype = StringUtils.trimToNull(defaultSubtype); this.defaultCharset = StringUtils.trimToNull(defaultCharset); AssertParameter.notNull(this.defaultControlName, "Default control name"); AssertParameter.notNull(this.defaultSubtype, "Default subtype"); this.isUserConfigured = isUserConfigured; }
private ProxySpecification(String host, int port, String scheme, String username, String password) { this.host = StringUtils.trimToNull(host); this.scheme = StringUtils.trimToNull(scheme); AssertParameter.notNull(this.host, "Proxy host"); AssertParameter.notNull(this.scheme, "Proxy scheme"); if (port < 1) { if (scheme.equalsIgnoreCase(HTTP)) { port = DEFAULT_HTTP_PORT; } else if (scheme.equalsIgnoreCase(HTTPS)) { port = DEFAULT_HTTPS_PORT; } else { throw new IllegalArgumentException("Cannot determine proxy port"); } } this.username = StringUtils.trimToNull(username); this.password = StringUtils.trimToNull(password); this.port = port; }
public boolean matches(String contentType) { String expectedContentType = StringUtils.trimToNull(contentType); if (expectedContentType == null) { return false; } for (String supportedContentType : getContentTypeStrings()) { if (supportedContentType.equalsIgnoreCase(expectedContentType)) { return true; } } return false; } }
protected String nameForClass(Class<?> cls, Set<Options> options) { if (options.contains(Options.SKIP_API_MODEL)) { return cls.getSimpleName(); } io.swagger.v3.oas.annotations.media.Schema mp = AnnotationsUtils.getSchemaDeclaredAnnotation(cls); final String modelName = mp == null ? null : StringUtils.trimToNull(mp.name()); return modelName == null ? cls.getSimpleName() : modelName; }
private HttpMethod toValidHttpMethod(String method) { String httpMethodAsString = notNull(trimToNull(method), "HTTP Method"); HttpMethod httpMethod = HttpMethod.resolve(httpMethodAsString.toUpperCase()); if (httpMethod == null) { throw new IllegalArgumentException("HTTP method '" + method + "' is not supported by WebTestClient"); } return httpMethod; }
private HttpMethod toValidHttpMethod(String method) { String httpMethodAsString = notNull(trimToNull(method), "HTTP Method"); HttpMethod httpMethod = HttpMethod.resolve(httpMethodAsString.toUpperCase()); if (httpMethod == null) { throw new IllegalArgumentException("HTTP method '" + method + "' is not supported by MockMvc"); } return httpMethod; } }
public Resources(String commaSeparatedResources) { final String[] resourceArray = commaSeparatedResources.split(","); for (String resource : resourceArray) { final String name = StringUtils.trimToNull(resource); if (name == null) { continue; } add(new Resource(name)); } }
@Test public void testTrimToNull() { assertEquals(FOO, StringUtils.trimToNull(FOO + " ")); assertEquals(FOO, StringUtils.trimToNull(" " + FOO + " ")); assertEquals(FOO, StringUtils.trimToNull(" " + FOO)); assertEquals(FOO, StringUtils.trimToNull(FOO + "")); assertNull(StringUtils.trimToNull(" \t\r\n\b ")); assertNull(StringUtils.trimToNull(StringUtilsTest.TRIMMABLE)); assertEquals(StringUtilsTest.NON_TRIMMABLE, StringUtils.trimToNull(StringUtilsTest.NON_TRIMMABLE)); assertNull(StringUtils.trimToNull("")); assertNull(StringUtils.trimToNull(null)); }
@Override protected String nameForClass(Class<?> cls, Set<Options> options) { String className = cls.getName().startsWith("java.") ? cls.getSimpleName() : cls.getName(); if (options.contains(Options.SKIP_API_MODEL)) { return className; } final io.swagger.v3.oas.annotations.media.Schema model = cls.getAnnotation(io.swagger.v3.oas.annotations.media.Schema.class); final String modelName = model == null ? null : StringUtils.trimToNull(model.name()); return modelName == null ? className : modelName; } }
void generateDefaultPropertiesFile(final String targetFileName) throws IOException { String fileName = StringUtils.trimToNull(targetFileName); if (fileName == null) { fileName = getDefaultFileName(); } DistributionConfig config = DistributionConfigImpl.createDefaultInstance(); config.toFile(new File(fileName)); } }
final String cleanName = StringUtils.trimToNull(name); final String useName; if (!isEmpty(cleanName) && !cleanName.equals(property.getName())) { useName = null; final String cleanNS = StringUtils.trimToNull(ns); final String useNS; if (!isEmpty(cleanNS)) {
private void invokeAfterRecvResponse(ClientHttpResponse httpResponse, boolean serverFlag) throws IOException { SpringCloudBeanRegistry beanRegistry = SpringCloudBeanRegistry.getInstance(); CompensableBeanFactory beanFactory = beanRegistry.getBeanFactory(); TransactionInterceptor transactionInterceptor = beanFactory.getTransactionInterceptor(); HttpHeaders respHeaders = httpResponse.getHeaders(); String respTransactionStr = respHeaders.getFirst(HEADER_TRANCACTION_KEY); String respPropagationStr = respHeaders.getFirst(HEADER_PROPAGATION_KEY); String transactionText = StringUtils.trimToNull(respTransactionStr); byte[] byteArray = StringUtils.isBlank(transactionText) ? null : Base64.getDecoder().decode(transactionText); TransactionContext serverContext = byteArray == null || byteArray.length == 0 // ? null : (TransactionContext) SerializeUtils.deserializeObject(byteArray); TransactionResponseImpl txResp = new TransactionResponseImpl(); txResp.setTransactionContext(serverContext); RemoteCoordinator serverCoordinator = beanRegistry.getConsumeCoordinator(respPropagationStr); txResp.setSourceTransactionCoordinator(serverCoordinator); txResp.setParticipantDelistFlag(serverFlag ? false : true); transactionInterceptor.afterReceiveResponse(txResp); }