Skip to content

Commit

Permalink
feat: add fixes from main
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaiSviridov committed Jun 12, 2023
1 parent d7cf728 commit ae4bf9b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions core/src/main/kotlin/loader/gerrit/CommentsLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CommentsLoader(files: Sequence<File>) {
private val loadedComments = mutableListOf<MutableMap<Int, CommentsREST>>()
private val commentsFilesIterator = CommentsFilesIterator(files)

fun get(id: Int): CommentsREST {
fun get(id: Int): CommentsREST? {
val iteratorLoadedComments = loadedComments.iterator()
while (iteratorLoadedComments.hasNext()) {
val loaded = iteratorLoadedComments.next()
Expand All @@ -25,7 +25,7 @@ class CommentsLoader(files: Sequence<File>) {
value?.let { return it }
}

throw Exception("There is no comments for id:${id}")
return null
}

}
2 changes: 1 addition & 1 deletion core/src/main/kotlin/loader/gerrit/LoaderChanges.kt
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class LoaderChanges(
changeIds.add(changeId)

val comments = commentsLoader.get(changeId)
if (change.totalCommentCount > 0) throw Exception("Can't find comments for ${change.number}")
if (change.totalCommentCount > 0 && comments == null) logger.severe("Can't find comments for ${change.number}")
processChanges(change, comments)
}
logger.info("Finished changes from ${file.name} file")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ open class FilesListIterator<T>(
}

private fun resetIterators() {
if (filesIter.hasNext()) {
while (filesIter.hasNext()) {
val listOfList = filesIter.next()
// assume files not empty
if (listOfList.isEmpty()) continue

listIter = listOfList.iterator()
resetValueIterator()
return
}
}

Expand Down

0 comments on commit ae4bf9b

Please sign in to comment.