I'm currently on TomEE 1.7.1 PLUS (CXF 2.6.14). CXF has a bug - it cannot
handle File attachments if file name contains single quote symbol ("):

-----------------------------------------------------------------------
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
                           at java.lang.String.substring(String.java:1954)
~[na:1.8.0_25]
                           at
org.apache.cxf.attachment.AttachmentUtil.createAttachment(AttachmentUtil.java:315)
~[cxf-api-2.6.14.jar:2.6.14]
                           at
org.apache.cxf.attachment.AttachmentDeserializer.createAttachment(AttachmentDeserializer.java:289)
~[cxf-api-2.6.14.jar:2.6.14]
                           at
org.apache.cxf.attachment.AttachmentDeserializer.readNext(AttachmentDeserializer.java:192)
~[cxf-api-2.6.14.jar:2.6.14]
                           at
org.apache.cxf.attachment.LazyAttachmentCollection$1.hasNext(LazyAttachmentCollection.java:95)
~[cxf-api-2.6.14.jar:2.6.14]
                           at
org.apache.cxf.attachment.LazyDataSource.load(LazyDataSource.java:51)
~[cxf-api-2.6.14.jar:2.6.14]
                           at
org.apache.cxf.attachment.LazyDataSource.getInputStream(LazyDataSource.java:88)
~[cxf-api-2.6.14.jar:2.6.14]
                           at
javax.activation.DataHandler.getInputStream(DataHandler.java:238)
~[na:1.8.0_25]
-----------------------------------------------------------------------

CXF source (org.apache.cxf.attachment.AttachmentUtil.java):

if (fileName.indexOf("\"") > 0) {
    fileName = fileName.substring(fileName.indexOf("\"") + 1,
fileName.lastIndexOf("\""));

This is WRONG: if fileName contains single quote symbol, begin index becomes
larger than end index, and String.substring() blows up (as seen above). I
cannot control file names - files are external to my system.

This bug seems to be fixed in CXF 2.7. Can I (and how) upgrade CXF in TomEE
PLUS?




--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/How-to-upgrade-CXF-to-2-7-tp4673228.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to