@Override public String getLocalizedMessage() { return String.format("Error updating signature file:\n%s", getMessage()); }
throw new SignatureServiceException( String.format(FILE_NOT_FOUND_404, endpointUrl)); } else if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_NOT_MODIFIED) { throw new SignatureServiceException( String.format(ERROR_MESSAGE_PATTERN, endpointUrl, statusCode)); return signatureFileInfo; } catch (UnknownHostException e) { throw new SignatureServiceException( String.format(COULD_NOT_FIND_SERVER, endpointUrl)); } catch (IOException e) { throw new SignatureServiceException(e); } catch (DateParseException e) { throw new SignatureServiceException(e); } catch (ParseException e) { throw new SignatureServiceException(e); } finally { get.releaseConnection();
final int statusCode = client.executeMethod(get); if (statusCode == HttpStatus.SC_NOT_FOUND) { throw new SignatureServiceException( String.format(FILE_NOT_FOUND_404, endpointUrl)); } else if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_NOT_MODIFIED) { throw new SignatureServiceException( String.format(ERROR_MESSAGE_PATTERN, endpointUrl, statusCode)); throw new SignatureServiceException( String.format(COULD_NOT_FIND_SERVER, endpointUrl)); } catch (final IOException | DateParseException e) { throw new SignatureServiceException(e); } finally { get.releaseConnection();
throw new SignatureServiceException( String.format(FILE_NOT_FOUND_404, endpointUrl)); } else if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_NOT_MODIFIED) { throw new SignatureServiceException( String.format(ERROR_MESSAGE_PATTERN, endpointUrl, statusCode)); return signatureFileInfo; } catch (UnknownHostException e) { throw new SignatureServiceException( String.format(COULD_NOT_FIND_SERVER, endpointUrl)); } catch (IOException e) { throw new SignatureServiceException(e); } catch (DateParseException e) { throw new SignatureServiceException(e); } catch (ParseException e) { throw new SignatureServiceException(e); } finally { get.releaseConnection();
@Override public String getLocalizedMessage() { return String.format("Error updating signature file:\n%s", getMessage()); }
int statusCode = client.executeMethod(get); if (statusCode == HttpStatus.SC_NOT_FOUND) { throw new SignatureServiceException( String.format(FILE_NOT_FOUND_404, endpointUrl)); } else if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_NOT_MODIFIED) { throw new SignatureServiceException( String.format(ERROR_MESSAGE_PATTERN, endpointUrl, statusCode)); throw new SignatureServiceException( String.format(COULD_NOT_FIND_SERVER, endpointUrl)); } catch (IOException e) { throw new SignatureServiceException(e); } catch (DateParseException e) { throw new SignatureServiceException(e); } finally { get.releaseConnection();
sigInfo.setFile(outputFile); } catch (IOException e) { throw new SignatureServiceException(e); } finally { try {
/** * * {@inheritDoc} */ @Override public SignatureFileInfo importSignatureFile(final Path targetDir) throws SignatureServiceException { final Element sigFile = pronomService.getSignatureFileV1().getElement(); // get the version number, which needs to be part of the filename... final int version = Integer.valueOf(sigFile.getAttribute("Version")); final boolean deprecated = Boolean .valueOf(sigFile.getAttribute("Deprecated")); final SignatureFileInfo sigInfo = new SignatureFileInfo(version, deprecated, SignatureType.BINARY); final String fileName = String.format(filenamePattern, version); final Path outputFile = targetDir.resolve(fileName); try (final Writer writer = Files.newBufferedWriter(outputFile, UTF_8)) { final XMLSerializer serializer = new XMLSerializer(writer, new OutputFormat(Method.XML, "UTF-8", true)); serializer.serialize(sigFile); sigInfo.setFile(outputFile); } catch (final IOException e) { throw new SignatureServiceException(e); } return sigInfo; }