Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException: at org.readium.r2_streamer.server.EpubServer.addLinks (EpubServer.java:68) #215

Closed
hackstarsj opened this issue Jun 14, 2018 · 11 comments

Comments

@hackstarsj
Copy link

private void addLinks(EpubPublication publication, String filePath) {
containsMediaOverlay = false;
for (Link link : publication.links) {
if (link.rel.contains("media-overlay")) {
containsMediaOverlay = true;
link.href = link.href.replace("port", "localhost:" + getListeningPort() + filePath);
}
}

Please Fix this Also

@prilaga
Copy link

prilaga commented Jun 18, 2018

I had the same issue:

`06-18 05:48:08.241 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha I/System.out: EpubContainer Reading epub at path: /storage/emulated/0/Android/data/de.appcuisine.tigermedia.tigerbooks.alpha/files/1478407.epub
06-18 05:48:08.241 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha I/System.out: EpubContainer Reading file at path: mimetype
06-18 05:48:08.287 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha I/System.out: EpubContainer Reading file at path: META-INF/container.xml
06-18 05:48:08.289 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha I/System.out: EpubContainer Reading file at path: content.opf
06-18 05:48:08.290 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha I/System.out: OPFParser rootFile:= content.opf
06-18 05:48:08.290 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha I/System.out: EpubContainer Reading file at path: toc.ncx
06-18 05:48:08.294 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: org.xml.sax.SAXParseException: expected: '>' actual: '"' (position:DOCDECL ncxPUBLIC @1:59 in java.io.StringReader@9e52fce)
06-18 05:48:08.294 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:146)
06-18 05:48:08.294 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at org.readium.r2_streamer.parser.EpubParser.xmlParser(EpubParser.java:129)
06-18 05:48:08.297 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at org.readium.r2_streamer.parser.NCXParser.parseNCXFile(NCXParser.java:37)
06-18 05:48:08.298 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at org.readium.r2_streamer.parser.OPFParser.parseSpineAndResourcesAndGuide(OPFParser.java:375)
06-18 05:48:08.298 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at org.readium.r2_streamer.parser.OPFParser.parseOpfFile(OPFParser.java:186)
06-18 05:48:08.298 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at org.readium.r2_streamer.parser.EpubParser.parseEpubFile(EpubParser.java:46)
06-18 05:48:08.298 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at org.readium.r2_streamer.server.EpubServer.parse(EpubServer.java:90)
06-18 05:48:08.299 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at org.readium.r2_streamer.server.EpubServer.addEpub(EpubServer.java:40)
06-18 05:48:08.299 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at com.folioreader.ui.folio.activity.FolioActivity.addEpub(FolioActivity.java:175)
06-18 05:48:08.300 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at com.folioreader.ui.folio.activity.FolioActivity.initBook(FolioActivity.java:163)
06-18 05:48:08.301 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at com.folioreader.ui.folio.activity.FolioActivity.setupBook(FolioActivity.java:399)
06-18 05:48:08.301 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at com.folioreader.ui.folio.activity.FolioActivity.onCreate(FolioActivity.java:134)
06-18 05:48:08.301 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at android.app.Activity.performCreate(Activity.java:6664)
06-18 05:48:08.301 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
06-18 05:48:08.301 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
06-18 05:48:08.301 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
06-18 05:48:08.301 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at android.app.ActivityThread.-wrap12(ActivityThread.java)
06-18 05:48:08.302 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
06-18 05:48:08.302 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
06-18 05:48:08.303 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at android.os.Looper.loop(Looper.java:154)
06-18 05:48:08.303 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6077)
06-18 05:48:08.303 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at java.lang.reflect.Method.invoke(Native Method)
06-18 05:48:08.303 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
06-18 05:48:08.303 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
06-18 05:48:08.303 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha I/System.out: EpubParser parserEpubFile() error org.readium.r2_streamer.parser.EpubParserException: Error while parsing
06-18 05:48:08.305 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha D/AndroidRuntime: Shutting down VM
06-18 05:48:08.315 3435-3435/de.appcuisine.tigermedia.tigerbooks.alpha E/AndroidRuntime: FATAL EXCEPTION: main
Process: de.appcuisine.tigermedia.tigerbooks.alpha, PID: 3435
java.lang.Error: FATAL EXCEPTION [main]
Unity version : 2017.2.0f3
Device model : Genymotion Google Nexus 9 - 7.0.0 - API 24 - 1536x2048
Device fingerprint: Android/vbox86p/vbox86p:7.0/NRD90M/genymo09131924:userdebug/test-keys

                                                                                     Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{de.appcuisine.tigermedia.tigerbooks.alpha/com.folioreader.ui.folio.activity.FolioActivity}: java.lang.NullPointerException: Attempt to read from field 'java.util.List org.readium.r2_streamer.model.publication.EpubPublication.links' on a null object reference
                                                                                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
                                                                                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
                                                                                         at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
                                                                                         at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                         at android.os.Looper.loop(Looper.java:154)
                                                                                         at android.app.ActivityThread.main(ActivityThread.java:6077)
                                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
                                                                                      Caused by: java.lang.NullPointerException: Attempt to read from field 'java.util.List org.readium.r2_streamer.model.publication.EpubPublication.links' on a null object reference
                                                                                         at org.readium.r2_streamer.server.EpubServer.addLinks(EpubServer.java:68)
                                                                                         at org.readium.r2_streamer.server.EpubServer.addEpub(EpubServer.java:42)
                                                                                         at com.folioreader.ui.folio.activity.FolioActivity.addEpub(FolioActivity.java:175)
                                                                                         at com.folioreader.ui.folio.activity.FolioActivity.initBook(FolioActivity.java:163)
                                                                                         at com.folioreader.ui.folio.activity.FolioActivity.setupBook(FolioActivity.java:399)
                                                                                         at com.folioreader.ui.folio.activity.FolioActivity.onCreate(FolioActivity.java:134)
                                                                                         at android.app.Activity.performCreate(Activity.java:6664)
                                                                                         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                                                                                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
                                                                                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) 
                                                                                         at android.app.ActivityThread.-wrap12(ActivityThread.java) 
                                                                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) 
                                                                                         at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                         at android.os.Looper.loop(Looper.java:154) 
                                                                                         at android.app.ActivityThread.main(ActivityThread.java:6077) 
                                                                                         at java.lang.reflect.Method.invoke(Native Method) 
                                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
                                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 

06-18 05:48:08.326 646-1398/system_process W/ActivityManager: Force finishing activity de.appcuisine.tigermedia.tigerbooks.alpha/com.folioreader.ui.folio.activity.FolioActivity
06-18 05:48:08.345 646-1398/system_process W/ActivityManager: Force finishing activity de.appcuisine.tigermedia.tigerbooks.alpha/de.appcuisine.tigermedia.tigerbooks.ui.splash.SplashActivity
`

@hackstarsj
Copy link
Author

Finally i Stuck Will all Errors i understand Developer works and respect and he make a such a wonderful library for epub .

but finally i create a new library with some customisation.

@mahavir155
Copy link
Contributor

@hackstarsj @OlegTarashkevich i believe it is fixed and will be released soon..

@prilaga
Copy link

prilaga commented Jun 18, 2018

@mahavir155 Thank you for the update!
Is it possible to publish new version for today?

@mahavir155
Copy link
Contributor

Really not.. But we'll try to release new version by end of this week or early next week.. we are really excited to release this version, since it will have horizontal scrolling enabled..

@prilaga
Copy link

prilaga commented Jun 21, 2018

Hi @mahavir155 , Do you have any update? My users see crashes. Please help!

hrishikesh-kadam added a commit to codetoart/FolioReader-Android that referenced this issue Jun 22, 2018
@hrishikesh-kadam
Copy link
Contributor

@OlegTarashkevich Upgrade to v0.3.10

@mahavir155
Copy link
Contributor

@OlegTarashkevich Crash should be fixed in v0.3.10.. FYI Horizontal scrolling is not released yet.. We'll need one more week to have Horizontal scrolling.. Meanwhile you can use 0.3.10..

@prilaga
Copy link

prilaga commented Jun 22, 2018

Thank you @hrishikesh-kadam @mahavir155
v0.3.10 has the same crash.
The "publication" object is null. It's the reason of the crash.
Looks like the bug while parsing: org.xml.sax.SAXParseException: expected: '>' actual: '"
Please look at the my previous post where I've provided the logs.

screen shot 2018-06-22 at 10 20 52

@mahavir155
Copy link
Contributor

any possibility to share epub?

@mahavir155 mahavir155 reopened this Jun 22, 2018
@hrishikesh-kadam
Copy link
Contributor

@OlegTarashkevich I have opened new issue on behalf of you - #221
This issue is different from yours so let us have conversation on #221

@mahavir155 we can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants