Package org.fao.geonet.exceptions

Examples of org.fao.geonet.exceptions.BadParameterEx


    if (ip == null)
      ip = "???.???.???.???";

    if (!Lib.type.isInteger(rat))
      throw new BadParameterEx(Params.RATING, rat);

    int rating = Integer.parseInt(rat);

    if (rating < 1 || rating > 5)
      throw new BadParameterEx(Params.RATING, rat);

    String harvUuid = getHarvestingUuid(context, id);

    // look up value of localrating/enable
    SettingManager settingManager = gc.getBean(SettingManager.class);
View Full Code Here


        String geomParam = Util.getParamText(params, GEOM_PARAM);
        String geomType = Util.getParam(params, GEOM_TYPE_PARAM, GeomFormat.WKT.toString());
        String geomSrs = Util.getParam(params, GEOM_SRS_PARAM, "EPSG:4326");

        if (id == null && geomParam == null) {
            throw new BadParameterEx(Params.ID, "Either " + GEOM_PARAM + " or " + Params.ID + " is required");
        }
        if (id != null && geomParam != null) {
            throw new BadParameterEx(Params.ID, "Only one of " + GEOM_PARAM + " or " + Params.ID + " is permitted");
        }

        // see calculateImageSize for more parameter checks

        Geometry geom = null;
View Full Code Here

  }

  private Dimension calculateImageSize(Envelope bboxOfImage, String widthString, String heightString) {

        if (widthString != null && heightString != null) {
            throw new BadParameterEx(
                    WIDTH_PARAM,
                    "Only one of "
                            + WIDTH_PARAM
                            + " and "
                            + HEIGHT_PARAM
                            + " can be defined currently.  Future versions may support this but it is not supported at the moment");
        }
        if (widthString == null && heightString == null) {
            throw new BadParameterEx(WIDTH_PARAM, "One of " + WIDTH_PARAM + " or " + HEIGHT_PARAM
                    + " parameters must be included in the request");

        }

        int width, height;
View Full Code Here

            if (name.equals("element")) {
                response.addContent(handleElement(scm, elem, context));
            } else if (name.equals("codelist")) {
                response.addContent(handleCodelist(scm, elem, context));
            } else {
                throw new BadParameterEx("element", name);
            }
        }

        return response;
    }
View Full Code Here

        }
    }

    protected void checkLegalId(String paramName, String xslid) throws BadParameterEx {
        if(!ID_XSL_REGEX.matcher(xslid).matches()) {
            throw new BadParameterEx(paramName, "Only the following are permitted in the id"+ID_XSL_REGEX);
        }
    }
View Full Code Here

        String canonicalContainer = container.getCanonicalPath();
        return canonicalDesired.startsWith(canonicalContainer);
    }
    protected File getAndVerifyFormatDir(String paramName, String xslid) throws BadParameterEx, IOException {
        if (xslid == null) {
            throw new BadParameterEx(paramName, "missing "+paramName+" param");
        }
       
        checkLegalId(paramName, xslid);
        File formatDir = new File(userXslDir + xslid);
       
        if(!formatDir.exists()) {
            throw new BadParameterEx(paramName, "Format bundle "+xslid+" does not exist");
        }
       
        if(!formatDir.isDirectory()) {
            throw new BadParameterEx(paramName, "Format bundle "+xslid+" is not a directory");
        }
       
        if(!new File(formatDir, VIEW_XSL_FILENAME).exists()) {
            throw new BadParameterEx(paramName, "Format bundle "+xslid+" is not a valid format bundle because it does not have a "+VIEW_XSL_FILENAME+" file");
        }
       
        if (!containsFile(new File(userXslDir), formatDir)) {
            throw new BadParameterEx(paramName, "Format bundle "+xslid+" is not a format bundle id because it does not reference a file contained within the userXslDir");
        }
        return formatDir;
    }
View Full Code Here

      throw new MissingParameterEx(name, el);

    String value = param.getTextTrim();

    if (value.length() == 0)
      throw new BadParameterEx(name, value);

    return value;
  }
View Full Code Here

    {
      return Integer.parseInt(value);
    }
    catch(NumberFormatException e)
    {
      throw new BadParameterEx(name, value);
    }
  }
View Full Code Here

    {
      return Integer.parseInt(value);
    }
    catch(NumberFormatException e)
    {
      throw new BadParameterEx(name, value);
    }
  }
View Full Code Here

      return true;

    if (value.equals("false") || value.equals("off") || value.equals("no"))
      return false;

    throw new BadParameterEx(name, value);
  }
View Full Code Here

TOP

Related Classes of org.fao.geonet.exceptions.BadParameterEx

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.