comparison src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java @ 102:9140017e8962

fix bug with empty username. add logging for JSON exceptions.
author casties
date Thu, 09 Feb 2017 20:46:15 +0100
parents acd44dfec9c8
children 7417f5915181
comparison
equal deleted inserted replaced
101:7268c3ca025b 102:9140017e8962
636 String fragment = parseRange(range); 636 String fragment = parseRange(range);
637 annot.setTargetFragment(fragment); 637 annot.setTargetFragment(fragment);
638 } 638 }
639 } 639 }
640 } catch (JSONException e) { 640 } catch (JSONException e) {
641 // nothing to do 641 logger.warning(e.toString());
642 } 642 }
643 try { 643 try {
644 if (jo.has("shapes")) { 644 if (jo.has("shapes")) {
645 JSONArray shapes = jo.getJSONArray("shapes"); 645 JSONArray shapes = jo.getJSONArray("shapes");
646 if (shapes.length() > 0) { 646 if (shapes.length() > 0) {
653 annot.setFragmentType(FragmentTypes.AREA); 653 annot.setFragmentType(FragmentTypes.AREA);
654 } 654 }
655 } 655 }
656 } 656 }
657 } catch (JSONException e) { 657 } catch (JSONException e) {
658 // nothing to do 658 logger.warning(e.toString());
659 } 659 }
660 // deprecated areas type 660 // deprecated areas type
661 try { 661 try {
662 if (jo.has("areas")) { 662 if (jo.has("areas")) {
663 JSONArray areas = jo.getJSONArray("areas"); 663 JSONArray areas = jo.getJSONArray("areas");
667 String fragment = parseArea(area); 667 String fragment = parseArea(area);
668 annot.setTargetFragment(fragment); 668 annot.setTargetFragment(fragment);
669 } 669 }
670 } 670 }
671 } catch (JSONException e) { 671 } catch (JSONException e) {
672 // nothing to do 672 logger.warning(e.toString());
673 } 673 }
674 // no fragment is an error 674 // no fragment is an error
675 if (annot.getFragmentType() == null || annot.getTargetFragment() == null) { 675 if (annot.getFragmentType() == null || annot.getTargetFragment() == null) {
676 throw new JSONException("Annotation has no valid target fragment!"); 676 throw new JSONException("Annotation has no valid target fragment!");
677 } 677 }