/** * Gets any detail messages, preferring the <code>Server</code> locale. * * @return The detail messages, with {num}-indexed placeholders populated, * if needed. */ public String[] getDetails() { return getDetails(Server.getLocale()); }
/** * Gets any detail messages, preferring the provided locale. * * @return The detail messages, with {num}-indexed placeholders populated, * if needed. */ public String[] getDetails(Locale locale) { if (m_details == null || m_details.length == 0) { return s_emptyStringArray; } String[] ret = new String[m_details.length]; for (int i = 0; i < m_details.length; i++) { ret[i] = getLocalizedOrCode(m_bundleName, locale, m_code, null); } return ret; }
throw new MelcoeXacmlException(e.getMessage(), e);
+ se.getClass().getName() + ": " + se.getMessage()); se.printStackTrace(); } catch (Throwable th) { System.out.println("Error while replicating: "
/** * {@inheritDoc} */ public Set<Triple> getTriplesForObject(DOReader reader) throws ResourceIndexException { try{ Triple triple = new SimpleTriple(new SimpleURIReference( new URI(Constants.FEDORA.uri.concat(reader.GetObjectPID()))), new SimpleURIReference(PREDICATE), new SimpleLiteral("true")); return Collections.singleton(triple); } catch (ServerException e){ throw new ResourceIndexException(e.getLocalizedMessage(),e); } catch (URISyntaxException e){ throw new ResourceIndexException(e.getLocalizedMessage(),e); } }
/** * Uploads a file encoded in a multipart/form message. * * @param multipart * the multiPart object containing the file to be uploaded * @return a URI with the (custom) uploaded:// scheme and a unique * identifier to be used future ingests. Returns 202 if request succeeds */ @POST @Consumes(MediaType.MULTIPART_FORM_DATA) public Response upload(MultipartBody multipart){ Attachment file = multipart.getAttachment("file"); if (file == null) { return Response.status(400).entity("Missing file part").type(MediaType.TEXT_PLAIN).build(); } InputStream fileStream = file.getObject(InputStream.class); String uploaded; try { uploaded = m_management.putTempStream(getContext(), fileStream); logger.debug("File uploaded: ", uploaded); } catch (ServerException e) { logger.error(e.toString()); return handleException(e, false); } return Response.status(Response.Status.ACCEPTED).entity(uploaded).type( MediaType.TEXT_PLAIN).build(); } }
private void processException(Throwable e) { if (e instanceof ServerException) { System.err.println("ServerException: code='" + ((ServerException) e).getCode() + "', class='" + e.getClass().getName() + "'"); StackTraceElement[] traces = e.getStackTrace(); for (StackTraceElement element : traces) { System.err.println(element); } Throwable cause = e.getCause(); if (cause != null) { cause.printStackTrace(); } fail("Threw a ServerException"); } else { e.printStackTrace(); fail("Threw an exception"); } }
throw new MelcoeXacmlException(e.getMessage(), e);
+ se.getClass().getName() + ": " + se.getMessage()); se.printStackTrace(); } catch (Throwable th) { System.out.println("Error while replicating: "
/** * {@inheritDoc} */ public Set<Triple> getTriplesForObject(DOReader reader) throws ResourceIndexException { try{ Triple triple = new SimpleTriple(new SimpleURIReference( new URI(Constants.FEDORA.uri.concat(reader.GetObjectPID()))), new SimpleURIReference(PREDICATE), new SimpleLiteral("true")); return Collections.singleton(triple); } catch (ServerException e){ throw new ResourceIndexException(e.getLocalizedMessage(),e); } catch (URISyntaxException e){ throw new ResourceIndexException(e.getLocalizedMessage(),e); } }
/** * Uploads a file encoded in a multipart/form message. * * @param multipart * the multiPart object containing the file to be uploaded * @return a URI with the (custom) uploaded:// scheme and a unique * identifier to be used future ingests. Returns 202 if request succeeds */ @POST @Consumes(MediaType.MULTIPART_FORM_DATA) public Response upload(MultipartBody multipart){ Attachment file = multipart.getAttachment("file"); if (file == null) { return Response.status(400).entity("Missing file part").type(MediaType.TEXT_PLAIN).build(); } InputStream fileStream = file.getObject(InputStream.class); String uploaded; try { uploaded = m_management.putTempStream(getContext(), fileStream); logger.debug("File uploaded: ", uploaded); } catch (ServerException e) { logger.error(e.toString()); return handleException(e, false); } return Response.status(Response.Status.ACCEPTED).entity(uploaded).type( MediaType.TEXT_PLAIN).build(); } }
+ pid + " - " + e.getMessage(), e);
/** * Gets the message, preferring the provided locale. * * <p>When a message in the desired locale is not found, the locale * selection logic described by <a * href="http://java.sun.com/j2se/1.4/docs/api/java/util/ResourceBundle.html">the * java.util.ResourceBundle</a> class javadoc is used. * * @param locale * The preferred locale. * @return The message, with {num}-indexed placeholders populated, if * needed. */ public String getMessage(Locale locale) { return getLocalizedOrCode(m_bundleName, locale, m_code, m_values); }
/** * Gets any detail messages, preferring the <code>Server</code> locale. * * @return The detail messages, with {num}-indexed placeholders populated, * if needed. */ public String[] getDetails() { return getDetails(Server.getLocale()); }
logger.warn("Object " + pid + " couldn't be removed from FieldSearch index (" + se.getMessage() + "), but that might be ok; continuing with purge"); } else { logger.error("Object " + pid + " couldn't be removed from FieldSearch index (" + se.getMessage() + ")");
/** * Gets the message, preferring the provided locale. * * <p>When a message in the desired locale is not found, the locale * selection logic described by <a * href="http://java.sun.com/j2se/1.4/docs/api/java/util/ResourceBundle.html">the * java.util.ResourceBundle</a> class javadoc is used. * * @param locale * The preferred locale. * @return The message, with {num}-indexed placeholders populated, if * needed. */ public String getMessage(Locale locale) { return getLocalizedOrCode(m_bundleName, locale, m_code, m_values); }
public static SoapFault getFault(ServerException se) { String[] details = se.getDetails(); String detailString = ""; if (details.length > 0) { StringBuilder buf = new StringBuilder(); String className = se.getClass().getName(); for (String element : details) { buf.append("<detail>"); buf.append(className); buf.append(": "); buf.append(element); buf.append("</detail>\n"); } detailString = buf.toString(); } SoapFault fault = new SoapFault(detailString, se, SoapFault.FAULT_CODE_CLIENT); return fault; }
logger.warn("Object " + pid + " couldn't be removed from FieldSearch index (" + se.getMessage() + "), but that might be ok; continuing with purge"); } else { logger.error("Object " + pid + " couldn't be removed from FieldSearch index (" + se.getMessage() + ")");
/** * Gets any detail messages, preferring the provided locale. * * @return The detail messages, with {num}-indexed placeholders populated, * if needed. */ public String[] getDetails(Locale locale) { if (m_details == null || m_details.length == 0) { return s_emptyStringArray; } String[] ret = new String[m_details.length]; for (int i = 0; i < m_details.length; i++) { ret[i] = getLocalizedOrCode(m_bundleName, locale, m_code, null); } return ret; }
public static SoapFault getFault(ServerException se) { String[] details = se.getDetails(); String detailString = ""; if (details.length > 0) { StringBuilder buf = new StringBuilder(); String className = se.getClass().getName(); for (String element : details) { buf.append("<detail>"); buf.append(className); buf.append(": "); buf.append(element); buf.append("</detail>\n"); } detailString = buf.toString(); } SoapFault fault = new SoapFault(detailString, se, SoapFault.FAULT_CODE_CLIENT); return fault; }