Git Product home page Git Product logo

volley's People

Contributors

aaijazi avatar bendowski avatar ducrohet avatar elevenfive avatar ericliu001 avatar evancharlton avatar gamblore avatar jjoslin avatar joebowbeer avatar jpd236 avatar kfaraj avatar krschultz avatar lucaseckels avatar maxtroy avatar maxzhouus avatar narayank avatar navidht avatar ndagnas avatar nfuller avatar poligun avatar ralph-bergmann avatar samuelyvon avatar skydoves avatar slinzner avatar sphill99 avatar uhager avatar vovkab avatar wrkben avatar xyhuangjinfu avatar zsmb13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

volley's Issues

unableto clear mErrorListener causing memory leaked.

I need to clear error listener after request is cancel (when call onStop()).

Currently that is no way to clear mErrorListener in Request class, which will cause leaked if the error listener implementation is reference fragment or activity.

a question about thecode that used volley lib

Hello i have few questions about below code , i think about it very much but i can't to understand it, please help me:
`public class AppController extends Application {

public static final String TAG = AppController.class
        .getSimpleName();

private static RequestQueue mRequestQueue;

private static AppController mInstance;

public RequestQueue getRequestQueue() {
    if (mRequestQueue == null) {
        mRequestQueue = Volley.newRequestQueue(getApplicationContext());
    }

    return mRequestQueue;
}

@Override
public void onCreate() {
    super.onCreate();
    mInstance = this;
}

public static synchronized AppController getInstance() {
    return mInstance;
}

public <T> void addToRequestQueue(Request<T> req, String tag) {
    // set the default tag if tag is empty
    req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
    getRequestQueue().add(req);
}

public void addToRequestQueue(Request req) {
    getRequestQueue().add(req);
}

public void cancelPendingRequests(Object tag) {
    if (mRequestQueue != null) {
        mRequestQueue.cancelAll(tag);
    }
}

`
why i initialize mInstance = this in oncreate method?

OutOfMemoryError and NegativeArraySizeException in DiskBasedCache.streamToBytes

DiskBasedCache may fail repeatedly if a cached header is corrupt. In the event of failure, the most common error is OutOfMemoryError thrown from streamToBytes, caused by trying to allocate a huge number of bytes resulting from the bogus length calculated due to the corruption.

Once a header has been corrupt, the cache initialization will continue to fail, and the errant header will not be removed.

A less common failure was NegativeArraySizeException, but that was recently patched.

DiscBasedCache needs to be updated to guard against corruption.

Related to:

https://code.google.com/p/android/issues/detail?id=230219
mcxiaoke/android-volley#141 (mirror)
http://stackoverflow.com/a/42196956/901597

The DefaultRetryPolicy method retry() doesn't do what it is intended to do.

Hi, I was going to through the code on the retry mechanism today and came across the RetryPolicy. The following code is from the class DefaultRetryPolicy.

/**
 * Prepares for the next retry by applying a backoff to the timeout.
 * @param error The error code of the last attempt.
 */
@Override
public void retry(VolleyError error) throws VolleyError {
    mCurrentRetryCount++;
    mCurrentTimeoutMs += (mCurrentTimeoutMs * mBackoffMultiplier);
    if (!hasAttemptRemaining()) {
        throw error;
    }
}

Under the circumstance where the NetworkDispatcher wants to retry a request, it calls retry() on the RetryPolicy instance of that request. I would assume that the same request should be added to the RequestQueue as an retry attempt.

But the retry() method actually doesn't do much other than updating a few values, which doesn't schedule another call to fire the failed request again.

If we look at the test case in BasicNetworkTest, it seems that we should assume that a retry request has been made as long as the retry() method of the RetryPolicy instance is called. But the currently implementation of DefaultRetryPolicy doesn't really do that.

@Test public void serverError_enableRetries() throws Exception {
    for (int i = 500; i <= 599; i++) {
        MockHttpStack mockHttpStack = new MockHttpStack();
        BasicHttpResponse fakeResponse =
                new BasicHttpResponse(new ProtocolVersion("HTTP", 1, 1), i, "");
        mockHttpStack.setResponseToReturn(fakeResponse);
        BasicNetwork httpNetwork =
                new BasicNetwork(mockHttpStack, new ByteArrayPool(4096));
        Request<String> request = buildRequest();
        request.setRetryPolicy(mMockRetryPolicy);
        request.setShouldRetryServerErrors(true);
        doThrow(new VolleyError()).when(mMockRetryPolicy).retry(any(VolleyError.class));
        try {
            httpNetwork.performRequest(request);
        } catch (VolleyError e) {
            // expected
        }
        // should retry all 500 errors
        verify(mMockRetryPolicy).retry(any(ServerError.class));
        reset(mMockRetryPolicy);
    }
} 

RequestFuture

Using the RequestFuture I realized that I can not handle network errors because doing future.get() forces me to implement ExecutionException, InterruptedException and TimeoutException.
By controlling the RequestFuture of the source code, I realized that the onRespoceError method as VolleyError parameter that would be perfect to know the type of network failure by VolleyError.NetworkResponse.
Instead, what is done is a throw new ExecutionException(mException) and then I can not have the VolleyError.NetworkResponse.

	RequestFuture<String> future = RequestFuture.newFuture();
    StringRequest testRequest = new StringRequest(this.mRequestMethod , url, future, future);
    queue.add(testRequest);

    try {
        String response = future.get(10, TimeUnit.SECONDS); // Blocks for at most 10 seconds.

        if(future.isDone()){
            callback.onSucces(response);
        }

    } catch (InterruptedException e) {
        // Exception handling
    } catch (ExecutionException e) {
	  
	  callback.onFail(9999 ,e.getMessage());
     
     } catch (TimeoutException e) {
        e.printStackTrace();
    }

I'm doing something wrong, or it was an oversight during the development of the future?

Thank you

Kotlin Version

Hi
I wonder if there any intention to support kotlin by making volley code full kotlin instead of java?
Thanks

java.util.concurrent.TimeoutException ..reported from clients which seems that the lock has reached limit to be locked

device specs:
Infinix X509
android:5.1

volley version 1.0.0

java.util.concurrent.TimeoutException: com.android.volley.toolbox.PoolingByteArrayOutputStream.finalize() timed out after 10 seconds
at com.android.volley.toolbox.ByteArrayPool.returnBuf(ByteArrayPool.java:111)
at com.android.volley.toolbox.PoolingByteArrayOutputStream.finalize(PoolingByteArrayOutputStream.java:65)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:191)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:174)
at java.lang.Thread.run(Thread.java:818)

Support of Gzip compression

Currently volley doesn't support gzip decompression. There is a lot of different implementations based on GZIPInputStream in internet. Shouldn't this be a part of API and be available by default?

DiskBasedCache uses different inputs for file size

Forking from #52 (comment):

Some parts of DiskBasedCache use the file size as the size of the cache entry, which includes the header overhead. Other parts use the data size which doesn't include the header overhead.

We should make this sane. Some constraints:

  • I'd generally prefer we use an accurate size on disk since we advertise the cache as using at most that size, but not including the overhead means we might exceed it.
  • It's currently hard to calculate the size prior to writing the entry because we don't know how big the CacheHeader will be. I think it would be technically feasible to calculate this deterministically though given that serialization format is fixed (or at least to estimate it...)

The way to finish a thread in volley.

In volley, to finish a thread such as CacheDiapatcher and NetworkDispatcher, are inturrupt not enough? Whether need the mQuit variable necessarily.
If write like this, hava any problems? those thread can be interrupted in other scenes?
public void quit() { interrupt(); }

while (!isInterrupted()) { ................... try { request = mQueue.take(); } catch (InterruptedException e) { return; } }

get and set cookies

hi, how to send request and get response cookies using volley?
this is my function

public void doActionJsonPost() {
    // Request a string response from the provided URL.
    StringRequest stringRequest = new StringRequest(Request.Method.POST, IConstants.BASE_URL + url,
            new Response.Listener<String>() {
                @Override
                public void onResponse(String response) {
                    JSONObject jsonObject;
                    try {
                        jsonObject = new JSONObject(response);
                        String msgCode = jsonObject.getString("responseCode");
                    } catch (JSONException e) {
                        LoggingHelper.verbose(e.toString());
                        iHttpAsync.onAsyncFailed(e.toString());
                    } catch (Exception e) {
                        LoggingHelper.verbose(e.toString());
                        iHttpAsync.onAsyncFailed(e.toString());
                    }
                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    LoggingHelper.verbose("ERROR");
                    iHttpAsync.onAsyncFailed(error.getMessage());
                }
            }){
        @Override
        public byte[] getBody() throws AuthFailureError {
            iHttpAsync.onAsyncProgress();
            return parameters.getBytes();
        }
        @Override
        public String getBodyContentType() {
            return "application/json";
        }
        @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            return getAuthHeader(context);
        }

        @Override
        protected Response<String> parseNetworkResponse(NetworkResponse response) {
            Map<String, String> responseHeaders = response.headers;
            String rawCookies = responseHeaders.get("Set-Cookie");
            return super.parseNetworkResponse(response);
        }
    };

    RequestQueue requestQueue = Volley.newRequestQueue(context);
    requestQueue.add(stringRequest);
}

