Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
superrain51
apollo
提交
cf6dda53
apollo
项目概览
superrain51
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cf6dda53
编写于
4月 14, 2016
作者:
J
Jason Song
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #90 from lepdou/portal
npe fix
上级
e46d33ee
fb6359a4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
6 deletion
+17
-6
apollo-portal/src/main/java/com/ctrip/apollo/portal/api/AdminServiceAPI.java
...ain/java/com/ctrip/apollo/portal/api/AdminServiceAPI.java
+4
-2
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/ConfigController.java
.../com/ctrip/apollo/portal/controller/ConfigController.java
+8
-2
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/txtresolver/PropertyResolver.java
...p/apollo/portal/service/txtresolver/PropertyResolver.java
+5
-2
未找到文件。
apollo-portal/src/main/java/com/ctrip/apollo/portal/api/AdminServiceAPI.java
浏览文件 @
cf6dda53
...
...
@@ -21,6 +21,7 @@ import org.springframework.util.MultiValueMap;
import
org.springframework.web.client.HttpClientErrorException
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
...
...
@@ -74,7 +75,7 @@ public class AdminServiceAPI {
public
List
<
ItemDTO
>
findItems
(
String
appId
,
Apollo
.
Env
env
,
String
clusterName
,
String
namespace
)
{
if
(
StringUtils
.
isContainEmpty
(
appId
,
clusterName
,
namespace
))
{
return
null
;
return
Collections
.
EMPTY_LIST
;
}
return
Arrays
.
asList
(
restTemplate
.
getForObject
(
getAdminServiceHost
(
env
)
+
String
...
...
@@ -140,7 +141,8 @@ public class AdminServiceAPI {
ResponseEntity
<
ReleaseDTO
>
response
=
restTemplate
.
postForEntity
(
getAdminServiceHost
(
env
)
+
String
.
format
(
"apps/%s/clusters/%s/namespaces/%s/releases"
,
appId
,
clusterName
,
namespace
),
entity
,
ReleaseDTO
.
class
);
if
(
response
.
getStatusCode
()
==
HttpStatus
.
OK
){
if
(
response
!=
null
&&
response
.
getStatusCode
()
==
HttpStatus
.
OK
){
return
response
.
getBody
();
}
else
{
logger
.
error
(
"release fail.id:{}, env:{}, clusterName:{}, namespace:{},releaseBy{}"
,
appId
,
env
,
clusterName
,
namespace
,
releaseBy
);
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/ConfigController.java
浏览文件 @
cf6dda53
...
...
@@ -44,12 +44,15 @@ public class ConfigController {
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
,
@RequestBody
NamespaceModifyModel
model
)
{
if
(
model
==
null
){
return
ResponseEntity
.
badRequest
().
body
(
new
SimpleMsg
(
"form data exception."
));
}
model
.
setAppId
(
appId
);
model
.
setClusterName
(
clusterName
);
model
.
setEnv
(
env
);
model
.
setNamespaceName
(
namespaceName
);
if
(
model
==
null
||
model
.
isInvalid
()){
if
(
model
.
isInvalid
()){
return
ResponseEntity
.
badRequest
().
body
(
new
SimpleMsg
(
"form data exception."
));
}
...
...
@@ -66,12 +69,15 @@ public class ConfigController {
public
ResponseEntity
<
SimpleMsg
>
createRelease
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
,
@RequestBody
NamespaceReleaseModel
model
){
if
(
model
==
null
){
return
ResponseEntity
.
badRequest
().
body
(
new
SimpleMsg
(
"form data exception."
));
}
model
.
setAppId
(
appId
);
model
.
setClusterName
(
clusterName
);
model
.
setEnv
(
env
);
model
.
setNamespaceName
(
namespaceName
);
if
(
model
==
null
||
model
.
isInvalid
()){
if
(
model
.
isInvalid
()){
return
ResponseEntity
.
badRequest
().
body
(
new
SimpleMsg
(
"form data exception."
));
}
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/txtresolver/PropertyResolver.java
浏览文件 @
cf6dda53
...
...
@@ -90,8 +90,11 @@ public class PropertyResolver implements ConfigTextResolver {
int
keyCount
=
0
;
for
(
String
item:
newItems
){
if
(!
isCommentItem
(
item
)
&&
!
isBlankItem
(
item
)){
keyCount
++;
keys
.
add
(
parseKeyValueFromItem
(
item
)[
0
]);
keyCount
++;
String
[]
kv
=
parseKeyValueFromItem
(
item
);
if
(
kv
!=
null
)
{
keys
.
add
(
kv
[
0
]);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录