Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: paging breaks with + sign on phone number #571

Merged
merged 39 commits into from
Sep 17, 2020
Merged

Conversation

thinkingserious
Copy link
Contributor

Fixes #569

Checklist

  • I acknowledge that all my contributions will be made under the project's license

@thinkingserious
Copy link
Contributor Author

This was how I reproduced #569:

git clone https://github.com/twilio/twilio-java.git
cd twilio-java
touch ReproduceTwilioBug.java

ReproduceTwilioBug.java:

import com.google.common.collect.Iterators;
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.api.v2010.account.Call;

public class ReproduceTwilioBug {

    static {
        String accountSid = System.getenv("TWILIO_ACCOUNT_SID");
        String authToken = System.getenv("TWILIO_AUTH_TOKEN");
        Twilio.init(accountSid, authToken);
    }

    public static void main(final String args[]) {
        String toPhoneNumber = System.getenv("TWILIO_TO_PHONE_NUMBER");
        final String to = toPhoneNumber;
        countCalls(to);
        countCalls(to.replace("+", ""));
    }

    static void countCalls(final String to) {
        ResourceSet<Call> calls = Call.reader().setTo(to).pageSize(5).limit(20).read();
        System.out.println("For " + to + " " + Iterators.size(calls.iterator()) + " calls.");
    }
}
mvn install -DskipTests
javac -classpath ./target/twilio-7.55.0-jar-with-dependencies.jar:. ReproduceTwilioBug.java && java -classpath ./target/twilio-7.55.0-jar-with-dependencies.jar:. ReproduceTwilioBug

Result:

For +1951XXXXXXX 5 calls.
For 1951XXXXXXX 6 calls.

After this fix, Result:

For +1951XXXXXXX 6 calls.
For 1951XXXXXXX 6 calls.

@childish-sambino
Copy link
Contributor

Is there any overlap with #570?

@thinkingserious
Copy link
Contributor Author

#570 seems related to not handling non-JSON return values when paging fails. To be sure, I'd like to reproduce that one as well.

src/main/java/com/twilio/http/Request.java Outdated Show resolved Hide resolved
src/main/java/com/twilio/http/Request.java Outdated Show resolved Hide resolved
src/main/java/com/twilio/http/Request.java Outdated Show resolved Hide resolved
src/main/java/com/twilio/http/Request.java Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Paging breaks when filtering with To number with + sign
3 participants