Browse Source

Clean exception message without class name and path (#4758)

* Clean exception message without class name and path

* Correct message, improvents to text of poppup on deleting

* Added log for except files

* Correct license header
pull/4779/head
AndrewVolosytnykhThingsboard 5 years ago
committed by GitHub
parent
commit
66d4c3fd20
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java
  2. 2
      ui-ngx/src/assets/locale/locale.constant-en_US.json

11
application/src/main/java/org/thingsboard/server/service/resource/DefaultTbResourceService.java

@ -86,7 +86,10 @@ public class DefaultTbResourceService implements TbResourceService {
} else { } else {
throw new DataValidationException(String.format("Could not parse the XML of objectModel with name %s", resource.getSearchText())); throw new DataValidationException(String.format("Could not parse the XML of objectModel with name %s", resource.getSearchText()));
} }
} catch (InvalidDDFFileException | IOException e) { } catch (InvalidDDFFileException e) {
log.error("Failed to parse file {}", resource.getFileName(), e);
throw new DataValidationException("Failed to parse file " + resource.getFileName());
} catch (IOException e) {
throw new ThingsboardException(e, ThingsboardErrorCode.GENERAL); throw new ThingsboardException(e, ThingsboardErrorCode.GENERAL);
} }
if (resource.getResourceType().equals(ResourceType.LWM2M_MODEL) && toLwM2mObject(resource, true) == null) { if (resource.getResourceType().equals(ResourceType.LWM2M_MODEL) && toLwM2mObject(resource, true) == null) {
@ -194,8 +197,7 @@ public class DefaultTbResourceService implements TbResourceService {
if (isSave) { if (isSave) {
LwM2mResourceObserve lwM2MResourceObserve = new LwM2mResourceObserve(k, v.name, false, false, false); LwM2mResourceObserve lwM2MResourceObserve = new LwM2mResourceObserve(k, v.name, false, false, false);
resources.add(lwM2MResourceObserve); resources.add(lwM2MResourceObserve);
} } else if (v.operations.isReadable()) {
else if (v.operations.isReadable()) {
LwM2mResourceObserve lwM2MResourceObserve = new LwM2mResourceObserve(k, v.name, false, false, false); LwM2mResourceObserve lwM2MResourceObserve = new LwM2mResourceObserve(k, v.name, false, false, false);
resources.add(lwM2MResourceObserve); resources.add(lwM2MResourceObserve);
} }
@ -204,8 +206,7 @@ public class DefaultTbResourceService implements TbResourceService {
instance.setResources(resources.toArray(LwM2mResourceObserve[]::new)); instance.setResources(resources.toArray(LwM2mResourceObserve[]::new));
lwM2mObject.setInstances(new LwM2mInstance[]{instance}); lwM2mObject.setInstances(new LwM2mInstance[]{instance});
return lwM2mObject; return lwM2mObject;
} } else {
else {
return null; return null;
} }
} }

2
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -2362,7 +2362,7 @@
"delete-resource-text": "Be careful, after the confirmation the resource will become unrecoverable.", "delete-resource-text": "Be careful, after the confirmation the resource will become unrecoverable.",
"delete-resource-title": "Are you sure you want to delete the resource '{{resourceTitle}}'?", "delete-resource-title": "Are you sure you want to delete the resource '{{resourceTitle}}'?",
"delete-resources-action-title": "Delete { count, plural, 1 {1 resource} other {# resources} }", "delete-resources-action-title": "Delete { count, plural, 1 {1 resource} other {# resources} }",
"delete-resources-text": "Be careful, after the confirmation all selected resources will be removed.", "delete-resources-text": "Please note that the selected resources, even if they are used in device profiles, will be deleted.",
"delete-resources-title": "Are you sure you want to delete { count, plural, 1 {1 resource} other {# resources} }?", "delete-resources-title": "Are you sure you want to delete { count, plural, 1 {1 resource} other {# resources} }?",
"download": "Download resource", "download": "Download resource",
"drop-file": "Drop a resource file or click to select a file to upload.", "drop-file": "Drop a resource file or click to select a file to upload.",

Loading…
Cancel
Save