i've overriden parseNetworkResponse to get header, but there is no cookies in the header
how can I get and set cookie with volley?

Publish to bintray

Do you know when these recent updates will be included in a build published to jCenter/bintray?

Currently is the only way to get the "NegativeArraySizeException" update is to pull down the entire project and include/build locally?

I would rather use the gradle file for including the dependency.

dependencies {
...
compile 'com.android.volley:volley:1.0.0'
}

Fix javadoc comments

Javadoc specs have changed and compilation fails with the following issues with java 8

C:\Repos\Volley\volley\src\main\java\com\android\volley\toolbox\BasicNetwork.java:268: error: malformed HTML * Converts Headers[] to Map. ^ C:\Repos\Volley\volley\src\main\java\com\android\volley\toolbox\BasicNetwork.java:268: error: bad use of '>' * Converts Headers[] to Map. ^ C:\Repos\Volley\volley\src\main\java\com\android\volley\VolleyLog.java:40: error: self-closing element not allowed *
^ C:\Repos\Volley\volley\src\main\java\com\android\volley\VolleyLog.java:42: error: self-closing element not allowed *
^ C:\Repos\Volley\volley\src\main\java\com\android\volley\VolleyLog.java:28: error: self-closing element not allowed *

^ C:\Repos\Volley\volley\src\main\java\com\android\volley\VolleyLog.java:29: error: self-closing element not allowed * to see Volley logs call:
^

Multiple Response Headers is not working !!!

I have spend hours and hours on this issue to find perfect solution and I found that Volley should have a function which return HttpUrlConnection (For example getConnection() )so it will be very helpful for developers to customize library and be able to use standard HttpUrlConnection ways like below:

For example to get response headers

Map<String, List<String>> headerFields = connection.getHeaderFields();
            List<String> cookiesHeader = headerFields.get(COOKIES_HEADER);
            if(cookiesHeader!=null){

                if (cookiesHeader != null) {
                    for (String cookie : cookiesHeader) {
                        Log.i("info",cookie);
                        msCookieManager.getCookieStore().add(null, HttpCookie.parse(cookie).get(0));
                    }
                }
            }

Unhandled exception: NullPointerException/NegativeArrayException in CacheDispatcher

java.lang.NegativeArraySizeException: -557
at com.android.volley.toolbox.DiskBasedCache.streamToBytes(DiskBasedCache.java:323)
at com.android.volley.toolbox.DiskBasedCache.get(DiskBasedCache.java:119)
at com.android.volley.CacheDispatcher.run(CacheDispatcher.java:100)

This is my stacktrace. I think it's caused by unhandled NullPointer in the CacheDispatcher. My app crashs with this stacktrace everytime when the OS cleans up the Volley cache.

Requests not sent and issbsettingenabled false

When I try to send a request, it seems to do absolutely nothing, and the callback is never called.
It also prints this in the logcat:

I/System.out (HTTPLog)-Static: isSBSettingEnabled false
I/System.out (HTTPLog)-Static: isSBSettingEnabled false
I/qtaguid Tagging socket 36 with tag 7dbc04b800000000{2109473976,0} for uid -1, pid: 7750, getuid(): 10553
I/qtaguid Untagging socket 36

Apparently, I read that this occurs on Samsung devices, and I am indeed on a Galaxy A3. What's very strange is that this bug started at a random moment, after removing a few things from my code that have absolutely nothing to do with internet (animations). I have tried reinstalling my app, cleaning the data/cache, rebooting my phone but nothing worked.

Multipart Request

Hello,

I want to use multipart request in my project which is using Volley. Can you please guide how can I use multipart request to upload file image/video.

Thanks,

There is no any simple way to set priority for ImageRequest

ImageRequest.java has Priority.LOW by default. There is no any easy way to load images with different priority. The only way currently is to implement own ImageLoader and extend ImageRequest.java to support other priorities. I think that ability to have different Priorities for Images loading. Let me know if you are agree and I may work on a patch, since I already have this feature added to valley for my project.

JSONObject request not working ?

This is input side on server in JSON form

{"user_email":"[email protected]","user_password":"123456"}

The returned JSON file is

Array{"result":{"id":"1","name":"ankur","email":"[email protected]","address":"b-block","designation":"devloper","department":"development","balanceleave":"5"}}


my code is 

final JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("user_email",login);
            jsonObject.put("user_password",passw);
        } catch (JSONException e) {
            e.printStackTrace();
        }

..............

bs.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              
                JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.PUT,url, jsonObject, new Response.Listener<JSONObject>() {
                    @Override
                    public void onResponse(JSONObject response) {
                        
                        Toast.makeText(Profile.this,"Passes from toast",Toast.LENGTH_LONG).show();
                        pDialog.dismiss();
                    }
                }, new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Toast.makeText(Profile.this,"Error from Toast",Toast.LENGTH_LONG).show();
                        error.printStackTrace();
                       
                    }
                });
                MySingleton.getInstance(Profile.this).addtorequestqueue(jsonObjectRequest);
            }
        });

Whenever I send the request the error listener gets the response , why the response listener doesn't get the response??

Marker exception

FATAL EXCEPTION: main Process: in.publicam.cricsquad, PID: 7283
java.lang.IllegalStateException: Marker added to finished log
at com.android.volley.VolleyLog$MarkerLog.add(VolleyLog.java:132)
at com.android.volley.Request.finish(Request.java:240)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:109)

Lenovo a7000 Marshmallow OS

Make "retry" logic more extensible

BasicNetwork.performRequest() makes some decisions about when to retry and when not to that I would like to be able to change, either in a RetryPolicy implementation or in the ErrorListener. For my application, it makes sense to retry on NetworkError and ServerError, with an exponential backoff.

I'd prefer not to have to implement a custom Network implementation for this. The best thing would be to be able to do it from the ErrorListener. But that's only passed the error at the moment, not the request. There's also no good way I can see to put the request back in the queue as a retry - by the time the ErrorListener is called, the request is out of the queue.

What should I do?

RecyclerView Header and Items from two separate Volley requests...

I have a RecyclerView with HEADER and ITEM to be populated from two separate URL JSON responses, how to approach this:

https://github.com/trangho214/HeaderToRecyclerView/blob/master/MultipleViewInRecycleView/app/src/main/java/paxcreation/com/multipleviewinrecycleview/MainActivity.java

but this is only for dummy data.

Or is this possible to embed a Volley request inside of another Volley request so that

adapter = new SimpleItemRecyclerViewAdapter(resHeader, resultItems);

are ready to be processed

Thanks

Fail loudly if a null Listener/ErrorListener is provided to Request or subclasses

See discussion at #64

If a null ErrorListener is passed to a Request, Volley just silently doesn't deliver errors. (It previously would crash for a null Listener, which is up to the Request subclass, but that crash is fixed per that pull request). I can't think of a valid scenario where you'd want to pass in a null listener, so we should clean this up everywhere and consider failing more loudly if a null listener or error listener is provided, at least in the classes Volley provides.

The maven repo in bintray seems not up to date

At least I don't see the following commit included in the bintray version:

86c71b8

And we are now encountering the NegativeArraySizeException bug.

I will compile the library myself anyway. But could you please update that repo?

ANR for NetworkDispatcher

in oppo x9007:
After some time the phone crashes;

Cmd line: com.esbook.reader

JNI: CheckJNI is off; workarounds are on; pins=1; globals=160

DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)

"main" prio=5 tid=1 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x41ee9710 self=0x41ed4b00
| sysTid=11799 nice=0 sched=0/0 cgrp=apps handle=1074655228
| state=S schedstat=( 167869122 72698117 339 ) utm=14 stm=2 core=0
#00 pc 0001c8bc /system/lib/libc.so (epoll_wait+12)
#1 pc 00014ff1 /system/lib/libutils.so (android::Looper::pollInner(int)+92)
#2 pc 00015215 /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
#3 pc 0006baf5 /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
#4 pc 000203cc /system/lib/libdvm.so (dvmPlatformInvoke+112)
#5 pc 00050ca7 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
#6 pc 00029860 /system/lib/libdvm.so
#7 pc 0002e218 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#8 pc 00062fbf /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+350)
#9 pc 0006abe3 /system/lib/libdvm.so
#10 pc 00029860 /system/lib/libdvm.so
#11 pc 0002e218 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#12 pc 00062d01 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+292)
#13 pc 0004c88b /system/lib/libdvm.so
#14 pc 0004f53b /system/lib/libandroid_runtime.so
#15 pc 000501cb /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+378)
#16 pc 0000105b /system/bin/app_process
#17 pc 0000df77 /system/lib/libc.so (__libc_init+50)
#18 pc 00000d7c /system/bin/app_process
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:132)
at android.os.Looper.loop(Looper.java:124)
at android.app.ActivityThread.main(ActivityThread.java:5166)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:768)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)

"java.lang.ProcessManager" daemon prio=5 tid=24 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x431ca018 self=0x74367ec8
| sysTid=11857 nice=0 sched=0/0 cgrp=apps handle=1949690488
| state=S schedstat=( 236354 672136 7 ) utm=0 stm=0 core=0
#00 pc 0001afd8 /system/lib/libc.so (wait4+8)
#1 pc 00021b33 /system/lib/libjavacore.so
#2 pc 000203cc /system/lib/libdvm.so (dvmPlatformInvoke+112)
#3 pc 00050ca7 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
#4 pc 00029860 /system/lib/libdvm.so
#5 pc 0002e218 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#6 pc 00062d01 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+292)
#7 pc 00062d2b /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#8 pc 00057aa3 /system/lib/libdvm.so
#9 pc 0000cde0 /system/lib/libc.so (__thread_entry+72)
#10 pc 0000cf5c /system/lib/libc.so (pthread_create+208)
at libcore.io.Posix.waitpid(Native Method)
at libcore.io.ForwardingOs.waitpid(ForwardingOs.java:141)
at java.lang.ProcessManager.watchChildren(ProcessManager.java:86)
at java.lang.ProcessManager.access$000(ProcessManager.java:40)
at java.lang.ProcessManager$1.run(ProcessManager.java:58)

"Thread-1362" prio=5 tid=25 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x431c8718 self=0x7436b2f0
| sysTid=11856 nice=0 sched=0/0 cgrp=apps handle=1949707288
| state=S schedstat=( 17581453 7506511 99 ) utm=0 stm=1 core=2
#00 pc 0001b4b0 /system/lib/libc.so (read+8)
#1 pc 00021d91 /system/lib/libjavacore.so
#2 pc 000203cc /system/lib/libdvm.so (dvmPlatformInvoke+112)
#3 pc 00050ca7 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
#4 pc 00029860 /system/lib/libdvm.so
#5 pc 0002e218 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#6 pc 00062fbf /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+350)
#7 pc 0006abe3 /system/lib/libdvm.so
#8 pc 00029860 /system/lib/libdvm.so
#9 pc 0002e218 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#10 pc 00062d01 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+292)
#11 pc 00062d2b /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#12 pc 0007063f /system/lib/libdvm.so
#13 pc 00029860 /system/lib/libdvm.so
#14 pc 0002e218 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#15 pc 00062d01 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+292)
#16 pc 00062d2b /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#17 pc 00057aa3 /system/lib/libdvm.so
#18 pc 0000cde0 /system/lib/libc.so (__thread_entry+72)
#19 pc 0000cf5c /system/lib/libc.so (pthread_create+208)
at libcore.io.Posix.readBytes(Native Method)
at libcore.io.Posix.read(Posix.java:127)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.morgoo.droidplugin.hook.proxy.ProxyHook.invoke(ProxyHook.java:56)
at $Proxy17.read(Native Method)
at libcore.io.BlockGuardOs.read(BlockGuardOs.java:149)
at libcore.io.IoBridge.read(IoBridge.java:425)
at java.io.FileInputStream.read(FileInputStream.java:179)
at java.io.InputStreamReader.read(InputStreamReader.java:244)
at java.io.BufferedReader.fillBuf(BufferedReader.java:130)
at java.io.BufferedReader.readLine(BufferedReader.java:354)
at com.esbook.reader.util.LogcatHelper$LogDumper.run(LogcatHelper.java:112)

"DroidPlugin@FileLogThread" prio=5 tid=23 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x43178748 self=0x74361bc8
| sysTid=11849 nice=0 sched=0/0 cgrp=apps handle=1949695016
| state=S schedstat=( 232396 175416 1 ) utm=0 stm=0 core=2
#00 pc 0001c8bc /system/lib/libc.so (epoll_wait+12)
#1 pc 00014ff1 /system/lib/libutils.so (android::Looper::pollInner(int)+92)
#2 pc 00015215 /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
#3 pc 0006baf5 /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
#4 pc 000203cc /system/lib/libdvm.so (dvmPlatformInvoke+112)
#5 pc 00050ca7 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
#6 pc 00029860 /system/lib/libdvm.so
#7 pc 0002e218 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#8 pc 00062d01 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+292)
#9 pc 00062d2b /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#10 pc 00057aa3 /system/lib/libdvm.so
#11 pc 0000cde0 /system/lib/libc.so (__thread_entry+72)
#12 pc 0000cf5c /system/lib/libc.so (pthread_create+208)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:132)
at android.os.Looper.loop(Looper.java:124)
at android.os.HandlerThread.run(HandlerThread.java:61)

"LocationClient" prio=5 tid=22 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x43111aa8 self=0x7435cf00
| sysTid=11843 nice=0 sched=0/0 cgrp=apps handle=1949684560
| state=S schedstat=( 249688 0 3 ) utm=0 stm=0 core=2
#00 pc 0001c8bc /system/lib/libc.so (epoll_wait+12)
#1 pc 00014ff1 /system/lib/libutils.so (android::Looper::pollInner(int)+92)
#2 pc 00015215 /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
#3 pc 0006baf5 /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
#4 pc 000203cc /system/lib/libdvm.so (dvmPlatformInvoke+112)
#5 pc 00050ca7 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
#6 pc 00029860 /system/lib/libdvm.so
#7 pc 0002e218 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#8 pc 00062d01 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+292)
#9 pc 00062d2b /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#10 pc 00057aa3 /system/lib/libdvm.so
#11 pc 0000cde0 /system/lib/libc.so (__thread_entry+72)
#12 pc 0000cf5c /system/lib/libc.so (pthread_create+208)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:132)
at android.os.Looper.loop(Looper.java:124)
at android.os.HandlerThread.run(HandlerThread.java:61)

"Thread-1351" prio=5 tid=21 WAIT
| group="main" sCount=1 dsCount=0 obj=0x430f9a40 self=0x7435c660
| sysTid=11842 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1949682352
| state=S schedstat=( 142708 55157 3 ) utm=0 stm=0 core=2
at java.lang.Object.wait(Native Method)

  • waiting on <0x430f9bc0> (a java.lang.VMThread) held by tid=21 (Thread-1351)
    at java.lang.Thread.parkFor(Thread.java:1205)
    at sun.misc.Unsafe.park(Unsafe.java:325)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:159)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2019)
    at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:505)
    at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-1350" prio=5 tid=20 WAIT
| group="main" sCount=1 dsCount=0 obj=0x430f93f0 self=0x7435c008
| sysTid=11841 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1897340088
| state=S schedstat=( 131927 91823 3 ) utm=0 stm=0 core=2
at java.lang.Object.wait(Native Method)

  • waiting on <0x430f95c8> (a java.lang.VMThread) held by tid=20 (Thread-1350)
    at java.lang.Thread.parkFor(Thread.java:1205)
    at sun.misc.Unsafe.park(Unsafe.java:325)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:159)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2019)
    at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:505)
    at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-1349" prio=5 tid=19 WAIT
| group="main" sCount=1 dsCount=0 obj=0x430f70e0 self=0x71171330
| sysTid=11840 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1897338752
| state=S schedstat=( 126407 66405 4 ) utm=0 stm=0 core=2
at java.lang.Object.wait(Native Method)

  • waiting on <0x430f7288> (a java.lang.VMThread) held by tid=19 (Thread-1349)
    at java.lang.Thread.parkFor(Thread.java:1205)
    at sun.misc.Unsafe.park(Unsafe.java:325)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:159)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2019)
    at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:505)
    at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-1348" prio=5 tid=18 WAIT
| group="main" sCount=1 dsCount=0 obj=0x430f6408 self=0x711709e8
| sysTid=11839 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1897336376
| state=S schedstat=( 197863 87031 5 ) utm=0 stm=0 core=2
at java.lang.Object.wait(Native Method)

  • waiting on <0x430f6930> (a java.lang.VMThread) held by tid=18 (Thread-1348)
    at java.lang.Thread.parkFor(Thread.java:1205)
    at sun.misc.Unsafe.park(Unsafe.java:325)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:159)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2019)
    at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:505)
    at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-1347" prio=5 tid=17 WAIT
