]> WPIA git - gigi.git/commitdiff
Merge "fix: ensure no blanks are entered between name parts and hyphens"
authorFelix Dörre <felix@dogcraft.de>
Mon, 17 Dec 2018 19:39:48 +0000 (20:39 +0100)
committerGerrit Code Review <gigi-system@dogcraft.de>
Mon, 17 Dec 2018 19:39:48 +0000 (20:39 +0100)
1  2 
src/club/wpia/gigi/output/NameInput.java

index d9116b12bfe6eec47d44571bcdf2cfd8fa077c65,516646674a55e9d947ae70601e0ecffdf519d2c2..272c06e4249a344a8ee63df3485b8ac9ba62a57c
@@@ -74,11 -74,8 +74,11 @@@ public class NameInput implements Outpu
  
      public NamePart[] getNameParts() throws GigiApiException {
          if ("single".equals(scheme)) {
 +            if (name == null || name.trim().isEmpty()) {
 +                throw new GigiApiException("requires at least one character in the single name");
 +            }
              return new NamePart[] {
 -                    new NamePart(NamePartType.SINGLE_NAME, name)
 +                    new NamePart(NamePartType.SINGLE_NAME, name.trim())
              };
          }
          String[] fparts = split(fname);
          if (toSplit == null || toSplit.trim().isEmpty()) {
              return new String[0];
          }
+         toSplit = toSplit.replaceAll("(?>[\\p{Z}\\s]*)([\u002d\u058a\u05be\u1806\u2010\u2011\u2012\u2013\u2014\u2015\u2e3a\u2e3b\ufe58\ufe63\uff0d])(?>[\\p{Z}\\s]*)", "-");
+         toSplit = toSplit.replaceAll("(?>[\\p{Z}\\s]+)", " ").trim();
          return toSplit.split(" ");
      }