zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r777662 - in /hadoop/zookeeper/trunk: ./ src/java/main/org/apache/jute/ src/java/main/org/apache/jute/compiler/ src/java/systest/org/apache/zookeeper/test/system/ src/java/test/config/
Date Fri, 22 May 2009 19:06:03 GMT
Author: breed
Date: Fri May 22 19:06:02 2009
New Revision: 777662

URL: http://svn.apache.org/viewvc?rev=777662&view=rev
Log:
ZOOKEEPER-409. address all findbugs warnings in jute related classes 

Modified:
    hadoop/zookeeper/trunk/CHANGES.txt
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/BinaryInputArchive.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/BinaryOutputArchive.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/CsvInputArchive.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/CsvOutputArchive.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Index.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/InputArchive.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/OutputArchive.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Record.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/RecordReader.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/RecordWriter.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/XmlInputArchive.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/XmlOutputArchive.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/CGenerator.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/CppGenerator.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JBoolean.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JBuffer.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JByte.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JCompType.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JDouble.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JField.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JFile.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JFloat.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JInt.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JLong.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JMap.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JRecord.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JString.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JType.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JVector.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JavaGenerator.java
    hadoop/zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/InstanceContainer.java
    hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Fri May 22 19:06:02 2009
@@ -97,6 +97,8 @@
   ZOOKEEPER-385. crctest failed on hudson patch test (mahadev via phunt)
 
   ZOOKEEPER-192.  trailing whitespace in config file can cause number format exceptions (phunt via breed)
+ 
+  ZOOKEEPER-409. address all findbugs warnings in jute related classes (phunt via breed)
 
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/BinaryInputArchive.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/BinaryInputArchive.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/BinaryInputArchive.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/BinaryInputArchive.java Fri May 22 19:06:02 2009
@@ -19,13 +19,12 @@
 package org.apache.jute;
 
 import java.io.DataInput;
-import java.io.IOException;
 import java.io.DataInputStream;
