Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Texo] Using BLOBs
[Texo] Using BLOBs [message #1065889] Fri, 28 June 2013 07:24 Go to next message
Bastian Wagenfeld is currently offline Bastian WagenfeldFriend
Messages: 183
Registered: January 2013
Senior Member
Hi Martin,

I just ran into another ClassCastException. Texo tries to cast an JSONArray to a Byte Array. So my question is: Is it a bug in Texo or do I have to annotate this ByteArray somehow? The column in the database was automatically set as a LargeBLOB type.

Here's the trace:
java.lang.ClassCastException: org.json.JSONArray cannot be cast to [B
	at de.cmp.test.texo.planes.PlanesModelFactory$ImageGaugeModelObject.eSet(PlanesModelFactory.java:3457)
	at org.eclipse.emf.texo.json.JSONModelConverter.eSet(JSONModelConverter.java:81)
	at org.eclipse.emf.texo.json.BaseJSONModelConverter.convertSingleEAttribute(BaseJSONModelConverter.java:436)
	at org.eclipse.emf.texo.json.BaseJSONModelConverter.convertContent(BaseJSONModelConverter.java:225)
	at org.eclipse.emf.texo.json.BaseJSONModelConverter.doConvert(BaseJSONModelConverter.java:113)
	at org.eclipse.emf.texo.json.BaseJSONModelConverter.convertManyEReference(BaseJSONModelConverter.java:376)
	at org.eclipse.emf.texo.json.BaseJSONModelConverter.convertContent(BaseJSONModelConverter.java:220)
	at org.eclipse.emf.texo.json.BaseJSONModelConverter.doConvert(BaseJSONModelConverter.java:113)
	at org.eclipse.emf.texo.json.BaseJSONModelConverter.convert(BaseJSONModelConverter.java:105)
	at org.eclipse.emf.texo.server.service.json.JSONServiceContext.getRequestData(JSONServiceContext.java:94)
	at org.eclipse.emf.texo.server.service.UpdateInsertModelOperation.internalExecute(UpdateInsertModelOperation.java:45)
	at org.eclipse.emf.texo.server.service.ModelOperation.execute(ModelOperation.java:59)
	at org.eclipse.emf.texo.server.web.WebServiceHandler.doPost(WebServiceHandler.java:111)
	at org.eclipse.emf.texo.server.web.WebServiceServlet.doPost(WebServiceServlet.java:65)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at de.cmp.test.filter.DatabaseSwitchFilter.doFilter(DatabaseSwitchFilter.java:42)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)


And that's the json sent to the server:
{"update":[],"_eclass":"request|ActionType","delete":[],"insert":[{"icon":[-119,80,...96,-126],"_eclass":"planes|ImageGauge","name":"test","_uri":"http://localhost:8080/test2/jsonws/planes|ImageGauge/1372403948903?tempUriNum=1#","_title":"test"}],"_title":""}


I removed the values in the byte array to shorten it a little. So he seems to think it is an JSONArray, because of the brackets []. Is there a way to tell Texo, it isn't?

Best regards
Bastian
Re: [Texo] Using BLOBs [message #1065905 is a reply to message #1065889] Fri, 28 June 2013 08:28 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Bastian,
This is probably an unsupported feature in Texo, I did not think about blobs being sent within json. Can you enter a
bugzilla for this?
Or if you are stuck you can override the JSONModelConverter and convert it in the correct way for this case.

gr. Martin

On 06/28/2013 09:24 AM, Bastian Wagenfeld wrote:
> Hi Martin,
>
> I just ran into another ClassCastException. Texo tries to cast an JSONArray to a Byte Array. So my question is: Is it a
> bug in Texo or do I have to annotate this ByteArray somehow? The column in the database was automatically set as a
> LargeBLOB type.
>
> Here's the trace:
> java.lang.ClassCastException: org.json.JSONArray cannot be cast to [B
> at de.cmp.test.texo.planes.PlanesModelFactory$ImageGaugeModelObject.eSet(PlanesModelFactory.java:3457)
> at org.eclipse.emf.texo.json.JSONModelConverter.eSet(JSONModelConverter.java:81)
> at org.eclipse.emf.texo.json.BaseJSONModelConverter.convertSingleEAttribute(BaseJSONModelConverter.java:436)
> at org.eclipse.emf.texo.json.BaseJSONModelConverter.convertContent(BaseJSONModelConverter.java:225)
> at org.eclipse.emf.texo.json.BaseJSONModelConverter.doConvert(BaseJSONModelConverter.java:113)
> at org.eclipse.emf.texo.json.BaseJSONModelConverter.convertManyEReference(BaseJSONModelConverter.java:376)
> at org.eclipse.emf.texo.json.BaseJSONModelConverter.convertContent(BaseJSONModelConverter.java:220)
> at org.eclipse.emf.texo.json.BaseJSONModelConverter.doConvert(BaseJSONModelConverter.java:113)
> at org.eclipse.emf.texo.json.BaseJSONModelConverter.convert(BaseJSONModelConverter.java:105)
> at org.eclipse.emf.texo.server.service.json.JSONServiceContext.getRequestData(JSONServiceContext.java:94)
> at org.eclipse.emf.texo.server.service.UpdateInsertModelOperation.internalExecute(UpdateInsertModelOperation.java:45)
> at org.eclipse.emf.texo.server.service.ModelOperation.execute(ModelOperation.java:59)
> at org.eclipse.emf.texo.server.web.WebServiceHandler.doPost(WebServiceHandler.java:111)
> at org.eclipse.emf.texo.server.web.WebServiceServlet.doPost(WebServiceServlet.java:65)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at de.cmp.test.filter.DatabaseSwitchFilter.doFilter(DatabaseSwitchFilter.java:42)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
> at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
> at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
> at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
> at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
> at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> at java.lang.Thread.run(Thread.java:722)
>
> And that's the json sent to the server:
> {"update":[],"_eclass":"request|ActionType","delete":[],"insert":[{"icon":[-119,80,...96,-126],"_eclass":"planes|ImageGauge","name":"test","_uri":"http://localhost:8080/test2/jsonws/planes|ImageGauge/1372403948903?tempUriNum=1#","_title":"test"}],"_title":""}
>
>
> I removed the values in the byte array to shorten it a little. So he seems to think it is an JSONArray, because of the
> brackets []. Is there a way to tell Texo, it isn't?
>
> Best regards
> Bastian


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Texo] Using BLOBs [message #1065941 is a reply to message #1065905] Fri, 28 June 2013 12:31 Go to previous message
Bastian Wagenfeld is currently offline Bastian WagenfeldFriend
Messages: 183
Registered: January 2013
Senior Member
Hi Martin,

I wrote a feature request: https://bugs.eclipse.org/bugs/show_bug.cgi?id=411874
So far I solved it by parsing the JSONArray manually.

Best regards
Bastian
Previous Topic:Problem with generate the EEF plguin with Acceleo
Next Topic:[Texo] ClassCastException String cast to JSONObject
Goto Forum:
  


Current Time: Fri Apr 26 06:03:36 GMT 2024

Powered by FUDForum. Page generated in 0.02378 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top