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

BackendStatusTask fails if there are no scheduled programs #161

Closed espenaf closed 11 years ago

espenaf commented 11 years ago

Using trunk with mythtv-service-api-0.0.32

A freshly installed MythTV 0.26 box with only a FREEBOX encoder gives me the following Scheduled status on the status page;

<Scheduled count="0"/>

The BackendStatusTask fails with the following strack trace:

09-04 11:03:06.284  15053-15153/org.mythtv E/AbstractMythFragment: BackendStatusTask.doInBackground : error
        org.mythtv.services.api.MythServiceApiRuntimeException: org.springframework.http.converter.HttpMessageNotReadableException: Could not read [class org.mythtv.services.api.status.Status]; nested exception is org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.ElementList(data=false, empty=true, entry=, inline=true, name=, required=true, type=void) on field 'programs' private java.util.List org.mythtv.services.api.status.Scheduled.programs for class org.mythtv.services.api.status.Scheduled at line 7; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: Could not read [class org.mythtv.services.api.status.Status]; nested exception is org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.ElementList(data=false, empty=true, entry=, inline=true, name=, required=true, type=void) on field 'programs' private java.util.List org.mythtv.services.api.status.Scheduled.programs for class org.mythtv.services.api.status.Scheduled at line 7
        at org.mythtv.services.api.status.impl.StatusTemplate.getStatus(StatusTemplate.java:54)
        at org.mythtv.client.ui.AbstractMythFragment$BackendStatusTask.doInBackground(AbstractMythFragment.java:248)
        at org.mythtv.client.ui.AbstractMythFragment$BackendStatusTask.doInBackground(AbstractMythFragment.java:230)
        at android.os.AsyncTask$2.call(AsyncTask.java:287)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:841)
        Caused by: org.springframework.http.converter.HttpMessageNotReadableException: Could not read [class org.mythtv.services.api.status.Status]; nested exception is org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.ElementList(data=false, empty=true, entry=, inline=true, name=, required=true, type=void) on field 'programs' private java.util.List org.mythtv.services.api.status.Scheduled.programs for class org.mythtv.services.api.status.Scheduled at line 7
        at org.springframework.http.converter.xml.SimpleXmlHttpMessageConverter.readInternal(SimpleXmlHttpMessageConverter.java:115)
        at org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:147)
        at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:76)
        at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:655)
        at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:641)
        at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:484)
        at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:453)
        at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:429)
        at org.mythtv.services.api.status.impl.StatusTemplate.getStatus(StatusTemplate.java:50)
        ... 8 more
        Caused by: org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.ElementList(data=false, empty=true, entry=, inline=true, name=, required=true, type=void) on field 'programs' private java.util.List org.mythtv.services.api.status.Scheduled.programs for class org.mythtv.services.api.status.Scheduled at line 7
        at org.simpleframework.xml.core.Composite.validate(Composite.java:644)
        at org.simpleframework.xml.core.Composite.readElements(Composite.java:449)
        at org.simpleframework.xml.core.Composite.access$400(Composite.java:59)
        at org.simpleframework.xml.core.Composite$Builder.read(Composite.java:1383)
        at org.simpleframework.xml.core.Composite.read(Composite.java:201)
        at org.simpleframework.xml.core.Composite.read(Composite.java:148)
        at org.simpleframework.xml.core.Composite.rea

If I change the following in Scheduled,java

    @ElementList( inline = true)
    private List<Program> programs;

to

    @ElementList( inline = true, required=false )
    private List<Program> programs;

it doesn't fail, but might now be correct.

dmfrey commented 11 years ago

@espenaf can you test this again since the refactor to use the v1+ mythtv services api. If it is still an issue, please open a ticket in the mythtv services api repo

espenaf commented 11 years ago

Looks good on 0.26.