Uploaded image for project: 'AeroGear'
  1. AeroGear
  2. AEROGEAR-6933

Add server side validation and appropriate response body for bad requests

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Add server side validation to avoid persistence exceptions.

      eg: Trying to register an installation with long name results to javax.persistence.PersistenceException: org.hibernate.exception.DataException: Value too long for column "DEVICETOKEN VARCHAR(255) SELECTIVITY 100"

      This happens for almost all the basic operations like Push App registration, Variant registration and installation registrations.

      In addition the WS responses do not contain information about the bad request causes. So in order to order to understand what went wrong, someone has to check the server side logs.

      e.g:
      if (androidVariant.getGoogleKey() == null) {
      return Response.status(Status.BAD_REQUEST).build();
      }

      It would be a better approach to remove snippets like the above one, to add Bean Validation checks and fill the response entity with a Map of ConstraintViolation property paths (bean root class) and messages.

      If you believe that this issue is better described as a feature request, feel free to modify it.

        Attachments

          Activity

            People

            Assignee:
            mwessendorf Matthias Wessendorf
            Reporter:
            aemmanou Tolis Emmanouilidis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: