Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
d35b39bb
Commit
d35b39bb
authored
Apr 20, 2016
by
Yiming Liu
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #124 from lepdou/lepdou_master
load namespaces handle release NotFountException
parents
6161b573
b29eddd8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
ConfigService.java
...n/java/com/ctrip/apollo/portal/service/ConfigService.java
+14
-9
No files found.
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/ConfigService.java
View file @
d35b39bb
package
com
.
ctrip
.
apollo
.
portal
.
service
;
import
com.google.gson.Gson
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.HttpClientErrorException
;
import
com.ctrip.apollo.core.enums.Env
;
import
com.ctrip.apollo.core.dto.ItemChangeSets
;
...
...
@@ -42,7 +46,7 @@ public class ConfigService {
@Autowired
private
ConfigTextResolver
resolver
;
private
ObjectMapper
objectMapper
=
new
ObjectMapper
();
private
Gson
gson
=
new
Gson
();
/**
* load cluster all namespace info with items
...
...
@@ -86,16 +90,17 @@ public class ConfigService {
String
namespaceName
=
namespace
.
getNamespaceName
();
//latest
create
Release
ReleaseDTO
release
=
releaseAPI
.
loadLatestRelease
(
appId
,
env
,
clusterName
,
namespaceName
)
;
//latest Release
ReleaseDTO
release
=
null
;
Map
<
String
,
String
>
releaseItems
=
new
HashMap
<>();
if
(
release
!=
null
)
{
try
{
releaseItems
=
objectMapper
.
readValue
(
release
.
getConfigurations
(),
Map
.
class
);
}
catch
(
IOException
e
)
{
logger
.
error
(
"parse createRelease json error. appId:{},env:{},clusterName:{},namespace:{}"
,
appId
,
env
,
clusterName
,
namespaceName
);
return
namespaceVO
;
release
=
releaseAPI
.
loadLatestRelease
(
appId
,
env
,
clusterName
,
namespaceName
);
releaseItems
=
gson
.
fromJson
(
release
.
getConfigurations
(),
Map
.
class
);
}
catch
(
HttpClientErrorException
e
){
if
(
e
.
getStatusCode
()
==
HttpStatus
.
NOT_FOUND
){
//ignore maybe new app has no release.
}
else
{
throw
e
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment