Amazefilemanager: long strings in filenames with spaces crashes app

Created on 27 Oct 2017  Â·  21Comments  Â·  Source: TeamAmaze/AmazeFileManager

The following filename will make the app crash when it tries to display the filename (in "list" view only -"grid" view works ok):

M2345 123 1234567890x1234567890 123 12.mp4

Substituting a "space" for the "x" character near the middle of the filename prevents the crash. The app then simply shows the whole "words" that it can and truncates the rest.
The following filename also does not cause the app to crash:

M234567 1234 123456789 12- 12 12345678901.mp4

Nor does an equally long filename with no spaces in it (the app "abridges" the filename, inserting "..." in the middle).
So it seems to be something to do with the length of the different parts of the filename and where the app decides to truncate or abridge it.

Different behaviour is evident whether the phone (and therefore the app window) is in "portrait" or "landscape" mode (i.e. one filename will crash the app in portrait but not landscape, and vice versa for a different filename), so it seems related to display area.

(Amaze v3.2.1, Lollipop 5.0.1, Huawei P8, 1080x1920 display).

Issue-Bug Severity-High

All 21 comments

Logcat?

this seems to be the relevant exception from logcat (it occurs immediately after i scroll to the problematic filename, and the app crashes). i don't see anything pertinent before that, but if more logs are required, please let me know. thanks =)

https://pastebin.com/vSkdmcR4

This seems to be related to "LG G3 app crashing on downloads folder": https://github.com/TeamAmaze/AmazeFileManager/issues/812

Because Logcat was showing the following error:
java.lang.ArrayIndexOutOfBoundsException: length=41; index=-1 at android.text.StaticLayout.calculateEllipsis(StaticLayout.java:729)

It is because of the ellipsize (especially when it is set to "middle") when used with maxlines. This is causing the app to crash in the old android versions (Tested on 5.0).

I created a PR for the aforementioned issue and it has been merged to master: https://github.com/TeamAmaze/AmazeFileManager/pull/813

@pellgarlic please test and report
@preet90 thanks for your contribution (:

Hi, I cannot see how to download the new version to test. Can you please point me in the right direction?

Thanks.

Caught something similar with the latest v 3.2.2 (from f-d):

Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659): FATAL EXCEPTION: main
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659): Process: com.amaze.filemanager, PID: 32659
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659): java.lang.ArrayIndexOutOfBoundsException: length=125; index=-1
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.text.StaticLayout.calculateEllipsis(StaticLayout.java:790)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.text.StaticLayout.out(StaticLayout.java:704)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.text.StaticLayout.generate(StaticLayout.java:410)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.text.StaticLayout.<init>(StaticLayout.java:140)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.TextView.makeSingleLayout(TextView.java:6175)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.TextView.makeNewLayout(TextView.java:6032)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.TextView.onMeasure(TextView.java:6389)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.View.measure(View.java:16521)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.View.measure(View.java:16521)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.View.measure(View.java:16521)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.v7.widget.RecyclerView$LayoutManager.measureChildWithMargins(RecyclerView.java:8636)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1577)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3583)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3312)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3844)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.View.layout(View.java:14841)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:636)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.View.layout(View.java:14841)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.View.layout(View.java:14841)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1795)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.View.layout(View.java:14841)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.View.layout(View.java:14841)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:131)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1391)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:870)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.View.layout(View.java:14841)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1193)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.View.layout(View.java:14841)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.View.layout(View.java:14841)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.View.layout(View.java:14841)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.View.layout(View.java:14841)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1717)
Mon, 25 Jun 2018 12:39:36 +0600: E/AndroidRuntime(32659):   at android.widget.LinearLayout.layoutVertical(LinearLayout.jav
Mon, 25 Jun 2018 12:39:36 +0600: W/ActivityManager(  537):   Force finishing activity com.amaze.filemanager/.activities.MainActivity

Is it that? Seems the PR (https://github.com/TeamAmaze/AmazeFileManager/pull/813) didn't help (?)

May I ask when exactly you get this error - @ildar ?

If you could provide steps to reproduce the error? I will have a look at it.

nothing special: IIRC just jumped to "home" folder. Can't reproduce :(

Can reproduce again. Can it help? It crashes on startup as it tries to show
"home" folder which is /sdcard/Download

BTW this may be dup of
https://github.com/TeamAmaze/AmazeFileManager/issues/673

Try clearing app data @ildar

Try clearing app data

This doesn't help. I confirm that the issue is still present.

didn't help :)))

I reproduced the issue with: "touch LM393-MILD-20180630-154522.pdf" then
Amazing crash.

You pressed on "LM393-MILD-20180630-154522.pdf" and it crashed? Could you give us the file and the path where it is stored?

No, just entered the folder containing the file named so.

You can create an empty file, it worked

Could you give us the path where it is stored?

As written, /sdcard/Download

Emm, actually it's /storage/emulated/0/Download

I don't think we can fix this...

Why's that? Did the case work? Or can I provide​ more diagnostics?

It seems to be a bug in Android with status won't fix (obsolete), we'll need keep working around it, maybe #813 missed some other TextView?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

disdagithubacc picture disdagithubacc  Â·  4Comments

Wilker-a picture Wilker-a  Â·  5Comments

kr-nahid picture kr-nahid  Â·  5Comments

MagTun picture MagTun  Â·  4Comments

spocko picture spocko  Â·  4Comments