Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wrr-cat
apollo
提交
0ecaebe4
apollo
项目概览
wrr-cat
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
0ecaebe4
编写于
7月 29, 2016
作者:
J
Jason Song
提交者:
GitHub
7月 29, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #357 from lepdou/coverity
fix coverity bugs
上级
739f8095
7fec8627
变更
88
隐藏空白更改
内联
并排
Showing
88 changed file
with
258 addition
and
277 deletion
+258
-277
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/aop/NamespaceLockAspect.java
...ramework/apollo/adminservice/aop/NamespaceLockAspect.java
+4
-4
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppController.java
...amework/apollo/adminservice/controller/AppController.java
+3
-3
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppNamespaceController.java
...pollo/adminservice/controller/AppNamespaceController.java
+2
-5
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ClusterController.java
...ork/apollo/adminservice/controller/ClusterController.java
+3
-3
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/CommitController.java
...work/apollo/adminservice/controller/CommitController.java
+1
-1
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java
...mework/apollo/adminservice/controller/ItemController.java
+3
-3
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetController.java
...ork/apollo/adminservice/controller/ItemSetController.java
+1
-1
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceController.java
...k/apollo/adminservice/controller/NamespaceController.java
+3
-3
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceLockController.java
...ollo/adminservice/controller/NamespaceLockController.java
+2
-2
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseController.java
...ork/apollo/adminservice/controller/ReleaseController.java
+2
-2
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/aop/NamespaceLockTest.java
.../framework/apollo/adminservice/aop/NamespaceLockTest.java
+2
-2
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppControllerTest.java
...ork/apollo/adminservice/controller/AppControllerTest.java
+1
-1
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppNamespaceControllerTest.java
...o/adminservice/controller/AppNamespaceControllerTest.java
+1
-1
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerExceptionTest.java
...ollo/adminservice/controller/ControllerExceptionTest.java
+3
-3
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerIntegrationExceptionTest.java
...ervice/controller/ControllerIntegrationExceptionTest.java
+1
-1
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetControllerTest.java
...apollo/adminservice/controller/ItemSetControllerTest.java
+5
-5
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseControllerTest.java
...apollo/adminservice/controller/ReleaseControllerTest.java
+5
-6
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppNamespaceService.java
...rip/framework/apollo/biz/service/AppNamespaceService.java
+1
-1
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppService.java
...va/com/ctrip/framework/apollo/biz/service/AppService.java
+1
-1
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ClusterService.java
...om/ctrip/framework/apollo/biz/service/ClusterService.java
+1
-1
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java
...a/com/ctrip/framework/apollo/biz/service/ItemService.java
+2
-2
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemSetService.java
...om/ctrip/framework/apollo/biz/service/ItemSetService.java
+3
-3
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/NamespaceService.java
.../ctrip/framework/apollo/biz/service/NamespaceService.java
+1
-1
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java
...om/ctrip/framework/apollo/biz/service/ReleaseService.java
+2
-2
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/utils/ConfigChangeContentBuilder.java
...ramework/apollo/biz/utils/ConfigChangeContentBuilder.java
+1
-4
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/AdminServiceTest.java
.../ctrip/framework/apollo/biz/service/AdminServiceTest.java
+1
-1
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ClusterServiceTest.java
...trip/framework/apollo/biz/service/ClusterServiceTest.java
+1
-1
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseServiceTest.java
...trip/framework/apollo/biz/service/ReleaseServiceTest.java
+1
-1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/GlobalDefaultExceptionHandler.java
...ollo/common/controller/GlobalDefaultExceptionHandler.java
+26
-52
apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/AppDTO.java
...in/java/com/ctrip/framework/apollo/common/dto/AppDTO.java
+1
-1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/AppNamespaceDTO.java
...om/ctrip/framework/apollo/common/dto/AppNamespaceDTO.java
+1
-1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/BaseDTO.java
...n/java/com/ctrip/framework/apollo/common/dto/BaseDTO.java
+1
-1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ClusterDTO.java
...ava/com/ctrip/framework/apollo/common/dto/ClusterDTO.java
+1
-1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/CommitDTO.java
...java/com/ctrip/framework/apollo/common/dto/CommitDTO.java
+1
-1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ItemChangeSets.java
...com/ctrip/framework/apollo/common/dto/ItemChangeSets.java
+1
-1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ItemDTO.java
...n/java/com/ctrip/framework/apollo/common/dto/ItemDTO.java
+1
-1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/NamespaceDTO.java
...a/com/ctrip/framework/apollo/common/dto/NamespaceDTO.java
+1
-1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/NamespaceLockDTO.java
...m/ctrip/framework/apollo/common/dto/NamespaceLockDTO.java
+1
-1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ReleaseDTO.java
...ava/com/ctrip/framework/apollo/common/dto/ReleaseDTO.java
+1
-1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/EntityPair.java
.../com/ctrip/framework/apollo/common/entity/EntityPair.java
+1
-1
apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/AbstractApolloHttpException.java
.../apollo/common/exception/AbstractApolloHttpException.java
+26
-0
apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/BadRequestException.java
...ramework/apollo/common/exception/BadRequestException.java
+13
-0
apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/BeanUtilsException.java
...framework/apollo/common/exception/BeanUtilsException.java
+9
-0
apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/NotFoundException.java
.../framework/apollo/common/exception/NotFoundException.java
+12
-0
apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/ServiceException.java
...p/framework/apollo/common/exception/ServiceException.java
+16
-0
apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java
...va/com/ctrip/framework/apollo/common/utils/BeanUtils.java
+8
-6
apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/RequestPrecondition.java
...ip/framework/apollo/common/utils/RequestPrecondition.java
+1
-1
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/NotificationControllerV2.java
...lo/configservice/controller/NotificationControllerV2.java
+1
-1
apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/AbstractBaseException.java
...ramework/apollo/core/exception/AbstractBaseException.java
+0
-36
apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/BadRequestException.java
.../framework/apollo/core/exception/BadRequestException.java
+0
-14
apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/NotFoundException.java
...ip/framework/apollo/core/exception/NotFoundException.java
+0
-13
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java
...om/ctrip/framework/apollo/portal/api/AdminServiceAPI.java
+9
-9
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/RetryableRestTemplate.java
...ip/framework/apollo/portal/api/RetryableRestTemplate.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/AppController.java
...rip/framework/apollo/portal/controller/AppController.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ClusterController.java
...framework/apollo/portal/controller/ClusterController.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/CommitController.java
.../framework/apollo/portal/controller/CommitController.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ItemController.java
...ip/framework/apollo/portal/controller/ItemController.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java
...amework/apollo/portal/controller/NamespaceController.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceLockController.java
...ork/apollo/portal/controller/NamespaceLockController.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PermissionController.java
...mework/apollo/portal/controller/PermissionController.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ReleaseController.java
...framework/apollo/portal/controller/ReleaseController.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceCreationModel.java
...ork/apollo/portal/entity/form/NamespaceCreationModel.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceSyncModel.java
...amework/apollo/portal/entity/form/NamespaceSyncModel.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/Change.java
...a/com/ctrip/framework/apollo/portal/entity/vo/Change.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/EnvClusterInfo.java
...rip/framework/apollo/portal/entity/vo/EnvClusterInfo.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ItemDiffs.java
...om/ctrip/framework/apollo/portal/entity/vo/ItemDiffs.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/NamespaceVO.java
.../ctrip/framework/apollo/portal/entity/vo/NamespaceVO.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseCompareResult.java
...amework/apollo/portal/entity/vo/ReleaseCompareResult.java
+1
-0
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseVO.java
...om/ctrip/framework/apollo/portal/entity/vo/ReleaseVO.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/CreationListener.java
...ip/framework/apollo/portal/listener/CreationListener.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppNamespaceService.java
.../framework/apollo/portal/service/AppNamespaceService.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppService.java
...com/ctrip/framework/apollo/portal/service/AppService.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ClusterService.java
...ctrip/framework/apollo/portal/service/ClusterService.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/CommitService.java
.../ctrip/framework/apollo/portal/service/CommitService.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigService.java
.../ctrip/framework/apollo/portal/service/ConfigService.java
+8
-9
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceLockService.java
...framework/apollo/portal/service/NamespaceLockService.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceService.java
...rip/framework/apollo/portal/service/NamespaceService.java
+3
-3
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ReleaseService.java
...ctrip/framework/apollo/portal/service/ReleaseService.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/ConfigTextResolver.java
...apollo/portal/service/txtresolver/ConfigTextResolver.java
+2
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/FileTextResolver.java
...k/apollo/portal/service/txtresolver/FileTextResolver.java
+3
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/PropertyResolver.java
...k/apollo/portal/service/txtresolver/PropertyResolver.java
+3
-3
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/RetryableRestTemplateTest.java
...ip/framework/apollo/portal/RetryableRestTemplateTest.java
+1
-1
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/ServiceExceptionTest.java
...m/ctrip/framework/apollo/portal/ServiceExceptionTest.java
+4
-5
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/AppNamespaceServiceTest.java
...mework/apollo/portal/service/AppNamespaceServiceTest.java
+1
-1
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/ConfigServiceTest.java
...ip/framework/apollo/portal/service/ConfigServiceTest.java
+3
-4
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/NamespaceServiceTest.java
...framework/apollo/portal/service/NamespaceServiceTest.java
+3
-3
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/txtresolver/FileTextResolverTest.java
...ollo/portal/service/txtresolver/FileTextResolverTest.java
+2
-2
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/txtresolver/PropertyResolverTest.java
...ollo/portal/service/txtresolver/PropertyResolverTest.java
+3
-3
未找到文件。
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/aop/NamespaceLockAspect.java
浏览文件 @
0ecaebe4
...
...
@@ -8,10 +8,10 @@ import com.ctrip.framework.apollo.biz.service.ItemService;
import
com.ctrip.framework.apollo.biz.service.NamespaceLockService
;
import
com.ctrip.framework.apollo.biz.service.NamespaceService
;
import
com.ctrip.framework.apollo.biz.utils.ApolloSwitcher
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
re
.exception.ServiceException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.ServiceException
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppController.java
浏览文件 @
0ecaebe4
...
...
@@ -16,9 +16,9 @@ import com.ctrip.framework.apollo.biz.service.AdminService;
import
com.ctrip.framework.apollo.biz.service.AppService
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.common.utils.InputValidator
;
import
com.ctrip.framework.apollo.co
re
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
re
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
@RestController
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppNamespaceController.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.adminservice.controller
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
...
...
@@ -10,13 +9,11 @@ import org.springframework.web.bind.annotation.RestController;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.biz.service.AppNamespaceService
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.co
re
.dto.AppNamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppNamespaceDTO
;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
java.util.List
;
@RestController
public
class
AppNamespaceController
{
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ClusterController.java
浏览文件 @
0ecaebe4
...
...
@@ -14,9 +14,9 @@ import com.ctrip.framework.apollo.biz.entity.Cluster;
import
com.ctrip.framework.apollo.biz.service.ClusterService
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.common.utils.InputValidator
;
import
com.ctrip.framework.apollo.co
re
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
re
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.NotFoundException
;
@RestController
public
class
ClusterController
{
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/CommitController.java
浏览文件 @
0ecaebe4
...
...
@@ -3,7 +3,7 @@ package com.ctrip.framework.apollo.adminservice.controller;
import
com.ctrip.framework.apollo.biz.entity.Commit
;
import
com.ctrip.framework.apollo.biz.service.CommitService
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.co
re
.dto.CommitDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.CommitDTO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java
浏览文件 @
0ecaebe4
...
...
@@ -19,9 +19,9 @@ import com.ctrip.framework.apollo.biz.service.ItemService;
import
com.ctrip.framework.apollo.biz.service.NamespaceService
;
import
com.ctrip.framework.apollo.biz.utils.ConfigChangeContentBuilder
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
re
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.NotFoundException
;
@RestController
public
class
ItemController
{
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetController.java
浏览文件 @
0ecaebe4
...
...
@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
import
com.ctrip.framework.apollo.adminservice.aop.PreAcquireNamespaceLock
;
import
com.ctrip.framework.apollo.biz.service.ItemSetService
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemChangeSets
;
@RestController
public
class
ItemSetController
{
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceController.java
浏览文件 @
0ecaebe4
...
...
@@ -14,9 +14,9 @@ import com.ctrip.framework.apollo.biz.entity.Namespace;
import
com.ctrip.framework.apollo.biz.service.NamespaceService
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.common.utils.InputValidator
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
re
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.NotFoundException
;
@RestController
public
class
NamespaceController
{
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceLockController.java
浏览文件 @
0ecaebe4
...
...
@@ -6,8 +6,8 @@ import com.ctrip.framework.apollo.biz.service.NamespaceLockService;
import
com.ctrip.framework.apollo.biz.service.NamespaceService
;
import
com.ctrip.framework.apollo.biz.utils.ApolloSwitcher
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceLockDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceLockDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
...
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseController.java
浏览文件 @
0ecaebe4
...
...
@@ -10,8 +10,8 @@ import com.ctrip.framework.apollo.biz.service.NamespaceService;
import
com.ctrip.framework.apollo.biz.service.ReleaseService
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.co
re
.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.NotFoundException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
...
...
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/aop/NamespaceLockTest.java
浏览文件 @
0ecaebe4
...
...
@@ -7,8 +7,8 @@ import com.ctrip.framework.apollo.biz.service.ItemService;
import
com.ctrip.framework.apollo.biz.service.NamespaceLockService
;
import
com.ctrip.framework.apollo.biz.service.NamespaceService
;
import
com.ctrip.framework.apollo.biz.utils.ApolloSwitcher
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
re
.exception.ServiceException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.ServiceException
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
...
...
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppControllerTest.java
浏览文件 @
0ecaebe4
...
...
@@ -12,7 +12,7 @@ import org.springframework.web.client.HttpClientErrorException;
import
com.ctrip.framework.apollo.common.entity.App
;
import
com.ctrip.framework.apollo.biz.repository.AppRepository
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.co
re
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppDTO
;
public
class
AppControllerTest
extends
AbstractControllerTest
{
...
...
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppNamespaceControllerTest.java
浏览文件 @
0ecaebe4
...
...
@@ -2,7 +2,7 @@ package com.ctrip.framework.apollo.adminservice.controller;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.biz.repository.AppNamespaceRepository
;
import
com.ctrip.framework.apollo.co
re
.dto.AppNamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppNamespaceDTO
;
import
org.junit.Assert
;
import
org.junit.Test
;
...
...
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerExceptionTest.java
浏览文件 @
0ecaebe4
...
...
@@ -19,9 +19,9 @@ import org.springframework.test.util.ReflectionTestUtils;
import
com.ctrip.framework.apollo.common.entity.App
;
import
com.ctrip.framework.apollo.biz.service.AdminService
;
import
com.ctrip.framework.apollo.biz.service.AppService
;
import
com.ctrip.framework.apollo.co
re
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.co
re
.exception.ServiceException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.ServiceException
;
@RunWith
(
MockitoJUnitRunner
.
class
)
public
class
ControllerExceptionTest
{
...
...
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerIntegrationExceptionTest.java
浏览文件 @
0ecaebe4
...
...
@@ -19,7 +19,7 @@ import org.springframework.web.client.HttpStatusCodeException;
import
com.ctrip.framework.apollo.common.entity.App
;
import
com.ctrip.framework.apollo.biz.service.AdminService
;
import
com.ctrip.framework.apollo.biz.service.AppService
;
import
com.ctrip.framework.apollo.co
re
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppDTO
;
import
com.google.gson.Gson
;
...
...
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetControllerTest.java
浏览文件 @
0ecaebe4
...
...
@@ -14,11 +14,11 @@ import org.springframework.web.client.RestTemplate;
import
com.ctrip.framework.apollo.biz.entity.Item
;
import
com.ctrip.framework.apollo.biz.repository.ItemRepository
;
import
com.ctrip.framework.apollo.co
re
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceDTO
;
public
class
ItemSetControllerTest
extends
AbstractControllerTest
{
...
...
apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseControllerTest.java
浏览文件 @
0ecaebe4
...
...
@@ -10,11 +10,11 @@ import com.ctrip.framework.apollo.biz.repository.ReleaseRepository;
import
com.ctrip.framework.apollo.biz.service.NamespaceService
;
import
com.ctrip.framework.apollo.biz.service.ReleaseService
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.co
re
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ReleaseDTO
;
import
org.junit.Assert
;
import
org.junit.Test
;
...
...
@@ -24,7 +24,6 @@ import org.springframework.http.HttpHeaders;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.test.context.jdbc.Sql
;
import
org.springframework.test.context.jdbc.Sql.ExecutionPhase
;
import
org.springframework.test.util.ReflectionTestUtils
;
...
...
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppNamespaceService.java
浏览文件 @
0ecaebe4
...
...
@@ -11,7 +11,7 @@ import com.ctrip.framework.apollo.common.entity.AppNamespace;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
com.ctrip.framework.apollo.co
re
.exception.ServiceException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.ServiceException
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppService.java
浏览文件 @
0ecaebe4
...
...
@@ -13,7 +13,7 @@ import com.ctrip.framework.apollo.common.entity.App;
import
com.ctrip.framework.apollo.biz.entity.Audit
;
import
com.ctrip.framework.apollo.biz.repository.AppRepository
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.co
re
.exception.ServiceException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.ServiceException
;
@Service
public
class
AppService
{
...
...
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ClusterService.java
浏览文件 @
0ecaebe4
...
...
@@ -13,7 +13,7 @@ import com.ctrip.framework.apollo.biz.entity.Cluster;
import
com.ctrip.framework.apollo.biz.repository.ClusterRepository
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.co
re
.exception.ServiceException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.ServiceException
;
import
com.google.common.base.Strings
;
...
...
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java
浏览文件 @
0ecaebe4
...
...
@@ -6,8 +6,8 @@ import com.ctrip.framework.apollo.biz.entity.Namespace;
import
com.ctrip.framework.apollo.biz.repository.ItemRepository
;
import
com.ctrip.framework.apollo.biz.repository.NamespaceRepository
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
re
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemSetService.java
浏览文件 @
0ecaebe4
...
...
@@ -10,9 +10,9 @@ import com.ctrip.framework.apollo.biz.entity.Commit;
import
com.ctrip.framework.apollo.biz.entity.Item
;
import
com.ctrip.framework.apollo.biz.utils.ConfigChangeContentBuilder
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
...
...
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/NamespaceService.java
浏览文件 @
0ecaebe4
...
...
@@ -13,7 +13,7 @@ import com.ctrip.framework.apollo.biz.entity.Namespace;
import
com.ctrip.framework.apollo.biz.repository.NamespaceRepository
;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.co
re
.exception.ServiceException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.ServiceException
;
@Service
public
class
NamespaceService
{
...
...
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java
浏览文件 @
0ecaebe4
...
...
@@ -9,8 +9,8 @@ import com.ctrip.framework.apollo.biz.entity.Release;
import
com.ctrip.framework.apollo.biz.repository.ItemRepository
;
import
com.ctrip.framework.apollo.biz.repository.ReleaseRepository
;
import
com.ctrip.framework.apollo.biz.utils.ReleaseKeyGenerator
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
re
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.NotFoundException
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/utils/ConfigChangeContentBuilder.java
浏览文件 @
0ecaebe4
...
...
@@ -4,9 +4,6 @@ import com.google.gson.Gson;
import
com.google.gson.GsonBuilder
;
import
com.ctrip.framework.apollo.biz.entity.Item
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.core.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.core.dto.ItemDTO
;
import
java.util.Date
;
import
java.util.LinkedList
;
...
...
@@ -56,7 +53,7 @@ public class ConfigChangeContentBuilder {
return
gson
.
toJson
(
this
);
}
class
ItemPair
{
static
class
ItemPair
{
Item
oldItem
;
Item
newItem
;
...
...
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/AdminServiceTest.java
浏览文件 @
0ecaebe4
...
...
@@ -14,7 +14,7 @@ import com.ctrip.framework.apollo.biz.entity.Cluster;
import
com.ctrip.framework.apollo.biz.entity.Namespace
;
import
com.ctrip.framework.apollo.biz.repository.AppRepository
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.co
re
.exception.ServiceException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.ServiceException
;
public
class
AdminServiceTest
extends
AbstractIntegrationTest
{
...
...
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ClusterServiceTest.java
浏览文件 @
0ecaebe4
...
...
@@ -7,7 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
com.ctrip.framework.apollo.biz.AbstractIntegrationTest
;
import
com.ctrip.framework.apollo.common.entity.App
;
import
com.ctrip.framework.apollo.co
re
.exception.ServiceException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.ServiceException
;
public
class
ClusterServiceTest
extends
AbstractIntegrationTest
{
...
...
apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseServiceTest.java
浏览文件 @
0ecaebe4
...
...
@@ -3,7 +3,7 @@ package com.ctrip.framework.apollo.biz.service;
import
com.ctrip.framework.apollo.biz.AbstractUnitTest
;
import
com.ctrip.framework.apollo.biz.entity.Release
;
import
com.ctrip.framework.apollo.biz.repository.ReleaseRepository
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
org.junit.Assert
;
import
org.junit.Before
;
...
...
apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/GlobalDefaultExceptionHandler.java
浏览文件 @
0ecaebe4
...
...
@@ -12,17 +12,12 @@ import org.springframework.web.bind.annotation.ControllerAdvice;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.client.HttpStatusCodeException
;
import
com.ctrip.framework.apollo.core.exception.AbstractBaseException
;
import
com.ctrip.framework.apollo.core.exception.BadRequestException
;
import
com.ctrip.framework.apollo.core.exception.NotFoundException
;
import
com.ctrip.framework.apollo.common.exception.AbstractApolloHttpException
;
import
com.dianping.cat.Cat
;
import
com.google.gson.Gson
;
import
com.google.gson.reflect.TypeToken
;
import
java.lang.reflect.Type
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.
Linked
HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.servlet.ServletException
;
...
...
@@ -30,49 +25,30 @@ import javax.servlet.http.HttpServletRequest;
import
static
org
.
springframework
.
http
.
HttpStatus
.
BAD_REQUEST
;
import
static
org
.
springframework
.
http
.
HttpStatus
.
INTERNAL_SERVER_ERROR
;
import
static
org
.
springframework
.
http
.
HttpStatus
.
NOT_FOUND
;
import
static
org
.
springframework
.
http
.
HttpStatus
.
UNAUTHORIZED
;
import
static
org
.
springframework
.
http
.
MediaType
.
APPLICATION_JSON
;
@ControllerAdvice
public
class
GlobalDefaultExceptionHandler
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
GlobalDefaultExceptionHandler
.
class
);
private
Gson
gson
=
new
Gson
();
private
static
Type
mapType
=
new
TypeToken
<
Map
<
String
,
Object
>>()
{}.
getType
(
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
GlobalDefaultExceptionHandler
.
class
);
@ExceptionHandler
(
Exception
.
class
)
public
ResponseEntity
<
Map
<
String
,
Object
>>
exception
(
HttpServletRequest
request
,
Exception
ex
)
{
logger
.
error
(
"internal server error"
,
ex
);
//处理系统内置的Exception
@ExceptionHandler
(
Throwable
.
class
)
public
ResponseEntity
<
Map
<
String
,
Object
>>
exception
(
HttpServletRequest
request
,
Throwable
ex
)
{
return
handleError
(
request
,
INTERNAL_SERVER_ERROR
,
ex
);
}
@ExceptionHandler
({
HttpRequestMethodNotSupportedException
.
class
,
HttpMediaTypeException
.
class
})
public
ResponseEntity
<
Map
<
String
,
Object
>>
badRequest
(
HttpServletRequest
request
,
ServletException
ex
)
{
return
handleError
(
request
,
BAD_REQUEST
,
ex
);
}
@ExceptionHandler
({
BadRequestException
.
class
})
public
ResponseEntity
<
Map
<
String
,
Object
>>
badRequest
(
HttpServletRequest
request
,
BadRequestException
ex
)
{
ServletException
ex
)
{
return
handleError
(
request
,
BAD_REQUEST
,
ex
);
}
@ExceptionHandler
(
NotFoundException
.
class
)
public
ResponseEntity
<
Map
<
String
,
Object
>>
notFound
(
HttpServletRequest
request
,
NotFoundException
ex
)
{
return
handleError
(
request
,
NOT_FOUND
,
ex
);
}
@ExceptionHandler
(
HttpStatusCodeException
.
class
)
public
ResponseEntity
<
Map
<
String
,
Object
>>
restTemplateException
(
HttpServletRequest
request
,
HttpStatusCodeException
ex
)
{
logger
.
error
(
"rest template exception"
,
ex
);
Map
<
String
,
Object
>
errorAttributes
=
gson
.
fromJson
(
ex
.
getResponseBodyAsString
(),
mapType
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
APPLICATION_JSON
);
return
new
ResponseEntity
<>(
errorAttributes
,
headers
,
ex
.
getStatusCode
());
HttpStatusCodeException
ex
)
{
return
handleError
(
request
,
ex
.
getStatusCode
(),
ex
);
}
@ExceptionHandler
(
AccessDeniedException
.
class
)
...
...
@@ -81,39 +57,37 @@ public class GlobalDefaultExceptionHandler {
return
handleError
(
request
,
UNAUTHORIZED
,
ex
);
}
//处理自定义Exception
@ExceptionHandler
({
AbstractApolloHttpException
.
class
})
public
ResponseEntity
<
Map
<
String
,
Object
>>
badRequest
(
HttpServletRequest
request
,
AbstractApolloHttpException
ex
)
{
return
handleError
(
request
,
ex
);
}
private
ResponseEntity
<
Map
<
String
,
Object
>>
handleError
(
HttpServletRequest
request
,
HttpStatus
status
,
Throwable
ex
)
{
return
handleError
(
request
,
status
,
ex
,
ex
.
getMessage
()
);
AbstractApolloHttpException
ex
)
{
return
handleError
(
request
,
ex
.
getHttpStatus
(),
ex
);
}
private
ResponseEntity
<
Map
<
String
,
Object
>>
handleError
(
HttpServletRequest
request
,
HttpStatus
status
,
Throwable
ex
,
String
message
)
{
ex
=
resolveError
(
ex
);
if
(
ex
.
getCause
()
instanceof
HttpStatusCodeException
)
{
return
restTemplateException
(
request
,
(
HttpStatusCodeException
)
ex
.
getCause
());
}
HttpStatus
status
,
Throwable
ex
)
{
String
message
=
ex
.
getMessage
();
logger
.
error
(
message
,
ex
);
Cat
.
logError
(
ex
);
Map
<
String
,
Object
>
errorAttributes
=
new
LinkedHashMap
<>();
Map
<
String
,
Object
>
errorAttributes
=
new
HashMap
<>();
errorAttributes
.
put
(
"status"
,
status
.
value
());
errorAttributes
.
put
(
"message"
,
message
);
errorAttributes
.
put
(
"timestamp"
,
LocalDateTime
.
now
().
format
(
DateTimeFormatter
.
ISO_LOCAL_DATE_TIME
));
errorAttributes
.
put
(
"exception"
,
resolveError
(
ex
).
getClass
().
getName
());
// errorAttributes.put("stackTrace", ex.getStackTrace());
if
(
ex
instanceof
AbstractBaseException
)
{
errorAttributes
.
put
(
"errorCode"
,
((
AbstractBaseException
)
ex
).
getErrorCode
());
}
errorAttributes
.
put
(
"exception"
,
ex
.
getClass
().
getName
());
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
APPLICATION_JSON
);
return
new
ResponseEntity
<>(
errorAttributes
,
headers
,
status
);
}
private
Throwable
resolveError
(
Throwable
ex
)
{
while
(
ex
instanceof
ServletException
&&
ex
.
getCause
()
!=
null
)
{
ex
=
((
ServletException
)
ex
).
getCause
();
}
return
ex
;
}
}
apollo-co
re/src/main/java/com/ctrip/framework/apollo/core
/dto/AppDTO.java
→
apollo-co
mmon/src/main/java/com/ctrip/framework/apollo/common
/dto/AppDTO.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.co
re
.dto
;
package
com.ctrip.framework.apollo.co
mmon
.dto
;
public
class
AppDTO
extends
BaseDTO
{
...
...
apollo-co
re/src/main/java/com/ctrip/framework/apollo/core
/dto/AppNamespaceDTO.java
→
apollo-co
mmon/src/main/java/com/ctrip/framework/apollo/common
/dto/AppNamespaceDTO.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.co
re
.dto
;
package
com.ctrip.framework.apollo.co
mmon
.dto
;
public
class
AppNamespaceDTO
extends
BaseDTO
{
...
...
apollo-co
re/src/main/java/com/ctrip/framework/apollo/core
/dto/BaseDTO.java
→
apollo-co
mmon/src/main/java/com/ctrip/framework/apollo/common
/dto/BaseDTO.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.co
re
.dto
;
package
com.ctrip.framework.apollo.co
mmon
.dto
;
import
java.util.Date
;
...
...
apollo-co
re/src/main/java/com/ctrip/framework/apollo/core
/dto/ClusterDTO.java
→
apollo-co
mmon/src/main/java/com/ctrip/framework/apollo/common
/dto/ClusterDTO.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.co
re
.dto
;
package
com.ctrip.framework.apollo.co
mmon
.dto
;
public
class
ClusterDTO
extends
BaseDTO
{
...
...
apollo-co
re/src/main/java/com/ctrip/framework/apollo/core
/dto/CommitDTO.java
→
apollo-co
mmon/src/main/java/com/ctrip/framework/apollo/common
/dto/CommitDTO.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.co
re
.dto
;
package
com.ctrip.framework.apollo.co
mmon
.dto
;
public
class
CommitDTO
extends
BaseDTO
{
...
...
apollo-co
re/src/main/java/com/ctrip/framework/apollo/core
/dto/ItemChangeSets.java
→
apollo-co
mmon/src/main/java/com/ctrip/framework/apollo/common
/dto/ItemChangeSets.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.co
re
.dto
;
package
com.ctrip.framework.apollo.co
mmon
.dto
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
apollo-co
re/src/main/java/com/ctrip/framework/apollo/core
/dto/ItemDTO.java
→
apollo-co
mmon/src/main/java/com/ctrip/framework/apollo/common
/dto/ItemDTO.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.co
re
.dto
;
package
com.ctrip.framework.apollo.co
mmon
.dto
;
public
class
ItemDTO
extends
BaseDTO
{
...
...
apollo-co
re/src/main/java/com/ctrip/framework/apollo/core
/dto/NamespaceDTO.java
→
apollo-co
mmon/src/main/java/com/ctrip/framework/apollo/common
/dto/NamespaceDTO.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.co
re
.dto
;
package
com.ctrip.framework.apollo.co
mmon
.dto
;
public
class
NamespaceDTO
extends
BaseDTO
{
private
long
id
;
...
...
apollo-co
re/src/main/java/com/ctrip/framework/apollo/core
/dto/NamespaceLockDTO.java
→
apollo-co
mmon/src/main/java/com/ctrip/framework/apollo/common
/dto/NamespaceLockDTO.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.co
re
.dto
;
package
com.ctrip.framework.apollo.co
mmon
.dto
;
public
class
NamespaceLockDTO
extends
BaseDTO
{
...
...
apollo-co
re/src/main/java/com/ctrip/framework/apollo/core
/dto/ReleaseDTO.java
→
apollo-co
mmon/src/main/java/com/ctrip/framework/apollo/common
/dto/ReleaseDTO.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.co
re
.dto
;
package
com.ctrip.framework.apollo.co
mmon
.dto
;
public
class
ReleaseDTO
extends
BaseDTO
{
private
long
id
;
...
...
apollo-
portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo
/EntityPair.java
→
apollo-
common/src/main/java/com/ctrip/framework/apollo/common/entity
/EntityPair.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.
portal.entity.vo
;
package
com.ctrip.framework.apollo.
common.entity
;
public
class
EntityPair
<
E
>
{
...
...
apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/AbstractApolloHttpException.java
0 → 100644
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.common.exception
;
import
org.springframework.http.HttpStatus
;
public
abstract
class
AbstractApolloHttpException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
-
1713129594004951820L
;
protected
HttpStatus
httpStatus
;
public
AbstractApolloHttpException
(
String
msg
){
super
(
msg
);
}
public
AbstractApolloHttpException
(
String
msg
,
Exception
e
){
super
(
msg
,
e
);
}
protected
void
setHttpStatus
(
HttpStatus
httpStatus
){
this
.
httpStatus
=
httpStatus
;
}
public
HttpStatus
getHttpStatus
()
{
return
httpStatus
;
}
}
apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/BadRequestException.java
0 → 100644
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.common.exception
;
import
org.springframework.http.HttpStatus
;
public
class
BadRequestException
extends
AbstractApolloHttpException
{
public
BadRequestException
(
String
str
)
{
super
(
str
);
setHttpStatus
(
HttpStatus
.
BAD_REQUEST
);
}
}
apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/BeanUtilsException.java
0 → 100644
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.common.exception
;
public
class
BeanUtilsException
extends
RuntimeException
{
public
BeanUtilsException
(
Throwable
e
){
super
(
e
);
}
}
apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/NotFoundException.java
0 → 100644
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.common.exception
;
import
org.springframework.http.HttpStatus
;
public
class
NotFoundException
extends
AbstractApolloHttpException
{
public
NotFoundException
(
String
str
)
{
super
(
str
);
setHttpStatus
(
HttpStatus
.
NOT_FOUND
);
}
}
apollo-co
re/src/main/java/com/ctrip/framework/apollo/core
/exception/ServiceException.java
→
apollo-co
mmon/src/main/java/com/ctrip/framework/apollo/common
/exception/ServiceException.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.co
re
.exception
;
package
com.ctrip.framework.apollo.co
mmon
.exception
;
public
class
ServiceException
extends
AbstractBaseException
{
import
org.springframework.http.HttpStatus
;
/**
*
*/
private
static
final
long
serialVersionUID
=
-
6529123764065547791L
;
public
class
ServiceException
extends
AbstractApolloHttpException
{
public
ServiceException
(
String
str
)
{
super
(
str
);
setHttpStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
public
ServiceException
(
String
str
,
Exception
e
)
{
super
(
str
,
e
);
setHttpStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.common.utils
;
import
com.ctrip.framework.apollo.common.exception.BeanUtilsException
;
import
java.beans.PropertyDescriptor
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
...
...
@@ -51,7 +53,7 @@ public class BeanUtils {
try
{
instance
=
clazz
.
newInstance
();
}
catch
(
Exception
e
)
{
throw
new
Runtime
Exception
(
e
);
throw
new
BeanUtils
Exception
(
e
);
}
org
.
springframework
.
beans
.
BeanUtils
.
copyProperties
(
src
,
instance
,
getNullPropertyNames
(
src
));
return
instance
;
...
...
@@ -95,7 +97,7 @@ public class BeanUtils {
map
.
put
((
K
)
field
.
get
(
o
),
(
V
)
o
);
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
);
throw
new
BeanUtilsException
(
e
);
}
return
map
;
}
...
...
@@ -127,7 +129,7 @@ public class BeanUtils {
map
.
get
(
k
).
add
((
V
)
o
);
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
);
throw
new
BeanUtilsException
(
e
);
}
return
map
;
}
...
...
@@ -155,7 +157,7 @@ public class BeanUtils {
set
.
add
((
K
)
field
.
get
(
o
));
}
}
catch
(
Exception
e
)
{
throw
new
Runtime
Exception
(
e
);
throw
new
BeanUtils
Exception
(
e
);
}
return
set
;
}
...
...
@@ -187,7 +189,7 @@ public class BeanUtils {
return
field
.
get
(
obj
);
}
}
catch
(
Exception
e
)
{
// ig
throw
new
BeanUtilsException
(
e
);
}
return
null
;
}
...
...
@@ -203,7 +205,7 @@ public class BeanUtils {
field
.
set
(
obj
,
value
);
}
}
catch
(
Exception
e
)
{
// ig
throw
new
BeanUtilsException
(
e
);
}
}
...
...
apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/RequestPrecondition.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.common.utils
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
...
...
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/NotificationControllerV2.java
浏览文件 @
0ecaebe4
...
...
@@ -21,7 +21,7 @@ import com.ctrip.framework.apollo.configservice.util.NamespaceUtil;
import
com.ctrip.framework.apollo.configservice.util.WatchKeysUtil
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.core.dto.ApolloConfigNotification
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.dianping.cat.Cat
;
import
org.slf4j.Logger
;
...
...
apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/AbstractBaseException.java
已删除
100644 → 0
浏览文件 @
739f8095
package
com.ctrip.framework.apollo.core.exception
;
public
abstract
class
AbstractBaseException
extends
RuntimeException
{
/**
*
*/
private
static
final
long
serialVersionUID
=
-
1713129594004951820L
;
private
String
errorCode
;
public
AbstractBaseException
(){
}
public
AbstractBaseException
(
String
str
){
super
(
str
);
}
public
AbstractBaseException
(
String
str
,
Exception
e
){
super
(
str
,
e
);
}
public
AbstractBaseException
(
String
str
,
String
errorCode
){
super
(
str
);
this
.
setErrorCode
(
errorCode
);
}
public
String
getErrorCode
()
{
return
errorCode
;
}
public
void
setErrorCode
(
String
errorCode
)
{
this
.
errorCode
=
errorCode
;
}
}
apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/BadRequestException.java
已删除
100644 → 0
浏览文件 @
739f8095
package
com.ctrip.framework.apollo.core.exception
;
public
class
BadRequestException
extends
AbstractBaseException
{
/**
*
*/
private
static
final
long
serialVersionUID
=
6060826407312134068L
;
public
BadRequestException
(
String
str
)
{
super
(
str
);
}
}
apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/NotFoundException.java
已删除
100644 → 0
浏览文件 @
739f8095
package
com.ctrip.framework.apollo.core.exception
;
public
class
NotFoundException
extends
AbstractBaseException
{
/**
*
*/
private
static
final
long
serialVersionUID
=
7611357629749481796L
;
public
NotFoundException
(
String
str
)
{
super
(
str
);
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.api
;
import
com.ctrip.framework.apollo.co
re
.dto.AppNamespaceDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.CommitDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceLockDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppNamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.CommitDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceLockDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.co
re
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ReleaseDTO
;
import
org.springframework.boot.actuate.health.Health
;
import
org.springframework.http.HttpEntity
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/RetryableRestTemplate.java
浏览文件 @
0ecaebe4
...
...
@@ -2,7 +2,7 @@ package com.ctrip.framework.apollo.portal.api;
import
com.ctrip.framework.apollo.core.dto.ServiceDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.co
re
.exception.ServiceException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.ServiceException
;
import
com.ctrip.framework.apollo.portal.constant.CatEventType
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.message.Message
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/AppController.java
浏览文件 @
0ecaebe4
...
...
@@ -6,7 +6,7 @@ import com.ctrip.framework.apollo.common.http.MultiResponseEntity;
import
com.ctrip.framework.apollo.common.http.RichResponseEntity
;
import
com.ctrip.framework.apollo.common.utils.InputValidator
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.portal.PortalSettings
;
import
com.ctrip.framework.apollo.portal.entity.po.UserInfo
;
import
com.ctrip.framework.apollo.portal.entity.vo.EnvClusterInfo
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ClusterController.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.controller
;
import
com.ctrip.framework.apollo.common.utils.InputValidator
;
import
com.ctrip.framework.apollo.co
re
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.service.ClusterService
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/CommitController.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.controller
;
import
com.ctrip.framework.apollo.common.utils.RequestPrecondition
;
import
com.ctrip.framework.apollo.co
re
.dto.CommitDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.CommitDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.service.CommitService
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ItemController.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.controller
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
com.ctrip.framework.apollo.portal.entity.vo.ItemDiffs
;
import
com.ctrip.framework.apollo.portal.entity.form.NamespaceSyncModel
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java
浏览文件 @
0ecaebe4
...
...
@@ -3,10 +3,10 @@ package com.ctrip.framework.apollo.portal.controller;
import
com.ctrip.framework.apollo.common.entity.App
;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.common.utils.InputValidator
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.entity.form.NamespaceCreationModel
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceLockController.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.controller
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceLockDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceLockDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.service.NamespaceLockService
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PermissionController.java
浏览文件 @
0ecaebe4
...
...
@@ -2,7 +2,7 @@ package com.ctrip.framework.apollo.portal.controller;
import
com.google.common.collect.Sets
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.constant.RoleType
;
import
com.ctrip.framework.apollo.portal.entity.po.UserInfo
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ReleaseController.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.controller
;
import
com.ctrip.framework.apollo.common.utils.RequestPrecondition
;
import
com.ctrip.framework.apollo.co
re
.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.entity.form.NamespaceReleaseModel
;
import
com.ctrip.framework.apollo.portal.entity.vo.ReleaseCompareResult
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceCreationModel.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.entity.form
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceDTO
;
public
class
NamespaceCreationModel
{
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceSyncModel.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.entity.form
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.portal.entity.vo.NamespaceIdentifer
;
import
org.springframework.util.CollectionUtils
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/Change.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.entity.vo
;
import
com.ctrip.framework.apollo.common.entity.EntityPair
;
import
com.ctrip.framework.apollo.portal.enums.ChangeType
;
public
class
Change
{
...
...
@@ -24,8 +25,7 @@ public class Change {
return
entity
;
}
public
void
setEntity
(
EntityPair
<
KVEntity
>
entity
)
{
public
void
setEntity
(
EntityPair
<
KVEntity
>
entity
)
{
this
.
entity
=
entity
;
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/EnvClusterInfo.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.entity.vo
;
import
com.ctrip.framework.apollo.co
re
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
java.util.List
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ItemDiffs.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.entity.vo
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemChangeSets
;
public
class
ItemDiffs
{
private
NamespaceIdentifer
namespace
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/NamespaceVO.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.entity.vo
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceDTO
;
import
java.util.List
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseCompareResult.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.entity.vo
;
import
com.ctrip.framework.apollo.common.entity.EntityPair
;
import
com.ctrip.framework.apollo.portal.enums.ChangeType
;
import
java.util.LinkedList
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseVO.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.entity.vo
;
import
com.ctrip.framework.apollo.co
re
.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ReleaseDTO
;
import
java.util.Set
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/CreationListener.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.listener
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.co
re
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.AppNamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppNamespaceDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.PortalSettings
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppNamespaceService.java
浏览文件 @
0ecaebe4
...
...
@@ -3,8 +3,8 @@ package com.ctrip.framework.apollo.portal.service;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
re
.exception.ServiceException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.ServiceException
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.repository.AppNamespaceRepository
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppService.java
浏览文件 @
0ecaebe4
...
...
@@ -15,9 +15,9 @@ import org.springframework.web.client.HttpStatusCodeException;
import
com.ctrip.framework.apollo.common.entity.App
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.common.utils.ExceptionUtils
;
import
com.ctrip.framework.apollo.co
re
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.constant.CatEventType
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ClusterService.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.service
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.co
re
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ClusterDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.constant.CatEventType
;
import
com.dianping.cat.Cat
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/CommitService.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.service
;
import
com.ctrip.framework.apollo.co
re
.dto.CommitDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.CommitDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigService.java
浏览文件 @
0ecaebe4
...
...
@@ -9,18 +9,16 @@ import org.springframework.util.CollectionUtils;
import
org.springframework.web.client.HttpClientErrorException
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.core.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
import
com.ctrip.framework.apollo.portal.constant.CatEventType
;
import
com.ctrip.framework.apollo.portal.entity.form.NamespaceReleaseModel
;
import
com.ctrip.framework.apollo.portal.entity.vo.ItemDiffs
;
import
com.ctrip.framework.apollo.portal.entity.vo.NamespaceIdentifer
;
import
com.ctrip.framework.apollo.portal.entity.form.NamespaceTextModel
;
...
...
@@ -77,7 +75,8 @@ public class ConfigService {
changeSets
.
setDataChangeLastModifiedBy
(
userInfoHolder
.
getUser
().
getUserId
());
itemAPI
.
updateItemsByChangeSet
(
appId
,
env
,
clusterName
,
namespaceName
,
changeSets
);
Cat
.
logEvent
(
CatEventType
.
MODIFY_NAMESPACE_BY_TEXT
,
String
.
format
(
"%s+%s+%s+%s"
,
appId
,
env
,
clusterName
,
namespaceName
));
Cat
.
logEvent
(
CatEventType
.
MODIFY_NAMESPACE_BY_TEXT
,
String
.
format
(
"%s+%s+%s+%s"
,
appId
,
env
,
clusterName
,
namespaceName
));
Cat
.
logEvent
(
CatEventType
.
MODIFY_NAMESPACE
,
String
.
format
(
"%s+%s+%s+%s"
,
appId
,
env
,
clusterName
,
namespaceName
));
}
...
...
@@ -128,7 +127,7 @@ public class ConfigService {
itemAPI
.
updateItemsByChangeSet
(
appId
,
env
,
clusterName
,
namespaceName
,
changeSets
);
Cat
.
logEvent
(
CatEventType
.
SYNC_NAMESPACE
,
String
.
format
(
"%s+%s+%s+%s"
,
appId
,
env
,
clusterName
,
namespaceName
));
}
}
}
public
List
<
ItemDiffs
>
compare
(
List
<
NamespaceIdentifer
>
comparedNamespaces
,
List
<
ItemDTO
>
sourceItems
)
{
...
...
@@ -212,7 +211,7 @@ public class ConfigService {
private
ItemDTO
buildItem
(
long
namespaceId
,
int
lineNum
,
ItemDTO
sourceItem
)
{
ItemDTO
createdItem
=
new
ItemDTO
();
BeanUtils
.
copyEntityProperties
(
sourceItem
,
createdItem
);
createdItem
.
setLineNum
(
lineNum
++
);
createdItem
.
setLineNum
(
lineNum
);
createdItem
.
setNamespaceId
(
namespaceId
);
return
createdItem
;
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceLockService.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.service
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceLockDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceLockDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceService.java
浏览文件 @
0ecaebe4
...
...
@@ -4,9 +4,9 @@ import com.google.gson.Gson;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ReleaseService.java
浏览文件 @
0ecaebe4
...
...
@@ -3,7 +3,7 @@ package com.ctrip.framework.apollo.portal.service;
import
com.google.common.base.Objects
;
import
com.google.gson.Gson
;
import
com.ctrip.framework.apollo.co
re
.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.auth.UserInfoHolder
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/ConfigTextResolver.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.service.txtresolver
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
java.util.List
;
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/FileTextResolver.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.service.txtresolver
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.core.utils.StringUtils
;
import
org.springframework.stereotype.Component
;
...
...
@@ -37,6 +37,7 @@ public class FileTextResolver implements ConfigTextResolver {
item
.
setId
(
itemId
);
item
.
setNamespaceId
(
namespaceId
);
item
.
setValue
(
value
);
item
.
setLineNum
(
1
);
item
.
setKey
(
ConfigConsts
.
CONFIG_FILE_CONTENT_KEY
);
return
item
;
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/PropertyResolver.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.service.txtresolver
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.common.utils.BeanUtils
;
import
org.springframework.stereotype.Component
;
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/RetryableRestTemplateTest.java
浏览文件 @
0ecaebe4
...
...
@@ -2,7 +2,7 @@ package com.ctrip.framework.apollo.portal;
import
com.ctrip.framework.apollo.core.dto.ServiceDTO
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.co
re
.exception.ServiceException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.ServiceException
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAddressLocator
;
import
com.ctrip.framework.apollo.portal.api.RetryableRestTemplate
;
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/ServiceExceptionTest.java
浏览文件 @
0ecaebe4
...
...
@@ -23,8 +23,8 @@ import org.springframework.web.client.HttpStatusCodeException;
import
com.ctrip.framework.apollo.common.entity.App
;
import
com.ctrip.framework.apollo.common.utils.ExceptionUtils
;
import
com.ctrip.framework.apollo.co
re
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.ServiceException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.AppDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.ServiceException
;
import
com.ctrip.framework.apollo.portal.controller.AppController
;
import
com.ctrip.framework.apollo.portal.service.UserService
;
...
...
@@ -69,9 +69,8 @@ public class ServiceExceptionTest extends AbstractIntegrationTest {
}
catch
(
HttpStatusCodeException
e
)
{
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
String
>
attr
=
new
Gson
().
fromJson
(
e
.
getResponseBodyAsString
(),
Map
.
class
);
System
.
out
.
println
(
ExceptionUtils
.
toString
(
e
));
Assert
.
assertEquals
(
"No available admin service"
,
attr
.
get
(
"message"
));
Assert
.
assertEquals
(
"8848"
,
attr
.
get
(
"errorCode"
));
Assert
.
assertEquals
(
"500 admin server error"
,
attr
.
get
(
"message"
));
Assert
.
assertEquals
(
500.0
,
attr
.
get
(
"status"
));
}
}
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/AppNamespaceServiceTest.java
浏览文件 @
0ecaebe4
...
...
@@ -3,7 +3,7 @@ package com.ctrip.framework.apollo.portal.service;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.portal.AbstractIntegrationTest
;
import
org.junit.Assert
;
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/ConfigServiceTest.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.service
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
...
...
@@ -12,7 +12,6 @@ import com.ctrip.framework.apollo.portal.entity.po.UserInfo;
import
com.ctrip.framework.apollo.portal.entity.vo.ItemDiffs
;
import
com.ctrip.framework.apollo.portal.entity.vo.NamespaceIdentifer
;
import
com.ctrip.framework.apollo.portal.entity.form.NamespaceTextModel
;
import
com.ctrip.framework.apollo.portal.service.ConfigService
;
import
com.ctrip.framework.apollo.portal.service.txtresolver.PropertyResolver
;
import
org.junit.Assert
;
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/NamespaceServiceTest.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.service
;
import
com.ctrip.framework.apollo.common.entity.AppNamespace
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
re
.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.NamespaceDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ReleaseDTO
;
import
com.ctrip.framework.apollo.core.enums.ConfigFileFormat
;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/txtresolver/FileTextResolverTest.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.service.txtresolver
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.portal.AbstractUnitTest
;
import
org.junit.Assert
;
...
...
apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/txtresolver/PropertyResolverTest.java
浏览文件 @
0ecaebe4
package
com.ctrip.framework.apollo.portal.service.txtresolver
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
re
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
re
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemChangeSets
;
import
com.ctrip.framework.apollo.co
mmon
.dto.ItemDTO
;
import
com.ctrip.framework.apollo.co
mmon
.exception.BadRequestException
;
import
com.ctrip.framework.apollo.portal.AbstractUnitTest
;
import
org.junit.Assert
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录