1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-14 00:51:19 +01:00

More checkstyle whitespace related checks

This commit is contained in:
Florian Schmaus 2017-05-23 16:45:04 +02:00
parent 847890b037
commit ce1cddc722
140 changed files with 583 additions and 512 deletions

View file

@ -118,9 +118,9 @@ public final class BookmarkManager {
BookmarkedConference bookmark
= new BookmarkedConference(name, jid, isAutoJoin, nickname, password);
List<BookmarkedConference> conferences = bookmarks.getBookmarkedConferences();
if(conferences.contains(bookmark)) {
if (conferences.contains(bookmark)) {
BookmarkedConference oldConference = conferences.get(conferences.indexOf(bookmark));
if(oldConference.isShared()) {
if (oldConference.isShared()) {
throw new IllegalArgumentException("Cannot modify shared bookmark");
}
oldConference.setAutoJoin(isAutoJoin);
@ -149,10 +149,10 @@ public final class BookmarkManager {
public void removeBookmarkedConference(EntityBareJid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
Iterator<BookmarkedConference> it = bookmarks.getBookmarkedConferences().iterator();
while(it.hasNext()) {
while (it.hasNext()) {
BookmarkedConference conference = it.next();
if(conference.getJid().equals(jid)) {
if(conference.isShared()) {
if (conference.getJid().equals(jid)) {
if (conference.isShared()) {
throw new IllegalArgumentException("Conference is shared and can't be removed");
}
it.remove();
@ -192,9 +192,9 @@ public final class BookmarkManager {
retrieveBookmarks();
BookmarkedURL bookmark = new BookmarkedURL(URL, name, isRSS);
List<BookmarkedURL> urls = bookmarks.getBookmarkedURLS();
if(urls.contains(bookmark)) {
if (urls.contains(bookmark)) {
BookmarkedURL oldURL = urls.get(urls.indexOf(bookmark));
if(oldURL.isShared()) {
if (oldURL.isShared()) {
throw new IllegalArgumentException("Cannot modify shared bookmarks");
}
oldURL.setName(name);
@ -219,10 +219,10 @@ public final class BookmarkManager {
public void removeBookmarkedURL(String bookmarkURL) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
retrieveBookmarks();
Iterator<BookmarkedURL> it = bookmarks.getBookmarkedURLS().iterator();
while(it.hasNext()) {
while (it.hasNext()) {
BookmarkedURL bookmark = it.next();
if(bookmark.getURL().equalsIgnoreCase(bookmarkURL)) {
if(bookmark.isShared()) {
if (bookmark.getURL().equalsIgnoreCase(bookmarkURL)) {
if (bookmark.isShared()) {
throw new IllegalArgumentException("Cannot delete a shared bookmark.");
}
it.remove();
@ -249,8 +249,8 @@ public final class BookmarkManager {
}
private Bookmarks retrieveBookmarks() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
synchronized(bookmarkLock) {
if(bookmarks == null) {
synchronized (bookmarkLock) {
if (bookmarks == null) {
bookmarks = (Bookmarks) privateDataManager.getPrivateData("storage",
"storage:bookmarks");
}

View file

@ -115,10 +115,10 @@ public class BookmarkedConference implements SharedBookmark {
@Override
public boolean equals(Object obj) {
if(obj == null || !(obj instanceof BookmarkedConference)) {
if (obj == null || !(obj instanceof BookmarkedConference)) {
return false;
}
BookmarkedConference conference = (BookmarkedConference)obj;
BookmarkedConference conference = (BookmarkedConference) obj;
return conference.getJid().equals(jid);
}

View file

@ -86,10 +86,10 @@ public class BookmarkedURL implements SharedBookmark {
@Override
public boolean equals(Object obj) {
if(!(obj instanceof BookmarkedURL)) {
if (!(obj instanceof BookmarkedURL)) {
return false;
}
BookmarkedURL url = (BookmarkedURL)obj;
BookmarkedURL url = (BookmarkedURL) obj;
return url.getURL().equalsIgnoreCase(URL);
}

View file

@ -177,7 +177,7 @@ public class Bookmarks implements PrivateData {
buf.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket();
for (BookmarkedURL urlStorage : getBookmarkedURLS()) {
if(urlStorage.isShared()) {
if (urlStorage.isShared()) {
continue;
}
buf.halfOpenElement("url").attribute("name", urlStorage.getName()).attribute("url", urlStorage.getURL());
@ -187,7 +187,7 @@ public class Bookmarks implements PrivateData {
// Add Conference additions
for (BookmarkedConference conference : getBookmarkedConferences()) {
if(conference.isShared()) {
if (conference.isShared()) {
continue;
}
buf.halfOpenElement("conference");
@ -260,7 +260,7 @@ public class Bookmarks implements PrivateData {
boolean done = false;
while (!done) {
int eventType = parser.next();
if(eventType == XmlPullParser.START_TAG
if (eventType == XmlPullParser.START_TAG
&& "shared_bookmark".equals(parser.getName())) {
urlStore.setShared(true);
}
@ -291,7 +291,7 @@ public class Bookmarks implements PrivateData {
else if (eventType == XmlPullParser.START_TAG && "password".equals(parser.getName())) {
conf.setPassword(parser.nextText());
}
else if(eventType == XmlPullParser.START_TAG
else if (eventType == XmlPullParser.START_TAG
&& "shared_bookmark".equals(parser.getName())) {
conf.setShared(true);
}