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

Using Collection.isEmpty() to test for emptiness #10

Merged
merged 1 commit into from
Mar 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/java/org/cafesip/sipunit/EventSubscriber.java
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,7 @@ public RequestEvent waitNotify(long timeout) {
initErrorInfo();

synchronized (this) {
if (reqEvents.size() == 0) {
if (reqEvents.isEmpty()) {
try {
LOG.trace("about to block, waiting");
this.wait(timeout);
Expand All @@ -1516,7 +1516,7 @@ public RequestEvent waitNotify(long timeout) {
}

LOG.trace("either we got the request, or timed out");
if (reqEvents.size() == 0) {
if (reqEvents.isEmpty()) {
String err =
"*** NOTIFY REQUEST ERROR *** (" + targetUri
+ ") - The maximum amount of time to wait for a NOTIFY message has elapsed.";
Expand Down Expand Up @@ -1554,7 +1554,7 @@ public RequestEvent waitNotify(long timeout) {
protected EventObject waitResponse(long timeout) {
synchronized (responseBlock) {
LinkedList<EventObject> events = transaction.getEvents();
if (events.size() == 0) {
if (events.isEmpty()) {
try {
LOG.trace("about to block, waiting");
responseBlock.waitForEvent(timeout);
Expand All @@ -1569,7 +1569,7 @@ protected EventObject waitResponse(long timeout) {

LOG.trace("either we got the response, or timed out");

if (events.size() == 0) {
if (events.isEmpty()) {
setReturnCode(SipSession.TIMEOUT_OCCURRED);
setErrorMessage("The maximum amount of time to wait for a response message has elapsed.");
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/cafesip/sipunit/SipPhone.java
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ public void dispose() {
this.removeRequestListener(Request.NOTIFY, this);

// drop calls
while (callList.size() > 0) {
while (!callList.isEmpty()) {
((SipCall) callList.get(0)).dispose();
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/cafesip/sipunit/SipSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ public EventObject waitResponse(SipTransaction trans, long timeout) {

synchronized (trans.getBlock()) {
LinkedList<EventObject> events = trans.getEvents();
if (events.size() == 0) {
if (events.isEmpty()) {
try {
trans.getBlock().waitForEvent(timeout);
} catch (Exception ex) {
Expand All @@ -1039,7 +1039,7 @@ public EventObject waitResponse(SipTransaction trans, long timeout) {
}
}

if (events.size() == 0) {
if (events.isEmpty()) {
setReturnCode(TIMEOUT_OCCURRED);
setErrorMessage("The maximum amount of time to wait for a response message has elapsed.");
return null;
Expand Down Expand Up @@ -1101,7 +1101,7 @@ public RequestEvent waitRequest(long timeout) {
initErrorInfo();

synchronized (reqBlock) {
if (reqEvents.size() == 0) {
if (reqEvents.isEmpty()) {
try {
LOG.trace("about to block, waiting");
reqBlock.waitForEvent(timeout);
Expand All @@ -1115,7 +1115,7 @@ public RequestEvent waitRequest(long timeout) {
}

LOG.trace("either we got the request, or timed out");
if (reqEvents.size() == 0) {
if (reqEvents.isEmpty()) {
setReturnCode(TIMEOUT_OCCURRED);
setErrorMessage("The maximum amount of time to wait for a request message has elapsed.");
return null;
Expand Down