alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  
") > 0) { i = 1; } } else if (i == 1) { int index = line.indexOf("

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

package nbbuild.misc.bugcompare;

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun
 * Microsystems, Inc. All Rights Reserved.
 */
import java.util.*;
import java.net.*;
import java.io.*;
import org.xml.sax.*;

/**
 *
 * @author  ph97928
 * @version 
 */
public class Compare_1 {
    Map release32;
    Map dev;
    
    public Map fillTable(String name) {
        Map map = new TreeMap();
        try {
            ChangelogRecognizer.parse(new InputSource(name), new ChangelogHandlerImpl(map), new ChangelogParslet());
        }
        catch (Exception exc) {
            exc.printStackTrace();
        }
        return map;
    }

    public List compare(Map source, Map dest) {
        List result = new ArrayList();
        Iterator it = source.keySet().iterator();
        while (it.hasNext()) {
            Integer key = (Integer) it.next();
            if (!dest.containsKey(key)) {
                result.add(key);
            }
        }
        return result;
    }

    public void start() {
        System.out.println("Filling release32");
        release32 = fillTable("d:\\petr\\bugs\\release32.xml");
        System.out.println("Filling dev");
        dev = fillTable("d:\\petr\\bugs\\dev.xml");
        System.out.println("Comparing");
        List notInDev = compare(release32, dev);
        output("d:\\petr\\bugs\\bugs.html", notInDev);
    }
    
    public void output(String name, List list) {
        try {
            PrintWriter writer = new PrintWriter(new FileWriter(name));
            writer.println("");
            writer.println("");
            writer.println("Found "+list.size()+" differences");

            writer.println("");

            Iterator it = list.iterator();
            while (it.hasNext()) {
                Integer number = (Integer) it.next();
                System.out.println("bug:"+number);
                writer.println("");
                writer.println("");
                writer.println("");
                writer.println("");
                writer.println("");
            }
            writer.println("
"+number+""+moduleName(number.intValue())+""+release32.get(number)+"
"); writer.println(""); writer.println(""); writer.close(); } catch (Exception exc) { exc.printStackTrace(); } } String moduleName(int bugnumber) throws Exception { URLConnection con = new URL("http://www.netbeans.org/issues/show_bug.cgi?id="+bugnumber).openConnection(); BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream())); int i = 0; for (;;) { String line = reader.readLine(); if (line == null) break; if (i == 0) { if (line.indexOf("
Product:
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.