Changeset 10105 in josm


Ignore:
Timestamp:
2016-04-03T16:12:22+02:00 (9 years ago)
Author:
Don-vip
Message:

fix coverity 1353745 + add unit test

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java

    r10097 r10105  
    509509            if (!s.isEmpty()) {
    510510                UnicodeBlock block = Character.UnicodeBlock.of(s.charAt(0));
    511                 if (block.toString().contains("CJK")) {
     511                if (block != null && block.toString().contains("CJK")) {
    512512                    result = s.length() < 4;
    513513                } else {
  • trunk/test/unit/org/openstreetmap/josm/gui/io/UploadDialogTest.java

    r10097 r10105  
    104104        assertFalse(UploadDialog.UploadAction.isUploadCommentTooShort("geometric corrections"));
    105105        assertFalse(UploadDialog.UploadAction.isUploadCommentTooShort("几何校正"));
     106        // test with unassigned unicode characters ==> no unicode block
     107        assertTrue(UploadDialog.UploadAction.isUploadCommentTooShort("\u0860"));
    106108    }
    107109}
Note: See TracChangeset for help on using the changeset viewer.