gpt4 book ai didi

android - 应用程序从后台转到前台时出现 stackoverflow 错误

转载 作者:太空狗 更新时间:2023-10-29 13:58:57 27 4
gpt4 key购买 nike

有时候,当我的应用程序从后台转到前台应用程序崩溃时,其logcat如下,

Fatal Exception: java.lang.StackOverflowError
at com.android.org.bouncycastle.asn1.DefiniteLengthInputStream.read(DefiniteLengthInputStream.java:74)
at java.io.FilterInputStream.read(FilterInputStream.java:118)
at com.android.org.bouncycastle.asn1.DefiniteLengthInputStream.read(DefiniteLengthInputStream.java:74)
at java.io.FilterInputStream.read(FilterInputStream.java:118)
at com.android.org.bouncycastle.asn1.DefiniteLengthInputStream.read(DefiniteLengthInputStream.java:74)
at com.android.org.bouncycastle.util.io.Streams.readFully(Streams.java:49)
at com.android.org.bouncycastle.util.io.Streams.readFully(Streams.java:40)
at com.android.org.bouncycastle.asn1.ASN1InputStream.getBuffer(ASN1InputStream.java:384)
at com.android.org.bouncycastle.asn1.ASN1InputStream.createPrimitiveDERObject(ASN1InputStream.java:447)
at com.android.org.bouncycastle.asn1.ASN1InputStream.buildObject(ASN1InputStream.java:184)
at com.android.org.bouncycastle.asn1.ASN1InputStream.readObject(ASN1InputStream.java:272)
at com.android.org.bouncycastle.asn1.ASN1InputStream.buildEncodableVector(ASN1InputStream.java:193)
at com.android.org.bouncycastle.asn1.ASN1InputStream.buildDEREncodableVector(ASN1InputStream.java:204)
at com.android.org.bouncycastle.asn1.ASN1InputStream.buildObject(ASN1InputStream.java:173)
at com.android.org.bouncycastle.asn1.ASN1InputStream.readObject(ASN1InputStream.java:272)
at com.android.org.bouncycastle.asn1.ASN1InputStream.buildEncodableVector(ASN1InputStream.java:193)
at com.android.org.bouncycastle.asn1.ASN1InputStream.buildDEREncodableVector(ASN1InputStream.java:204)
at com.android.org.bouncycastle.asn1.ASN1InputStream.buildObject(ASN1InputStream.java:173)
at com.android.org.bouncycastle.asn1.ASN1InputStream.readObject(ASN1InputStream.java:272)
at com.android.org.bouncycastle.asn1.ASN1InputStream.buildEncodableVector(ASN1InputStream.java:193)
at com.android.org.bouncycastle.asn1.ASN1InputStream.buildDEREncodableVector(ASN1InputStream.java:204)
at com.android.org.bouncycastle.asn1.ASN1InputStream.buildObject(ASN1InputStream.java:173)
at com.android.org.bouncycastle.asn1.ASN1InputStream.readObject(ASN1InputStream.java:272)
at com.android.org.bouncycastle.asn1.ASN1InputStream.buildEncodableVector(ASN1InputStream.java:193)
at com.android.org.bouncycastle.asn1.ASN1InputStream.buildDEREncodableVector(ASN1InputStream.java:204)
at com.android.org.bouncycastle.asn1.ASN1InputStream.buildObject(ASN1InputStream.java:173)
at com.android.org.bouncycastle.asn1.ASN1InputStream.readObject(ASN1InputStream.java:272)
at com.android.org.bouncycastle.jce.provider.CertPathValidatorUtilities.getObject(CertPathValidatorUtilities.java:339)
at com.android.org.bouncycastle.jce.provider.CertPathValidatorUtilities.getExtensionValue(CertPathValidatorUtilities.java:325)
at com.android.org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCertD(RFC3280CertPathUtilities.java:1268)
at com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:310)
at com.sec.android.security.pkix.SecCertPathValidatorSpi.engineValidate(SecCertPathValidatorSpi.java:100)
at java.security.cert.CertPathValidator.validate(CertPathValidator.java:190)
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:295)
at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:202)
at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:612)
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(NativeCrypto.java)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:406)
at okhttp3.internal.io.RealConnection.connectTls(RealConnection.java:195)
at okhttp3.internal.io.RealConnection.connectSocket(RealConnection.java:148)
at okhttp3.internal.io.RealConnection.connect(RealConnection.java:111)
at okhttp3.internal.http.StreamAllocation.findConnection(StreamAllocation.java:188)
at okhttp3.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:127)
at okhttp3.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
at okhttp3.internal.http.HttpEngine.connect(HttpEngine.java:289)
at okhttp3.internal.http.HttpEngine.sendRequest(HttpEngine.java:241)
at okhttp3.RealCall.getResponse(RealCall.java:240)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:198)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:203)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:187)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:160)
at okhttp3.RealCall.access$100(RealCall.java:30)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)

