Package org.fao.oaipmh.exceptions

Examples of org.fao.oaipmh.exceptions.BadArgumentException


      context.info("Exception stack trace : \n"+ Util.getStackTrace(e));

      //--- we should use another exception type but we don't have a specific
      //--- type to handle internal errors

      BadArgumentException ex = new BadArgumentException("Internal error : "+ e.getMessage());

      return OaiPmhException.marshal(ex, url, params);
    }
  }
View Full Code Here


    else if (fileType.equals("mef"))
      visitor = new MEFVisitor();
    else if (fileType.equals("mef2"))
      visitor = new MEF2Visitor();
    else
      throw new BadArgumentException("Bad file type parameter.");

    // --- import metadata from MEF, Xml, ZIP files
        final String finalPreferredSchema = preferredSchema;
        MEFLib.visit(mefFile, visitor, new IMEFVisitor() {
View Full Code Here

        String sTo = until.isDateOnly() ? until.getDateAsString() : until.toString();
        params.addContent(new Element(getDateUntil()).setText(sTo));
      }

      if (from != null && until != null && from.timeDifferenceInSeconds(until) > 0)
        throw new BadArgumentException("From is greater than until");

      if (set != null)
        params.addContent(new Element("category").setText(set));

      params.addContent(new Element("_schema").setText(prefix));
View Full Code Here

      Element elem = (Element) o;
      String  name = elem.getName();
      String  value= elem.getText();

      if (params.containsKey(name))
        throw new BadArgumentException("Parameter repeated : "+ name);

      params.put(name, value);
    }

    return params;
View Full Code Here

  private static String consumeMan(Map<String, String> params, String name) throws BadArgumentException
  {
    String value = params.get(name);

    if (value == null)
      throw new BadArgumentException("Missing '"+name+"' parameter");

    if (value.trim().length() == 0)
      throw new BadArgumentException("Empty '"+name+"' parameter");

    params.remove(name);

    return value;
  }
View Full Code Here

    if (value == null)
      return null;

    if (value.trim().length() == 0)
      throw new BadArgumentException("Empty '"+name+"' parameter");

    params.remove(name);

    return value;
  }
View Full Code Here

    {
      return new ISODate(date);
    }
    catch(Exception e)
    {
      throw new BadArgumentException("Illegal date format : "+ date);
    }
  }
View Full Code Here

    if (params.keySet().size() == 0)
      return;

    String extraParam = params.keySet().iterator().next();

    throw new BadArgumentException("Unknown extra parameter '"+ extraParam +"'");
  }
View Full Code Here

TOP

Related Classes of org.fao.oaipmh.exceptions.BadArgumentException

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.