Example usage for org.apache.commons.logging Log error

List of usage examples for org.apache.commons.logging Log error

Introduction

In this page you can find the example usage for org.apache.commons.logging Log error.

Prototype

void error(Object message);

Source Link

Document

Logs a message with error log level.

Usage

From source file:org.objectweb.proactive.extensions.vfsprovider.client.Utils.java

public static IOException generateAndLogIOExceptionWrongStreamType(Log log, WrongStreamTypeException e) {
    log.error("File server unexpectedly does not allow to perform some type of operation on an opened stream");
    return new IOException6(
            "File server unexpectedly does not allow to perform some type of operation on an opened stream", e);
}

From source file:org.objectweb.proactive.extensions.vfsprovider.client.Utils.java

public static IOException generateAndLogIOExceptionStreamNotFound(Log log, StreamNotFoundException e) {
    log.error("File server unexpectedly closed (possibly reopened) file stream");
    return new IOException6("File server unexpectedly closed (possibly reopened) file stream", e);
}

From source file:org.objectweb.proactive.extensions.vfsprovider.client.Utils.java

public static IOException generateAndLogIOExceptionCouldNotReopen(Log log, Exception x) {
    log.error("Could not reopen stream correctly");
    return new IOException6("Could not reopen stream correctly", x);
}

From source file:org.opencms.pdftools.CmsXRLogAdapter.java

/**
 * Sends a log message to the commons-logging interface.<p>
 *
 * @param level the log level/*from   w ww .  j  ava2 s.  co m*/
 * @param message the message
 * @param log the commons logging log object
 * @param e a throwable or null
 */
private void sendMessageToLogger(Level level, String message, Log log, Throwable e) {

    if (e == null) {
        if (level == Level.SEVERE) {
            log.error(message);
        } else if (level == Level.WARNING) {
            log.warn(message);
        } else if (level == Level.INFO) {
            log.info(message);
        } else if (level == Level.CONFIG) {
            log.info(message);
        } else if ((level == Level.FINE) || (level == Level.FINER) || (level == Level.FINEST)) {
            log.debug(message);
        } else {
            log.info(message);
        }
    } else {
        if (level == Level.SEVERE) {
            log.error(message, e);
        } else if (level == Level.WARNING) {
            log.warn(message, e);
        } else if (level == Level.INFO) {
            log.info(message, e);
        } else if (level == Level.CONFIG) {
            log.info(message, e);
        } else if ((level == Level.FINE) || (level == Level.FINER) || (level == Level.FINEST)) {
            log.debug(message, e);
        } else {
            log.info(message, e);
        }
    }
}

From source file:org.opendatakit.aggregate.externalservice.FormServiceCursor.java

/**
 * Implement the generic deletion of an ExternalService task here.
 * This needs to be within a TaskLock to prevent a concurrent update of the
 * ExternalServiceCursor from leaving the ExternalServiceCursor object in the
 * database while the underlying Publisher records
 * (e.g., FusionTable2ParameterTable, GoogleSpreadsheet2ParameterTable)
 * are deleted./*from w  w w.  j ava  2s  . c  o  m*/
 *
 * @param service
 * @param cc
 * @return true if the deletion was successful
 * @throws ODKDatastoreException
 */
public static final boolean deleteExternalServiceTask(ExternalService service, CallingContext cc)
        throws ODKDatastoreException {
    Datastore ds = cc.getDatastore();
    User user = cc.getCurrentUser();
    String uriExternalService = service.getFormServiceCursor().getUri();
    TaskLock taskLock = ds.createTaskLock(user);
    String pLockId = UUID.randomUUID().toString();
    boolean deleted = false;
    try {
        if (taskLock.obtainLock(pLockId, uriExternalService, TaskLockType.UPLOAD_SUBMISSION)) {
            taskLock = null;
            service.delete(cc);
            deleted = true;
        }
    } catch (ODKTaskLockException e1) {
        e1.printStackTrace();
    } finally {
        if (!deleted) {
            Log logger = LogFactory.getLog(FormServiceCursor.class);
            logger.error("Unable to delete FormServiceCursor: " + service.getFormServiceCursor().getUri());
        }
    }
    taskLock = ds.createTaskLock(user);
    try {
        for (int i = 0; i < 10; i++) {
            if (taskLock.releaseLock(pLockId, uriExternalService, TaskLockType.UPLOAD_SUBMISSION))
                break;
            try {
                Thread.sleep(PersistConsts.MIN_SETTLE_MILLISECONDS);
            } catch (InterruptedException e) {
                // just move on, this retry mechanism is to only
                // make things
                // nice
            }
        }
    } catch (ODKTaskLockException e) {
        e.printStackTrace();
    }
    return deleted;
}

