Example usage for java.lang IllegalArgumentException toString

List of usage examples for java.lang IllegalArgumentException toString

Introduction

In this page you can find the example usage for java.lang IllegalArgumentException toString.

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:mx.edu.ittepic.proyectofinal.ejbs.webservicesusers.java

@POST
@Path("/adduser/{username}/{password}/{phone}/{neigborhood}/{zipcode}/{city}/{country}/{state}/{region}/{street}/{email}/{streetnumber}/{photo}/{cellphone}/{companyid}/{roleid}/{gender}")
@Produces({ MediaType.TEXT_PLAIN })/*  w  w  w.ja  va 2s  . c  o m*/
public String newUser(@PathParam("username") String username, @PathParam("password") String password,
        @PathParam("phone") String phone, @PathParam("neigborhood") String neigborhood,
        @PathParam("zipcode") String zipcode, @PathParam("city") String city,
        @PathParam("contry") String country, @PathParam("state") String state,
        @PathParam("region") String region, @PathParam("street") String street,
        @PathParam("email") String email, @PathParam("streetnumber") String streetnumber,
        @PathParam("photo") String photo, @PathParam("cellphone") String cellphone,
        @PathParam("companyid") String companyid, @PathParam("roleid") String roleid,
        @PathParam("gender") String gender) {

    Message m = new Message();
    GsonBuilder builder = new GsonBuilder();
    Gson gson = builder.create();

    try {

        Users u = new Users();
        Company com = entity.find(Company.class, Integer.parseInt(companyid));
        Role rol = entity.find(Role.class, Integer.parseInt(roleid));

        u.setUsername(username);
        u.setPassword(password);
        u.setPhone(phone);
        u.setNeigborhood(neigborhood);
        u.setZipcode(zipcode);
        u.setCity(city);
        u.setCountry(country);
        u.setState(state);
        u.setRegion(region);
        u.setStreet(street);
        u.setEmail(email);
        u.setStreetnumber(streetnumber);
        u.setPhoto(photo);
        u.setCellphone(cellphone);
        u.setCompanyid(com);
        u.setRoleid(rol);
        u.setGender(gender.charAt(0));
        u.setApikey("off");

        entity.persist(u);
        entity.flush();

        updateUser(u.getUserid().toString(), u.getApikey());

        m.setCode(200);
        m.setMsg("El usuario se ha registro correctamente");
        m.setDetail(u.getUserid().toString());

    } catch (IllegalArgumentException e) {
        m.setCode(503);
        m.setMsg("Error en la base de datos");
        m.setDetail(e.toString());
    } catch (TransactionRequiredException e) {
        m.setCode(503);
        m.setMsg("Error en la transaccion con la base de datos");
        m.setDetail(e.toString());
    } catch (EntityExistsException e) {
        m.setCode(400);
        m.setMsg("Hubo problemas con la base de datos");
        m.setDetail(e.toString());
    }
    return gson.toJson(m);
}

From source file:ca.watier.echechess.services.GameService.java

/**
 * Used when we need to upgrade a piece in the board (example: pawn promotion)
 *
 * @param uuid//  w  ww. j ava2  s. co m
 * @param piece
 * @param player
 * @return
 */
public boolean upgradePiece(CasePosition to, String uuid, GenericPiecesModel piece, Player player) {
    if (player == null || StringUtils.isBlank(uuid) || piece == null || to == null) {
        throw new IllegalArgumentException();
    }

    GenericGameHandler gameFromUuid = getGameFromUuid(uuid);
    Side playerSide = gameFromUuid.getPlayerSide(player);

    sendPawnPromotionMessage(uuid, playerSide, to);

    boolean isChanged = false;

    try {
        isChanged = gameFromUuid.upgradePiece(to, GenericPiecesModel.from(piece, playerSide), playerSide);

        if (isChanged) {
            webSocketService.fireGameEvent(uuid, SCORE_UPDATE, gameFromUuid.getGameScore()); //Refresh the points
            webSocketService.fireGameEvent(uuid, REFRESH_BOARD); //Refresh the boards
            webSocketService.fireSideEvent(uuid, getOtherPlayerSide(playerSide), PLAYER_TURN,
                    Constants.PLAYER_TURN);
        }

    } catch (IllegalArgumentException ex) {
        LOGGER.error(ex.toString(), ex);
    }

    return isChanged;
}

From source file:jdchub.module.commands.handlers.BanCommand.java

private String ban() {
    SubnetUtils subnetUtils = null;/*from w  ww  .  j  a va2  s  . c o  m*/

    if (!StringUtils.isEmpty(this.nick)) {
        if (ClientManager.getInstance().getClientByNick(this.nick) == null) {
            showError("Client with nick \'" + this.nick + "\' not found.");
            return "Client not found";
        }
    } else if (!StringUtils.isEmpty(this.ip)) {
        if (this.ip.contains("/")) {
            try {
                subnetUtils = new SubnetUtils(this.ip);
            } catch (IllegalArgumentException e) {
                showError("Invalid ip : " + e.toString());
                return "Invalid ip : " + e.toString();
            }

            this.ip = subnetUtils.getInfo().getAddress();
            this.mask = subnetUtils.getInfo().getNetmask();
        } else {
            if (StringUtils.isEmpty(this.mask)) {
                this.mask = "255.255.255.255";
            }

            try {
                subnetUtils = new SubnetUtils(this.ip, this.mask);
            } catch (IllegalArgumentException e) {
                showError("Invalid ip or mask : " + e.toString());
                return "Invalid ip or mask : " + e.toString();
            }
        }
    } else {
        showError("--nick or --ip parameter is required!");
        return "--nick or --ip parameter is required!";
    }

    try {
        if (subnetUtils == null) {
            if (!ClientUtils.ban(commandOwner.getNick(), nick, banType, banExpiresDate, reason)) {
                return "Client was not banned.";
            }
        } else {
            if (!ClientUtils.ban(commandOwner.getNick(), subnetUtils, banType, banExpiresDate, reason)) {
                return "IP was not banned.";
            }
        }
    } catch (Exception e) {
        commandOwner.sendPrivateMessageFromHub(e.toString());
        return "Client was not banned.";
    }

    if (subnetUtils == null) {
        switch (banType) {
        case Constants.BAN_TEMPORARY:
            ClientUtils.sendMessageToOpChat(Messages.get("core.opchat.client_ban_temp",
                    new Object[] { nick, commandOwner.getNick(), reason, banExpiresDate }));
            break;

        case Constants.BAN_PERMANENT:
            ClientUtils.sendMessageToOpChat(Messages.get("core.opchat.client_ban_perm",
                    new Object[] { nick, commandOwner.getNick(), reason }));
            break;
        }
    } else {
        switch (banType) {
        case Constants.BAN_TEMPORARY:
            ClientUtils.sendMessageToOpChat(Messages.get("core.opchat.ip_ban_temp",
                    new Object[] { subnetUtils.getInfo().getCidrSignature(), commandOwner.getNick(), reason,
                            banExpiresDate }));
            break;

        case Constants.BAN_PERMANENT:
            ClientUtils.sendMessageToOpChat(Messages.get("core.opchat.ip_ban_perm",
                    new Object[] { subnetUtils.getInfo().getCidrSignature(), commandOwner.getNick(), reason }));
            break;
        }
    }

    return "Successfully banned.";
}

From source file:net.lightbody.bmp.proxy.jetty.http.handler.DumpHandler.java

public void handle(String pathInContext, String pathParams, HttpRequest request, HttpResponse response)
        throws HttpException, IOException {
    if (!isStarted())
        return;//w  w  w . j av  a2s .  co  m

    // Only handle GET, HEAD and POST
    if (!HttpRequest.__GET.equals(request.getMethod()) && !HttpRequest.__HEAD.equals(request.getMethod())
            && !HttpRequest.__POST.equals(request.getMethod()))
        return;

    log.debug("Dump");

    response.setField(HttpFields.__ContentType, HttpFields.__TextHtml);
    OutputStream out = response.getOutputStream();
    ByteArrayOutputStream buf = new ByteArrayOutputStream(2048);
    Writer writer = new OutputStreamWriter(buf, StringUtil.__ISO_8859_1);
    writer.write("<HTML><H1>Dump HttpHandler</H1>");
    writer.write("<PRE>\npath=" + request.getPath() + "\ncontextPath=" + getHttpContext().getContextPath()
            + "\npathInContext=" + pathInContext + "\n</PRE>\n");
    writer.write("<H3>Header:</H3><PRE>");
    writer.write(request.toString());
    writer.write("</PRE>\n<H3>Parameters:</H3>\n<PRE>");
    Set names = request.getParameterNames();
    Iterator iter = names.iterator();
    while (iter.hasNext()) {
        String name = iter.next().toString();
        List values = request.getParameterValues(name);
        if (values == null || values.size() == 0) {
            writer.write(name);
            writer.write("=\n");
        } else if (values.size() == 1) {
            writer.write(name);
            writer.write("=");
            writer.write((String) values.get(0));
            writer.write("\n");
        } else {
            for (int i = 0; i < values.size(); i++) {
                writer.write(name);
                writer.write("[" + i + "]=");
                writer.write((String) values.get(i));
                writer.write("\n");
            }
        }
    }

    String cookie_name = request.getParameter("CookieName");
    if (cookie_name != null && cookie_name.trim().length() > 0) {
        String cookie_action = request.getParameter("Button");
        try {
            Cookie cookie = new Cookie(cookie_name.trim(), request.getParameter("CookieVal"));
            if ("Clear Cookie".equals(cookie_action))
                cookie.setMaxAge(0);
            response.addSetCookie(cookie);
        } catch (IllegalArgumentException e) {
            writer.write("</PRE>\n<H3>BAD Set-Cookie:</H3>\n<PRE>");
            writer.write(e.toString());
            LogSupport.ignore(log, e);
        }
    }

    writer.write("</PRE>\n<H3>Cookies:</H3>\n<PRE>");
    Cookie[] cookies = request.getCookies();
    if (cookies != null && cookies.length > 0) {
        for (int c = 0; c < cookies.length; c++) {
            Cookie cookie = cookies[c];
            writer.write(cookie.getName());
            writer.write("=");
            writer.write(cookie.getValue());
            writer.write("\n");
        }
    }

    writer.write("</PRE>\n<H3>Attributes:</H3>\n<PRE>");
    Enumeration attributes = request.getAttributeNames();
    if (attributes != null && attributes.hasMoreElements()) {
        while (attributes.hasMoreElements()) {
            String attr = attributes.nextElement().toString();
            writer.write(attr);
            writer.write("=");
            writer.write(request.getAttribute(attr).toString());
            writer.write("\n");
        }
    }

    writer.write("</PRE>\n<H3>Content:</H3>\n<PRE>");
    byte[] content = new byte[4096];
    int len;
    try {
        InputStream in = request.getInputStream();
        while ((len = in.read(content)) >= 0)
            writer.write(new String(content, 0, len));
    } catch (IOException e) {
        LogSupport.ignore(log, e);
        writer.write(e.toString());
    }

    // You wouldn't normally set a trailer like this, but
    // we don't want to commit the output to force trailers as
    // it makes test harness messy
    request.getAcceptableTransferCodings();

    // commit now
    writer.flush();
    response.setIntField(HttpFields.__ContentLength, buf.size() + 1000);
    buf.writeTo(out);
    out.flush();

    // Now add the response
    buf.reset();
    writer.write("</PRE>\n<H3>Response:</H3>\n<PRE>");
    writer.write(response.toString());
    writer.write("</PRE></HTML>");
    writer.flush();
    for (int pad = 998 - buf.size(); pad-- > 0;)
        writer.write(" ");
    writer.write("\015\012");
    writer.flush();
    buf.writeTo(out);

    request.setHandled(true);
}