+import java.io.IOException;
 import java.io.InputStream;
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class BinaryInputArchive implements InputArchive {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/BinaryOutputArchive.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/BinaryOutputArchive.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/BinaryOutputArchive.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/BinaryOutputArchive.java Fri May 22 19:06:02 2009
@@ -18,19 +18,16 @@
 
 package org.apache.jute;
 
-import java.io.IOException;
-import java.io.ByteArrayOutputStream;
-import java.util.List;
-import java.util.TreeMap;
-import java.util.ArrayList;
 import java.io.DataOutput;
 import java.io.DataOutputStream;
+import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.TreeMap;
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class BinaryOutputArchive implements OutputArchive {
     private ByteBuffer bb = ByteBuffer.allocate(1024);

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/CsvInputArchive.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/CsvInputArchive.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/CsvInputArchive.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/CsvInputArchive.java Fri May 22 19:06:02 2009
@@ -18,16 +18,14 @@
 
 package org.apache.jute;
 
-import java.io.InputStreamReader;
-import java.io.InputStream;
 import java.io.IOException;
-import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.PushbackReader;
 import java.io.UnsupportedEncodingException;
 
 /**
  *
- * @author Milind Bhandarkar
  */
 class CsvInputArchive implements InputArchive {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/CsvOutputArchive.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/CsvOutputArchive.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/CsvOutputArchive.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/CsvOutputArchive.java Fri May 22 19:06:02 2009
@@ -19,15 +19,14 @@
 package org.apache.jute;
 
 import java.io.IOException;
-import java.util.List;
-import java.util.TreeMap;
-import java.io.PrintStream;
 import java.io.OutputStream;
+import java.io.PrintStream;
 import java.io.UnsupportedEncodingException;
+import java.util.List;
+import java.util.TreeMap;
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class CsvOutputArchive implements OutputArchive {
 

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Index.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Index.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Index.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Index.java Fri May 22 19:06:02 2009
@@ -31,7 +31,6 @@
  * }
  * </code>
  *
- * @author Milind Bhandarkar
  */
 public interface Index {
     public boolean done();

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/InputArchive.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/InputArchive.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/InputArchive.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/InputArchive.java Fri May 22 19:06:02 2009
@@ -19,12 +19,10 @@
 package org.apache.jute;
 
 import java.io.IOException;
-import java.io.ByteArrayOutputStream;
 
 /**
  * Interface that all the Deserializers have to implement.
  *
- * @author Milind Bhandarkar
  */
 public interface InputArchive {
     public byte readByte(String tag) throws IOException;

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/OutputArchive.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/OutputArchive.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/OutputArchive.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/OutputArchive.java Fri May 22 19:06:02 2009
@@ -25,7 +25,6 @@
 /**
  * Interface that alll the serializers have to implement.
  *
- * @author Milind Bhandarkar
  */
 public interface OutputArchive {
     public void writeByte(byte b, String tag) throws IOException;

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Record.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Record.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Record.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Record.java Fri May 22 19:06:02 2009
@@ -23,7 +23,6 @@
 /**
  * Interface that is implemented by generated classes.
  * 
- * @author Milind Bhandarkar
  */
 public interface Record {
     public void serialize(OutputArchive archive, String tag)

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/RecordReader.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/RecordReader.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/RecordReader.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/RecordReader.java Fri May 22 19:06:02 2009
@@ -20,19 +20,14 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.DataInputStream;
-import java.io.UnsupportedEncodingException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.HashMap;
-import javax.xml.parsers.ParserConfigurationException;
-import org.xml.sax.SAXException;
 
 /**
  * Front-end interface to deserializers. Also acts as a factory
  * for deserializers.
  *
- * @author Milind Bhandarkar
  */
 public class RecordReader {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/RecordWriter.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/RecordWriter.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/RecordWriter.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/RecordWriter.java Fri May 22 19:06:02 2009
@@ -18,21 +18,17 @@
 
 package org.apache.jute;
 
+import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.io.DataOutputStream;
-import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.HashMap;
-import javax.xml.parsers.ParserConfigurationException;
-import org.xml.sax.SAXException;
 
 /**
  * Front-end for serializers. Also serves as a factory for serializers.
  *
- * @author Milind Bhandarkar
  */
 public class RecordWriter {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java Fri May 22 19:06:02 2009
@@ -23,7 +23,6 @@
 
 /**
  * Various utility functions for Hadoop record I/O runtime.
- * @author Milind Bhandarkar
  */
 public class Utils {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/XmlInputArchive.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/XmlInputArchive.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/XmlInputArchive.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/XmlInputArchive.java Fri May 22 19:06:02 2009
@@ -18,19 +18,19 @@
 
 package org.apache.jute;
 
-import java.io.InputStream;
 import java.io.IOException;
-import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
 import java.util.ArrayList;
 
-import org.xml.sax.*;
-import org.xml.sax.helpers.DefaultHandler;
-import javax.xml.parsers.SAXParserFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
 /**
  *
- * @author Milind Bhandarkar
  */
 class XmlInputArchive implements InputArchive {
     
@@ -49,12 +49,12 @@
         public String getType() { return type; }
     }
     
-    private class XMLParser extends DefaultHandler {
+    private static class XMLParser extends DefaultHandler {
         private boolean charsValid = false;
         
-        private ArrayList valList;
+        private ArrayList<Value> valList;
         
-        private XMLParser(ArrayList vlist) {
+        private XMLParser(ArrayList<Value> vlist) {
             valList = vlist;
         }
         
@@ -96,7 +96,7 @@
         public void characters(char buf[], int offset, int len)
         throws SAXException {
             if (charsValid) {
-                Value v = (Value) valList.get(valList.size()-1);
+                Value v = valList.get(valList.size()-1);
                 v.addChars(buf, offset,len);
             }
         }
@@ -105,7 +105,7 @@
     
     private class XmlIndex implements Index {
         public boolean done() {
-            Value v = (Value) valList.get(vIdx);
+            Value v = valList.get(vIdx);
             if ("/array".equals(v.getType())) {
                 valList.set(vIdx, null);
                 vIdx++;
@@ -117,13 +117,13 @@
         public void incr() {}
     }
     
-    private ArrayList valList;
+    private ArrayList<Value> valList;
     private int vLen;
     private int vIdx;
     
     private Value next() throws IOException {
         if (vIdx < vLen) {
-            Value v = (Value) valList.get(vIdx);
+            Value v = valList.get(vIdx);
             valList.set(vIdx, null);
             vIdx++;
             return v;
@@ -140,7 +140,7 @@
     /** Creates a new instance of BinaryInputArchive */
     public XmlInputArchive(InputStream in)
     throws ParserConfigurationException, SAXException, IOException {
-        valList = new ArrayList();
+        valList = new ArrayList<Value>();
         DefaultHandler handler = new XMLParser(valList);
         SAXParserFactory factory = SAXParserFactory.newInstance();
         SAXParser parser = factory.newSAXParser();

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/XmlOutputArchive.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/XmlOutputArchive.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/XmlOutputArchive.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/XmlOutputArchive.java Fri May 22 19:06:02 2009
@@ -19,15 +19,14 @@
 package org.apache.jute;
 
 import java.io.IOException;
-import java.util.List;
-import java.util.TreeMap;
-import java.io.PrintStream;
 import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.List;
 import java.util.Stack;
+import java.util.TreeMap;
 
 /**
  *
- * @author Milind Bhandarkar
  */
 class XmlOutputArchive implements OutputArchive {
 
@@ -35,7 +34,7 @@
     
     private int indent = 0;
     
-    private Stack compoundStack;
+    private Stack<String> compoundStack;
     
     private void putIndent() {
         StringBuffer sb = new StringBuffer("");
@@ -55,7 +54,7 @@
     
     private void printBeginEnvelope(String tag) {
         if (!compoundStack.empty()) {
-            String s = (String) compoundStack.peek();
+            String s = compoundStack.peek();
             if ("struct".equals(s)) {
                 putIndent();
                 stream.print("<member>\n");
@@ -76,7 +75,7 @@
     
     private void printEndEnvelope(String tag) {
         if (!compoundStack.empty()) {
-            String s = (String) compoundStack.peek();
+            String s = compoundStack.peek();
             if ("struct".equals(s)) {
                 stream.print("</value>\n");
                 closeIndent();
@@ -98,7 +97,7 @@
     }
     
     private void outsideVector(String tag) throws IOException {
-        String s = (String) compoundStack.pop();
+        String s = compoundStack.pop();
         if (!"vector".equals(s)) {
             throw new IOException("Error serializing vector.");
         }
@@ -111,7 +110,7 @@
     }
     
     private void outsideMap(String tag) throws IOException {
-        String s = (String) compoundStack.pop();
+        String s = compoundStack.pop();
         if (!"map".equals(s)) {
             throw new IOException("Error serializing map.");
         }
@@ -124,7 +123,7 @@
     }
     
     private void outsideRecord(String tag) throws IOException {
-        String s = (String) compoundStack.pop();
+        String s = compoundStack.pop();
         if (!"struct".equals(s)) {
             throw new IOException("Error serializing record.");
         }
@@ -138,7 +137,7 @@
     /** Creates a new instance of XmlOutputArchive */
     public XmlOutputArchive(OutputStream out) {
         stream = new PrintStream(out);
-        compoundStack = new Stack();
+        compoundStack = new Stack<String>();
     }
     
     public void writeByte(byte b, String tag) throws IOException {

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/CGenerator.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/CGenerator.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/CGenerator.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/CGenerator.java Fri May 22 19:06:02 2009
@@ -26,14 +26,11 @@
 
 /**
  * C++ Code generator front-end for Hadoop record I/O.
- *
- * @author Milind Bhandarkar
  */
 class CGenerator {
-    private String mFullName;
     private String mName;
-    private ArrayList mInclFiles;
-    private ArrayList mRecList;
+    private ArrayList<JFile> mInclFiles;
+    private ArrayList<JRecord> mRecList;
     private final File outputDirectory;
     
     /** Creates a new instance of CppGenerator
@@ -43,8 +40,9 @@
      * @param rlist List of records defined within this file
      * @param outputDirectory 
      */
-    CGenerator(String name, ArrayList ilist, ArrayList rlist, File outputDirectory) {
-        mFullName = name;
+    CGenerator(String name, ArrayList<JFile> ilist, ArrayList<JRecord> rlist,
+            File outputDirectory)
+    {
         this.outputDirectory = outputDirectory;
         mName = (new File(name)).getName();
         mInclFiles = ilist;
@@ -57,15 +55,20 @@
      * record-level code is generated by JRecord.
      */
     void genCode() throws IOException {
-        outputDirectory.mkdirs();
+        if (!outputDirectory.exists()) {
+            if (!outputDirectory.mkdirs()) {
+                throw new IOException("unable to create output directory "
+                        + outputDirectory);
+            }
+        }
         FileWriter c = new FileWriter(new File(outputDirectory, mName+".c"));
         FileWriter h = new FileWriter(new File(outputDirectory, mName+".h"));
         h.write("#ifndef __"+mName.toUpperCase().replace('.','_')+"__\n");
         h.write("#define __"+mName.toUpperCase().replace('.','_')+"__\n");
         
         h.write("#include \"recordio.h\"\n");
-        for (Iterator i = mInclFiles.iterator(); i.hasNext();) {
-            JFile f = (JFile) i.next();
+        for (Iterator<JFile> i = mInclFiles.iterator(); i.hasNext();) {
+            JFile f = i.next();
             h.write("#include \""+f.getName()+".h\"\n");
         }
         // required for compilation from C++
@@ -74,8 +77,8 @@
         c.write("#include <stdlib.h>\n"); // need it for calloc() & free()
         c.write("#include \""+mName+".h\"\n\n");
         
-        for (Iterator i = mRecList.iterator(); i.hasNext();) {
-            JRecord jr = (JRecord) i.next();
+        for (Iterator<JRecord> i = mRecList.iterator(); i.hasNext();) {
+            JRecord jr = i.next();
             jr.genCCode(h, c);
         }
         

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/CppGenerator.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/CppGenerator.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/CppGenerator.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/CppGenerator.java Fri May 22 19:06:02 2009
@@ -26,14 +26,11 @@
 
 /**
  * C++ Code generator front-end for Hadoop record I/O.
- *
- * @author Milind Bhandarkar
  */
 class CppGenerator {
-    private String mFullName;
     private String mName;
-    private ArrayList mInclFiles;
-    private ArrayList mRecList;
+    private ArrayList<JFile> mInclFiles;
+    private ArrayList<JRecord> mRecList;
     private final File outputDirectory;
     
     /** Creates a new instance of CppGenerator
@@ -43,8 +40,9 @@
      * @param rlist List of records defined within this file
      * @param outputDirectory 
      */
-    CppGenerator(String name, ArrayList ilist, ArrayList rlist, File outputDirectory) {
-        mFullName = name;
+    CppGenerator(String name, ArrayList<JFile> ilist, ArrayList<JRecord> rlist,
+            File outputDirectory)
+     {
         this.outputDirectory = outputDirectory;
         mName = (new File(name)).getName();
         mInclFiles = ilist;
@@ -57,21 +55,26 @@
      * record-level code is generated by JRecord.
      */
     void genCode() throws IOException {
-        outputDirectory.mkdirs();
+        if (!outputDirectory.exists()) {
+            if (!outputDirectory.mkdirs()) {
+                throw new IOException("unable to create output directory "
+                        + outputDirectory);
+            }
+        }
         FileWriter cc = new FileWriter(new File(outputDirectory, mName+".cc"));
         FileWriter hh = new FileWriter(new File(outputDirectory, mName+".hh"));
         hh.write("#ifndef __"+mName.toUpperCase().replace('.','_')+"__\n");
         hh.write("#define __"+mName.toUpperCase().replace('.','_')+"__\n");
         
         hh.write("#include \"recordio.hh\"\n");
-        for (Iterator i = mInclFiles.iterator(); i.hasNext();) {
-            JFile f = (JFile) i.next();
+        for (Iterator<JFile> i = mInclFiles.iterator(); i.hasNext();) {
+            JFile f = i.next();
             hh.write("#include \""+f.getName()+".hh\"\n");
         }
         cc.write("#include \""+mName+".hh\"\n");
         
-        for (Iterator i = mRecList.iterator(); i.hasNext();) {
-            JRecord jr = (JRecord) i.next();
+        for (Iterator<JRecord> i = mRecList.iterator(); i.hasNext();) {
+            JRecord jr = i.next();
             jr.genCppCode(hh, cc);
         }
         

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JBoolean.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JBoolean.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JBoolean.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JBoolean.java Fri May 22 19:06:02 2009
@@ -20,7 +20,6 @@
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class JBoolean extends JType {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JBuffer.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JBuffer.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JBuffer.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JBuffer.java Fri May 22 19:06:02 2009
@@ -20,7 +20,6 @@
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class JBuffer extends JCompType {
     
@@ -77,7 +76,7 @@
     }
     
     public String genJavaHashCode(String fname) {
-        return "    ret = "+fname+".toString().hashCode();\n";
+        return "    ret = Arrays.toString("+fname+").hashCode();\n";
     }
     
     public String genJavaSlurpBytes(String b, String s, String l) {

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JByte.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JByte.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JByte.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JByte.java Fri May 22 19:06:02 2009
@@ -20,7 +20,6 @@
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class JByte extends JType {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JCompType.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JCompType.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JCompType.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JCompType.java Fri May 22 19:06:02 2009
@@ -21,8 +21,6 @@
 /**
  * Abstract base class for all the "compound" types such as ustring,
  * buffer, vector, map, and record.
- *
- * @author Milind Bhandarkar
  */
 abstract class JCompType extends JType {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JDouble.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JDouble.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JDouble.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JDouble.java Fri May 22 19:06:02 2009
@@ -20,7 +20,6 @@
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class JDouble extends JType {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JField.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JField.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JField.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JField.java Fri May 22 19:06:02 2009
@@ -20,7 +20,6 @@
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class JField {
     private JType mType;

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JFile.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JFile.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JFile.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JFile.java Fri May 22 19:06:02 2009
@@ -27,13 +27,12 @@
  * The main components of the file are filename, list of included files,
  * and records defined in that file.
  *
- * @author Milind Bhandarkar
  */
 public class JFile {
     
     private String mName;
-    private ArrayList mInclFiles;
-    private ArrayList mRecords;
+    private ArrayList<JFile> mInclFiles;
+    private ArrayList<JRecord> mRecords;
     
     /** Creates a new instance of JFile
      *
@@ -41,7 +40,9 @@
      * @param inclFiles included files (as JFile)
      * @param recList List of records defined within this file
      */
-    public JFile(String name, ArrayList inclFiles, ArrayList recList) {
+    public JFile(String name, ArrayList<JFile> inclFiles,
+            ArrayList<JRecord> recList)
+    {
         mName = name;
         mInclFiles = inclFiles;
         mRecords = recList;
@@ -57,19 +58,23 @@
      *  lowercase.
      * @param outputDirectory 
      */
-    public void genCode(String language, File outputDirectory) throws IOException {
+    public void genCode(String language, File outputDirectory)
+        throws IOException
+    {
         if ("c++".equals(language)) {
-            CppGenerator gen = new CppGenerator(mName, mInclFiles, mRecords, outputDirectory);
+            CppGenerator gen = new CppGenerator(mName, mInclFiles, mRecords,
+                    outputDirectory);
             gen.genCode();
         } else if ("java".equals(language)) {
-            JavaGenerator gen = new JavaGenerator(mName, mInclFiles, mRecords, outputDirectory);
+            JavaGenerator gen = new JavaGenerator(mName, mInclFiles, mRecords,
+                    outputDirectory);
             gen.genCode();
         } else if ("c".equals(language)) {
-        	CGenerator gen = new CGenerator(mName, mInclFiles, mRecords, outputDirectory);
+        	CGenerator gen = new CGenerator(mName, mInclFiles, mRecords,
+        	        outputDirectory);
         	gen.genCode();
         } else {
-            System.out.println("Cannnot recognize language:"+language);
-            System.exit(1);
+            throw new IOException("Cannnot recognize language:" + language);
         }
     }
 }

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JFloat.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JFloat.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JFloat.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JFloat.java Fri May 22 19:06:02 2009
@@ -20,7 +20,6 @@
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class JFloat extends JType {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JInt.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JInt.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JInt.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JInt.java Fri May 22 19:06:02 2009
@@ -20,7 +20,6 @@
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class JInt extends JType {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JLong.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JLong.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JLong.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JLong.java Fri May 22 19:06:02 2009
@@ -20,7 +20,6 @@
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class JLong extends JType {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JMap.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JMap.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JMap.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JMap.java Fri May 22 19:06:02 2009
@@ -18,9 +18,10 @@
 
 package org.apache.jute.compiler;
 
+import org.apache.zookeeper.KeeperException.UnimplementedException;
+
 /**
  *
- * @author Milind Bhandarkar
  */
 public class JMap extends JCompType {
    
@@ -50,7 +51,8 @@
     }
     
     public String genJavaCompareTo(String fname) {
-        return "";
+        return "    throw new UnsupportedOperationException(\"comparing "
+            + fname + " is unimplemented\");\n";
     }
     
     public String genJavaReadWrapper(String fname, String tag, boolean decl) {

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JRecord.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JRecord.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JRecord.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JRecord.java Fri May 22 19:06:02 2009
@@ -27,7 +27,6 @@
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class JRecord extends JCompType {
 
@@ -39,8 +38,9 @@
     /**
      * Creates a new instance of JRecord
      */
-    public JRecord(String name, ArrayList flist) {
-        super("struct " + name.substring(name.lastIndexOf('.')+1), name.replaceAll("\\.","::"), name, "Record", name);
+    public JRecord(String name, ArrayList<JField> flist) {
+        super("struct " + name.substring(name.lastIndexOf('.')+1),
+                name.replaceAll("\\.","::"), name, "Record", name);
         mFQName = name;
         int idx = name.lastIndexOf('.');
         mName = name.substring(idx+1);
@@ -68,15 +68,15 @@
         return mModule.replaceAll("\\.", "::");
     }
     
-    public ArrayList getFields() {
+    public ArrayList<JField> getFields() {
         return mFields;
     }
     
     public String getSignature() {
         StringBuffer sb = new StringBuffer();
         sb.append("L").append(mName).append("(");
-        for (Iterator i = mFields.iterator(); i.hasNext();) {
-            String s = ((JField) i.next()).getSignature();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
+            String s = i.next().getSignature();
             sb.append(s);
         }
         sb.append(")");
@@ -255,8 +255,8 @@
         hh.write("class "+getName()+" : public ::hadoop::Record {\n");
         hh.write("private:\n");
         
-        for (Iterator i = mFields.iterator(); i.hasNext();) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
+            JField jf = i.next();
             hh.write(jf.genCppDecl());
         }
         hh.write("  mutable std::bitset<"+mFields.size()+"> bs_;\n");
@@ -270,8 +270,8 @@
         hh.write("  virtual bool operator==(const "+getName()+"& peer_) const;\n");
         hh.write("  virtual ~"+getName()+"() {};\n");
         int fIdx = 0;
-        for (Iterator i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
             hh.write(jf.genCppGetSet(fIdx));
         }
         hh.write("}; // end record "+getName()+"\n");
@@ -282,8 +282,8 @@
         cc.write("  if (!validate()) throw new ::hadoop::IOException(\"All fields not set.\");\n");
         cc.write("  a_.startRecord(*this,tag);\n");
         fIdx = 0;
-        for (Iterator i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
             String name = jf.getName();
             if (jf.getType() instanceof JBuffer) {
                 cc.write("  a_.serialize("+name+","+name+".length(),\""+jf.getTag()+"\");\n");
@@ -299,8 +299,8 @@
         cc.write("void "+getCppFQName()+"::deserialize(::hadoop::IArchive& a_, const char* tag) {\n");
         cc.write("  a_.startRecord(*this,tag);\n");
         fIdx = 0;
-        for (Iterator i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
             String name = jf.getName();
             if (jf.getType() instanceof JBuffer) {
                 cc.write("  { size_t len=0; a_.deserialize("+name+",len,\""+jf.getTag()+"\");}\n");
@@ -327,8 +327,8 @@
         
         cc.write("bool "+getCppFQName()+"::operator< (const "+getCppFQName()+"& peer_) const {\n");
         cc.write("  return (1\n");
-        for (Iterator i = mFields.iterator(); i.hasNext();) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
+            JField jf = i.next();
             String name = jf.getName();
             cc.write("    && ("+name+" < peer_."+name+")\n");
         }
@@ -337,8 +337,8 @@
         
         cc.write("bool "+getCppFQName()+"::operator== (const "+getCppFQName()+"& peer_) const {\n");
         cc.write("  return (1\n");
-        for (Iterator i = mFields.iterator(); i.hasNext();) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
+            JField jf = i.next();
             String name = jf.getName();
             cc.write("    && ("+name+" == peer_."+name+")\n");
         }
@@ -363,24 +363,21 @@
         File pkgdir = new File(outputDirectory, pkgpath);
         if (!pkgdir.exists()) {
             // create the pkg directory
-            boolean ret = pkgdir.mkdirs();
-            if (!ret) {
-                System.out.println("Cannnot create directory: "+pkgpath);
-                System.exit(1);
+            if (!pkgdir.mkdirs()) {
+                throw new IOException("Cannnot create directory: " + pkgpath);
             }
         } else if (!pkgdir.isDirectory()) {
-            // not a directory
-            System.out.println(pkgpath+" is not a directory.");
-            System.exit(1);
+            throw new IOException(pkgpath + " is not a directory.");
         }
         File jfile = new File(pkgdir, getName()+".java");
         FileWriter jj = new FileWriter(jfile);
         jj.write("// File generated by hadoop record compiler. Do not edit.\n");
         jj.write("package "+getJavaPackage()+";\n\n");
+        jj.write("import java.util.*;\n");
         jj.write("import org.apache.jute.*;\n");
         jj.write("public class "+getName()+" implements Record {\n");
-        for (Iterator i = mFields.iterator(); i.hasNext();) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext();) {
+            JField jf = i.next();
             jj.write(jf.genJavaDecl());
         }
         jj.write("  public "+getName()+"() {\n");
@@ -389,28 +386,28 @@
         jj.write("  public "+getName()+"(\n");
         int fIdx = 0;
         int fLen = mFields.size();
-        for (Iterator i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
             jj.write(jf.genJavaConstructorParam(jf.getName()));
             jj.write((fLen-1 == fIdx)?"":",\n");
         }
         jj.write(") {\n");
         fIdx = 0;
-        for (Iterator i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
             jj.write(jf.genJavaConstructorSet(jf.getName()));
         }
         jj.write("  }\n");
         fIdx = 0;
-        for (Iterator i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
             jj.write(jf.genJavaGetSet(fIdx));
         }
         jj.write("  public void serialize(OutputArchive a_, String tag) throws java.io.IOException {\n");
         jj.write("    a_.startRecord(this,tag);\n");
         fIdx = 0;
-        for (Iterator i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
             jj.write(jf.genJavaWriteMethodName());
         }
         jj.write("    a_.endRecord(this,tag);\n");
@@ -419,8 +416,8 @@
         jj.write("  public void deserialize(InputArchive a_, String tag) throws java.io.IOException {\n");
         jj.write("    a_.startRecord(tag);\n");
         fIdx = 0;
-        for (Iterator i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
             jj.write(jf.genJavaReadMethodName());
         }
         jj.write("    a_.endRecord(tag);\n");
@@ -434,8 +431,8 @@
         jj.write("        new CsvOutputArchive(s);\n");
         jj.write("      a_.startRecord(this,\"\");\n");
         fIdx = 0;
-        for (Iterator i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
             jj.write(jf.genJavaWriteMethodName());
         }
         jj.write("      a_.endRecord(this,\"\");\n");
@@ -457,17 +454,30 @@
         jj.write("  }\n");
         
         jj.write("  public int compareTo (Object peer_) throws ClassCastException {\n");
-        jj.write("    if (!(peer_ instanceof "+getName()+")) {\n");
-        jj.write("      throw new ClassCastException(\"Comparing different types of records.\");\n");
-        jj.write("    }\n");
-        jj.write("    "+getName()+" peer = ("+getName()+") peer_;\n");
-        jj.write("    int ret = 0;\n");
-        for (Iterator i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = (JField) i.next();
-            jj.write(jf.genJavaCompareTo());
-            jj.write("    if (ret != 0) return ret;\n");
+        boolean unimplemented = false;
+        for (JField f : mFields) {
+            if ((f.getType() instanceof JMap) 
+                    || (f.getType() instanceof JVector))
+            {
+                unimplemented = true;
+            }
+        }
+        if (unimplemented) {
+            jj.write("    throw new UnsupportedOperationException(\"comparing "
+                    + getName() + " is unimplemented\");\n");
+        } else {
+            jj.write("    if (!(peer_ instanceof "+getName()+")) {\n");
+            jj.write("      throw new ClassCastException(\"Comparing different types of records.\");\n");
+            jj.write("    }\n");
+            jj.write("    "+getName()+" peer = ("+getName()+") peer_;\n");
+            jj.write("    int ret = 0;\n");
+            for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+                JField jf = i.next();
+                jj.write(jf.genJavaCompareTo());
+                jj.write("    if (ret != 0) return ret;\n");
+            }
+            jj.write("     return ret;\n");
         }
-        jj.write("     return ret;\n");
         jj.write("  }\n");
         
         jj.write("  public boolean equals(Object peer_) {\n");
@@ -479,8 +489,8 @@
         jj.write("    }\n");
         jj.write("    "+getName()+" peer = ("+getName()+") peer_;\n");
         jj.write("    boolean ret = false;\n");
-        for (Iterator i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
             jj.write(jf.genJavaEquals());
             jj.write("    if (!ret) return ret;\n");
         }
@@ -490,8 +500,8 @@
         jj.write("  public int hashCode() {\n");
         jj.write("    int result = 17;\n");
         jj.write("    int ret;\n");
-        for (Iterator i = mFields.iterator(); i.hasNext(); fIdx++) {
-            JField jf = (JField) i.next();
+        for (Iterator<JField> i = mFields.iterator(); i.hasNext(); fIdx++) {
+            JField jf = i.next();
             jj.write(jf.genJavaHashCode());
             jj.write("    result = 37*result + ret;\n");
         }

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JString.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JString.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JString.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JString.java Fri May 22 19:06:02 2009
@@ -20,7 +20,6 @@
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class JString extends JCompType {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JType.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JType.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JType.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JType.java Fri May 22 19:06:02 2009
@@ -21,7 +21,6 @@
 /**
  * Abstract Base class for all types supported by Hadoop Record I/O.
  * 
- * @author Milind Bhandarkar
  */
 abstract public class JType {
     

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JVector.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JVector.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JVector.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JVector.java Fri May 22 19:06:02 2009
@@ -20,7 +20,6 @@
 
 /**
  *
- * @author Milind Bhandarkar
  */
 public class JVector extends JCompType {
     
@@ -47,7 +46,8 @@
     }
     
     public String genJavaCompareTo(String fname) {
-        return "";
+        return "    throw new UnsupportedOperationException(\"comparing "
+            + fname + " is unimplemented\");\n";
     }
     
     public String genJavaReadWrapper(String fname, String tag, boolean decl) {

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JavaGenerator.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JavaGenerator.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JavaGenerator.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/jute/compiler/JavaGenerator.java Fri May 22 19:06:02 2009
@@ -18,21 +18,16 @@
 
 package org.apache.jute.compiler;
 
-import java.util.ArrayList;
 import java.io.File;
-import java.io.FileWriter;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Iterator;
 
 /**
  * Java Code generator front-end for Hadoop record I/O.
- *
- * @author Milind Bhandarkar
  */
 class JavaGenerator {
-    private String mName;
-    private ArrayList mInclFiles;
-    private ArrayList mRecList;
+    private ArrayList<JRecord> mRecList;
     private final File outputDirectory;
     
     /** Creates a new instance of JavaGenerator
@@ -42,9 +37,9 @@
      * @param records List of records defined within this file
      * @param outputDirectory 
      */
-    JavaGenerator(String name, ArrayList incl, ArrayList records, File outputDirectory) {
-        mName = name;
-        mInclFiles = incl;
+    JavaGenerator(String name, ArrayList<JFile> incl,
+            ArrayList<JRecord> records, File outputDirectory)
+    {
         mRecList = records;
         this.outputDirectory = outputDirectory;
     }
@@ -54,8 +49,8 @@
      * JRecord, since one file is generated for each record.
      */
     void genCode() throws IOException {
-        for (Iterator i = mRecList.iterator(); i.hasNext(); ) {
-            JRecord rec = (JRecord) i.next();
+        for (Iterator<JRecord> i = mRecList.iterator(); i.hasNext(); ) {
+            JRecord rec = i.next();
             rec.genJavaCode(outputDirectory);
         }
     }

Modified: hadoop/zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/InstanceContainer.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/InstanceContainer.java?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/InstanceContainer.java (original)
+++ hadoop/zookeeper/trunk/src/java/systest/org/apache/zookeeper/test/system/InstanceContainer.java Fri May 22 19:06:02 2009
@@ -42,8 +42,6 @@
 
 /**
  * This class starts up, 
- * @author breed
- *
  */
 public class InstanceContainer implements Watcher, AsyncCallback.ChildrenCallback {
     private final class MyWatcher implements Watcher {

Modified: hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml?rev=777662&r1=777661&r2=777662&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml (original)
+++ hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml Fri May 22 19:06:02 2009
@@ -60,4 +60,9 @@
     <Package name="org.apache.jute.compiler.generated" />
   </Match>
 
+  <Match>
+    <Package name="~org\.apache\.zookeeper\.(proto|data|txn)" />
+    <Bug code="EI, EI2" />
+  </Match>
+
 </FindBugsFilter>



Mime
View raw message