From source file:org.opendatakit.aggregate.odktables.impl.api.FileManifestServiceImpl.java

@Override
public Response getAppLevelFileManifest(HttpHeaders httpHeaders,
        @PathParam("odkClientVersion") String odkClientVersion)
        throws PermissionDeniedException, ODKDatastoreException, ODKTaskLockException {

    FileManifestManager manifestManager = new FileManifestManager(appId, odkClientVersion, cc);
    OdkTablesFileManifest manifest = null;

    // retrieve the incoming if-none-match eTag...
    List<String> eTags = httpHeaders.getRequestHeader(HttpHeaders.IF_NONE_MATCH);
    String eTag = (eTags == null || eTags.isEmpty()) ? null : eTags.get(0);
    DbManifestETagEntity eTagEntity = null;
    try {/*from w w  w  .j  a va2 s .c o  m*/
        try {
            eTagEntity = DbManifestETags.getTableIdEntry(DbManifestETags.APP_LEVEL, cc);
        } catch (ODKEntityNotFoundException e) {
            // ignore...
        }
        if (eTag != null && eTagEntity != null && eTag.equals(eTagEntity.getManifestETag())) {
            return Response.status(Status.NOT_MODIFIED).header(HttpHeaders.ETAG, eTag)
                    .header(ApiConstants.OPEN_DATA_KIT_VERSION_HEADER, ApiConstants.OPEN_DATA_KIT_VERSION)
                    .header("Access-Control-Allow-Origin", "*")
                    .header("Access-Control-Allow-Credentials", "true").build();
        }
        // we want just the app-level files.
        manifest = manifestManager.getManifestForAppLevelFiles();

    } catch (ODKDatastoreException e) {
        Log log = LogFactory.getLog(FileManifestServiceImpl.class);
        log.error("Datastore exception in getting the file manifest");
        e.printStackTrace();
    }
    if (manifest == null) {
        return Response.status(Status.INTERNAL_SERVER_ERROR).entity("Unable to retrieve manifest.")
                .header(ApiConstants.OPEN_DATA_KIT_VERSION_HEADER, ApiConstants.OPEN_DATA_KIT_VERSION)
                .header("Access-Control-Allow-Origin", "*").header("Access-Control-Allow-Credentials", "true")
                .build();
    } else {
        String newETag = Integer.toHexString(manifest.hashCode());
        // create a new eTagEntity if there isn't one already...
        if (eTagEntity == null) {
            eTagEntity = DbManifestETags.createNewEntity(DbManifestETags.APP_LEVEL, cc);
            eTagEntity.setManifestETag(newETag);
            eTagEntity.put(cc);
        } else if (!newETag.equals(eTagEntity.getManifestETag())) {
            Log log = LogFactory.getLog(FileManifestServiceImpl.class);
            log.error("App-level Manifest ETag does not match computed value!");
            eTagEntity.setManifestETag(newETag);
            eTagEntity.put(cc);
        }
        // and whatever the eTag is in that entity is the eTag we should return...
        eTag = eTagEntity.getManifestETag();

        UriBuilder ub = info.getBaseUriBuilder();
        ub.path(OdkTables.class, "getFilesService");
        // now supply the downloadUrl...
        for (OdkTablesFileManifestEntry entry : manifest.getFiles()) {
            URI self = ub.clone().path(FileService.class, "getFile").build(appId, odkClientVersion,
                    entry.filename);
            try {
                entry.downloadUrl = self.toURL().toExternalForm();
            } catch (MalformedURLException e) {
                e.printStackTrace();
                throw new IllegalArgumentException("Unable to convert to URL");
            }
        }

        return Response.ok(manifest).header(HttpHeaders.ETAG, eTag)
                .header(ApiConstants.OPEN_DATA_KIT_VERSION_HEADER, ApiConstants.OPEN_DATA_KIT_VERSION)
                .header("Access-Control-Allow-Origin", "*").header("Access-Control-Allow-Credentials", "true")
                .build();
    }
}

From source file:org.opendatakit.aggregate.odktables.impl.api.FileManifestServiceImpl.java

@Override
public Response getTableIdFileManifest(HttpHeaders httpHeaders,
        @PathParam("odkClientVersion") String odkClientVersion, @PathParam("tableId") String tableId)
        throws PermissionDeniedException, ODKDatastoreException, ODKTaskLockException {

    FileManifestManager manifestManager = new FileManifestManager(appId, odkClientVersion, cc);
    OdkTablesFileManifest manifest = null;

    // retrieve the incoming if-none-match eTag...
    List<String> eTags = httpHeaders.getRequestHeader(HttpHeaders.IF_NONE_MATCH);
    String eTag = (eTags == null || eTags.isEmpty()) ? null : eTags.get(0);
    DbManifestETagEntity eTagEntity = null;
    try {/*from   w w w . j  a  v  a  2 s.  c o m*/
        try {
            eTagEntity = DbManifestETags.getTableIdEntry(tableId, cc);
        } catch (ODKEntityNotFoundException e) {
            // ignore...
        }
        if (eTag != null && eTagEntity != null && eTag.equals(eTagEntity.getManifestETag())) {
            return Response.status(Status.NOT_MODIFIED).header(HttpHeaders.ETAG, eTag)
                    .header(ApiConstants.OPEN_DATA_KIT_VERSION_HEADER, ApiConstants.OPEN_DATA_KIT_VERSION)
                    .header("Access-Control-Allow-Origin", "*")
                    .header("Access-Control-Allow-Credentials", "true").build();
        }
        // we want just the files for the table.
        manifest = manifestManager.getManifestForTable(tableId);
    } catch (ODKDatastoreException e) {
        Log log = LogFactory.getLog(FileManifestServiceImpl.class);
        log.error("Datastore exception in getting the file manifest");
        e.printStackTrace();
    }
    if (manifest == null) {
        return Response.status(Status.INTERNAL_SERVER_ERROR).entity("Unable to retrieve manifest.")
                .header(ApiConstants.OPEN_DATA_KIT_VERSION_HEADER, ApiConstants.OPEN_DATA_KIT_VERSION)
                .header("Access-Control-Allow-Origin", "*").header("Access-Control-Allow-Credentials", "true")
                .build();
    } else {
        String newETag = Integer.toHexString(manifest.hashCode());
        // create a new eTagEntity if there isn't one already...
        if (eTagEntity == null) {
            eTagEntity = DbManifestETags.createNewEntity(tableId, cc);
            eTagEntity.setManifestETag(newETag);
            eTagEntity.put(cc);
        } else if (!newETag.equals(eTagEntity.getManifestETag())) {
            Log log = LogFactory.getLog(FileManifestServiceImpl.class);
            log.error("Table-level (" + tableId + ") Manifest ETag does not match computed value!");
            eTagEntity.setManifestETag(newETag);
            eTagEntity.put(cc);
        }
        // and whatever the eTag is in that entity is the eTag we should return...
        eTag = eTagEntity.getManifestETag();

        UriBuilder ub = info.getBaseUriBuilder();
        ub.path(OdkTables.class, "getFilesService");
        // now supply the downloadUrl...
        for (OdkTablesFileManifestEntry entry : manifest.getFiles()) {
            URI self = ub.clone().path(FileService.class, "getFile").build(appId, odkClientVersion,
                    entry.filename);
            try {
                entry.downloadUrl = self.toURL().toExternalForm();
            } catch (MalformedURLException e) {
                e.printStackTrace();
                throw new IllegalArgumentException("Unable to convert to URL");
            }
        }

        return Response.ok(manifest).header(HttpHeaders.ETAG, eTag)
                .header(ApiConstants.OPEN_DATA_KIT_VERSION_HEADER, ApiConstants.OPEN_DATA_KIT_VERSION)
                .header("Access-Control-Allow-Origin", "*").header("Access-Control-Allow-Credentials", "true")
                .build();
    }
}

From source file:org.opendatakit.aggregate.odktables.impl.api.InstanceFileServiceImpl.java

@Override
public Response getManifest(@Context HttpHeaders httpHeaders,
        @QueryParam(PARAM_AS_ATTACHMENT) String asAttachment) throws IOException {

    UriBuilder ub = info.getBaseUriBuilder();
    ub.path(OdkTables.class, "getTablesService");
    UriBuilder full = ub.clone().path(TableService.class, "getRealizedTable")
            .path(RealizedTableService.class, "getInstanceFiles")
            .path(InstanceFileService.class, "getManifest");
    URI self = full.build(appId, tableId, schemaETag, rowId);
    String manifestUrl = self.toURL().toExternalForm();

    // retrieve the incoming if-none-match eTag...
    List<String> eTags = httpHeaders.getRequestHeader(HttpHeaders.IF_NONE_MATCH);
    String eTag = (eTags == null || eTags.isEmpty()) ? null : eTags.get(0);
    DbTableInstanceManifestETagEntity eTagEntity = null;
    try {/*from   www .  j  ava 2 s .  c o  m*/
        try {
            eTagEntity = DbTableInstanceManifestETags.getRowIdEntry(tableId, rowId, cc);
        } catch (ODKEntityNotFoundException e) {
            // ignore...
        }

        if (eTag != null && eTagEntity != null && eTag.equals(eTagEntity.getManifestETag())) {
            return Response.status(Status.NOT_MODIFIED).header(HttpHeaders.ETAG, eTag)
                    .header(ApiConstants.OPEN_DATA_KIT_VERSION_HEADER, ApiConstants.OPEN_DATA_KIT_VERSION)
                    .header("Access-Control-Allow-Origin", "*")
                    .header("Access-Control-Allow-Credentials", "true").build();
        }

        userPermissions.checkPermission(appId, tableId, TablePermission.READ_ROW);

        ArrayList<OdkTablesFileManifestEntry> manifestEntries = new ArrayList<OdkTablesFileManifestEntry>();
        DbTableInstanceFiles blobStore = new DbTableInstanceFiles(tableId, cc);
        BlobEntitySet instance = blobStore.getBlobEntitySet(rowId, cc);

        int count = instance.getAttachmentCount(cc);
        for (int i = 1; i <= count; ++i) {
            OdkTablesFileManifestEntry entry = new OdkTablesFileManifestEntry();
            entry.filename = instance.getUnrootedFilename(i, cc);
            entry.contentLength = instance.getContentLength(i, cc);
            entry.contentType = instance.getContentType(i, cc);
            entry.md5hash = instance.getContentHash(i, cc);

            URI getFile = ub.clone().path(TableService.class, "getRealizedTable")
                    .path(RealizedTableService.class, "getInstanceFiles")
                    .path(InstanceFileService.class, "getFile")
                    .build(appId, tableId, schemaETag, rowId, entry.filename);
            String locationUrl = getFile.toURL().toExternalForm();
            entry.downloadUrl = locationUrl;

            manifestEntries.add(entry);
        }
        OdkTablesFileManifest manifest = new OdkTablesFileManifest(manifestEntries);

        String newETag = Integer.toHexString(manifest.hashCode());
        // create a new eTagEntity if there isn't one already...
        if (eTagEntity == null) {
            eTagEntity = DbTableInstanceManifestETags.createNewEntity(tableId, rowId, cc);
            eTagEntity.setManifestETag(newETag);
            eTagEntity.put(cc);
        } else if (!newETag.equals(eTagEntity.getManifestETag())) {
            Log log = LogFactory.getLog(FileManifestServiceImpl.class);
            log.error("TableInstance (" + tableId + "," + rowId
                    + ") Manifest ETag does not match computed value!");
            eTagEntity.setManifestETag(newETag);
            eTagEntity.put(cc);
        }

        // and whatever the eTag is in that entity is the eTag we should return...
        eTag = eTagEntity.getManifestETag();

        ResponseBuilder rBuild = Response.ok(manifest).header(HttpHeaders.ETAG, eTag)
                .header(ApiConstants.OPEN_DATA_KIT_VERSION_HEADER, ApiConstants.OPEN_DATA_KIT_VERSION)
                .header("Access-Control-Allow-Origin", "*").header("Access-Control-Allow-Credentials", "true");
        if (asAttachment != null && !"".equals(asAttachment)) {
            // Set the filename we're downloading to the disk.
            rBuild.header(HtmlConsts.CONTENT_DISPOSITION,
                    "attachment; " + "filename=\"" + "manifest.json" + "\"");
        }
        return rBuild.build();
    } catch (ODKDatastoreException e) {
        e.printStackTrace();
        return Response.status(Status.INTERNAL_SERVER_ERROR)
                .entity("Unable to retrieve manifest of attachments for: " + manifestUrl)
                .header(ApiConstants.OPEN_DATA_KIT_VERSION_HEADER, ApiConstants.OPEN_DATA_KIT_VERSION)
                .header("Access-Control-Allow-Origin", "*").header("Access-Control-Allow-Credentials", "true")
                .build();
    } catch (PermissionDeniedException e) {
        String msg = e.getMessage();
        if (msg == null) {
            msg = e.toString();
        }
        LOGGER.error(("ODKTables file upload permissions error: " + msg));
        return Response.status(Status.FORBIDDEN).entity(new Error(ErrorType.PERMISSION_DENIED, msg))
                .header(ApiConstants.OPEN_DATA_KIT_VERSION_HEADER, ApiConstants.OPEN_DATA_KIT_VERSION)
                .header("Access-Control-Allow-Origin", "*").header("Access-Control-Allow-Credentials", "true")
                .build();
    }
}