From source file:org.ofbiz.product.imagemanagement.ImageManagementServices.java

public static Map<String, Object> scaleImageMangementInAllSize(Map<String, ? extends Object> context,
        String filenameToUse, String resizeType, String productId)
        throws IllegalArgumentException, ImagingOpException, IOException, JDOMException {

    /* VARIABLES */
    Locale locale = (Locale) context.get("locale");
    List<String> sizeTypeList = null;
    if (UtilValidate.isNotEmpty(resizeType)) {
        sizeTypeList = UtilMisc.toList(resizeType);
    } else {//w  ww  .j a v a2  s.c o m
        sizeTypeList = UtilMisc.toList("small", "100x75", "150x112", "320x240", "640x480", "800x600",
                "1024x768", "1280x1024", "1600x1200");
    }

    int index;
    Map<String, Map<String, String>> imgPropertyMap = FastMap.newInstance();
    BufferedImage bufImg, bufNewImg;
    double imgHeight, imgWidth;
    Map<String, String> imgUrlMap = FastMap.newInstance();
    Map<String, Object> resultXMLMap = FastMap.newInstance();
    Map<String, Object> resultBufImgMap = FastMap.newInstance();
    Map<String, Object> resultScaleImgMap = FastMap.newInstance();
    Map<String, Object> result = FastMap.newInstance();

    /* ImageProperties.xml */
    String imgPropertyFullPath = System.getProperty("ofbiz.home")
            + "/applications/product/config/ImageProperties.xml";
    resultXMLMap.putAll(ImageTransform.getXMLValue(imgPropertyFullPath, locale));
    if (resultXMLMap.containsKey("responseMessage") && resultXMLMap.get("responseMessage").equals("success")) {
        imgPropertyMap.putAll(UtilGenerics.<Map<String, Map<String, String>>>cast(resultXMLMap.get("xml")));
    } else {
        String errMsg = UtilProperties.getMessage(resource, "ScaleImage.unable_to_parse", locale)
                + " : ImageProperties.xml";
        Debug.logError(errMsg, module);
        result.put("errorMessage", errMsg);
        return result;
    }

    /* IMAGE */
    // get Name and Extension
    index = filenameToUse.lastIndexOf(".");
    String imgExtension = filenameToUse.substring(index + 1);
    // paths
    String imageServerPath = FlexibleStringExpander
            .expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
    String imageServerUrl = FlexibleStringExpander
            .expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);

    /* get original BUFFERED IMAGE */
    resultBufImgMap.putAll(
            ImageTransform.getBufferedImage(imageServerPath + "/" + productId + "/" + filenameToUse, locale));

    if (resultBufImgMap.containsKey("responseMessage")
            && resultBufImgMap.get("responseMessage").equals("success")) {
        bufImg = (BufferedImage) resultBufImgMap.get("bufferedImage");

        // get Dimensions
        imgHeight = (double) bufImg.getHeight();
        imgWidth = (double) bufImg.getWidth();
        if (imgHeight == 0.0 || imgWidth == 0.0) {
            String errMsg = UtilProperties.getMessage(resource,
                    "ScaleImage.one_current_image_dimension_is_null", locale) + " : imgHeight = " + imgHeight
                    + " ; imgWidth = " + imgWidth;
            Debug.logError(errMsg, module);
            result.put("errorMessage", errMsg);
            return result;
        }

        /* scale Image for each Size Type */
        for (String sizeType : sizeTypeList) {
            resultScaleImgMap.putAll(
                    ImageTransform.scaleImage(bufImg, imgHeight, imgWidth, imgPropertyMap, sizeType, locale));

            if (resultScaleImgMap.containsKey("responseMessage")
                    && resultScaleImgMap.get("responseMessage").equals("success")) {
                bufNewImg = (BufferedImage) resultScaleImgMap.get("bufferedImage");

                // write the New Scaled Image

                String targetDirectory = imageServerPath + "/" + productId;
                File targetDir = new File(targetDirectory);
                if (!targetDir.exists()) {
                    boolean created = targetDir.mkdirs();
                    if (!created) {
                        String errMsg = UtilProperties.getMessage(resource,
                                "ScaleImage.unable_to_create_target_directory", locale) + " - "
                                + targetDirectory;
                        Debug.logFatal(errMsg, module);
                        return ServiceUtil.returnError(errMsg);
                    }
                }

                // write new image
                try {
                    ImageIO.write((RenderedImage) bufNewImg, imgExtension,
                            new File(imageServerPath + "/" + productId + "/" + filenameToUse));
                    File deleteFile = new File(imageServerPath + "/" + filenameToUse);
                    deleteFile.delete();
                    //FIXME can be removed ?
                    //  boolean check = deleteFile.delete();
                } catch (IllegalArgumentException e) {
                    String errMsg = UtilProperties.getMessage(resource, "ScaleImage.one_parameter_is_null",
                            locale) + e.toString();
                    Debug.logError(errMsg, module);
                    result.put("errorMessage", errMsg);
                    return result;
                } catch (IOException e) {
                    String errMsg = UtilProperties.getMessage(resource,
                            "ScaleImage.error_occurs_during_writing", locale) + e.toString();
                    Debug.logError(errMsg, module);
                    result.put("errorMessage", errMsg);
                    return result;
                }

                /* write Return Result */
                String imageUrl = imageServerUrl + "/" + productId + "/" + filenameToUse;
                imgUrlMap.put(sizeType, imageUrl);

            } // scaleImgMap
        } // sizeIter

        result.put("responseMessage", "success");
        result.put("imageUrlMap", imgUrlMap);
        result.put("original", resultBufImgMap);
        return result;

    } else {
        String errMsg = UtilProperties.getMessage(resource, "ScaleImage.unable_to_scale_original_image", locale)
                + " : " + filenameToUse;
        Debug.logError(errMsg, module);
        result.put("errorMessage", errMsg);
        return ServiceUtil.returnError(errMsg);
    }
}

From source file:org.apache.hadoop.fs.s3a.TestS3AConfiguration.java

@Test
public void testProxyPortWithoutHost() throws Exception {
    conf = new Configuration();
    conf.setInt(Constants.MAX_ERROR_RETRIES, 2);
    conf.setInt(Constants.PROXY_PORT, 1);
    try {//from w  w w .  java  2  s  .c om
        fs = S3ATestUtils.createTestFileSystem(conf);
        fail("Expected a proxy configuration error");
    } catch (IllegalArgumentException e) {
        String msg = e.toString();
        if (!msg.contains(Constants.PROXY_HOST) && !msg.contains(Constants.PROXY_PORT)) {
            throw e;
        }
    }
}

From source file:org.apache.hadoop.fs.s3a.TestS3AConfiguration.java

@Test
public void testUsernameInconsistentWithPassword() throws Exception {
    conf = new Configuration();
    conf.setInt(Constants.MAX_ERROR_RETRIES, 2);
    conf.set(Constants.PROXY_HOST, "127.0.0.1");
    conf.setInt(Constants.PROXY_PORT, 1);
    conf.set(Constants.PROXY_USERNAME, "user");
    try {// ww w . ja v a 2 s  . c  o  m
        fs = S3ATestUtils.createTestFileSystem(conf);
        fail("Expected a connection error for proxy server");
    } catch (IllegalArgumentException e) {
        String msg = e.toString();
        if (!msg.contains(Constants.PROXY_USERNAME) && !msg.contains(Constants.PROXY_PASSWORD)) {
            throw e;
        }
    }
    conf = new Configuration();
    conf.setInt(Constants.MAX_ERROR_RETRIES, 2);
    conf.set(Constants.PROXY_HOST, "127.0.0.1");
    conf.setInt(Constants.PROXY_PORT, 1);
    conf.set(Constants.PROXY_PASSWORD, "password");
    try {
        fs = S3ATestUtils.createTestFileSystem(conf);
        fail("Expected a connection error for proxy server");
    } catch (IllegalArgumentException e) {
        String msg = e.toString();
        if (!msg.contains(Constants.PROXY_USERNAME) && !msg.contains(Constants.PROXY_PASSWORD)) {
            throw e;
        }
    }
}

From source file:mx.edu.ittepic.proyectofinal.ejbs.ejbUsers.java

public String deleteUser(String userid) {
    Message m = new Message();
    GsonBuilder builder = new GsonBuilder();
    Gson gson = builder.create();// w w w  .ja  va2 s. com

    try {
        String info = this.GetUserByID(userid);
        boolean resultado = info.contains("OK");
        if (resultado) {
            Users r = entity.find(Users.class, Integer.parseInt(userid));
            entity.remove(r);
            m.setCode(200);
            m.setMsg("Registro Eliminado correctamente");
            m.setDetail("OK");
        } else {
            m.setCode(404);
            m.setMsg("No se encontro el registro");
            m.setDetail("");
        }
    } catch (IllegalArgumentException e) {
        m.setCode(404);
        m.setMsg("No se encontro el registro");
        m.setDetail(e.toString());
    } catch (TransactionRequiredException e) {
        m.setCode(404);
        m.setMsg("No se encontro el registro");
        m.setDetail(e.toString());
    }

    return gson.toJson(m);
}

From source file:mx.edu.ittepic.proyectofinal.ejbs.ejbUsers.java

public String GetUsers() {
    List<Users> listUsers;//from   www . j  a v a2 s .c  om
    Message m = new Message();
    GsonBuilder builder = new GsonBuilder();
    Gson gson = builder.create();
    String msg = "";

    try {
        Query q = entity.createNamedQuery("Users.findAll");
        listUsers = q.getResultList();

        Users users;

        for (int i = 0; i < listUsers.size(); i++) {
            users = listUsers.get(i);
            users.getCompanyid().setUsersList(null);
            users.getRoleid().setUsersList(null);
        }

        msg = gson.toJson(listUsers);

        m.setCode(200);
        m.setMsg(msg);
        m.setDetail("OK");
    } catch (IllegalArgumentException e) {
        m.setCode(501);
        m.setMsg("Error al consultar los registros");
        m.setDetail(e.toString());
    }
    return gson.toJson(m);
}

From source file:net.longfalcon.web.AdminRegexController.java

