Skip to content

Commit

Permalink
[ISSUE #2992] use new code style for nacos-common (#3106)
Browse files Browse the repository at this point in the history
* use new code style for nacos-common

* Fix code style file can't set java import problem.
  • Loading branch information
KomachiSion authored Jun 18, 2020
1 parent 38d0b6b commit f864880
Show file tree
Hide file tree
Showing 77 changed files with 2,591 additions and 2,319 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static private void setHeaders(HttpURLConnection conn, List<String> headers, Str
conn.addRequestProperty(iter.next(), iter.next());
}
}
conn.addRequestProperty(HttpHeaderConsts.CLIENT_VERSION_HEADER, VersionUtils.VERSION);
conn.addRequestProperty(HttpHeaderConsts.CLIENT_VERSION_HEADER, VersionUtils.version);
conn.addRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=" + encoding);

String ts = String.valueOf(System.currentTimeMillis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void loadConfiguration() {

private Configuration loadConfiguration(LoggerContext loggerContext, String location) {
try {
URL url = ResourceUtils.getResourceURL(location);
URL url = ResourceUtils.getResourceUrl(location);
ConfigurationSource source = getConfigurationSource(url);
// since log4j 2.7 getConfiguration(LoggerContext loggerContext, ConfigurationSource source)
return ConfigurationFactory.getInstance().getConfiguration(loggerContext, source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void loadConfiguration() {

try {
LoggerContext loggerContext = (LoggerContext)StaticLoggerBinder.getSingleton().getLoggerFactory();
new ContextInitializer(loggerContext).configureByResource(ResourceUtils.getResourceURL(location));
new ContextInitializer(loggerContext).configureByResource(ResourceUtils.getResourceUrl(location));
} catch (Exception e) {
throw new IllegalStateException("Could not initialize Logback Nacos logging from " + location, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ private void injectSecurityInfo(Map<String, String> params) {

public List<String> builderHeaders() {
List<String> headers = Arrays.asList(
HttpHeaderConsts.CLIENT_VERSION_HEADER, VersionUtils.VERSION,
HttpHeaderConsts.CLIENT_VERSION_HEADER, VersionUtils.version,
HttpHeaderConsts.USER_AGENT_HEADER, UtilAndComs.VERSION,
"Accept-Encoding", "gzip,deflate,sdch",
"Connection", "Keep-Alive",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
public class UtilAndComs {

public static final String VERSION = "Nacos-Java-Client:v" + VersionUtils.VERSION;
public static final String VERSION = "Nacos-Java-Client:v" + VersionUtils.version;

public static String WEB_CONTEXT = "/nacos";

Expand Down
26 changes: 13 additions & 13 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,48 @@
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-all</artifactId>
<version>1.3.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>nacos-common</artifactId>
<packaging>jar</packaging>

<name>nacos-common ${project.version}</name>
<url>http://nacos.io</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>nacos-api</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
Expand All @@ -65,14 +65,14 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
package com.alibaba.nacos.common;

/**
* Just for test.
*
* @author <a href="mailto:liaochuntao@live.com">liaochuntao</a>
*/
public @interface JustForTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.alibaba.nacos.common.constant;

/**
* Nacos header constants
* Nacos header constants.
*
* @author ly
*/
public interface HttpHeaderConsts {

String CLIENT_VERSION_HEADER = "Client-Version";
String USER_AGENT_HEADER = "User-Agent";
String REQUEST_SOURCE_HEADER = "Request-Source";
Expand All @@ -33,5 +34,5 @@ public interface HttpHeaderConsts {
String CONNECTION = "Connection";
String REQUEST_ID = "RequestId";
String REQUEST_MODULE = "REQUEST_MODULE";

}
Loading

0 comments on commit f864880

Please # to comment.