Closed Antpachon closed 12 years ago
I am able to shore the string you have pasted above. Here's the source code:
MyEntity.java
@Entity class MyEntity extends Model<MyEntity>{ public String text; }
Main.java main
method:
SQLite db = new SQLite("foo.db~");
MappingSession.registerDatabase(db);
MappingSession.start();
MyEntity m = new MyEntity();
m.text = "<![CDATA[<div id='new'><div class=\"chapeaux\"><ul>";
m.insert();
System.out.println(m.countAll()); // count is now 1.
It works on me. How exactly do you pass your string to your field? Maybe we can investigate further if you show us more of your code.
Try with a % it seems the ' is not the problem
Putting a %
does not reproduce the exception on me. (and please just paste all the exception message here next time, it does not cost extra money.)
It looks like issue #32 which is fixed. Can you please download the latest build from the Downloads page?
Yes, it's issue #32 I'll download the new build. Thanks!
The issue still
E/AndroidRuntime(1075): FATAL EXCEPTION: AsyncTask #1 11-10 15:56:52.448: E/AndroidRuntime(1075): java.lang.RuntimeException: An error occured while executing doInBackground() 11-10 15:56:52.448: E/AndroidRuntime(1075): at android.os.AsyncTask$3.done(AsyncTask.java:266) 11-10 15:56:52.448: E/AndroidRuntime(1075): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273) 11-10 15:56:52.448: E/AndroidRuntime(1075): at java.util.concurrent.FutureTask.setException(FutureTask.java:124) 11-10 15:56:52.448: E/AndroidRuntime(1075): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307) 11-10 15:56:52.448: E/AndroidRuntime(1075): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 11-10 15:56:52.448: E/AndroidRuntime(1075): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081) 11-10 15:56:52.448: E/AndroidRuntime(1075): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574) 11-10 15:56:52.448: E/AndroidRuntime(1075): at java.lang.Thread.run(Thread.java:1020) 11-10 15:56:52.448: E/AndroidRuntime(1075): Caused by: java.util.MissingFormatArgumentException: Format specifier: l 11-10 15:56:52.448: E/AndroidRuntime(1075): at java.util.Formatter.getArgument(Formatter.java:1132) 11-10 15:56:52.448: E/AndroidRuntime(1075): at java.util.Formatter.doFormat(Formatter.java:1097) 11-10 15:56:52.448: E/AndroidRuntime(1075): at java.util.Formatter.format(Formatter.java:1063) 11-10 15:56:52.448: E/AndroidRuntime(1075): at java.util.Formatter.format(Formatter.java:1032) 11-10 15:56:52.448: E/AndroidRuntime(1075): at java.lang.String.format(String.java:2104) 11-10 15:56:52.448: E/AndroidRuntime(1075): at java.lang.String.format(String.java:2078) 11-10 15:56:52.448: E/AndroidRuntime(1075): at org.orman.util.logging.AndroidLogger.trace(AndroidLogger.java:22) 11-10 15:56:52.448: E/AndroidRuntime(1075): at org.orman.util.logging.Log.trace(Log.java:48) 11-10 15:56:
Are you omitting rest of this error message call stack? It prevents me to locate the bug.
The exceptions ocurs in the insert() statement when I insert something with %, without that it is working
I'm inserting this : Telefónica gana 2.733 millones hasta septiembre, un 69% menos por el coste del ERE
11-11 10:48:51.860: E/AndroidRuntime(7106): FATAL EXCEPTION: AsyncTask #1 11-11 10:48:51.860: E/AndroidRuntime(7106): java.lang.RuntimeException: An error occured while executing doInBackground() 11-11 10:48:51.860: E/AndroidRuntime(7106): at android.os.AsyncTask$3.done(AsyncTask.java:266) 11-11 10:48:51.860: E/AndroidRuntime(7106): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273) 11-11 10:48:51.860: E/AndroidRuntime(7106): at java.util.concurrent.FutureTask.setException(FutureTask.java:124) 11-11 10:48:51.860: E/AndroidRuntime(7106): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307) 11-11 10:48:51.860: E/AndroidRuntime(7106): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 11-11 10:48:51.860: E/AndroidRuntime(7106): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081) 11-11 10:48:51.860: E/AndroidRuntime(7106): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574) 11-11 10:48:51.860: E/AndroidRuntime(7106): at java.lang.Thread.run(Thread.java:1020) 11-11 10:48:51.860: E/AndroidRuntime(7106): Caused by: java.util.MissingFormatArgumentException: Format specifier: m 11-11 10:48:51.860: E/AndroidRuntime(7106): at java.util.Formatter.getArgument(Formatter.java:1132) 11-11 10:48:51.860: E/AndroidRuntime(7106): at java.util.Formatter.doFormat(Formatter.java:1097) 11-11 10:48:51.860: E/AndroidRuntime(7106): at java.util.Formatter.format(Formatter.java:1063) 11-11 10:48:51.860: E/AndroidRuntime(7106): at java.util.Formatter.format(Formatter.java:1032) 11-11 10:48:51.860: E/AndroidRuntime(7106): at java.lang.String.format(String.java:2104) 11-11 10:48:51.860: E/AndroidRuntime(7106): at org.orman.util.logging.AndroidLogger.trace(AndroidLogger.java:22) 11-11 10:48:51.860: E/AndroidRuntime(7106): at org.orman.util.logging.Log.trace(Log.java:48) 11-11 10:48:51.860: E/AndroidRuntime(7106): at rtve.tablet.thread.ConnectionTask.doInBackground(ConnectionTask.java:52) 11-11 10:48:51.860: E/AndroidRuntime(7106): at rtve.tablet.thread.ConnectionTask.doInBackground(ConnectionTask.java:1) 11-11 10:48:51.860: E/AndroidRuntime(7106): at android.os.AsyncTask$2.call(AsyncTask.java:252) 11-11 10:48:51.860: E/AndroidRuntime(7106): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 11-11 10:48:51.860: E/AndroidRuntime(7106): ... 4 more
I understand you but I could not reproduce exception in my computer. I can save a string that includes %
in Android. I also don't see insert
method in the stack trace you pasted above. I need to see that. Please paste your full exception stack trace.
This issue was related to %
characters that appear in log messages, fixed before.
I need to store a string like this :
And it's giving me Bad format exception in the insert query because of the ' and the %
How can I avoid this?