MythTV-Clients / MythTV-Android-Frontend

Implementation of MythTV .25+ Services API for Android
GNU General Public License v3.0
66 stars 16 forks source link

NPE if recording no longer has original channel information (Edge Case) #245

Closed billmeek closed 10 years ago

billmeek commented 10 years ago
12-03 15:08:15.863: E/RecordedHelperV28(5580): process : non UTF-8 exception 
12-03 15:08:15.863: E/RecordedHelperV28(5580): java.lang.NullPointerException
12-03 15:08:15.863: E/RecordedHelperV28(5580):  at org.mythtv.service.channel.v28.ChannelHelperV28.convertChannelInfoToContentValues(ChannelHelperV28.java:495)
12-03 15:08:15.863: E/RecordedHelperV28(5580):  at org.mythtv.service.channel.v28.ChannelHelperV28.processChannel(ChannelHelperV28.java:315)
12-03 15:08:15.863: E/RecordedHelperV28(5580):  at org.mythtv.service.dvr.v28.RecordedHelperV28.load(RecordedHelperV28.java:294)
12-03 15:08:15.863: E/RecordedHelperV28(5580):  at org.mythtv.service.dvr.v28.RecordedHelperV28.downloadRecorded(RecordedHelperV28.java:220)
12-03 15:08:15.863: E/RecordedHelperV28(5580):  at org.mythtv.service.dvr.v28.RecordedHelperV28.process(RecordedHelperV28.java:126)
12-03 15:08:15.863: E/RecordedHelperV28(5580):  at org.mythtv.service.dvr.RecordedService.onHandleIntent(RecordedService.java:114)
12-03 15:08:15.863: E/RecordedHelperV28(5580):  at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
12-03 15:08:15.863: E/RecordedHelperV28(5580):  at android.os.Handler.dispatchMessage(Handler.java:99)
12-03 15:08:15.863: E/RecordedHelperV28(5580):  at android.os.Looper.loop(Looper.java:137)
12-03 15:08:15.863: E/RecordedHelperV28(5580):  at android.os.HandlerThread.run(HandlerThread.java:60)

To duplicate

Make a 'normal' recording
Remove the original channel and source
e.g. if a backend has been reconfigured with different tuners
SELECT * FROM channel WHERE chanid = 3625;

Returns the proper information about the recording.

The data in the recorded MAF table appears to be correct.

The following snippet is returned from:

http://mc0:6544/Dvr/GetRecordedList?TitleRegEx=Failing ProgramName

Note the empty ChanNum.

<Channel>
<ChanId>3625</ChanId>
<ChanNum/>
<CallSign/>
<IconURL/>
<ChannelName/>
<MplexId>0</MplexId>
<TransportId>0</TransportId>
<ServiceId>0</ServiceId>
<NetworkId>0</NetworkId>
<ATSCMajorChan>0</ATSCMajorChan>
<ATSCMinorChan>0</ATSCMinorChan>

In MAF 0.28, the exception fires here:

    public ContentValues convertChannelInfoToContentValues( final LocationProfile locationProfile, final ChannelInfo channelInfo ) {
//      Log.v( TAG, "convertChannelToContentValues : enter" );

        String formattedChannelNumber = formatChannelNumber( channelInfo.getChanNum() );
        if( formattedChannelNumber.startsWith( "." ) ) { <------------------------- NPE
            formattedChannelNumber = formattedChannelNumber.substring( 1 );
        }
billmeek commented 10 years ago

Corrected typos in the original post. Also, there is no entry in the MAF channel table for the channel above.

SELECT * FROM channel WHERE chan_id  > 3000 and chan_id < 4000;

returns nothing.

billmeek commented 10 years ago

Fixed in 8e029ac and ae942ac. Also showed up when an 'old' recording had a chanid that mapped to an invalid channum e.g. _50-1.