fluo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [fluo-examples] kpm1985 opened a new issue #7: Webindex PageLoader null handling
Date Thu, 07 Mar 2019 23:38:22 GMT
kpm1985 opened a new issue #7: Webindex PageLoader null handling
URL: https://github.com/apache/fluo-examples/issues/7
   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 {
   	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);

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message