Commit ab5c803a68f50c669a42221d3558ec3476d61e1a
Committed by
Andrew Shvayka
1 parent
4cd59674
refactored
Showing
1 changed file
with
4 additions
and
3 deletions
... | ... | @@ -158,7 +158,7 @@ public class DeviceCredentialsServiceImpl extends AbstractEntityService implemen |
158 | 158 | throw new DataValidationException("Invalid credentials body for LwM2M credentials!"); |
159 | 159 | } |
160 | 160 | |
161 | - String credentialsId; | |
161 | + String credentialsId = null; | |
162 | 162 | |
163 | 163 | switch (clientCredentials.getSecurityConfigClientMode()) { |
164 | 164 | case NO_SEC: |
... | ... | @@ -181,8 +181,9 @@ public class DeviceCredentialsServiceImpl extends AbstractEntityService implemen |
181 | 181 | credentialsId = x509Config.getEndpoint(); |
182 | 182 | } |
183 | 183 | break; |
184 | - default: | |
185 | - throw new DataValidationException("Invalid credentials body for LwM2M credentials!"); | |
184 | + } | |
185 | + if (credentialsId == null) { | |
186 | + throw new DataValidationException("Invalid credentials body for LwM2M credentials!"); | |
186 | 187 | } |
187 | 188 | deviceCredentials.setCredentialsId(credentialsId); |
188 | 189 | } | ... | ... |