我正在使用 retrofit 2 和 Jackson,这次崩溃发生在三星上。

我的 fragment 代码如下,

package cl.tp.ui.fragments;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import cl.tp.ui.iBAPView.Empty_EndlessRecyclerView;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class EngagementsOffers extends
Fragment implements ProcessedResult
{
int skip = 0;
private Context context;
private Engagment_offers engagementAdapter;
private List<MJob> engagementJob;

//This is my custom Recyclerview which detects onScroll when end to bottom of page or crossed the threshold.
private Empty_EndlessRecyclerView mRecyclerView;
private String accessToken = null;

@Override
public void onAttach(Context context) {
super.onAttach(context);
this.context=context;
}

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.recycler_empty_view, container, false);

initialize(view);
return view;
}

private void initialize(View view)
{
accessToken = GeneralFunctions.getStorageManager(context).getValue(Constants.Other.SHAREPREFECE_APPTOKEN.toString(), null);
mRecyclerView = (Empty_EndlessRecyclerView) view.findViewById(R.id.common_recyclerView);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setItemAnimator(new DefaultItemAnimator());

LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mRecyclerView.getContext());
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(linearLayoutManager);

View emptyView = view.findViewById(R.id.ev_emptyView);
TextView textView = (TextView) emptyView.findViewById(R.id.ev_text);

MUdetails.Data profileDetail=((ApplicationClass)context.getApplicationContext()).getProfileDetail();
if(profileDetail!=null)
if(profileDetail.getIsLookingForJob())
textView.setText(getString(R.string.recycler_empty_engagementoffers));
else
textView.setText(getString(R.string.recycler_empty_engagementoffers_off));

mRecyclerView.setEmptyView(emptyView);
mRecyclerView.setProgressView(R.layout.progress_footer);

engagementJob = new ArrayList<>();
engagementAdapter = new Engagment_offers(engagementJob,this);
mRecyclerView.setAdapter(engagementAdapter);
mRecyclerView.setPager(this);

mRecyclerView.setRefreshing(true);
processedResult(null, Constants.Other.LOAD_MORE_METHOD);
}

private void getAllCurrentJobs() {
/* if (totalSize == skip) {
mRecyclerView.setRefreshing(false);
GeneralFunctions.showToast(context.getResources().getString(R.string.toast_no_more_item), context);
return;
}*/
// LogUtil.e("ss:-",mRecyclerView.isRefreshing()+"");
RetrofitAdapters.createRetrofitService(Api.class).getMyjobOffers(accessToken,10,skip).enqueue(new Callback<MEngagementOffers>() {
@Override
public void onResponse(Call<MEngagementOffers> call, Response<MEngagementOffers> response) {
mRecyclerView.setRefreshing(false);
GeneralFunctions.parseResponse( response,Constants.CallbackConstants.JOBOFFERS,EngagementsOffers.this);
}

@Override
public void onFailure(Call<MEngagementOffers> call, Throwable t) {
GeneralFunctions.parserRetrofitError(context, t);
mRecyclerView.setRefreshing(false);
}
});
}


//Custom callback for result parse from retrofit 2
@Override
public <IResponse, IMethod> void processedResult(IResponse iResponse, IMethod iMethod) {
switch (iMethod.toString()) {
case Constants.Other.LOAD_MORE_METHOD:
getAllCurrentJobs();
break;
case Constants.CallbackConstants.JOBOFFERS:
{
MEngagementOffers mEngagements=((Response<MEngagementOffers>)iResponse).body();
int size = mEngagements.getData().getNewJobOffers().size();
skip += size;
if (size > 0) {
int prevousSize = engagementJob.size();
engagementJob.addAll(mEngagements.getData().getNewJobOffers());
engagementAdapter.notifyItemRangeInserted(prevousSize, size);
}
}break;
}
}

最佳答案

我最近遇到了非常相似的事情。事实证明,当我认为添加拦截器会覆盖原始拦截器时,我仍在继续添加拦截器。最终我会得到一个 StackOverflowError,就像您在上面发布的堆栈跟踪一样。以下讨论帮助我弄清楚发生了什么:https://github.com/square/okhttp/issues/2300

关于android - 应用程序从后台转到前台时出现 stackoverflow 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37297034/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com