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
b29eddd8
Commit
b29eddd8
authored
Apr 20, 2016
by
lepdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
load namespaces handle release NotFountException
parent
6161b573
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
ConfigService.java
...n/java/com/ctrip/apollo/portal/service/ConfigService.java
+15
-10
No files found.
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/ConfigService.java
View file @
b29eddd8
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
;
try
{
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