You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Kylie McCormick <ky...@gmail.com> on 2008/07/16 07:47:50 UTC

Codec Returning null

Hello Again!

I'm running into a NullPointerException from the following code (taken from
a recordreader). None of the other variables are returning null, I've check
them all. I've checked the documentation, and I still don't know why the
compressionCodecFactory would return a null result. Any ideas?

Thank you!
Kylie

    public ServiceRecordReader(Configuration job, FileSplit split)
        throws java.io.IOException {

            final Path file = split.getPath();
            compressionCodecs = new CompressionCodecFactory(job);
            final CompressionCodec codec = compressionCodecs.getCodec(file);

            //since we're not concerned with splits, we'll just open the
objects
            FileSystem fs = file.getFileSystem(job);
            FSDataInputStream fileIn = fs.open(split.getPath());


            if(codec != null) {

                in = new ServiceReader(codec.createInputStream(fileIn));

            } else {

                throw new java.io.IOException("codec is null, curses... ");

            }

Re: Codec Returning null

Posted by Kylie McCormick <ky...@gmail.com>.
Hello Abdul:
Thanks very much! You're right, I need to check the file ending before using
Codec.

Thanks,
Kylie

On Wed, Jul 16, 2008 at 10:53 AM, Abdul Qadeer <qa...@gmail.com>
wrote:

> Kylie,
>
> If your file is e.g gzip compressed its name should end in .gz.  Codec
> factory
> tries to recognize compressed files by its extensions.
>
> Abdul Qadeer
>
> On Wed, Jul 16, 2008 at 11:47 AM, Kylie McCormick <
> kyliemccormick@gmail.com>
> wrote:
>
> > Hello:
> > My filename extension for the input file is .txt.
> >
> > Thanks,
> > Kylie
> >
> > On Wed, Jul 16, 2008 at 3:21 AM, Devaraj Das <dd...@yahoo-inc.com> wrote:
> >
> > > What does your file name extension look like?
> > >
> > > > -----Original Message-----
> > > > From: Kylie McCormick [mailto:kyliemccormick@gmail.com]
> > > > Sent: Wednesday, July 16, 2008 11:18 AM
> > > > To: core-user@hadoop.apache.org
> > > > Subject: Codec Returning null
> > > >
> > > > Hello Again!
> > > >
> > > > I'm running into a NullPointerException from the following
> > > > code (taken from a recordreader). None of the other variables
> > > > are returning null, I've check them all. I've checked the
> > > > documentation, and I still don't know why the
> > > > compressionCodecFactory would return a null result. Any ideas?
> > > >
> > > > Thank you!
> > > > Kylie
> > > >
> > > >     public ServiceRecordReader(Configuration job, FileSplit split)
> > > >         throws java.io.IOException {
> > > >
> > > >             final Path file = split.getPath();
> > > >             compressionCodecs = new CompressionCodecFactory(job);
> > > >             final CompressionCodec codec =
> > > > compressionCodecs.getCodec(file);
> > > >
> > > >             //since we're not concerned with splits, we'll
> > > > just open the objects
> > > >             FileSystem fs = file.getFileSystem(job);
> > > >             FSDataInputStream fileIn = fs.open(split.getPath());
> > > >
> > > >
> > > >             if(codec != null) {
> > > >
> > > >                 in = new
> > > > ServiceReader(codec.createInputStream(fileIn));
> > > >
> > > >             } else {
> > > >
> > > >                 throw new java.io.IOException("codec is null,
> > > > curses... ");
> > > >
> > > >             }
> > > >
> > >
> > >
> >
> >
> > --
> > The Circle of the Dragon -- unlock the mystery that is the dragon.
> > http://www.blackdrago.com/index.html
> >
> > "Light, seeking light, doth the light of light beguile!"
> > -- William Shakespeare's Love's Labor's Lost
> >
>



-- 
The Circle of the Dragon -- unlock the mystery that is the dragon.
http://www.blackdrago.com/index.html

"Light, seeking light, doth the light of light beguile!"
-- William Shakespeare's Love's Labor's Lost

Re: Codec Returning null

Posted by Abdul Qadeer <qa...@gmail.com>.
Kylie,

If your file is e.g gzip compressed its name should end in .gz.  Codec
factory
tries to recognize compressed files by its extensions.

Abdul Qadeer

On Wed, Jul 16, 2008 at 11:47 AM, Kylie McCormick <ky...@gmail.com>
wrote:

> Hello:
> My filename extension for the input file is .txt.
>
> Thanks,
> Kylie
>
> On Wed, Jul 16, 2008 at 3:21 AM, Devaraj Das <dd...@yahoo-inc.com> wrote:
>
> > What does your file name extension look like?
> >
> > > -----Original Message-----
> > > From: Kylie McCormick [mailto:kyliemccormick@gmail.com]
> > > Sent: Wednesday, July 16, 2008 11:18 AM
> > > To: core-user@hadoop.apache.org
> > > Subject: Codec Returning null
> > >
> > > Hello Again!
> > >
> > > I'm running into a NullPointerException from the following
> > > code (taken from a recordreader). None of the other variables
> > > are returning null, I've check them all. I've checked the
> > > documentation, and I still don't know why the
> > > compressionCodecFactory would return a null result. Any ideas?
> > >
> > > Thank you!
> > > Kylie
> > >
> > >     public ServiceRecordReader(Configuration job, FileSplit split)
> > >         throws java.io.IOException {
> > >
> > >             final Path file = split.getPath();
> > >             compressionCodecs = new CompressionCodecFactory(job);
> > >             final CompressionCodec codec =
> > > compressionCodecs.getCodec(file);
> > >
> > >             //since we're not concerned with splits, we'll
> > > just open the objects
> > >             FileSystem fs = file.getFileSystem(job);
> > >             FSDataInputStream fileIn = fs.open(split.getPath());
> > >
> > >
> > >             if(codec != null) {
> > >
> > >                 in = new
> > > ServiceReader(codec.createInputStream(fileIn));
> > >
> > >             } else {
> > >
> > >                 throw new java.io.IOException("codec is null,
> > > curses... ");
> > >
> > >             }
> > >
> >
> >
>
>
> --
> The Circle of the Dragon -- unlock the mystery that is the dragon.
> http://www.blackdrago.com/index.html
>
> "Light, seeking light, doth the light of light beguile!"
> -- William Shakespeare's Love's Labor's Lost
>

Re: Codec Returning null

Posted by Kylie McCormick <ky...@gmail.com>.
Hello:
My filename extension for the input file is .txt.

Thanks,
Kylie

On Wed, Jul 16, 2008 at 3:21 AM, Devaraj Das <dd...@yahoo-inc.com> wrote:

> What does your file name extension look like?
>
> > -----Original Message-----
> > From: Kylie McCormick [mailto:kyliemccormick@gmail.com]
> > Sent: Wednesday, July 16, 2008 11:18 AM
> > To: core-user@hadoop.apache.org
> > Subject: Codec Returning null
> >
> > Hello Again!
> >
> > I'm running into a NullPointerException from the following
> > code (taken from a recordreader). None of the other variables
> > are returning null, I've check them all. I've checked the
> > documentation, and I still don't know why the
> > compressionCodecFactory would return a null result. Any ideas?
> >
> > Thank you!
> > Kylie
> >
> >     public ServiceRecordReader(Configuration job, FileSplit split)
> >         throws java.io.IOException {
> >
> >             final Path file = split.getPath();
> >             compressionCodecs = new CompressionCodecFactory(job);
> >             final CompressionCodec codec =
> > compressionCodecs.getCodec(file);
> >
> >             //since we're not concerned with splits, we'll
> > just open the objects
> >             FileSystem fs = file.getFileSystem(job);
> >             FSDataInputStream fileIn = fs.open(split.getPath());
> >
> >
> >             if(codec != null) {
> >
> >                 in = new
> > ServiceReader(codec.createInputStream(fileIn));
> >
> >             } else {
> >
> >                 throw new java.io.IOException("codec is null,
> > curses... ");
> >
> >             }
> >
>
>


-- 
The Circle of the Dragon -- unlock the mystery that is the dragon.
http://www.blackdrago.com/index.html

"Light, seeking light, doth the light of light beguile!"
-- William Shakespeare's Love's Labor's Lost

RE: Codec Returning null

Posted by Devaraj Das <dd...@yahoo-inc.com>.
What does your file name extension look like? 

> -----Original Message-----
> From: Kylie McCormick [mailto:kyliemccormick@gmail.com] 
> Sent: Wednesday, July 16, 2008 11:18 AM
> To: core-user@hadoop.apache.org
> Subject: Codec Returning null
> 
> Hello Again!
> 
> I'm running into a NullPointerException from the following 
> code (taken from a recordreader). None of the other variables 
> are returning null, I've check them all. I've checked the 
> documentation, and I still don't know why the 
> compressionCodecFactory would return a null result. Any ideas?
> 
> Thank you!
> Kylie
> 
>     public ServiceRecordReader(Configuration job, FileSplit split)
>         throws java.io.IOException {
> 
>             final Path file = split.getPath();
>             compressionCodecs = new CompressionCodecFactory(job);
>             final CompressionCodec codec = 
> compressionCodecs.getCodec(file);
> 
>             //since we're not concerned with splits, we'll 
> just open the objects
>             FileSystem fs = file.getFileSystem(job);
>             FSDataInputStream fileIn = fs.open(split.getPath());
> 
> 
>             if(codec != null) {
> 
>                 in = new 
> ServiceReader(codec.createInputStream(fileIn));
> 
>             } else {
> 
>                 throw new java.io.IOException("codec is null, 
> curses... ");
> 
>             }
>