[Demonstration 2]

[Buggy Method]
public static void main(String[] args) throws IOException {
    if (args.length != 3) {
        System.err.println("please input args: number of nodes, output path of topology, output path of demand");
        return;
    }
    int maxNodes = Integer.parseInt(args[0]);
    String topoPath = args[1];
    String demandPath = args[2];
    // Create a random system
    Random rand = new Random();
    // Create topology
    File topoFile = new File(topoPath);
    if (topoFile.exists() && topoFile.isFile() && (!topoFile.canRead())) {
        System.err.println(topoPath + " can not be created.");
        return;
    }
    topoFile.createNewFile();
    FileWriter fw = new FileWriter(topoFile, false);
    BufferedWriter bw = new BufferedWriter(fw);
    int pathCnt = 0;
    HashMap<Integer, Integer> pathStatus = new HashMap<Integer, Integer>();
    int threshold = (MAXPATH > (maxNodes - 1)) ? (maxNodes - 1) : MAXPATH;
    for (int i = 0; i < maxNodes; i++) {
        int currentCnt = 0;
        if (pathStatus.containsKey(i)) {
            currentCnt = pathStatus.get(i);
        }
        if (currentCnt >= threshold) {
            continue;
        }
        // How many nodes will be the current node's destinations
        int destsNum = rand.nextInt(threshold - currentCnt) + 1;
        ArrayList<Integer> destsList = new ArrayList<Integer>();
        destsList.add(i);
        for (int j = 0; j < destsNum; j++) {
            int testNode;
            int testCnt = 0;
            do {
                testNode = rand.nextInt(maxNodes);
                if (pathStatus.containsKey(testNode)) {
                    testCnt = pathStatus.get(testNode);
                }
            } while ((testCnt >= threshold) || (destsList.contains(testNode)));
            String out = pathCnt + "," + i + "," + testNode + "," + (rand.nextInt(MAXCOST) + 1) + "\n";
            bw.write(out);
            pathStatus.put(testNode, testCnt + 1);
            destsList.add(testNode);
            pathCnt++;
        }
        pathStatus.put(i, currentCnt + destsNum);
    }
    if (fw != null)
        bw.close();
    if (bw != null)
        fw.close();
    // Create demand
    File demandFile = new File(demandPath);
    if (demandFile.exists() && demandFile.isFile() && (!demandFile.canRead())) {
        System.err.println(demandPath + " can not be created.");
        return;
    }
    demandFile.createNewFile();
    fw = new FileWriter(demandFile, false);
    bw = new BufferedWriter(fw);
    int source = rand.nextInt(maxNodes);
    int destination;
    do {
        destination = rand.nextInt(maxNodes);
    } while (source == destination);
    // How many nodes should be in the including set
    int includingSetNum = rand.nextInt(maxNodes - 1);
    String out = source + "," + destination + ",";
    for (int i = 0; i < includingSetNum; i++) {
        int testNode;
        do {
            testNode = rand.nextInt(maxNodes);
        } while ((testNode == source) || (testNode == destination));
        out += testNode;
        if (i != includingSetNum - 1) {
            out += '|';
        }
    }
    bw.write(out);
    if (bw != null)
        bw.close();
    if (fw != null)
        fw.close();
}

[Buggy Hunk]
int includingSetNum = rand.nextInt(maxNodes - 1);

[Patch]
int includingSetNum = rand.nextInt(maxNodes - 2) + 1;

[Demonstration 3]

[Buggy Method]
@Nullable
public <T> T deserialize(@Nullable Ason ason, @NotNull Class<T> cls) {
    if (ason == null) {
        return null;
    } else if (isPrimitive(cls)) {
        throw new IllegalArgumentException("You cannot deserialize an object to a primitive type (" + cls.getName() + ").");
    } else if (cls == Ason.class || cls == JSONObject.class) {
        if (cls == JSONObject.class)
            return (T) ason.toStockJson();
        return (T) ason;
    } else if (cls == AsonArray.class || cls == JSONArray.class) {
        throw new IllegalArgumentException("You cannot deserialize an object to a JSON array.");
    }
    ClassCacheEntry<T> cacheEntry = classCache.get(cls);
    if (cacheEntry == null) {
        cacheEntry = new ClassCacheEntry<>(cls);
    }
    final T newObject = cacheEntry.newInstance();
    for (String name : cacheEntry.fields()) {
        final Class<?> type = cacheEntry.fieldType(name);
        if (isPrimitive(type) || type == JSONObject.class || type == JSONArray.class || type == Ason.class || type == AsonArray.class) {
            cacheEntry.set(newObject, name, ason.get(name));
        } else if (type.isArray()) {
            AsonArray asonArray = ason.get(name);
            cacheEntry.set(newObject, name, deserializeArray(asonArray, type.getComponentType()));
        } else if (isList(type)) {
            AsonArray asonArray = ason.get(name);
            Class<?> listItemType = cacheEntry.listItemType(name);
            cacheEntry.set(newObject, name, deserializeList(asonArray, listItemType));
        } else {
            Object value = ason.get(name);
            if (value instanceof Ason) {
                Ason asonObject = (Ason) value;
                cacheEntry.set(newObject, name, deserialize(asonObject, type));
            } else {
                AsonArray asonArray = (AsonArray) value;
                cacheEntry.set(newObject, name, deserializeArray(asonArray, type));
            }
        }
    }
    return newObject;
}

[Buggy Hunk]
cacheEntry.set(newObject, name, deserializeArray(asonArray, type.getComponentType()));

[Patch]
cacheEntry.set(newObject, name, deserializeArray(asonArray, type));