NumberFormatException RouterController (ZonedDateTime)

19 views
Skip to first unread message

French Cruzian

unread,
Jun 27, 2017, 4:54:43 PM6/27/17
to extdirectspring
Using ZoneDateTime for an Object, not sure why or where this date is being called. Does not contain any of my source???


2017-06-27 16:27:57.557 ERROR 114684 --- [nio-8080-exec-5] c.r.e.controller.RouterController        : Error calling method: read

java.lang.NumberFormatException: For input string: "05-28-2017"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[na:1.8.0_121]
    at java.lang.Integer.parseInt(Integer.java:580) ~[na:1.8.0_121]
    at java.lang.Integer.valueOf(Integer.java:766) ~[na:1.8.0_121]
    at org.springframework.util.NumberUtils.parseNumber(NumberUtils.java:208) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.core.convert.support.StringToNumberConverterFactory$StringToNumber.convert(StringToNumberConverterFactory.java:62) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.core.convert.support.StringToNumberConverterFactory$StringToNumber.convert(StringToNumberConverterFactory.java:49) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.core.convert.support.GenericConversionService$ConverterFactoryAdapter.convert(GenericConversionService.java:436) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:37) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:203) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:187) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
    at ch.ralscha.extdirectspring.util.ParametersResolver.fillReadRequestFromMap(ParametersResolver.java:595) ~[extdirectspring-1.7.1.jar:na]
    at ch.ralscha.extdirectspring.util.ParametersResolver.resolveParameters(ParametersResolver.java:161) ~[extdirectspring-1.7.1.jar:na]
    at ch.ralscha.extdirectspring.controller.RouterController.processRemotingRequest(RouterController.java:649) [extdirectspring-1.7.1.jar:na]
    at ch.ralscha.extdirectspring.controller.RouterController.handleMethodCall(RouterController.java:440) [extdirectspring-1.7.1.jar:na]
    at ch.ralscha.extdirectspring.controller.RouterController.handleMethodCallsSequential(RouterController.java:407) [extdirectspring-1.7.1.jar:na]
    at ch.ralscha.extdirectspring.controller.RouterController.router(RouterController.java:306) [extdirectspring-1.7.1.jar:na]

ralph

unread,
Jun 28, 2017, 12:17:06 AM6/28/17
to extdirectspring
Hi

Can you post the JSON the client (browser) sends to the server and the signature of the extdirectspring method. Thanks

Ralph

French Cruzian

unread,
Jun 28, 2017, 1:27:02 PM6/28/17
to extdirectspring
Hey Ralph,

Thanks for the quick response!! Greatly appreciated. I'm using the Extjs 5 calendar which has a sorter for a start date, which is recognized as a String Converter instead of a Date Converter.

proxy: {
        type
: "direct",
        api
: {
            read
: "eventService.read",
            create
: "eventService.update",
            update
: "eventService.update",
            destroy
: "eventService.destroy"
       
},
        reader
: {
            rootProperty
: "records"
       
},
        writer
: {
            writeAllFields
: true
       
}
   
},
   
    autoLoad
: true,
   
    initComponent
: function() {
        console
.log('initComp');
       
var me = this,
            eventData
= Nexus.modules.calendar.data;
        console
.log('me: '+me+', eventData: '+eventData);    
        me
.sorters = me.sorters || [{
            property
: eventData.EventMappings.StartDate.name,
            direction
: 'ASC'
       
}];
        console
.log('sorters: '+me.sorters);
       
        me
.idProperty = me.idProperty || eventData.EventMappings.EventId.name || 'id';        
        me
.fields = eventData.EventModel.prototype.fields.getRange();//getFields();        
        me
.callParent(arguments);
   
}

MemoryEventStore changed to a proxy.Direct


   
@ExtDirectMethod(STORE_READ)
   
@Transactional(readOnly = true)
   
public ExtDirectStoreResult<Event> read(ExtDirectStoreReadRequest request) {
       
System.out.println("request "+request+", tostring: "+request.toString());
       
JPQLQuery<Event> query = this.jpaQueryFactory.selectFrom(QEvent.event);
       
if (!request.getFilters().isEmpty()) {
           
System.out.println("request Filters: "+request.getFilters());
           
StringFilter filter = (StringFilter) request.getFilters().iterator().next();

           
BooleanBuilder bb = new BooleanBuilder();
            bb
.or(QEvent.event.title.containsIgnoreCase(filter.getValue()));
            bb
.or(QEvent.event.description.containsIgnoreCase(filter.getValue()));
            bb
.or(QEvent.event.fedex.containsIgnoreCase(filter.getValue()));
            bb
.or(QEvent.event.reminder.containsIgnoreCase(filter.getValue()));
            query
.where(bb);
       
}

       
QuerydslUtil.addPagingAndSorting(query, request, Event.class, QEvent.event);
       
QueryResults<Event> searchResult = query.fetchResults();
       
       
return new ExtDirectStoreResult<>(searchResult.getTotal(),
                searchResult
.getResults());
   
}
       

EventService read function

    @ModelField(dateFormat = "time", persist = false)
   
@Column(nullable = false)
   
private ZonedDateTime startdate;

   
@ModelField(dateFormat = "time", persist = false)
   
@Column(nullable = false)
   
private ZonedDateTime enddate;

Event entity object

 Attached are the screen of the JSON, when you say signature of the extdirectspring method can you direct me how to obtains this for you?


Thanks again Ralph :-)
EventService.png
EventServiceError.png

ralph

unread,
Jun 28, 2017, 1:41:31 PM6/28/17
to extdirectspring
The problem is the start field in the JSON. start is for paging and has to contain a number. You need to rename the field.

French Cruzian

unread,
Jun 28, 2017, 6:17:48 PM6/28/17
to extdirectspring
Ralph thanks for you patience and support on this. I was able to find and make the changes in the AbstractCalendar class

 setStartDate: function(start, refresh) {
       
this.startDate = Ext.Date.clearTime(start);
       
this.setViewBounds(start);
       
this.store.load({
           
params: {
                start
: Ext.Date.format(this.viewStart, 'm-d-Y'),
               
end: Ext.Date.format(this.viewEnd, 'm-d-Y')
           
}
       
});
       
if (refresh === true) {
           
this.refresh();
       
}
       
this.fireEvent('datechange', this, this.startDate, this.viewStart, this.viewEnd);
   
},
Reply all
Reply to author
Forward
0 new messages