Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
eb9d27df
Commit
eb9d27df
authored
Mar 02, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added specific excptions
parent
ff83120d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
2 deletions
+76
-2
NullKeyException.java
.../java/nl/uva/sne/drip/api/exception/NullKeyException.java
+36
-0
NullKeyIDException.java
...ava/nl/uva/sne/drip/api/exception/NullKeyIDException.java
+36
-0
CloudConfigurationController.java
...l/uva/sne/drip/api/rest/CloudConfigurationController.java
+4
-2
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/exception/NullKeyException.java
0 → 100644
View file @
eb9d27df
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
api
.
exception
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
/**
*
* @author S. Koulouzis
*/
@ResponseStatus
(
value
=
HttpStatus
.
NOT_FOUND
,
reason
=
"Key can't be null"
)
public
class
NullKeyException
extends
RuntimeException
{
public
NullKeyException
(
String
string
)
{
super
(
string
);
}
public
NullKeyException
()
{
super
();
}
}
drip-api/src/main/java/nl/uva/sne/drip/api/exception/NullKeyIDException.java
0 → 100644
View file @
eb9d27df
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
api
.
exception
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
/**
*
* @author S. Koulouzis
*/
@ResponseStatus
(
value
=
HttpStatus
.
NOT_FOUND
,
reason
=
"KeyId can't be null"
)
public
class
NullKeyIDException
extends
RuntimeException
{
public
NullKeyIDException
(
String
string
)
{
super
(
string
);
}
public
NullKeyIDException
()
{
super
();
}
}
drip-api/src/main/java/nl/uva/sne/drip/api/rest/CloudConfigurationController.java
View file @
eb9d27df
...
...
@@ -33,6 +33,8 @@ import org.springframework.web.bind.annotation.RestController;
import
nl.uva.sne.drip.api.dao.CloudCredentialsDao
;
import
nl.uva.sne.drip.api.exception.BadRequestException
;
import
nl.uva.sne.drip.api.exception.NotFoundException
;
import
nl.uva.sne.drip.api.exception.NullKeyException
;
import
nl.uva.sne.drip.api.exception.NullKeyIDException
;
import
nl.uva.sne.drip.api.service.UserService
;
import
nl.uva.sne.drip.commons.types.LoginKey
;
import
org.apache.commons.io.FilenameUtils
;
...
...
@@ -60,10 +62,10 @@ public class CloudConfigurationController {
public
@ResponseBody
String
postConf
(
@RequestBody
CloudCredentials
cc
)
{
if
(
cc
.
getKey
()
==
null
)
{
throw
new
BadRequestException
(
"key can't be null"
);
throw
new
NullKeyException
(
);
}
if
(
cc
.
getKeyIdAlias
()
==
null
)
{
throw
new
BadRequestException
(
"keyIdAlias can't be null"
);
throw
new
NullKeyIDException
(
);
}
cloudCredentialsDao
.
save
(
cc
);
return
cc
.
getId
();
...
...
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