From source file:org.opendatakit.aggregate.parser.SubmissionParser.java

/**
 * Helper Constructor an ODK submission by processing XML submission to
 * extract values//  w  w w. j  a v a  2  s . c o  m
 * 
 * @param inputStreamXML
 *          xml submission input stream
 * @param isIncomplete
 * 
 * @throws IOException
 * @throws ODKFormNotFoundException
 *           thrown if a form is not found with a matching ODK ID
 * @throws ODKParseException
 * @throws ODKIncompleteSubmissionData
 * @throws ODKConversionException
 * @throws ODKDatastoreException
 * @throws ODKFormSubmissionsDisabledException
 */
private void constructorHelper(InputStream inputStreamXML, boolean isIncomplete, CallingContext cc)
        throws IOException, ODKFormNotFoundException, ODKParseException, ODKIncompleteSubmissionData,
        ODKConversionException, ODKDatastoreException, ODKFormSubmissionsDisabledException {
    try {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(true);
        factory.setIgnoringComments(true);
        factory.setCoalescing(true);
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document doc = builder.parse(inputStreamXML);
        root = doc.getDocumentElement();
        // if debugging: printNode(root);

        // check for odk id
        formId = root.getAttribute(ParserConsts.FORM_ID_ATTRIBUTE_NAME);

        // if odk id is not present use namespace
        if (formId.equalsIgnoreCase(BasicConsts.EMPTY_STRING)) {
            String schema = root.getAttribute(ParserConsts.NAMESPACE_ATTRIBUTE);

            // TODO: move this into FormDefinition?
            if (schema == null) {
                throw new ODKIncompleteSubmissionData(Reason.ID_MISSING);
            }

            formId = schema;
        }

    } catch (ParserConfigurationException e) {
        throw new IOException(e);
    } catch (SAXException e) {
        e.printStackTrace();
        throw new IOException(e);
    }

    // need to escape all slashes... for xpath processing...
    formId = formId.replaceAll(ParserConsts.FORWARD_SLASH, ParserConsts.FORWARD_SLASH_SUBSTITUTION);

    String fullyQualifiedId = FormFactory.extractWellFormedFormId(formId);

    form = FormFactory.retrieveFormByFormId(fullyQualifiedId, cc);
    if (!form.getSubmissionEnabled()) {
        throw new ODKFormSubmissionsDisabledException();
    }

    String modelVersionString = root.getAttribute(ParserConsts.MODEL_VERSION_ATTRIBUTE_NAME);
    String uiVersionString = root.getAttribute(ParserConsts.UI_VERSION_ATTRIBUTE_NAME);
    Long modelVersion = null;
    Long uiVersion = null;
    if (modelVersionString != null && modelVersionString.length() > 0) {
        modelVersion = Long.valueOf(modelVersionString);
    }
    if (uiVersionString != null && uiVersionString.length() > 0) {
        uiVersion = Long.valueOf(uiVersionString);
    }

    String instanceId = getOpenRosaInstanceId();
    if (instanceId == null) {
        instanceId = root.getAttribute(ParserConsts.INSTANCE_ID_ATTRIBUTE_NAME);
        if (instanceId == null || instanceId.length() == 0) {
            instanceId = CommonFieldsBase.newUri();
        }
    }

    Date submissionDate = new Date();
    String submissionDateString = root.getAttribute(ParserConsts.SUBMISSION_DATE_ATTRIBUTE_NAME);
    if (submissionDateString != null && submissionDateString.length() != 0) {
        submissionDate = WebUtils.parseDate(submissionDateString);
    }

    Date markedAsCompleteDate = new Date();
    String markedAsCompleteDateString = root.getAttribute(ParserConsts.MARKED_AS_COMPLETE_DATE_ATTRIBUTE_NAME);
    if (markedAsCompleteDateString != null && markedAsCompleteDateString.length() != 0) {
        markedAsCompleteDate = WebUtils.parseDate(markedAsCompleteDateString);
    }

    // retrieve the record with this instanceId from the database or
    // create a new one. This supports submissions having more than
    // 10MB of attachments. In that case, ODK Collect will post the
    // submission in multiple parts and Aggregate needs to be able to
    // merge the parts together. This SHOULD NOT be used to 'update'
    // an existing submission, only to attach additional binary content
    // to an already-uploaded submission.
    boolean preExisting = false;
    try {
        Datastore ds = cc.getDatastore();
        User user = cc.getCurrentUser();
        TopLevelInstanceData fi = (TopLevelInstanceData) ds.getEntity(
                form.getTopLevelGroupElement().getFormDataModel().getBackingObjectPrototype(), instanceId,
                user);
        try {
            submission = new Submission(fi, form, cc);
        } catch (ODKDatastoreException e) {
            Log logger = LogFactory.getLog(Submission.class);
            e.printStackTrace();
            logger.error("Unable to reconstruct submission for " + fi.getSchemaName() + "." + fi.getTableName()
                    + " uri " + fi.getUri());
            if ((e instanceof ODKEntityNotFoundException) || (e instanceof ODKEnumeratedElementException)) {
                // this is a malformed submission...
                // try to clean this up...
                DeleteHelper.deleteDamagedSubmission(fi, form.getAllBackingObjects(), cc);
            }
            throw e;
        }
        preExisting = true;
        preExistingComplete = submission.isComplete();
    } catch (ODKEntityNotFoundException e) {
        submission = new Submission(modelVersion, uiVersion, instanceId, form, submissionDate, cc);
    }

    topLevelTableKey = submission.getKey();

    Map<String, Integer> repeatGroupIndices = new HashMap<String, Integer>();
    FormElementModel formRoot = form.getTopLevelGroupElement();
    // if the submission is pre-existing in the datastore, ONLY update binaries
    boolean uploadAllBinaries = processSubmissionElement(formRoot, root, submission, repeatGroupIndices,
            preExisting, cc);
    submission.setIsComplete(uploadAllBinaries);
    if (uploadAllBinaries) {
        submission.setMarkedAsCompleteDate(markedAsCompleteDate);
    }
    // save the elements inserted into the top-level submission
    try {
        submission.persist(cc);
    } catch (Exception e) {
        List<EntityKey> keys = new ArrayList<EntityKey>();
        submission.recursivelyAddEntityKeysForDeletion(keys, cc);
        keys.add(submission.getKey());
        try {
            DeleteHelper.deleteEntities(keys, cc);
        } catch (Exception ex) {
            // ignore... we are rolling back...
        }
        throw new ODKDatastoreException("Unable to persist data", e);
    }
}

