Permalink
Browse files

Checkstyle.

  • Loading branch information...
pavelbucek committed Feb 24, 2015
1 parent 109825b commit a03e637ac0f7161dd97c8f9a9775a923054ff12a
Showing 378 changed files with 5,909 additions and 4,075 deletions.
@@ -257,6 +257,15 @@
<unpackBundle>true</unpackBundle>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
@@ -41,15 +41,11 @@


import java.net.URI;
import java.util.Map;

import javax.websocket.ClientEndpointConfig;

import org.glassfish.tyrus.client.auth.AuthConfig;
import org.glassfish.tyrus.client.auth.AuthenticationException;
import org.glassfish.tyrus.client.auth.Authenticator;
import org.glassfish.tyrus.client.auth.Credentials;
import org.glassfish.tyrus.spi.ClientEngine;
import org.glassfish.tyrus.spi.UpgradeResponse;

/**
@@ -101,13 +97,15 @@
* Sample below demonstrates use of this feature to set preemptive basic proxy authentication:
* <pre>
* final HashMap<String, String> proxyHeaders = new HashMap<String, String>();
* proxyHeaders.put("Proxy-Authorization", "Basic " + Base64Utils.encodeToString("username:password".getBytes(Charset.forName("UTF-8")), false));
* proxyHeaders.put("Proxy-Authorization", "Basic " +
* Base64Utils.encodeToString("username:password".getBytes(Charset.forName("UTF-8")), false));
*
* client.getProperties().put(ClientProperties.PROXY_HEADERS, proxyHeaders);
* client.connectToServer(...);
* </pre>
* Please note that these headers will be used only when establishing proxy connection, for modifying
* WebSocket handshake headers, see {@link javax.websocket.ClientEndpointConfig.Configurator#beforeRequest(java.util.Map)}.
* WebSocket handshake headers, see
* {@link javax.websocket.ClientEndpointConfig.Configurator#beforeRequest(java.util.Map)}.
*
* @see javax.websocket.ClientEndpointConfig#getUserProperties()
*/
@@ -133,7 +131,8 @@
* sslContextConfigurator.setKeyStoreFile("...");
* sslContextConfigurator.setKeyStorePassword("...");
* sslContextConfigurator.setKeyStoreType("...");
* SslEngineConfigurator sslEngineConfigurator = new SslEngineConfigurator(sslContextConfigurator, true, false, false);
* SslEngineConfigurator sslEngineConfigurator = new SslEngineConfigurator(sslContextConfigurator, true,
* false, false);
* client.getProperties().put(ClientProperties.SSL_ENGINE_CONFIGURATOR, sslEngineConfigurator);
* </pre>
*/
@@ -142,7 +141,9 @@
/**
* Property name for maximal incoming buffer size.
* <p/>
* Can be set in properties map (see {@link org.glassfish.tyrus.spi.ClientContainer#openClientSocket(ClientEndpointConfig, Map, ClientEngine)}).
* Can be set in properties map (see {@link
* org.glassfish.tyrus.spi.ClientContainer#openClientSocket(javax.websocket.ClientEndpointConfig, java.util.Map,
* org.glassfish.tyrus.spi.ClientEngine)}.
*/
public static final String INCOMING_BUFFER_SIZE = "org.glassfish.tyrus.incomingBufferSize";

