Thread: Re: [json-lib-user] What causes: Property 'x' has no read method. SKIPPED?
Brought to you by:
aalmiray
From: Andres A. <aal...@ya...> - 2008-06-29 06:23:59
|
Hi Christopher, Json-lib relies on PropertyDescriptors to find which properties may be serialized into JSON. In your case there is a class that has a write-only property name geometryN (usually it just has a setter method). Perhaps the property descriptor for 'geometryN' is actually for an indexed property and not a regular one. Without a proper bounded limit for that indexed property it may be hard to retrieve any values. I agree that the message is not quite clear on which class is the owner of that property, I'll fix that for the next release. Let me think what can be done with indexed properties, you can tweak the serialization process with JsonValueProcessors or JsonBeanProcessors for the time being. Cheers, Andres ------------------------------------------- http://jroller.com/aalmiray http://www.linkedin.com/in/aalmiray -- What goes up, must come down. Ask any system administrator. There are 10 types of people in the world: Those who understand binary, and those who don't. To understand recursion, we must first understand recursion. ----- Original Message ---- From: Christopher Hunt <hu...@in...> To: jso...@li... Sent: Saturday, June 28, 2008 10:55:34 PM Subject: [json-lib-user] What causes: Property 'x' has no read method. SKIPPED? Hi there, Thanks for providing JSON-LIB. I think that it is great. I have received the following warning in my logs: WARN 2008-06-29 14:30:20,999 [connector.stdio.0.dispatcher.1] net.sf.json.JSONObject: Property 'geometryN' has no read method. SKIPPED Can you please shed some more light on what conditions cause the message to appear? Additionally is there a means to determine the class that is actually causing the problem? I'm using the Java Topology Suite and can only see two instances of its Geometry type in my code (there is a public getGeometryN(int n) method associated with the Geometry class). I also have the following setup for JSON-LIB which really should capture Geometry conversions: JsonConfig jsonConfig = new JsonConfig(); jsonConfig.registerJsonValueProcessor(Coordinate.class, new JsonValueProcessor() { public Object processArrayValue(Object arg0, JsonConfig arg1) { Coordinate coord = (Coordinate) arg0; return "{x:" + coord.x + ",y:" + coord.y + ",z:" + coord.z + "}"; } public Object processObjectValue(String arg0, Object arg1, JsonConfig arg2) { return processArrayValue(arg1, arg2); } }); jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.NOPROP); jsonConfig.setJsonPropertyFilter(new PropertyFilter() { public boolean apply(Object source, String name, Object value) { boolean filterOut = false; if (source instanceof Geometry) { filterOut = (!name.equals("coordinates") && !name .equals("SRID")); } return filterOut; } }); JSONObject jsonObject = JSONObject.fromObject(this, jsonConfig); return jsonObject.toString(); Help is appreciated. Cheers, -C ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ json-lib-user mailing list jso...@li... https://lists.sourceforge.net/lists/listinfo/json-lib-user |
From: Andres A. <aal...@ya...> - 2008-06-29 07:00:16
|
Hi Christopher, It looks to me that your filter is configured to filter out every single property of a Geometry class/subclass unless its name is 'coordinates' or 'SRID', still it tries to process other properties? Ahh I see JSONObject:737, the filter is applied only if the property has a read method. Let me see if it can be changed. Btw, filed 2005661 Add class name to skipped properties messages and fixed it already. Cheers, Andres ------------------------------------------- http://jroller.com/aalmiray http://www.linkedin.com/in/aalmiray -- What goes up, must come down. Ask any system administrator. There are 10 types of people in the world: Those who understand binary, and those who don't. To understand recursion, we must first understand recursion. ----- Original Message ---- From: Christopher Hunt <hu...@in...> To: Andres Almiray <aal...@ya...> Cc: jso...@li... Sent: Saturday, June 28, 2008 11:46:45 PM Subject: Re: [json-lib-user] What causes: Property 'x' has no read method. SKIPPED? Hi Andres, Thanks for your email. My reply: Json-lib relies on PropertyDescriptors to find which properties may be serialized into JSON. In your case there is a class that has a write-only property name geometryN (usually it just has a setter method). I think it is a read-only property... Here's the class reference: http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html Perhaps the property descriptor for 'geometryN' is actually for an indexed property and not a regular one. Yes it is. Without a proper bounded limit for that indexed property it may be hard to retrieve any values. I agree that the message is not quite clear on which class is the owner of that property, I'll fix that for the next release. Let me think what can be done with indexed properties, you can tweak the serialization process with JsonValueProcessors or JsonBeanProcessors for the time being.OK. Thanks. I understand the work-around - but I'm still not clear on why the warning appears when I've told JSON to filter my Geometry instances... Perhaps my filter is wrong? Cheers, -C |
From: Christopher H. <hu...@in...> - 2008-06-29 07:16:59
|
Wonderful! Thanks. Shall I download from the source repository, build and test? Cheers, -C On 29/06/2008, at 5:00 PM, Andres Almiray wrote: > Hi Christopher, > > It looks to me that your filter is configured to filter out every > single property of a Geometry class/subclass unless its name is > 'coordinates' or 'SRID', still it tries to process other properties? > > Ahh I see JSONObject:737, the filter is applied only if the property > has a read method. Let me see if it can be changed. > Btw, filed 2005661 Add class name to skipped properties messages and > fixed it already. > > Cheers, > Andres > > ------------------------------------------- > http://jroller.com/aalmiray > http://www.linkedin.com/in/aalmiray > -- > What goes up, must come down. Ask any system administrator. > There are 10 types of people in the world: Those who understand > binary, and those who don't. > To understand recursion, we must first understand recursion. > > > ----- Original Message ---- > From: Christopher Hunt <hu...@in...> > To: Andres Almiray <aal...@ya...> > Cc: jso...@li... > Sent: Saturday, June 28, 2008 11:46:45 PM > Subject: Re: [json-lib-user] What causes: Property 'x' has no read > method. SKIPPED? > > Hi Andres, > > Thanks for your email. My reply: > >> Json-lib relies on PropertyDescriptors to find which properties may >> be serialized into JSON. >> In your case there is a class that has a write-only property name >> geometryN (usually it just >> has a setter method). > I think it is a read-only property... Here's the class reference: > > http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html > >> Perhaps the property descriptor for 'geometryN' is actually for an >> indexed >> property and not a regular one. > Yes it is. > >> Without a proper bounded limit for that indexed property it may >> be hard to retrieve any values. >> >> I agree that the message is not quite clear on which class is the >> owner of that property, I'll fix that >> for the next release. Let me think what can be done with indexed >> properties, you can tweak the >> serialization process with JsonValueProcessors or >> JsonBeanProcessors for the time being. > OK. Thanks. I understand the work-around - but I'm still not clear > on why the warning appears when I've told JSON to filter my Geometry > instances... Perhaps my filter is wrong? > > Cheers, > -C > > |
From: Andres A. <aal...@ya...> - 2008-06-29 19:04:06
|
Hi Christopher, Yes, please feel free to grab a copy from the cvs repo and test it (you'll need maven+ant to build the package). Further review on how the code works with filters, it is impossible to move the filters from their current place, as they also require the property's value. If no read method is available for the property then the value can't be retrieved. There are two other options at your disposal: 1) JsonConfig.setExcludes() 2) register a JsonBeanProcessor #1 is the most straightforward and less intrusive. The exclusion list does not discriminate using the source class, only the matching property name. #2 requires you to provided the full serialization of the target class. It is a bit less intrusive that having the target class implement JSONString. I recommend you to go with option #1 to filter out unwanted properties of Geometry that the filtered mechanism can't touch. Cheers, Andres ------------------------------------------- http://jroller.com/aalmiray http://www.linkedin.com/in/aalmiray -- What goes up, must come down. Ask any system administrator. There are 10 types of people in the world: Those who understand binary, and those who don't. To understand recursion, we must first understand recursion. ----- Original Message ---- From: Christopher Hunt <hu...@in...> To: Andres Almiray <aal...@ya...> Cc: jso...@li... Sent: Sunday, June 29, 2008 12:16:54 AM Subject: Re: [json-lib-user] What causes: Property 'x' has no read method. SKIPPED? Wonderful! Thanks. Shall I download from the source repository, build and test? Cheers, -C On 29/06/2008, at 5:00 PM, Andres Almiray wrote: Hi Christopher, It looks to me that your filter is configured to filter out every single property of a Geometry class/subclass unless its name is 'coordinates' or 'SRID', still it tries to process other properties? Ahh I see JSONObject:737, the filter is applied only if the property has a read method. Let me see if it can be changed. Btw, filed 2005661 Add class name to skipped properties messages and fixed it already. Cheers, Andres ------------------------------------------- http://jroller.com/aalmiray http://www.linkedin.com/in/aalmiray -- What goes up, must come down. Ask any system administrator. There are 10 types of people in the world: Those who understand binary, and those who don't. To understand recursion, we must first understand recursion. ----- Original Message ---- From: Christopher Hunt <hu...@in...> To: Andres Almiray <aal...@ya...> Cc: jso...@li... Sent: Saturday, June 28, 2008 11:46:45 PM Subject: Re: [json-lib-user] What causes: Property 'x' has no read method. SKIPPED? Hi Andres, Thanks for your email. My reply: Json-lib relies on PropertyDescriptors to find which properties may be serialized into JSON. In your case there is a class that has a write-only property name geometryN (usually it just has a setter method).I think it is a read-only property... Here's the class reference: http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html Perhaps the property descriptor for 'geometryN' is actually for an indexed property and not a regular one.Yes it is. Without a proper bounded limit for that indexed property it may be hard to retrieve any values. I agree that the message is not quite clear on which class is the owner of that property, I'll fix that for the next release. Let me think what can be done with indexed properties, you can tweak the serialization process with JsonValueProcessors or JsonBeanProcessors for the time being.OK. Thanks. I understand the work-around - but I'm still not clear on why the warning appears when I've told JSON to filter my Geometry instances... Perhaps my filter is wrong? Cheers, -C |
From: Christopher H. <hu...@in...> - 2008-07-05 22:56:30
|
Hi Andres, By way of closure to this thread I'm now using a bean processor and all is well. Thanks for your help. Cheers, -C |
From: Christopher H. <hu...@in...> - 2008-06-29 06:46:50
|
Hi Andres, Thanks for your email. My reply: > Json-lib relies on PropertyDescriptors to find which properties may > be serialized into JSON. > In your case there is a class that has a write-only property name > geometryN (usually it just > has a setter method). I think it is a read-only property... Here's the class reference: http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html > Perhaps the property descriptor for 'geometryN' is actually for an > indexed > property and not a regular one. Yes it is. > Without a proper bounded limit for that indexed property it may > be hard to retrieve any values. > > I agree that the message is not quite clear on which class is the > owner of that property, I'll fix that > for the next release. Let me think what can be done with indexed > properties, you can tweak the > serialization process with JsonValueProcessors or JsonBeanProcessors > for the time being. OK. Thanks. I understand the work-around - but I'm still not clear on why the warning appears when I've told JSON to filter my Geometry instances... Perhaps my filter is wrong? Cheers, -C |