2016-05-18 1 views
3

Иногда, когда мое приложение приходит от фона на передние план аварий приложений, чей LogCat выглядит следующим образом,StackOverflow ошибка, когда приложение приходит от фона на передний план

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) 

Я использую переоснащение 2 вместе с Джексоном, и это происходит сбой на Samsung.

Мой код фрагмента выглядит следующим образом,

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; 
    } 
} 

}

+0

Возможно, вы используете ** слишком много вложенных представлений ** –

+0

, но это простой фрагмент с recyclerview. – TheReprator

+0

проверьте свой код для выполнения нескольких потоков, выполняя ту же задачу, также закройте все задачи таймера перед отправкой приложения в фоновый режим в onPause, например. –

ответ

1

я столкнулся с чем-то очень похожем недавно. Оказалось, что я продолжаю добавлять перехватчики, когда думаю, что добавление будет перезаписывать оригинал. В конце концов я бы получил StackOverflowError так же, как и трассировка стека выше. Следующее обсуждение помогло мне выяснить, что происходит: https://github.com/square/okhttp/issues/2300