Fixed potential div by zero bug
commit4c14b7869d47a28aca29e219a3bae10f43083b33
authorJeff Schumacher <jeffschu@google.com>
Fri, 9 Jul 2010 19:53:57 +0000 (9 12:53 -0700)
committerJeff Schumacher <jeffschu@google.com>
Mon, 12 Jul 2010 19:24:42 +0000 (12 12:24 -0700)
tree1efd65612f486c82b312881c58f9cbcbed8309ff
parent64b9458640bafadc70028c99bb038480309e568d
Fixed potential div by zero bug

The scoring logic in SimilarityIndex was dividing by the max file
size. If both files are empty, this would cause a div by zero
error. This case cannot currently happen, since two empty files
would have the same SHA1, and would therefore be caught in the
earlier SHA1 based detection pass. Still, if this logic eventually
gets separated from that pass, a div by zero error would occur.

I changed the logic to instead consider two empty files to have a
similarity score of 100.

Change-Id: Ic08e18a066b8fef25bb5e7c62418106a8cee762a
org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java