在本文中,您将会了解到关于ArrayIndexOutOfBoundsException160的新资讯,并给出一些关于0617关于fastjson报ArrayIndexOutOfBoundsExcept
在本文中,您将会了解到关于ArrayIndexOutOfBoundsException 160的新资讯,并给出一些关于0617 关于 fastjson报ArrayIndexOutOfBoundsExcept:160错误、android – TextView样式ArrayIndexOutOfBoundsException、ArrayIndexOutOfBoundsException >> arr lenght 引起的异常、ArrayIndexOutOfBoundsException数组越界 --- 之二的实用技巧。
本文目录一览:- ArrayIndexOutOfBoundsException 160
- 0617 关于 fastjson报ArrayIndexOutOfBoundsExcept:160错误
- android – TextView样式ArrayIndexOutOfBoundsException
- ArrayIndexOutOfBoundsException >> arr lenght 引起的异常
- ArrayIndexOutOfBoundsException数组越界 --- 之二
ArrayIndexOutOfBoundsException 160
解决方法,升级fastjson的版本
0617 关于 fastjson报ArrayIndexOutOfBoundsExcept:160错误
最近改接口测试代码的时候,遇到了个问题报ArrayIndexOutOfBoundsException: 160错误
百度谷歌了半天也没找到解决办法,
at com.alibaba.fastjson.serializer.SerializeWriter.writeStringWithDoubleQuote(SerializeWriter.java:868)
at com.alibaba.fastjson.serializer.SerializeWriter.writeStringWithDoubleQuote(SerializeWriter.java:602)
at com.alibaba.fastjson.serializer.SerializeWriter.writeString(SerializeWriter.java:1411)
at com.alibaba.fastjson.serializer.StringCodec.write(StringCodec.java:49)
at com.alibaba.fastjson.serializer.StringCodec.write(StringCodec.java:34)
at com.alibaba.fastjson.serializer.MapSerializer.write(MapSerializer.java:188)
at com.alibaba.fastjson.serializer.ListSerializer.write(ListSerializer.java:87)
at com.alibaba.fastjson.serializer.MapSerializer.write(MapSerializer.java:188)
at com.alibaba.fastjson.serializer.JSONSerializer.write(JSONSerializer.java:369)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:418)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:568)
大概就是超长或者特殊字符
加断点跟踪了下,30多万字节的返回数据,难道是超长?
完全没有头绪,写了几行代码,单条跟踪试试吧
String contentd= "XXXXXXXXXXXXXXX";
JSONObject jsonObject = JSON.parseObject(contenta);
System.out.println(jsonObject);
截断了些数据,测试了下,发现不会报错,真是超长?
再试了几次,发现原来是有特殊字符!!!传输的String中 有不可见字符,类似于空格,但又不是空格,应该就是不可见的特殊字符吧。
找到了问题的所在,接下来就是想想怎么解决了。
最好的办法就是fastjson可以支持特殊字符,作者大概一时半会也不会修改
自己修改源码,算了,我还太菜。
其实可以偷工取消下吧
我只要让返回数据正常打印出来就行。
contenta=contenta.replace(" "," ");
把特殊字符替换成空格。先解决眼前的问题。
加断点,跟踪下程序,replace一下。
这是目前想到的最简单快捷的方法了。不过也是治标不治本
android – TextView样式ArrayIndexOutOfBoundsException
我从来没有重现过这次崩溃,它似乎只是来自三星galaxy设备(虽然不太确定).来自sdk 4.1版& 4.2& 4.3
这是完整的StackTrace:
android.view.InflateException: Binary XML file line #31: Error inflating class <unkNown> at android.view.LayoutInflater.createView(LayoutInflater.java:613) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at com.android.internal.widget.ActionBarContextView.initClose(ActionBarContextView.java:262) at com.android.internal.widget.ActionBarContextView.onConfigurationChanged(ActionBarContextView.java:136) at android.view.View.dispatchConfigurationChanged(View.java:7761) at android.view.ViewGroup.dispatchConfigurationChanged(ViewGroup.java:1056) at android.view.ViewGroup.dispatchConfigurationChanged(ViewGroup.java:1060) at android.view.ViewGroup.dispatchConfigurationChanged(ViewGroup.java:1060) at android.view.ViewGroup.dispatchConfigurationChanged(ViewGroup.java:1060) at android.view.ViewGroup.dispatchConfigurationChanged(ViewGroup.java:1060) at android.view.ViewRootImpl.updateConfiguration(ViewRootImpl.java:2800) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1509) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4464) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725) at android.view.Choreographer.doCallbacks(Choreographer.java:555) at android.view.Choreographer.doFrame(Choreographer.java:525) at android.view.Choreographer$FramedisplayEventReceiver.run(Choreographer.java:711) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4895) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:417) at android.view.LayoutInflater.createView(LayoutInflater.java:587) ... 31 more Caused by: java.lang.Arrayindexoutofboundsexception: length=24; index=691 at android.content.res.StringBlock.get(StringBlock.java:64) at android.content.res.XmlBlock$Parser.getPooledString(XmlBlock.java:458) at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:720) at android.content.res.TypedArray.getString(TypedArray.java:124) at android.widget.TextView.<init>(TextView.java:916) at android.widget.TextView.<init>(TextView.java:562) ... 34 more
我想也许这是由我给TextView的风格(特别是fontFamily)引起的.所以这里是我的价值观风格-v16> styles.xml(values-v16):
<style name="TextViewHour"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> <item name="android:layout_marginLeft">5dip</item> <item name="android:ellipsize">end</item> <item name="android:maxLines">1</item> <item name="android:textSize">@dimen/text_hour_size</item> <item name="android:textColor">@color/item_hour</item> <item name="android:fontFamily">sans-serif-condensed</item> <item name="android:textStyle">bold</item> </style>
来自价值观> styles.xml
<style name="TextViewHour"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> <item name="android:layout_marginLeft">5dip</item> <item name="android:ellipsize">end</item> <item name="android:maxLines">1</item> <item name="android:textSize">@dimen/text_hour_size</item> <item name="android:textColor">@color/item_hour</item> <item name="android:textStyle">bold</item> </style>
这里是一个使用TextView的例子:
<TextViewandroid:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/item_date_separator"/>
我对我的应用程序在某些设备上崩溃的原因一无所知.
所以,如果有人有想法,我全都耳朵!
编辑:似乎它不仅在galaxy设备上,我也有这个Nexus 7的崩溃.
解决方法
public class MyTextView extends TextView { public MyTextView(Context context,AttributeSet attrs,int defStyle) { super(context,attrs,defStyle); init(); } public MyTextView(Context context,AttributeSet attrs) { super(context,attrs); init(); } public MyTextView(Context context) { super(context); init(); } private void init() { Typeface tf = Typeface.createFromAsset(getContext().getAssets(),"your_font.ttf"); setTypeface(tf); }
}
并在你的xml中.
<com.mypackage.test.MyTextView android:id="@+id/txt" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:layout_weight="1" android:text="custom text view. " android:textSize="30dip" android:textColor="#ff0000" >
ArrayIndexOutOfBoundsException >> arr lenght 引起的异常
如何解决ArrayIndexOutOfBoundsException >> arr lenght 引起的异常?
对 Arrayindexoutofboundsexception 有点熟悉但无法解决。
突出显示错误所在的行。
如果为数组的长度引入 5,程序将指出为什么 d 可能等于 arr 的长度值(在本例中为 5)。
我知道这是一个愚蠢的错误,因此我很生气......
已突出显示错误的行。
任何帮助??
enter image description here
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
ArrayIndexOutOfBoundsException数组越界 --- 之二
现象:
Caused by: java.lang.ArrayIndexOutOfBoundsException: 7786
at org.springframework.asm.ClassReader.readClass(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:54)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:101)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:236)
... 45 more
问题及解决方案:
executor.execute(() -> threadTask(activityId, mobiles, content));
改为:
executor.execute(new Runnable() { @Override public void run() { threadTask(activityId, mobiles, content); } });
今天关于ArrayIndexOutOfBoundsException 160的分享就到这里,希望大家有所收获,若想了解更多关于0617 关于 fastjson报ArrayIndexOutOfBoundsExcept:160错误、android – TextView样式ArrayIndexOutOfBoundsException、ArrayIndexOutOfBoundsException >> arr lenght 引起的异常、ArrayIndexOutOfBoundsException数组越界 --- 之二等相关知识,可以在本站进行查询。
本文标签: