Skip to content

Commit

Permalink
fixes for some changes in SVN 6797 that caused NPEs when the bookmark…
Browse files Browse the repository at this point in the history
…s initialized

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6800 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Apr 13, 2010
1 parent dff6604 commit 4917f96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions source/de/anomic/data/BookmarkDate.java
Expand Up @@ -72,6 +72,7 @@ public void init(Iterator<Bookmark> it) {
int count = 0;
while (it.hasNext()) {
bookmark=it.next();
if (bookmark == null) continue;
date = String.valueOf(bookmark.getTimeStamp());
bmDate=getDate(date);
if(bmDate==null){
Expand Down
12 changes: 7 additions & 5 deletions source/de/anomic/data/bookmarksDB.java
Expand Up @@ -102,6 +102,7 @@ public bookmarksDB(final File bookmarksFile, final File datesFile) throws IOExce
String[] tagArray;
while(it.hasNext()){
bookmark = it.next();
if (bookmark == null) continue;
tagArray = BookmarkHelper.cleanTagsString(bookmark.getTagsString() + bookmark.getFoldersString()).split(",");
tag = null;
for (final String element : tagArray) {
Expand Down Expand Up @@ -332,7 +333,7 @@ public String addBookmark(final Bookmark bookmark){
public Bookmark getBookmark(final String urlHash){
try {
final Map<String, String> map = bookmarks.get(urlHash);
return (map == null) ? new Bookmark(map) : null;
return (map == null) ? null : new Bookmark(map);
} catch (final IOException e) {
return null;
}
Expand Down Expand Up @@ -373,6 +374,7 @@ public Iterator<String> getBookmarksIterator(final boolean priv) {
Bookmark bm;
while(it.hasNext()){
bm=it.next();
if (bm == null) continue;
if(priv || bm.getPublic()){
set.add(bm.getUrlHash());
}
Expand Down Expand Up @@ -866,17 +868,17 @@ public boolean hasNext() {
try {
return this.bookmarkIter.hasNext();
} catch (final kelondroException e) {
//resetDatabase();
Log.logException(e);
return false;
}
}

public Bookmark next() {
if (hasNext()) {
try {
String s = new String(this.bookmarkIter.next());
return getBookmark(s);
} else {
//resetDatabase();
} catch (final kelondroException e) {
Log.logException(e);
return null;
}
}
Expand Down

0 comments on commit 4917f96

Please sign in to comment.