Changeset 11324 in josm for trunk/test/functional


Ignore:
Timestamp:
2016-11-27T05:16:30+01:00 (3 years ago)
Author:
Don-vip
Message:

findbugs

Location:
trunk/test/functional/org/openstreetmap/josm/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java

    r10937 r11324  
    1515import java.io.PrintWriter;
    1616import java.nio.charset.StandardCharsets;
     17import java.security.SecureRandom;
    1718import java.text.MessageFormat;
    1819import java.util.ArrayList;
    1920import java.util.Locale;
     21import java.util.Random;
    2022import java.util.logging.Logger;
    2123
     
    3941import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    4042
     43import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     44
    4145/**
    4246 * Unit tests of {@link MultiFetchServerObjectReader}.
    4347 */
     48@SuppressFBWarnings(value = "CRLF_INJECTION_LOGS")
    4449public class MultiFetchServerObjectReaderTest {
    4550    private static Logger logger = Logger.getLogger(MultiFetchServerObjectReader.class.getName());
     
    5964        DataSet ds = new DataSet();
    6065        ds.setVersion("0.6");
     66        Random rand = new SecureRandom();
    6167
    6268        int numNodes = 1000;
     
    8187        for (int i = 0; i < numWays; i++) {
    8288            Way w = new Way();
    83             int numNodesInWay = 2 + (int) Math.round(Math.random() * 5);
    84             int start = (int) Math.round(Math.random() * numNodes);
     89            int numNodesInWay = 2 + (int) Math.round(rand.nextDouble() * 5);
     90            int start = (int) Math.round(rand.nextDouble() * numNodes);
    8591            for (int j = 0; j < numNodesInWay; j++) {
    8692                int idx = (start + j) % numNodes;
     
    98104            Relation r = new Relation();
    99105            r.put("name", "relation-" +i);
    100             int numNodesInRelation = (int) Math.round(Math.random() * 10);
    101             int start = (int) Math.round(Math.random() * numNodes);
     106            int numNodesInRelation = (int) Math.round(rand.nextDouble() * 10);
     107            int start = (int) Math.round(rand.nextDouble() * numNodes);
    102108            for (int j = 0; j < numNodesInRelation; j++) {
    103109                int idx = (start + j) % 500;
     
    105111                r.addMember(new RelationMember("role-" + j, n));
    106112            }
    107             int numWaysInRelation = (int) Math.round(Math.random() * 10);
    108             start = (int) Math.round(Math.random() * numWays);
     113            int numWaysInRelation = (int) Math.round(rand.nextDouble() * 10);
     114            start = (int) Math.round(rand.nextDouble() * numWays);
    109115            for (int j = 0; j < numWaysInRelation; j++) {
    110116                int idx = (start + j) % 500;
  • trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java

    r11060 r11324  
    4444import org.openstreetmap.josm.tools.Logging;
    4545
     46import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     47
    4648/**
    4749 * Reads primitives referring to a particular primitive (ways including a node, relations referring to a relation)
    4850 * @since 1806
    4951 */
     52@SuppressFBWarnings(value = "CRLF_INJECTION_LOGS")
    5053public class OsmServerBackreferenceReaderTest {
    5154    private static final Logger logger = Logger.getLogger(OsmServerBackreferenceReader.class.getName());
Note: See TracChangeset for help on using the changeset viewer.