Program: 78333
Project: 78333
Buggy source:
/** 
 * 商品的关键字搜索和动态排序
 * @param categoryId
 * @param keyword
 * @param pageNum
 * @param pageSize
 * @param orderBy
 * @return
 */
@Override public ServerResponse<PageInfo> getProductByKeywordCategory(Integer categoryId,String keyword,int pageNum,int pageSize,String orderBy){
  if (StringUtils.isBlank(keyword) && categoryId == null) {
    return ServerResponse.createByErrorCodeMessage(ResponseCode.ILLEGAL_ARGUMENT.getCode(),ResponseCode.ILLEGAL_ARGUMENT.getDescription());
  }
  List<Integer> categoryIdList=new ArrayList<>();
  if (categoryId != null) {
    Category category=categoryMapper.selectByPrimaryKey(categoryId);
    if (category == null) {
      PageHelper.startPage(pageNum,pageSize);
      List<ProductListVo> productListVoList=Lists.newArrayList();
      PageInfo pageInfo=new PageInfo(productListVoList);
      return ServerResponse.createBySuccess(pageInfo);
    }
    categoryIdList=iCategoryService.selectCategoryAndChildrenById(categoryId).getData();
  }
  if (StringUtils.isNotBlank(keyword)) {
    keyword=new StringBuilder().append("String_Node_Str").append(keyword).append("String_Node_Str").toString();
  }
  if (StringUtils.isNotBlank(orderBy)) {
    String[] orderArr=orderBy.split("String_Node_Str");
    PageHelper.orderBy(orderArr[0] + "String_Node_Str" + orderArr[1]);
  }
  PageHelper.startPage(pageNum,pageSize);
  keyword=StringUtils.isBlank(keyword) ? null : keyword;
  categoryIdList=categoryIdList.size() == 0 ? null : categoryIdList;
  List<Product> productList=productMapper.selectByNameAndCategoryIds(keyword,categoryIdList);
  List<ProductListVo> productListVoList=new ArrayList<>();
  for (  Product product : productList) {
    ProductListVo productListVo=assembleProductListVo(product);
    productListVoList.add(productListVo);
  }
  PageInfo pageInfo=new PageInfo(productList);
  pageInfo.setList(productListVoList);
  return ServerResponse.createBySuccess(pageInfo);
}

Fixed version (ground truth):
/** 
 * 商品的关键字搜索和动态排序
 * @param categoryId
 * @param keyword
 * @param pageNum
 * @param pageSize
 * @param orderBy
 * @return
 */
@Override public ServerResponse<PageInfo> getProductByKeywordCategory(Integer categoryId,String keyword,int pageNum,int pageSize,String orderBy){
  if (StringUtils.isBlank(keyword) && categoryId == null) {
    return ServerResponse.createByErrorCodeMessage(ResponseCode.ILLEGAL_ARGUMENT.getCode(),ResponseCode.ILLEGAL_ARGUMENT.getDescription());
  }
  List<Integer> categoryIdList=new ArrayList<>();
  if (categoryId != null) {
    Category category=categoryMapper.selectByPrimaryKey(categoryId);
    if (category == null) {
      PageHelper.startPage(pageNum,pageSize);
      List<ProductListVo> productListVoList=Lists.newArrayList();
      PageInfo pageInfo=new PageInfo(productListVoList);
      return ServerResponse.createBySuccess(pageInfo);
    }
    categoryIdList=iCategoryService.selectCategoryAndChildrenById(categoryId).getData();
  }
  if (StringUtils.isNotBlank(keyword)) {
    keyword=new StringBuilder().append("String_Node_Str").append(keyword).append("String_Node_Str").toString();
  }
  if (StringUtils.isNotBlank(orderBy)) {
    if (Const.ProductListOrderBy.PRICE_ASC_DESC.contains(orderBy)) {
      String[] orderArr=orderBy.split("String_Node_Str");
      PageHelper.orderBy(orderArr[0] + "String_Node_Str" + orderArr[1]);
    }
  }
  PageHelper.startPage(pageNum,pageSize);
  keyword=StringUtils.isBlank(keyword) ? null : keyword;
  categoryIdList=categoryIdList.size() == 0 ? null : categoryIdList;
  List<Product> productList=productMapper.selectByNameAndCategoryIds(keyword,categoryIdList);
  List<ProductListVo> productListVoList=new ArrayList<>();
  for (  Product product : productList) {
    ProductListVo productListVo=assembleProductListVo(product);
    productListVoList.add(productListVo);
  }
  PageInfo pageInfo=new PageInfo(productList);
  pageInfo.setList(productListVoList);
  return ServerResponse.createBySuccess(pageInfo);
}