haipv1108 / androjena

Automatically exported from code.google.com/p/androjena
0 stars 0 forks source link

Model.read RDF file -> ExpatParser$ParseException #12

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create InputStream from RDF file as an application raw resource
2. Call model.read(is,null);

What is the expected output?
Parsing of the RDF file to work, and for the model to contain the triples in 
the RDF file.

What do you see instead?
The error in the attached androjena_log.txt

What version of Android runs on your device/emulated AVD? (please put an X
next to the correct version)
Android 2.3 (Gingerbread) - X
Android 4.0 (Ice Cream Sandwich) -X

What version of Android is your application targeting? (please put an X
next to the correct version)
Android 2.3 (Gingerbread) - X
Android 4.0 (target = 15) (Ice Cream Sandwich) - X

What IDE/environment are you developing with? (Eclipse w/ ADT, Android SDK
w/ Apache Ant, ...)
Eclipse + Android SDK r19.

What operating system and hardware is your IDE/development environment
running on?
Fedora Linux i686

Please attach the following application files (when applicable):
- a full LogCat dump from application launch to exception/crash DONE
- a meaningful portion of the source code where the exception is thrown DONE

Please provide any additional detail below
Note: I am using all jars that are packaged with androjena:
icu4j-3.4.5.jar
iri-0.8.jar
slf4j-android-1.6.1-RC1.jar
androjena_0.5.jar

Here are the permissions in the manifest file:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission 
android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission 
android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission 
android:name="android.permission.READ_PHONE_STATE"></uses-permission>

Original issue reported on code.google.com by robstewa...@gmail.com on 24 Apr 2012 at 1:54

Attachments:

GoogleCodeExporter commented 8 years ago
This isn't an androjena error; seems like android cannot read the raw resource, 
so the xml parser (ExpatParser) fails. From the Android reference 
(http://developer.android.com/reference/android/content/res/Resources.html#openR
awResource(int)):

openRawResource: This can only be used with resources whose value is the name 
of an asset files -- that is, it can be used to open drawable, sound, and raw 
resources; it will fail on string and color resources.

Please try to embed the rdf file as an asset, that is, put it in the assets 
folder in the root of the app project, and open it with:

InputStream fis = getAssets().open("rdf_file_name.rdf");

Let me know if this solves the issue,
bye
lorenzo

Original comment by loreca...@gmail.com on 24 Apr 2012 at 4:30

GoogleCodeExporter commented 8 years ago
If the previous suggestion doesn't work, it could be a problem related to the 
rdf file itself, such as bad form or unrecognized encoding, so please upload 
the rdf file so that i can try to parse it locally.

Original comment by loreca...@gmail.com on 24 Apr 2012 at 4:57

GoogleCodeExporter commented 8 years ago
So, your suggestion did not work unfortunately. Note that the test.rdf passes 
the W3C RDF validator check.

Model model = ModelFactory.createDefaultModel();
InputStream fis = getAssets().open("test.rdf");
model.read(fis,null);

Attached:
- test.rdf
- androjena_log2.txt <- The error using the getAssets() approach

Original comment by robstewa...@gmail.com on 24 Apr 2012 at 5:07

Attachments:

GoogleCodeExporter commented 8 years ago
I see from the new logcat that the exception has changed; now the error seems 
to be related to ICU4J not being able to read one of the data files that are 
bundled in icu4j-3.4.5.jar. This never happened before and is very strange, 
I'll do some deeper debugging and get back to you. It would be very helpful if 
you could attach the whole eclipse project, thanks.

Original comment by loreca...@gmail.com on 24 Apr 2012 at 5:34

GoogleCodeExporter commented 8 years ago
Hi.. just following this up.

Did you find anything when you looked into the fact that ICU4J not reading one 
of the data files bundled with icu4j-3.4.5.jar ?

Original comment by robstewa...@gmail.com on 23 May 2012 at 9:03