private static RuntimeException createParamConversionException(ParameterType pType, Exception ex) { // // For path, query & matrix parameters this is 404, // for others 400... // if (pType == ParameterType.PATH || pType == ParameterType.QUERY || pType == ParameterType.MATRIX) { return ExceptionUtils.toNotFoundException(ex, null); } return ExceptionUtils.toBadRequestException(ex, null); } public static <T> T createFromParameterHandler(String value,
private List<LogRecord> getLogRecords(int index, SearchCondition<LogRecord> theSearch) { List<LogRecord> list = new LinkedList<LogRecord>(); if (storage != null) { int storageSize = storage.getSize(); if (recordsSize == -1 || index < storageSize) { storage.load(list, theSearch, index, 1); } else if (index < recordsSize) { list.add(records.get(index - storageSize)); } } else { list.add(records.get(index)); } if (list.size() != 1) { throw ExceptionUtils.toNotFoundException(null, null); } return list; }
private static Object checkSubResultObject(Object result, String subResourcePath) { result = checkResultObject(result); if (result == null) { org.apache.cxf.common.i18n.Message errorM = new org.apache.cxf.common.i18n.Message("NULL_SUBRESOURCE", BUNDLE, subResourcePath); LOG.info(errorM.toString()); throw ExceptionUtils.toNotFoundException(null, null); } return result; }
private static Object checkResultObject(Object result, String subResourcePath) { //the result becomes the object that will handle the request if (result != null) { if (result instanceof MessageContentsList) { result = ((MessageContentsList)result).get(0); } else if (result instanceof List) { result = ((List<?>)result).get(0); } else if (result.getClass().isArray()) { result = ((Object[])result)[0]; } } if (result == null) { org.apache.cxf.common.i18n.Message errorM = new org.apache.cxf.common.i18n.Message("NULL_SUBRESOURCE", BUNDLE, subResourcePath); LOG.info(errorM.toString()); throw ExceptionUtils.toNotFoundException(null, null); } return result; }
throw ExceptionUtils.toNotFoundException(nfe, null);
Response resp = JAXRSUtils.createResponse(resources, message, errorMsg.toString(), Response.Status.NOT_FOUND.getStatusCode(), false); throw ExceptionUtils.toNotFoundException(null, resp);
Response resp = JAXRSUtils.createResponse(null, message, errorMsg.toString(), Response.Status.NOT_FOUND.getStatusCode(), false); throw ExceptionUtils.toNotFoundException(null, resp);
subResourcePath); LOG.severe(errorM.toString()); throw ExceptionUtils.toNotFoundException(null, null);
subResourcePath); LOG.severe(errorM.toString()); throw ExceptionUtils.toNotFoundException(null, null);