@RequestMapping("/admin/regex-test")
public String testRegexView(
        @RequestParam(value = "action", required = false, defaultValue = "view") String action,
        @RequestParam(value = "regex", required = false) String regex,
        @RequestParam(value = "groupId", required = false) Long groupId,
        @RequestParam(value = "groupName", required = false) String groupName,
        @RequestParam(value = "offset", required = false, defaultValue = "0") Integer offset,
        @RequestParam(defaultValue = "false") boolean unreleased, Model model) {
    title = "Release Regex Test";

    if (ValidatorUtil.isNull(regex)) {
        regex = "/^(?P<name>.*)$/i";
    }//from  w  w  w. j  a  v a2  s.  c  o  m

    if (ValidatorUtil.isNull(groupId)) {
        groupId = -1L;
    }

    if (ValidatorUtil.isNotNull(groupName)) {
        Group group = groupDAO.getGroupByName(groupName);
        if (group != null) {
            groupId = group.getId();
        }
    }

    List<Group> groupList = groupDAO.getActiveGroups();
    List<Binary> matchesList = new ArrayList<>();
    Map<String, Binary> matchesMap = new HashMap<>();
    int pagerTotalItems = 0;

    if (ValidatorUtil.isNotNull(regex) && ValidatorUtil.isNotNull(groupId)) {
        String realRegex = fixRegex(regex);
        List<Integer> procstats = Arrays.asList(Defaults.PROCSTAT_NEW, Defaults.PROCSTAT_READYTORELEASE,
                Defaults.PROCSTAT_WRONGPARTS);
        if (unreleased) {
            matchesList = binaryDAO.findByGroupIdProcStatsReleaseId(groupId, procstats, null);
        } else {
            matchesList = binaryDAO.findByGroupIdProcStatsReleaseId(groupId, null, 0L);
        }

        for (Binary binary : matchesList) {
            Pattern pattern = Pattern.compile(fixRegex(regex), Pattern.CASE_INSENSITIVE); // remove '/' and '/i'
            String testMessage = "Test run - Binary Name " + binary.getName();

            Matcher groupRegexMatcher = pattern.matcher(binary.getName());
            if (groupRegexMatcher.find()) {
                String reqIdGroup = null;
                try {
                    reqIdGroup = groupRegexMatcher.group("reqid");
                } catch (IllegalArgumentException e) {
                    _log.debug(e.toString());
                }
                String partsGroup = null;
                try {
                    partsGroup = groupRegexMatcher.group("parts");
                } catch (IllegalArgumentException e) {
                    _log.debug(e.toString());
                }
                String nameGroup = null;
                try {
                    nameGroup = groupRegexMatcher.group("name");
                } catch (Exception e) {
                    _log.debug(e.toString());
                }
                _log.debug(testMessage + " matches with: \n reqId = " + reqIdGroup + " parts = " + partsGroup
                        + " and name = " + nameGroup);

                if ((ValidatorUtil.isNotNull(reqIdGroup) && ValidatorUtil.isNumeric(reqIdGroup))
                        && ValidatorUtil.isNull(nameGroup)) {
                    nameGroup = reqIdGroup;
                }

                if (ValidatorUtil.isNull(nameGroup)) {
                    _log.debug(String.format(
                            "regex applied which didnt return right number of capture groups - %s", regex));
                    _log.debug(String.format("regex matched: reqId = %s parts = %s and name = %s", reqIdGroup,
                            partsGroup, nameGroup));
                    continue;
                }

                int relTotalPart = 0;
                if (ValidatorUtil.isNotNull(partsGroup)) {
                    String partsStrings[] = partsGroup.split("/");
                    int relpart = Integer.parseInt(partsStrings[0]);
                    relTotalPart = Integer.parseInt(partsStrings[1]);
                }

                binary.setRelName(nameGroup);
                if (ValidatorUtil.isNotNull(reqIdGroup)) {
                    binary.setReqId(Integer.valueOf(reqIdGroup));
                }
                binary.setRelPart(relTotalPart);

                if (!matchesMap.containsKey(nameGroup)) {
                    binary.setRelTotalPart(1);
                    int categoryId = categoryService.determineCategory(groupId, nameGroup);
                    binary.setCategoryName(categoryService.getCategoryDisplayName(categoryId));
                    binary.setCategoryId(categoryId);
                    matchesMap.put(nameGroup, binary);
                } else {
                    Binary prevMatch = matchesMap.get(nameGroup);
                    int count = prevMatch.getRelTotalPart();
                    prevMatch.setRelTotalPart(count + 1);
                }
            }
        }
        List<Binary> valuesList = new ArrayList<>(matchesMap.values());
        pagerTotalItems = valuesList.size();
        matchesList = ArrayUtil.paginate(valuesList, offset, PAGE_SIZE);
    }

    model.addAttribute("title", title);
    model.addAttribute("regex", regex);
    model.addAttribute("groupId", groupId);
    model.addAttribute("groupList", groupList);
    model.addAttribute("unreleased", unreleased);
    model.addAttribute("matchesList", matchesList);
    model.addAttribute("pagerTotalItems", pagerTotalItems);
    model.addAttribute("pagerOffset", offset);
    model.addAttribute("pagerItemsPerPage", PAGE_SIZE);
    return "admin/regex-test";
}