From source file:org.opendatakit.aggregate.query.submission.QueryByDateRange.java

@Override
public List<Submission> getResultSubmissions(CallingContext cc)
        throws ODKIncompleteSubmissionData, ODKDatastoreException {

    List<Submission> retrievedSubmissions = new ArrayList<Submission>();

    QueryResult result = query.executeQuery(startCursor, fetchLimit);

    resumeCursor = result.getResumeCursor();

    // retrieve submissions
    List<? extends CommonFieldsBase> submissionEntities = result.getResultList();

    // create a row for each submission
    for (int count = 0; count < submissionEntities.size(); count++) {
        CommonFieldsBase subEntity = submissionEntities.get(count);
        try {//from  ww w  . java  2  s .  c o  m
            retrievedSubmissions.add(new Submission((TopLevelDynamicBase) subEntity, getForm(), cc));
        } catch (ODKDatastoreException e) {
            Log logger = LogFactory.getLog(QueryByUIFilterGroup.class);
            e.printStackTrace();
            logger.error("Unable to reconstruct submission for " + subEntity.getSchemaName() + "."
                    + subEntity.getTableName() + " uri " + subEntity.getUri());

            if ((e instanceof ODKEntityNotFoundException) || (e instanceof ODKEnumeratedElementException)) {
                // see if we should throw an error or skip processing...
                Boolean skip = ServerPreferencesProperties.getSkipMalformedSubmissions(cc);
                if (skip) {
                    continue;
                } else {
                    throw e;
                }
            } else {
                throw e;
            }
        }
    }
    return retrievedSubmissions;
}