mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
add pmd for codecheck
add generic to the smackx bookmark git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@11023 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
f943d27a3b
commit
634afb2cad
6 changed files with 40 additions and 23 deletions
BIN
build/asm.jar
Normal file
BIN
build/asm.jar
Normal file
Binary file not shown.
|
@ -339,6 +339,24 @@
|
|||
<ant antfile="${basedir}/build/release.xml" />
|
||||
</target>
|
||||
|
||||
<!-- checkcode -->
|
||||
<!-- ======================================================================================= -->
|
||||
<target name="checkcode" >
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
|
||||
<classpath>
|
||||
<pathelement location="${basedir}/build/pmd.jar" />
|
||||
<pathelement location="${basedir}/build/asm.jar" />
|
||||
<pathelement location="${basedir}/build/jaxen.jar" />
|
||||
</classpath>
|
||||
</taskdef>
|
||||
<pmd shortFilenames="true">
|
||||
<ruleset>migrating</ruleset>
|
||||
<formatter type="html" toFile="target/pmd_report.html" toConsole="true" />
|
||||
<fileset dir="source/">
|
||||
<include name="**/*.java" />
|
||||
</fileset>
|
||||
</pmd>
|
||||
</target>
|
||||
|
||||
<!-- release-exists -->
|
||||
<!-- ======================================================================================= -->
|
||||
|
|
BIN
build/jaxen.jar
Normal file
BIN
build/jaxen.jar
Normal file
Binary file not shown.
BIN
build/pmd.jar
Normal file
BIN
build/pmd.jar
Normal file
Binary file not shown.
|
@ -36,7 +36,7 @@ import java.util.*;
|
|||
* @author Alexander Wenckus
|
||||
*/
|
||||
public class BookmarkManager {
|
||||
private static final Map bookmarkManagerMap = new HashMap();
|
||||
private static final Map<XMPPConnection, BookmarkManager> bookmarkManagerMap = new HashMap<XMPPConnection, BookmarkManager>();
|
||||
static {
|
||||
PrivateDataManager.addPrivateDataProvider("storage", "storage:bookmarks",
|
||||
new Bookmarks.Provider());
|
||||
|
@ -87,7 +87,7 @@ public class BookmarkManager {
|
|||
* the server.
|
||||
* @see BookmarkedConference
|
||||
*/
|
||||
public Collection getBookmarkedConferences() throws XMPPException {
|
||||
public Collection<BookmarkedConference> getBookmarkedConferences() throws XMPPException {
|
||||
retrieveBookmarks();
|
||||
return Collections.unmodifiableCollection(bookmarks.getBookmarkedConferences());
|
||||
}
|
||||
|
@ -109,10 +109,9 @@ public class BookmarkManager {
|
|||
retrieveBookmarks();
|
||||
BookmarkedConference bookmark
|
||||
= new BookmarkedConference(name, jid, isAutoJoin, nickname, password);
|
||||
List conferences = bookmarks.getBookmarkedConferences();
|
||||
List<BookmarkedConference> conferences = bookmarks.getBookmarkedConferences();
|
||||
if(conferences.contains(bookmark)) {
|
||||
BookmarkedConference oldConference = (BookmarkedConference)
|
||||
conferences.get(conferences.indexOf(bookmark));
|
||||
BookmarkedConference oldConference = conferences.get(conferences.indexOf(bookmark));
|
||||
if(oldConference.isShared()) {
|
||||
throw new IllegalArgumentException("Cannot modify shared bookmark");
|
||||
}
|
||||
|
@ -138,9 +137,9 @@ public class BookmarkManager {
|
|||
*/
|
||||
public void removeBookmarkedConference(String jid) throws XMPPException {
|
||||
retrieveBookmarks();
|
||||
Iterator it = bookmarks.getBookmarkedConferences().iterator();
|
||||
Iterator<BookmarkedConference> it = bookmarks.getBookmarkedConferences().iterator();
|
||||
while(it.hasNext()) {
|
||||
BookmarkedConference conference = (BookmarkedConference) it.next();
|
||||
BookmarkedConference conference = it.next();
|
||||
if(conference.getJid().equalsIgnoreCase(jid)) {
|
||||
if(conference.isShared()) {
|
||||
throw new IllegalArgumentException("Conference is shared and can't be removed");
|
||||
|
@ -158,7 +157,7 @@ public class BookmarkManager {
|
|||
* @return returns an unmodifiable collection of all bookmarked urls.
|
||||
* @throws XMPPException thrown when there is a problem retriving bookmarks from the server.
|
||||
*/
|
||||
public Collection getBookmarkedURLs() throws XMPPException {
|
||||
public Collection<BookmarkedURL> getBookmarkedURLs() throws XMPPException {
|
||||
retrieveBookmarks();
|
||||
return Collections.unmodifiableCollection(bookmarks.getBookmarkedURLS());
|
||||
}
|
||||
|
@ -175,9 +174,9 @@ public class BookmarkManager {
|
|||
public void addBookmarkedURL(String URL, String name, boolean isRSS) throws XMPPException {
|
||||
retrieveBookmarks();
|
||||
BookmarkedURL bookmark = new BookmarkedURL(URL, name, isRSS);
|
||||
List urls = bookmarks.getBookmarkedURLS();
|
||||
List<BookmarkedURL> urls = bookmarks.getBookmarkedURLS();
|
||||
if(urls.contains(bookmark)) {
|
||||
BookmarkedURL oldURL = (BookmarkedURL) urls.get(urls.indexOf(bookmark));
|
||||
BookmarkedURL oldURL = urls.get(urls.indexOf(bookmark));
|
||||
if(oldURL.isShared()) {
|
||||
throw new IllegalArgumentException("Cannot modify shared bookmarks");
|
||||
}
|
||||
|
@ -199,9 +198,9 @@ public class BookmarkManager {
|
|||
*/
|
||||
public void removeBookmarkedURL(String bookmarkURL) throws XMPPException {
|
||||
retrieveBookmarks();
|
||||
Iterator it = bookmarks.getBookmarkedURLS().iterator();
|
||||
Iterator<BookmarkedURL> it = bookmarks.getBookmarkedURLS().iterator();
|
||||
while(it.hasNext()) {
|
||||
BookmarkedURL bookmark = (BookmarkedURL) it.next();
|
||||
BookmarkedURL bookmark = it.next();
|
||||
if(bookmark.getURL().equalsIgnoreCase(bookmarkURL)) {
|
||||
if(bookmark.isShared()) {
|
||||
throw new IllegalArgumentException("Cannot delete a shared bookmark.");
|
||||
|
|
|
@ -62,15 +62,15 @@ import java.util.List;
|
|||
*/
|
||||
public class Bookmarks implements PrivateData {
|
||||
|
||||
private List bookmarkedURLS;
|
||||
private List bookmarkedConferences;
|
||||
private List<BookmarkedURL> bookmarkedURLS;
|
||||
private List<BookmarkedConference> bookmarkedConferences;
|
||||
|
||||
/**
|
||||
* Required Empty Constructor to use Bookmarks.
|
||||
*/
|
||||
public Bookmarks() {
|
||||
bookmarkedURLS = new ArrayList();
|
||||
bookmarkedConferences = new ArrayList();
|
||||
bookmarkedURLS = new ArrayList<BookmarkedURL>();
|
||||
bookmarkedConferences = new ArrayList<BookmarkedConference>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,7 +128,7 @@ public class Bookmarks implements PrivateData {
|
|||
*
|
||||
* @return a collection of all Bookmarked URLs.
|
||||
*/
|
||||
public List getBookmarkedURLS() {
|
||||
public List<BookmarkedURL> getBookmarkedURLS() {
|
||||
return bookmarkedURLS;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ public class Bookmarks implements PrivateData {
|
|||
*
|
||||
* @return a collection of all Bookmarked Conferences.
|
||||
*/
|
||||
public List getBookmarkedConferences() {
|
||||
public List<BookmarkedConference> getBookmarkedConferences() {
|
||||
return bookmarkedConferences;
|
||||
}
|
||||
|
||||
|
@ -169,9 +169,9 @@ public class Bookmarks implements PrivateData {
|
|||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("<storage xmlns=\"storage:bookmarks\">");
|
||||
|
||||
final Iterator urls = getBookmarkedURLS().iterator();
|
||||
final Iterator<BookmarkedURL> urls = getBookmarkedURLS().iterator();
|
||||
while (urls.hasNext()) {
|
||||
BookmarkedURL urlStorage = (BookmarkedURL) urls.next();
|
||||
BookmarkedURL urlStorage = urls.next();
|
||||
if(urlStorage.isShared()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -184,9 +184,9 @@ public class Bookmarks implements PrivateData {
|
|||
}
|
||||
|
||||
// Add Conference additions
|
||||
final Iterator conferences = getBookmarkedConferences().iterator();
|
||||
final Iterator<BookmarkedConference> conferences = getBookmarkedConferences().iterator();
|
||||
while (conferences.hasNext()) {
|
||||
BookmarkedConference conference = (BookmarkedConference) conferences.next();
|
||||
BookmarkedConference conference = conferences.next();
|
||||
if(conference.isShared()) {
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue