Closed lucrus73 closed 9 years ago
I cloned the master repo and fixed this issue locally a few minutes ago, however I never used github before and got lost while trying to understand how to send you my commit. Please advice.
if you send me the code i could test it (have the same problem) and make a pull request to @thiagolocatelli can merge it to master.
yes, send a pull request and I will merge the changes right away... :) Thanks guys
On Fri, Sep 5, 2014 at 8:51 AM, Daniel Rodríguez Millán < notifications@github.com> wrote:
if you send me the code i could test it (have the same problem) and make a pull request to @thiagolocatelli https://github.com/thiagolocatelli can merge it to master.
— Reply to this email directly or view it on GitHub https://github.com/thiagolocatelli/parse4j/issues/17#issuecomment-54620668 .
"thiago:locatelli$gmail:com".replace(':','.').replace('$','@')
Here is the output of git diff, hope that's what you need.
diff --git a/src/main/java/org/parse4j/ParseObject.java b/src/main/java/org/parse4j/ParseObject.java index b6ed735..537598c 100644 --- a/src/main/java/org/parse4j/ParseObject.java +++ b/src/main/java/org/parse4j/ParseObject.java @@ -337,6 +337,17 @@ public class ParseObject { } public void put(String key, Object value) { + put(key, value, false); + } + + /** + * + * @param key + * @param value + * @param disableChecks some checks have to be skipped during fetch. Currently the only + * effect of passing true here is to disable the check on uploaded files. See issue #17 on github. + */ + protected void put(String key, Object value, boolean disableChecks) { if (key == null) { LOGGER.error("key may not be null."); @@ -354,7 +365,7 @@ public class ParseObject { "ParseFile must be saved before being set on a ParseObject."); } - if (value instanceof ParseFile && !((ParseFile) value).isUploaded()) { + if (value instanceof ParseFile && !((ParseFile) value).isUploaded() && !disableChecks) { LOGGER.error("ParseFile must be saved before being set on a ParseObject."); throw new IllegalArgumentException( "ParseFile must be saved before being set on a ParseObject."); @@ -712,7 +723,11 @@ public class ParseObject { } - protected void setData(JSONObject jsonObject) { + protected void setData(JSONObject jsonObject) { + setData(jsonObject, false); + } + + protected void setData(JSONObject jsonObject, boolean disableChecks) { Iterator> it = jsonObject.keys(); while (it.hasNext()) { @@ -722,7 +737,7 @@ public class ParseObject { setReservedKey(key, value); } else { - put(key, ParseDecoder.decode(value)); + put(key, ParseDecoder.decode(value), disableChecks); } } diff --git a/src/main/java/org/parse4j/ParseQuery.java b/src/main/java/org/parse4j/ParseQuery.java index 2359e77..6339f27 100644 --- a/src/main/java/org/parse4j/ParseQuery.java +++ b/src/main/java/org/parse4j/ParseQuery.java @@ -524,13 +524,21 @@ public class ParseQuery{ if(clazz != null) { T po = (T) clazz.newInstance(); JSONObject obj = (JSONObject) objs.get(i); - po.setData(obj); + + /* + We disable some checks while setting data in objects during fetch because + those checks are useful only when setting data from client + code. The "true" argument disables such checks. + */ + po.setData(obj, true); results.add((T) po); } else { ParseObject po = new ParseObject(getClassName()); JSONObject obj = (JSONObject) objs.get(i); - po.setData(obj); + + // see above for the "true" argument + po.setData(obj, true); results.add((T) po); } }
Any news?
I had this issue, but it was fixed with https://github.com/thiagolocatelli/parse4j/commit/f2c1306a3fab79291bf89bba77ce92b1682b31e7
I'm having this issue, but I'm using maven and don't know how to change the file so it works. Can I use the library somehow without maven?
EDIT: I see that the problem was fixed but I'm still getting the error...
EDIT2: Solved by downloading library from http://thiagolocatelli.github.io/parse4j/ and loading the project directly on IntelliJ.
hi guys, Is this issue fixed in ver 1.3 ?
I'm still get this error when I got data
I'm not sure, but I suspect 1.3 will always have the issue, because I reported the bug against 1.3 in the first place... maybe my patch will be included in a future release, maybe not, but 1.3 was released before I reported the bug.
Can you upload the latest version to maven repository? Thanks
I will manage to get the new version out there as soon as I can! Thank you
On Mon, Mar 2, 2015 at 9:19 AM, Gareth Lacey notifications@github.com wrote:
Can you upload the latest version to maven repository? Thanks
— Reply to this email directly or view it on GitHub https://github.com/thiagolocatelli/parse4j/issues/17#issuecomment-76718692 .
"thiago:locatelli$gmail:com".replace(':','.').replace('$','@')
I see the readme has been updated saying that v1.4 is available but it doesn't appear to be working in maven.
What kinda of error are you getting?
On Mon, Mar 2, 2015 at 3:16 PM, Gareth Lacey notifications@github.com wrote:
I see the readme has been updated saying that v1.4 is available but it doesn't appear to be working in maven.
— Reply to this email directly or view it on GitHub https://github.com/thiagolocatelli/parse4j/issues/17#issuecomment-76806829 .
"thiago:locatelli$gmail:com".replace(':','.').replace('$','@')
Missing artifact com.github.thiagolocatelli:parse4j:jar:1.4. 1.3 works fine though.
Thats interesting, I just tested it here and it is working, let me retry after deleting my .m2 folder
On Mon, Mar 2, 2015 at 3:28 PM, Gareth Lacey notifications@github.com wrote:
Missing artifact com.github.thiagolocatelli:parse4j:jar:1.4. 1.3 works fine though.
— Reply to this email directly or view it on GitHub https://github.com/thiagolocatelli/parse4j/issues/17#issuecomment-76810604 .
"thiago:locatelli$gmail:com".replace(':','.').replace('$','@')
It's not on here either: http://mvnrepository.com/artifact/com.github.thiagolocatelli/parse4j
its available here:
http://search.maven.org/#artifactdetails%7Ccom.github.thiagolocatelli%7Cparse4j%7C1.4%7Cjar
I have just removed my .m2 folder and forced the project to download the jar again and it worked fine for me
On Mon, Mar 2, 2015 at 3:30 PM, Gareth Lacey notifications@github.com wrote:
It's not on here either: http://mvnrepository.com/artifact/com.github.thiagolocatelli/parse4j
— Reply to this email directly or view it on GitHub https://github.com/thiagolocatelli/parse4j/issues/17#issuecomment-76811570 .
"thiago:locatelli$gmail:com".replace(':','.').replace('$','@')
I have managed to fix it. Thanks for the help!
No problem
On Mon, Mar 2, 2015 at 3:37 PM, Gareth Lacey notifications@github.com wrote:
I have managed to fix it. Thanks for the help!
— Reply to this email directly or view it on GitHub https://github.com/thiagolocatelli/parse4j/issues/17#issuecomment-76813993 .
"thiago:locatelli$gmail:com".replace(':','.').replace('$','@')
I use the following code with parse4j 1.3 in a wicket web application:
The find() call raises an IllegalArgumentException: ParseFile must be saved before being set on a ParseObject. However I'm not saving any object, I'm only fetching. Here is my Event class:
Here is the relevant part of the stack trace:
Caused by: java.lang.IllegalArgumentException: ParseFile must be saved before being set on a ParseObject. at org.parse4j.ParseObject.put(ParseObject.java:359) at org.parse4j.ParseObject.setData(ParseObject.java:725) at org.parse4j.ParseQuery.find(ParseQuery.java:499)