details: https://code.openbravo.com/erp/devel/pi/rev/82b271d48d3d changeset: 30672:82b271d48d3d user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Mon Nov 21 15:28:27 2016 +0100 summary: fixed bug 34571: Cannot attach xlsx files
It was failing because tyka detected type is too long for column size. In case type is longer than this size, it will not be saved, this is a purely informational field with no functional effect, so it is save not to store it. Resizing column, would require a table recreation which could be problematic because its volume is pontentially high. diffstat: modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diffs (25 lines): diff -r 9e84e90e2f2a -r 82b271d48d3d modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java Fri Nov 18 14:11:43 2016 -0500 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java Mon Nov 21 15:28:27 2016 +0100 @@ -92,6 +92,9 @@ @Inject private ApplicationDictionaryCachedStructures adcs; + private static final int DATA_TYPE_MAX_LENGTH = ModelProvider.getInstance() + .getEntity(Attachment.class).getProperty(Attachment.PROPERTY_DATATYPE).getFieldLength();; + /** * Method to upload files. This method calls needed handler class * @@ -152,7 +155,10 @@ strDataType = new Tika().detect(file); } catch (IOException ignore) { } - attachment.setDataType(strDataType); + + if (strDataType != null && strDataType.length() <= DATA_TYPE_MAX_LENGTH) { + attachment.setDataType(strDataType); + } OBDal.getInstance().save(attachment); ------------------------------------------------------------------------------ _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits