Example usage for javax.naming SizeLimitExceededException printStackTrace

List of usage examples for javax.naming SizeLimitExceededException printStackTrace

Introduction

In this page you can find the example usage for javax.naming SizeLimitExceededException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:SearchCountLimit.java

public static void printSearchEnumeration(NamingEnumeration srhEnum) {
    int count = 0;
    try {/*from w  w w. j a  va2s . c om*/
        while (srhEnum.hasMore()) {
            SearchResult sr = (SearchResult) srhEnum.next();
            System.out.println(">>>" + sr.getName());
            ++count;
        }
        System.out.println("number of answers: " + count);
    } catch (SizeLimitExceededException e) {
        if (count == expected)
            System.out.println("number of answers: " + count);
        else
            e.printStackTrace();
    } catch (NamingException e) {
        e.printStackTrace();
    }
}

From source file:edu.ucsd.library.dams.api.DAMSAPIServlet.java

private InputBundle multipartInput(HttpServletRequest req, String objid, String cmpid, String fileid)
        throws IOException, SizeLimitExceededException {
    // process parts
    Map<String, String[]> params = new HashMap<String, String[]>();
    params.putAll(req.getParameterMap());
    InputStream in = null;//from  www  . ja v a 2 s.  co m
    FileItemFactory factory = new DiskFileItemFactory();
    ServletFileUpload upload = new ServletFileUpload(factory);
    if (maxUploadSize != -1L) {
        upload.setSizeMax(maxUploadSize);
    }
    List items = null;
    try {
        items = upload.parseRequest(req);
    } catch (SizeLimitExceededException ex) {
        throw ex;
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    for (int i = 0; items != null && i < items.size(); i++) {
        FileItem item = (FileItem) items.get(i);
        // form fields go in parameter map
        if (item.isFormField()) {
            params.put(item.getFieldName(), new String[] { item.getString() });
            log.debug("Parameter: " + item.getFieldName() + " = " + item.getString());
        }
        // file gets opened as an input stream
        else {
            in = item.getInputStream();
            log.debug("File: " + item.getFieldName() + ", " + item.getName());
            params.put("sourceFileName", new String[] { item.getName() });
        }
    }

    // if no file upload found, check for locally-staged file
    if (in == null) {
        in = alternateStream(params, objid, cmpid, fileid);
    }
    return new InputBundle(params, in);
}