Skip to content

Commit

Permalink
Adds a verification logic to the parameters which must have positive …
Browse files Browse the repository at this point in the history
  • Loading branch information
koo-taejin committed Nov 2, 2016
1 parent 4bef040 commit 8cb11aa
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@

package com.navercorp.pinpoint.web.controller;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.navercorp.pinpoint.common.service.ServiceTypeRegistryService;
import com.navercorp.pinpoint.common.util.DateUtils;
import com.navercorp.pinpoint.common.util.TransactionId;
Expand All @@ -28,16 +39,6 @@
import com.navercorp.pinpoint.web.util.TimeUtils;
import com.navercorp.pinpoint.web.vo.LimitedScanResult;
import com.navercorp.pinpoint.web.vo.Range;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
*
Expand Down Expand Up @@ -159,6 +160,12 @@ public FilterMapWrap getFilteredServerMapDataMadeOfDotGroup(
@RequestParam(value = "filter", required = false) String filterText,
@RequestParam(value = "hint", required = false) String filterHint,
@RequestParam(value = "limit", required = false, defaultValue = "10000") int limit) {
if (xGroupUnit <= 0) {
throw new IllegalArgumentException("xGroupUnit(" + xGroupUnit + ") must be positive number");
}
if (yGroupUnit <= 0) {
throw new IllegalArgumentException("yGroupUnit(" + yGroupUnit + ") must be positive number");
}

limit = LimitUtils.checkRange(limit);
final Filter filter = filterBuilder.build(filterText, filterHint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@

package com.navercorp.pinpoint.web.controller;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.navercorp.pinpoint.common.server.bo.SpanBo;
import com.navercorp.pinpoint.common.util.DateUtils;
import com.navercorp.pinpoint.common.util.TransactionId;
Expand All @@ -31,22 +48,6 @@
import com.navercorp.pinpoint.web.vo.LimitedScanResult;
import com.navercorp.pinpoint.web.vo.Range;
import com.navercorp.pinpoint.web.vo.TransactionMetadataQuery;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
* @author netspider
Expand Down Expand Up @@ -148,6 +149,13 @@ public ModelAndView getScatterData(
@RequestParam(value = "filter", required = false) String filterText,
@RequestParam(value = "_callback", required = false) String jsonpCallback,
@RequestParam(value = "v", required = false, defaultValue = "1") int version) {
if (xGroupUnit <= 0) {
throw new IllegalArgumentException("xGroupUnit(" + xGroupUnit + ") must be positive number");
}
if (yGroupUnit <= 0) {
throw new IllegalArgumentException("yGroupUnit(" + yGroupUnit + ") must be positive number");
}

limit = LimitUtils.checkRange(limit);

StopWatch watch = new StopWatch();
Expand Down

0 comments on commit 8cb11aa

Please sign in to comment.