Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
knightliao committed May 7, 2016
2 parents 12bde88 + 1f267f2 commit e80e43f
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ https://github.com/knightliao/disconf-demos-java
disconf.git branches and Maven version:

- dev(develop branch): 2.6.33-SNAPSHOT
- master(stable branch):2.6.32
- master(stable branch):2.6.33
- [更新日志](https://github.com/knightliao/disconf/wiki/updates)
- 在Maven Central Repository里查看 [com.baidu.disconf](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.baidu.disconf%22 )

Expand Down Expand Up @@ -100,7 +100,7 @@ Disconf的功能特点描述图:
<dependency>
<groupId>com.baidu.disconf</groupId>
<artifactId>disconf-client</artifactId>
<version>2.6.31</version>
<version>2.6.33</version>
</dependency>

### server: disconf-web 使用 ###
Expand Down
2 changes: 1 addition & 1 deletion disconf-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>com.baidu.disconf</groupId>
<artifactId>disconf-base</artifactId>
<version>2.6.32</version>
<version>2.6.33</version>
</parent>

<licenses>
Expand Down
2 changes: 1 addition & 1 deletion disconf-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>com.baidu.disconf</groupId>
<artifactId>disconf-base</artifactId>
<version>2.6.32</version>
<version>2.6.33</version>
</parent>

<licenses>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.baidu.disconf.core.common.utils;

import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLDecoder;

import org.slf4j.Logger;
Expand All @@ -20,7 +23,6 @@ public final class ClassLoaderUtil {
private static ClassLoader loader = Thread.currentThread().getContextClassLoader();

private ClassLoaderUtil() {

}

//
Expand All @@ -42,18 +44,44 @@ private ClassLoaderUtil() {

// 如果是jar包内的,则返回当前路径
if (classPath.contains(".jar!")) {
LOGGER.warn("using config file inline jar!");
LOGGER.warn("using config file inline jar!" + classPath);
classPath = System.getProperty("user.dir");

//
addCurrentWorkingDir2Classpath(classPath);
}

} catch (Exception e) {
LOGGER.warn("cannot get classpath using getResource(), now using user.dir");
classPath = System.getProperty("user.dir");

//
addCurrentWorkingDir2Classpath(classPath);
}

LOGGER.info("classpath: {}", classPath);
}

/**
* only support 1.7 or higher
* http://stackoverflow.com/questions/252893/how-do-you-change-the-classpath-within-java
*/
private static void addCurrentWorkingDir2Classpath(String path2Added) {

// Add the conf dir to the classpath
// Chain the current thread classloader
URLClassLoader urlClassLoader;
try {
urlClassLoader = new URLClassLoader(new URL[] {new File(path2Added).toURI().toURL()},
loader);
// Replace the thread classloader - assumes
// you have permissions to do so
Thread.currentThread().setContextClassLoader(urlClassLoader);
} catch (Exception e) {
LOGGER.warn(e.toString());
}
}

public static String getClassPath() {
return classPath;
}
Expand Down
2 changes: 1 addition & 1 deletion disconf-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>com.baidu.disconf</groupId>
<artifactId>disconf-base</artifactId>
<version>2.6.32</version>
<version>2.6.33</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public ConfListVo transfer(Config input) {
ConfListVo configListVo = convert(input, appNameString, envName, zkDisconfData);

// 列表操作不要显示值, 为了前端显示快速(只是内存里操作)
if (!myFetchZk || !getErrorMessage) {
if (!myFetchZk && !getErrorMessage) {

// 列表 value 设置为 ""
configListVo.setValue("");
Expand Down Expand Up @@ -424,7 +424,7 @@ public String updateItemValue(Long configId, String value) {
//
String toEmails = appMgr.getEmails(config.getAppId());

if (applicationPropertyConfig.isEmailMonitorOn() == true) {
if (applicationPropertyConfig.isEmailMonitorOn()) {
boolean isSendSuccess = logMailBean.sendHtmlEmail(toEmails,
" config update", DiffUtils.getDiff(CodeUtils.unicodeToUtf8(oldValue),
value,
Expand Down
14 changes: 4 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.baidu.disconf</groupId>
<artifactId>disconf-base</artifactId>
<version>2.6.32</version>
<version>2.6.33</version>
<packaging>pom</packaging>

<modules>
Expand All @@ -25,9 +25,9 @@

<properties>
<!-- 模块版本号 -->
<disconf-core.version>2.6.32</disconf-core.version>
<disconf-client.version>2.6.32</disconf-client.version>
<disconf-client-spring.version>2.6.32</disconf-client-spring.version>
<disconf-core.version>2.6.33</disconf-core.version>
<disconf-client.version>2.6.33</disconf-client.version>
<disconf-client-spring.version>2.6.33</disconf-client-spring.version>

<!-- Spring項目配置 -->
<encoding>UTF-8</encoding>
Expand Down Expand Up @@ -122,12 +122,6 @@
<version>1.2.1</version>
</dependency>

<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>

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

0 comments on commit e80e43f

Please sign in to comment.