-1 to 'throws Exception' except where harmless or needed:

- main()
- JUnit
- methods which call such unfortunately declared methods

There is no good reason a collections class throws IOException in general.
At best its some generic MapException but that doesn't scan.

It's an issue for subclasses to address, as you see them do, by chaining.
RuntimeException is too generic; use perhaps IllegalStateException.

Sean

On Feb 13, 2010 9:20 PM, "Robin Anil" <robin.a...@gmail.com> wrote:

On the topic of code cleanup.

Current OpenXXYYhashmaps has to throw runtime exception on an IOException in
Hadoop

This will make that statement clear

void map(Text key, Text value, final OutputCollector output){

forEachPair(function(){
 @Override
 bool apply(key, value){
   try {
        do something;
        output.collect(key1,value1);
   }
   catch(IOException e){
   throw new RuntimeException(e);
   }
   return true;
 }
}

}


What to do here? Why not let ObjectProcedure class throw Exception ?

On Sun, Feb 14, 2010 at 2:37 AM, Robin Anil <robin.a...@gmail.com> wrote: >
final doesnt necess...

Reply via email to