diff --git a/sigla-ejb/src/main/java/it/cnr/contab/docamm00/service/FatturaPassivaElettronicaService.java b/sigla-ejb/src/main/java/it/cnr/contab/docamm00/service/FatturaPassivaElettronicaService.java index 90f53f2be4..a49f18be6e 100644 --- a/sigla-ejb/src/main/java/it/cnr/contab/docamm00/service/FatturaPassivaElettronicaService.java +++ b/sigla-ejb/src/main/java/it/cnr/contab/docamm00/service/FatturaPassivaElettronicaService.java @@ -938,12 +938,14 @@ public UploadedFileDataSourceStream(InputStream inputStream, String contentType) @Override public OutputStream getOutputStream() throws IOException { - throw new NotImplementedException("datasource file non implementato Stream"); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + IOUtils.copy(inputStream, output); + return output; } @Override public String getName() { - throw new NotImplementedException("Nome non implementato Stream"); + return "DATASOURCE"; } @Override @@ -971,17 +973,17 @@ public OutputStream getOutputStream() throws IOException { @Override public String getName() { - throw new NotImplementedException("Nome non implementato Output Stream"); + return "DATASOURCE"; } @Override public InputStream getInputStream() throws IOException { - throw new NotImplementedException("Nome non implementato Output Stream"); + throw new NotImplementedException("getInputStream non implementato Output Stream"); } @Override public String getContentType() { - throw new NotImplementedException("Nome non implementato Output Stream"); + return "www/unknow"; } } class UploadedFileDataSource implements DataSource { @@ -994,7 +996,13 @@ public UploadedFileDataSource(BodyPart bodypart) { @Override public OutputStream getOutputStream() throws IOException { - throw new NotImplementedException("datasource file non implementato" + bodypart.toString()); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + try { + IOUtils.copy(bodypart.getInputStream(), output); + } catch (MessagingException e) { + logger.error("UploadedFileDataSource::getOutputStream", e); + } + return output; } @Override @@ -1002,8 +1010,7 @@ public String getName() { try { return bodypart.getFileName(); } catch (MessagingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + logger.error("UploadedFileDataSource::getName", e); } return null; } @@ -1013,8 +1020,7 @@ public InputStream getInputStream() throws IOException { try { return bodypart.getInputStream(); } catch (MessagingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + logger.error("UploadedFileDataSource::getInputStream", e); } return null; } @@ -1024,8 +1030,7 @@ public String getContentType() { try { return bodypart.getContentType(); } catch (MessagingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + logger.error("UploadedFileDataSource::getContentType", e); } return null; }