@@ -188,7 +189,8 @@
* <p/>
* Sample below demonstrates how to use this property:
* <pre>
* client.getProperties().put(ClientProperties.AUTH_CONFIG, AuthConfig.builder().enableProvidedBasicAuth().build());
* client.getProperties().put(ClientProperties.AUTH_CONFIG, AuthConfig.builder().enableProvidedBasicAuth()
* .build());
* </pre>
*
* @see AuthConfig
@@ -222,10 +224,10 @@
* <p/>
* Value is expected to be {@code boolean}. Default value is {@code false}.
* <p/>
* When set to {@code true} and one of the following redirection HTTP response status code (3xx) is received
* during a handshake, client will attempt to connect to the {@link URI} contained in
* {@value UpgradeResponse#LOCATION} header from handshake response. Number of redirection is limited by property
* {@link #REDIRECT_THRESHOLD} (integer value), while default value is {@value TyrusClientEngine#DEFAULT_REDIRECT_THRESHOLD}.
* When set to {@code true} and one of the following redirection HTTP response status code (3xx) is received during
* a handshake, client will attempt to connect to the {@link URI} contained in {@value UpgradeResponse#LOCATION}
* header from handshake response. Number of redirection is limited by property {@link #REDIRECT_THRESHOLD} (integer
* value), while default value is {@value TyrusClientEngine#DEFAULT_REDIRECT_THRESHOLD}.
* <p/>
* List of supported HTTP status codes:
* <ul>
@@ -244,9 +246,11 @@
/**
* The maximal number of redirects during single handshake.
* <p/>
* Value is expected to be positive {@link Integer}. Default value is {@value TyrusClientEngine#DEFAULT_REDIRECT_THRESHOLD}.
* Value is expected to be positive {@link Integer}. Default value is {@value
* TyrusClientEngine#DEFAULT_REDIRECT_THRESHOLD}.
* <p/>
* HTTP redirection must be enabled by property {@link #REDIRECT_ENABLED}, otherwise {@code REDIRECT_THRESHOLD} is not applied.
* HTTP redirection must be enabled by property {@link #REDIRECT_ENABLED}, otherwise {@code REDIRECT_THRESHOLD} is
* not applied.
*
* @see #REDIRECT_ENABLED
* @see RedirectException
@@ -258,9 +262,10 @@
* <p/>
* Value is expected to be {@code boolean}. Default value is {@code false}.
* <p/>
* When set to {@code true} and HTTP response code {@code 503 - Service Unavailable} is received, client will attempt
* to reconnect after delay specified in {@value UpgradeResponse#RETRY_AFTER} header from handshake response. According to
* RFC 2616 the value must be decimal integer (representing delay in seconds) or {@code http-date}.
* When set to {@code true} and HTTP response code {@code 503 - Service Unavailable} is received, client will
* attempt to reconnect after delay specified in {@value UpgradeResponse#RETRY_AFTER} header from handshake
* response. According to RFC 2616 the value must be decimal integer (representing delay in seconds) or {@code
* http-date}.
* <p/>
* Tyrus client will try to reconnect after this delay if:
* <ul>
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
@@ -49,8 +49,10 @@
import org.glassfish.tyrus.spi.UpgradeResponse;

/**
* This exception is set as a cause of {@link DeploymentException} thrown from {@link WebSocketContainer}.connectToServer(...)
* when any of the Redirect HTTP response status codes (300, 301, 302, 303, 307, 308) is received as a handshake response and:
* This exception is set as a cause of {@link DeploymentException} thrown from {@link
* WebSocketContainer}.connectToServer(...)
* when any of the Redirect HTTP response status codes (300, 301, 302, 303, 307, 308) is received as a handshake
* response and:
* <ul>
* <li>
* {@link ClientProperties#REDIRECT_ENABLED} is not enabled
@@ -78,8 +80,8 @@
* Constructor.
*
* @param httpStatusCode http status code to be set to response.
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
* @param message the detail message. The detail message is saved for later retrieval by the {@link
* #getMessage()} method.
*/
public RedirectException(int httpStatusCode, String message) {
super(httpStatusCode, message);
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
@@ -47,8 +47,9 @@
import org.glassfish.tyrus.spi.UpgradeResponse;

/**
* This exception is set as a cause of {@link DeploymentException} thrown from {@link WebSocketContainer}.connectToServer(...)
* when HTTP response status code {@code 503 - Service Unavailable} is received.
* This exception is set as a cause of {@link DeploymentException} thrown from {@link
* WebSocketContainer}.connectToServer(...) when HTTP response status code {@code 503 - Service Unavailable} is
* received.
*
* @author Ondrej Kosatka (ondrej.kosatka at oracle.com)
* @see ClientManager.ReconnectHandler
@@ -61,7 +62,8 @@
/**
* Constructor.
*
* @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
* @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()}
* method.
* @param delay a delay to the time received handshake response in header.
*/
public RetryAfterException(String message, Long delay) {
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007-2014 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007-2015 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
@@ -62,8 +62,8 @@
/**
* Utility class, which helps to configure ssl context.
* <p/>
* Used to configure {@link SslEngineConfigurator}, which
* will be passed to client via configuration properties. Example:
* Used to configure {@link SslEngineConfigurator}, which will be passed to client via configuration properties.
* Example:
* <p/>
* <pre>
* SslContextConfigurator sslContextConfigurator = new SslContextConfigurator();
@@ -73,7 +73,8 @@
* sslContextConfigurator.setKeyStoreFile("...");
* sslContextConfigurator.setKeyStorePassword("...");
* sslContextConfigurator.setKeyStoreType("...");
* SslEngineConfigurator sslEngineConfigurator = new SslEngineConfigurator(sslContextConfigurator, true, false, false);
* SslEngineConfigurator sslEngineConfigurator = new SslEngineConfigurator(sslContextConfigurator, true, false,
* false);
* client.getProperties().put(ClientManager.SSL_ENGINE_CONFIGURATOR, sslEngineConfigurator);
* </pre>
*
@@ -491,7 +492,8 @@ public boolean validateConfiguration(boolean needsKeyStore) {
try {
KeyStore keyStore;
if (keyStoreProvider != null) {
keyStore = KeyStore.getInstance(keyStoreType != null ? keyStoreType : KeyStore.getDefaultType(), keyStoreProvider);
keyStore = KeyStore.getInstance(keyStoreType != null ? keyStoreType : KeyStore.getDefaultType(),
keyStoreProvider);
} else {
keyStore = KeyStore.getInstance(keyStoreType != null ? keyStoreType : KeyStore.getDefaultType());
}
@@ -516,7 +518,8 @@ public boolean validateConfiguration(boolean needsKeyStore) {

String kmfAlgorithm = keyManagerFactoryAlgorithm;
if (kmfAlgorithm == null) {
kmfAlgorithm = System.getProperty(KEY_FACTORY_MANAGER_ALGORITHM, KeyManagerFactory.getDefaultAlgorithm());
kmfAlgorithm =
System.getProperty(KEY_FACTORY_MANAGER_ALGORITHM, KeyManagerFactory.getDefaultAlgorithm());
}
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(kmfAlgorithm);
keyManagerFactory.init(keyStore, keyPassword != null ? keyPassword : keyStorePassword);
@@ -550,9 +553,12 @@ public boolean validateConfiguration(boolean needsKeyStore) {
try {
KeyStore trustStore;
if (trustStoreProvider != null) {
trustStore = KeyStore.getInstance(trustStoreType != null ? trustStoreType : KeyStore.getDefaultType(), trustStoreProvider);
trustStore =
KeyStore.getInstance(trustStoreType != null ? trustStoreType : KeyStore.getDefaultType(),
trustStoreProvider);
} else {
trustStore = KeyStore.getInstance(trustStoreType != null ? trustStoreType : KeyStore.getDefaultType());
trustStore =
KeyStore.getInstance(trustStoreType != null ? trustStoreType : KeyStore.getDefaultType());
}
InputStream trustStoreInputStream = null;
try {
@@ -623,7 +629,8 @@ public SSLContext createSSLContext() {
keyStore = KeyStore.getInstance(
keyStoreType != null ? keyStoreType : KeyStore.getDefaultType(), keyStoreProvider);
} else {
keyStore = KeyStore.getInstance(keyStoreType != null ? keyStoreType : KeyStore.getDefaultType());
keyStore =
KeyStore.getInstance(keyStoreType != null ? keyStoreType : KeyStore.getDefaultType());
}
InputStream keyStoreInputStream = null;
try {
@@ -645,7 +652,8 @@ public SSLContext createSSLContext() {

String kmfAlgorithm = keyManagerFactoryAlgorithm;
if (kmfAlgorithm == null) {
kmfAlgorithm = System.getProperty(KEY_FACTORY_MANAGER_ALGORITHM, KeyManagerFactory.getDefaultAlgorithm());
kmfAlgorithm = System.getProperty(KEY_FACTORY_MANAGER_ALGORITHM,
KeyManagerFactory.getDefaultAlgorithm());
}
keyManagerFactory = KeyManagerFactory.getInstance(kmfAlgorithm);
keyManagerFactory.init(keyStore, keyPassword != null ? keyPassword : keyStorePassword);
@@ -670,9 +678,12 @@ public SSLContext createSSLContext() {
try {
KeyStore trustStore;
if (trustStoreProvider != null) {
trustStore = KeyStore.getInstance(trustStoreType != null ? trustStoreType : KeyStore.getDefaultType(), trustStoreProvider);
trustStore = KeyStore.getInstance(
trustStoreType != null ? trustStoreType : KeyStore.getDefaultType(),
trustStoreProvider);
} else {
trustStore = KeyStore.getInstance(trustStoreType != null ? trustStoreType : KeyStore.getDefaultType());
trustStore = KeyStore.getInstance(
trustStoreType != null ? trustStoreType : KeyStore.getDefaultType());
}
InputStream trustStoreInputStream = null;
try {
@@ -694,7 +705,8 @@ public SSLContext createSSLContext() {

String tmfAlgorithm = trustManagerFactoryAlgorithm;
if (tmfAlgorithm == null) {
tmfAlgorithm = System.getProperty(TRUST_FACTORY_MANAGER_ALGORITHM, TrustManagerFactory.getDefaultAlgorithm());
tmfAlgorithm = System.getProperty(TRUST_FACTORY_MANAGER_ALGORITHM,
TrustManagerFactory.getDefaultAlgorithm());
}

trustManagerFactory = TrustManagerFactory.getInstance(tmfAlgorithm);
@@ -719,7 +731,8 @@ public SSLContext createSSLContext() {
secProtocol = securityProtocol;
}
sslContext = SSLContext.getInstance(secProtocol);
sslContext.init(keyManagerFactory != null ? keyManagerFactory.getKeyManagers() : null, trustManagerFactory != null ? trustManagerFactory.getTrustManagers() : null, null);
sslContext.init(keyManagerFactory != null ? keyManagerFactory.getKeyManagers() : null,
trustManagerFactory != null ? trustManagerFactory.getTrustManagers() : null, null);
} catch (KeyManagementException e) {
LOGGER.log(Level.FINE, "Key management error.", e);
} catch (NoSuchAlgorithmException e) {
Oops, something went wrong.

0 comments on commit a03e637

Please sign in to comment.