webindex.data.fluo.PageLoader does not check for null inputs. When dereferencing the object to see if it is empty it doesn't first check to make sure the object exists. I wrote a simple test to show this below.
This is line 45 - 50 that shows why it happens
public static PageLoader updatePage(Page page) {
Preconditions.checkArgument(!page.isEmpty(), "Page cannot be empty");
PageLoader update = new PageLoader();
update.action = Action.UPDATE;
update.page = page;
return update;
}
package webindex.fluo;
import org.junit.Test;
import webindex.core.models.Page;
import webindex.data.fluo.PageLoader;
public class PageLoaderTest {
@Test
public void testNullPage() {
Page p = null;
PageLoader loader = PageLoader.updatePage(p);
}
@Test(expected = IllegalArgumentException.class)
public void testEmptyPageThrowsIllegalArgument() {
Page p = Page.EMPTY;
PageLoader loader = PageLoader.updatePage(p);
}
}
webindex.data.fluo.PageLoader does not check for null inputs. When dereferencing the object to see if it is empty it doesn't first check to make sure the object exists. I wrote a simple test to show this below.
This is line 45 - 50 that shows why it happens