| group="main" sCount=1 dsCount=0 obj=0x430f55f8 self=0x7116ee98
| sysTid=11838 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1897329384
| state=S schedstat=( 191093 1416250 5 ) utm=0 stm=0 core=2
at java.lang.Object.wait(Native Method)

  • waiting on <0x430f59d8> (a java.lang.VMThread) held by tid=17 (Thread-1347)
    at java.lang.Thread.parkFor(Thread.java:1205)
    at sun.misc.Unsafe.park(Unsafe.java:325)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:159)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2019)
    at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:505)
    at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-1346" prio=5 tid=16 WAIT
| group="main" sCount=1 dsCount=0 obj=0x430f4468 self=0x71170300
| sysTid=11837 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1897327176
| state=S schedstat=( 109322 34948 2 ) utm=0 stm=0 core=2
at java.lang.Object.wait(Native Method)

  • waiting on <0x430f4838> (a java.lang.VMThread) held by tid=16 (Thread-1346)
    at java.lang.Thread.parkFor(Thread.java:1205)
    at sun.misc.Unsafe.park(Unsafe.java:325)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:159)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2019)
    at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:505)
    at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-1345" prio=5 tid=15 WAIT
| group="main" sCount=1 dsCount=0 obj=0x430f3b50 self=0x7116fba0
| sysTid=11836 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1897332920
| state=S schedstat=( 139896 2628645 7 ) utm=0 stm=0 core=0
at java.lang.Object.wait(Native Method)

  • waiting on <0x430f3c60> (a java.lang.VMThread) held by tid=15 (Thread-1345)
    at java.lang.Thread.parkFor(Thread.java:1205)
    at sun.misc.Unsafe.park(Unsafe.java:325)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:159)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2019)
    at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:505)
    at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-1344" prio=5 tid=14 WAIT
| group="main" sCount=1 dsCount=0 obj=0x430f3a28 self=0x7116cb90
| sysTid=11835 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1897326072
| state=S schedstat=( 205522 129167 2 ) utm=0 stm=0 core=2
at java.lang.Object.wait(Native Method)

  • waiting on <0x430f3b38> (a java.lang.VMThread) held by tid=14 (Thread-1344)
    at java.lang.Thread.parkFor(Thread.java:1205)
    at sun.misc.Unsafe.park(Unsafe.java:325)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:159)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2019)
    at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:505)
    at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

"Thread-1343" prio=5 tid=13 WAIT
| group="main" sCount=1 dsCount=0 obj=0x430f3900 self=0x7116bba8
| sysTid=11834 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1897318208
| state=S schedstat=( 7708858 9135572 18 ) utm=0 stm=0 core=0
at java.lang.Object.wait(Native Method)

  • waiting on <0x430f3a10> (a java.lang.VMThread) held by tid=13 (Thread-1343)
    at java.lang.Thread.parkFor(Thread.java:1205)
    at sun.misc.Unsafe.park(Unsafe.java:325)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:159)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2019)
    at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:505)
    at com.android.volley.CacheDispatcher.run(CacheDispatcher.java:90)

"[email protected]@430b1b78" daemon prio=5 tid=12 WAIT
| group="main" sCount=1 dsCount=0 obj=0x430b4a10 self=0x71169010
| sysTid=11831 nice=0 sched=0/0 cgrp=apps handle=1897305184
| state=S schedstat=( 91927 0 2 ) utm=0 stm=0 core=0
at java.lang.Object.wait(Native Method)

  • waiting on <0x430b3a50> (a java.lang.ref.ReferenceQueue)
    at java.lang.Object.wait(Object.java:401)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:102)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:73)
    at org.apache.http.impl.conn.tsccm.RefQueueWorker.run(RefQueueWorker.java:102)
    at java.lang.Thread.run(Thread.java:841)

"AsyncTask #1" prio=5 tid=11 WAIT
| group="main" sCount=1 dsCount=0 obj=0x430acc80 self=0x710d4bd8
| sysTid=11830 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1896697896
| state=S schedstat=( 530989 524949 6 ) utm=0 stm=0 core=3
at java.lang.Object.wait(Native Method)

  • waiting on <0x430ace18> (a java.lang.VMThread) held by tid=11 (AsyncTask #1)
    at java.lang.Thread.parkFor(Thread.java:1205)
    at sun.misc.Unsafe.park(Unsafe.java:325)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:159)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2019)
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1013)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1073)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    at java.lang.Thread.run(Thread.java:841)

Which is best lib. to use ?

In my app RESTful services are called in background threading & in 1 sec i want tom kae 2 to 4 request in one thread…And there may be 3 to 4 such thread running in parallel & making individual REST request…
So in this Situation which lib. should I use ??
Plz help me out..
Thanks…

Cache of POST with same url and different body

Because of the mWaitingRequests field of RequestQueue, several Request which have same url and different body, the others request can only be executed after the first Request return. I think this is a little unreasonable, can mWaitingRequests only work for GET method? Common HTTP caches are typically limited to caching responses to GET.

Make Request.finish public

I am working on a project where I want to write my own implementation of ResponseDelivery. As part of handling the delivery, it looks like (based on the behavior of ExecutorDelivery) I should be calling Request.finish, but I can't do that because the method is package private.

I don't see anything to indicate that the method is supposed to be package private. Is it supposed to be, or was the access modifier omitted by mistake?

How to read header from response and store it for every future request?

Hi,
I have a JWT token that I get from a login response. For authentication, I need to set that token for every request later on until that token gets deleted on logout.

How can I read that token, without providing it on JSON body and store it for every future request?

I am quite new with Android development and until now I had really good experience with volley. Now I am struggling at this use case. Any help would be appreciated!

Have a nice day!

JSONObject isn't encoding like it should be?

This is server side code

<?php
require('connection.php');
require('functions.php');

$inputJSON = file_get_contents('php://input');
$aReuestData = json_decode( $inputJSON, TRUE ); //convert JSON into array

 $user_email = $aReuestData['user_email'];
 $user_password = $aReuestData['user_password'];
  $user_uniq = $aReuestData['user_uniq_id'];

if((($user_password !='') && ($user_email !=''))|| ($user_uniq!=''))
{
    $uname = $user_email;
    $pword = $user_password;
    $format ='json';    
    if(($user_password !='') && ($user_email !='')){
    echo $checkUser = checkLogin($uname,$pword);
    }
    else{
        $checkUser = checkLoginFacebook($user_uniq);
    }
    //print_r($checkUser);
    if($checkUser['id'] > 0)
    {
        $result = $checkUser; 
    }else{
        $result = "false";
    }
}else{

    $result = "Enter username and password";

}

$records = array("result"=> $result); 

echo $_REQUEST['jsoncallback'].  json_encode($records);

?>

and my code for login activity is

 final JSONObject jsonObject = new JSONObject();

        try {

            jsonObject.put("user_email",username.getText().toString().trim());
            jsonObject.put("user_password",password.getText().toString().trim());
        } catch (JSONException e) {
            e.printStackTrace();
        }

        requestQueue.start();
        final String url = "http://demo4u.org/leaveapp/ws/login.php";
        send.setText(jsonObject.toString());
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url, jsonObject,
                        new Response.Listener<JSONObject>() {
                            @Override
                            public void onResponse(JSONObject response) {
                                Toast.makeText(Login.this,"Passed",Toast.LENGTH_LONG).show();
                                hello.setText(response.toString());

                            }
                        }, new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Toast.makeText(Login.this,"Error",Toast.LENGTH_LONG).show();
                    }
                }

                );
                requestQueue.add(jsonObjectRequest);
            }
        });

and the only thing that I get returned is

$result = "Enter username and password";

what am I doing wrong? am I to include JSON header or something ???

Please reply in detailed view cause I'm new to android.....
SHOWCASE your skills please....

Bring up build infrastructure

Includes the following components:

  • Clean up the makefiles (perhaps just use Gradle for everything instead of Maven)
  • Continuous integration builds/tests for commits and pull requests
  • Other useful things to check in CI (e.g. error-prone, google-java-format)
  • Artifact deployment (snapshots on commit, official releases on tags)

Make the dependency on Apache HTTP optional

Volley currently depends on Apache HTTP. We can mostly remove the dependency except that HttpStack#performRequest returns an org.apache.http.HttpResponse, which means it'd be an API-breaking change to remove.

It might be worth biting the bullet and just doing a major version bump that breaks the API. There are other known issues that we could potentially address alongside this. However, one avenue worth exploring would be to see if we could treat Apache HTTP as a "provided" dependency - that is, one which is available at compile time, but not runtime - and then deprecate the old performRequest and add a new one that is implemented by all built-in clients (except HttpClientStack, which should be deprecated as well).

I think the result would compile and let apps build against Volley without pulling in the Apache HTTP dependency, but existing users could continue to use the Apache stack as long as they pulled in the dependency at runtime (and it should be there on an actual Android device).

Apart from the ugliness, my main concern is how proguard would respond to the missing reference - we could add a consumer proguard rule to not warn on org.apache stuff though that might be a bit overbearing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.