Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Unhandled exception while calling getMimeType() #24

Closed
crawter opened this issue Mar 29, 2018 · 2 comments
Closed

Unhandled exception while calling getMimeType() #24

crawter opened this issue Mar 29, 2018 · 2 comments

Comments

@crawter
Copy link

crawter commented Mar 29, 2018

When we create instance of storj.libstorj.File class getMimeType() method sometimes throws an unhandled exception at this line:

String mime = URLConnection.guessContentTypeFromName(name);

Example of such file:
http://dropmefiles.com/xDfzp

Steps to reproduce

  1. upload this file to bucket
  2. try to retrieve files list of this bucket and call getMimeType() method for this one
@kaloyan-raev
Copy link
Collaborator

Could you include the exception stack trace here?

@crawter
Copy link
Author

crawter commented Mar 29, 2018

FATAL EXCEPTION: Thread-25
Process: com.storjmobile, PID: 21943
java.lang.StringIndexOutOfBoundsException: String index out of range: -4
at java.lang.String.substring(String.java:1975)
at java.net.DefaultFileNameMap.getContentTypeFor(DefaultFileNameMap.java:38)
at java.net.URLConnection.guessContentTypeFromName(URLConnection.java:1381)
at io.storj.libstorj.File.getMimeType(File.java:179)
at storjlib.Models.FileModel.(FileModel.java:86)
at storjlib.Models.FileModel.(FileModel.java:64)
at storjlib.services.UploadService$1.onComplete(UploadService.java:166)
at io.storj.libstorj.Storj._runEventLoop(Native Method)
at io.storj.libstorj.Storj.access$100(Storj.java:29)
at io.storj.libstorj.Storj$4.run(Storj.java:1238)

@crawter crawter changed the title Unhandler exception while calling getMimeType() Unhandled exception while calling getMimeType() Mar 29, 2018
kaloyan-raev added a commit to storj-archived/java-libstorj that referenced this issue Apr 3, 2018
kaloyan-raev added a commit to storj-archived/java-libstorj that referenced this issue Apr 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants