Skip to content

Commit

Permalink
Merge pull request apolloconfig#659 from lepdou/bugfix_appnamespace
Browse files Browse the repository at this point in the history
Bugfix: check application namespace existed
  • Loading branch information
lepdou authored Jul 14, 2017
2 parents d010aa5 + 56b195e commit 7b3551e
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,19 @@ public AppNamespace findByAppIdAndName(String appId, String namespaceName) {

@Transactional
public void createDefaultAppNamespace(String appId) {
if (!isAppNamespaceNameUnique(appId, appId)) {
throw new ServiceException("appnamespace not unique");
if (!isAppNamespaceNameUnique(appId, ConfigConsts.NAMESPACE_APPLICATION)) {
throw new BadRequestException(String.format("App already has application namespace. AppId = %s", appId));
}

AppNamespace appNs = new AppNamespace();
appNs.setAppId(appId);
appNs.setName(ConfigConsts.NAMESPACE_APPLICATION);
appNs.setComment("default app namespace");
appNs.setFormat(ConfigFileFormat.Properties.getValue());

String userId = userInfoHolder.getUser().getUserId();
appNs.setDataChangeCreatedBy(userId);
appNs.setDataChangeLastModifiedBy(userId);

appNamespaceRepository.save(appNs);
}

Expand Down

0 comments on commit 7b3551e

Please sign in to comment.