I am getting a NumberFormatException intermittently when reading the historical records of a Task [Latest Java ApiClient]

565 views
Skip to first unread message

Anjum Naseer

unread,
Apr 18, 2012, 7:31:47 AM4/18/12
to version...@googlegroups.com

java.util.concurrent.ExecutionException: java.lang.NumberFormatException: multiple points
        at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
        at java.util.concurrent.FutureTask.get(FutureTask.java:111)
        at javax.swing.SwingWorker.get(SwingWorker.java:602)
        at com.teamphone.versionone.dashboard.views.TaskWorkflowPanel$WorkflowUpdator.done(TaskWorkflowPanel.java:190)
        at javax.swing.SwingWorker$5.run(SwingWorker.java:737)
        at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
        at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
        at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842)
        at javax.swing.Timer.fireActionPerformed(Timer.java:312)
        at javax.swing.Timer$DoPostEvent.run(Timer.java:244)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:705)
        at java.awt.EventQueue.access$000(EventQueue.java:101)
        at java.awt.EventQueue$3.run(EventQueue.java:666)
        at java.awt.EventQueue$3.run(EventQueue.java:664)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.NumberFormatException: multiple points
        at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1101)
        at java.lang.Double.parseDouble(Double.java:540)
        at java.text.DigitList.getDouble(DigitList.java:168)
        at java.text.DecimalFormat.parse(DecimalFormat.java:1321)
        at java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:2089)
        at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1455)
        at java.text.DateFormat.parse(DateFormat.java:355)
        at com.versionone.DB$DateTime.<init>(DB.java:494)
        at com.versionone.apiclient.AttributeDefinition.coerce(AttributeDefinition.java:79)
        at com.versionone.apiclient.SingleValueAttribute.loadValue(SingleValueAttribute.java:149)
        at com.versionone.apiclient.Asset.loadAttributeValue(Asset.java:197)
        at com.versionone.apiclient.Services.parseAttributeNode(Services.java:347)
        at com.versionone.apiclient.Services.parseAssetNode(Services.java:377)
        at com.versionone.apiclient.Services.parseAssetListQueryResult(Services.java:396)
        at com.versionone.apiclient.Services.parseHistoryQueryResult(Services.java:432)
        at com.versionone.apiclient.Services.parseQueryResult(Services.java:267)
        at com.versionone.apiclient.Services.retrieve(Services.java:53)
        at com.teamphone.versionone.api.impl.DefaultV1Task.queryWorkflow(DefaultV1Task.java:352)
        at com.teamphone.versionone.api.impl.DefaultV1Task.getWorkflow(DefaultV1Task.java:300)
        at com.teamphone.versionone.dashboard.views.TaskWorkflowPanel$WorkflowUpdator.doInBackground(TaskWorkflowPanel.java:173)
        at com.teamphone.versionone.dashboard.views.TaskWorkflowPanel$WorkflowUpdator.doInBackground(TaskWorkflowPanel.java:154)
        at javax.swing.SwingWorker$1.call(SwingWorker.java:296)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at javax.swing.SwingWorker.run(SwingWorker.java:335)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)

 

I am using the Java SwingWorker class to fetch these in the background.

 

The query is along the lines of:

 

      final IAssetType assetType = metaModel.getAssetType("Task");

      final IAttributeDefinition changeDateAttribute = assetType.getAttributeDefinition("ChangeDate");

      final Query query = new Query(assetType, true);

      final FilterTerm changeDateFilterTerm = new FilterTerm(changeDateAttribute);

      changeDateFilterTerm.exists();

      query.setFilter(new AndFilterTerm(changeDateFilterTerm, createTaskOidFilter(metaModel,taskOid)));

      query.getOrderBy().minorSort(changeDateAttribute, OrderBy.Order.Ascending);

      query.getSelection().add(changeDateAttribute);

      query.getSelection().add(assetType.getAttributeDefinition("ChangedBy.Name"));

      query.getSelection().add(assetType.getAttributeDefinition("ChangedBy.Nickname"));

      query.getSelection().add(assetType.getAttributeDefinition("Status.Name"));

 

      return services.retrieve(query);

 

Looks like it is having problems parsing the date/time. Anyone know how to fix this?

 

NOTE: I originally thought this might be to do with having temporary empty dates in the V1 database (which is why I added changeDateFilterTerm.exists()) but it still throws this error intermittently.

 

Thanks,

 

Anjum

 

Anjum Naseer

unread,
Apr 18, 2012, 7:52:41 AM4/18/12
to version...@googlegroups.com

I tracked this down to com.versionone.DB – the constructor at line 481 is coded as follows:

 

481:                        public DateTime(Object value) {

482:                                        if ((value != null) && (!(value instanceof NullObject))) {

483:                                                        if (value instanceof String) {

484:                                                                        String strValue = (String) value;

485:                                                                        if (!strValue.equals("")) {

486:                                                                                        final SimpleDateFormat format;

487:                                                                                        if (strValue.contains("T")) {

488:                                                                                                        format = DAY_N_TIME_FORMAT;

489:                                                                                        } else {

490:                                                                                                        format = DAY_FORMAT;

491:                                                                                        }

492://                        format.setTimeZone(TimeZone.getTimeZone("UTC"));

493:                                                                                        try {

494:                                                                                                        setDate(format.parse(strValue));

495:                                                                                        } catch (ParseException e) {

496:                                                                                                        throw new RuntimeException("Cannot Parse Value", e);

497:                                                                                        }

498:                                                                        }

499:                                                        } else if (value instanceof Date) {

500:                                                                        setDate((Date) value);

501:                                                        } else if (value instanceof DateTime) {

502:                                                                        DateTime other = (DateTime) value;

503:                                                                        if (!other.isNull())

504:                                                                                        setDate(other.getValue());

505:                                                        } else

506:                                                                        throw new RuntimeException(UnknownConversionMessage(value));

507:                                        }

508:                        }

 

It throws at line 494 in this file.

 

I noticed that if this throws a ParseException then it is converted to a RuntimeException at line 496.

It might be useful to add the value of strValue to this exception to aid diagnostics.

 

The actual exception thrown in this case is a NumberFormatException so it wouldn’t be caught. It might be worth catching this as well so that you can add more context to the exception message before re-throwing it.

 

Thanks,

 

Anjum

--
You received this message because you are subscribed to the Google Groups "VersionOne-dev" group.
To post to this group, send email to version...@googlegroups.com.
To unsubscribe from this group, send email to versionone-de...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/versionone-dev?hl=en.

ibuchanan

unread,
Apr 18, 2012, 8:07:48 AM4/18/12
to version...@googlegroups.com
Anjum,
 
It does look like a problem that the SDK catches the wrong kind of exception. I'll put a story in our backlog to address it. That said, it's not exactly an explanation. I wonder if you could add the strValue to the exception and recompile so we can learn a little more about the root cause. I have a hard time imagining how the ChangeDate could be coming back as something other than a parseable date. And the fact that it's intermitent puzzles me, too.
 
Yours truly,
Ian Buchanan
Product Manager for Platform and Integrations

To post to this group, send email to versionone-dev@googlegroups.com.
To unsubscribe from this group, send email to versionone-dev+unsubscribe@googlegroups.com.

Anjum Naseer

unread,
Apr 18, 2012, 8:32:19 AM4/18/12
to version...@googlegroups.com

Ian,

 

I have amended the relevant code to this:

 

                                                                                                try {

                                                                                                                setDate(format.parse(strValue));

                                                                                                } catch (final ParseException e) {

                                                                                                                throw new RuntimeException("Cannot Parse Value ["+strValue+"] using format ["+format+"]", e);

                                                                                                } catch (final RuntimeException e) {

                                                        throw new RuntimeException("Cannot Parse Value ["+strValue+"] using format ["+format+"]", e);

                                                                                                }

 

And will let you have the details when it occurs again.

 

Thanks,

 

Anjum.

To post to this group, send email to version...@googlegroups.com.
To unsubscribe from this group, send email to versionone-de...@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/versionone-dev?hl=en.

--

You received this message because you are subscribed to the Google Groups "VersionOne-dev" group.

To view this discussion on the web visit https://groups.google.com/d/msg/versionone-dev/-/LbqIYTZml08J.
To post to this group, send email to version...@googlegroups.com.
To unsubscribe from this group, send email to versionone-de...@googlegroups.com.

Anjum Naseer

unread,
Apr 19, 2012, 7:42:06 AM4/19/12
to version...@googlegroups.com

Hi Ian,

 

It hasn’t occurred again yet. Just to be clear, intermittently here means that it happened twice in the past 3 weeks. So maybe I should have said “rarely” rather than intermittently.

 

I’ll let you if it does occur again.

ibuchanan

unread,
Apr 19, 2012, 8:08:02 AM4/19/12
to version...@googlegroups.com
Anjum,
 
That's helpful clarification. If it's that infrequent, then it will certainly be hard to reproduce. And yet, I still can't imagine how it would happen so I'm only more intrigued. Is it wrong of me to wish you the misfortune of having it happen again? ;)
 
Ian

To post to this group, send email to versionone-dev@googlegroups.com.
To unsubscribe from this group, send email to versionone-dev+unsubscribe@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/versionone-dev?hl=en.

--
You received this message because you are subscribed to the Google Groups "VersionOne-dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/versionone-dev/-/LbqIYTZml08J.

To post to this group, send email to versionone-dev@googlegroups.com.
To unsubscribe from this group, send email to versionone-dev+unsubscribe@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/versionone-dev?hl=en.

--
You received this message because you are subscribed to the Google Groups "VersionOne-dev" group.

To post to this group, send email to versionone-dev@googlegroups.com.
To unsubscribe from this group, send email to versionone-dev+unsubscribe@googlegroups.com.

Anjum Naseer

unread,
Apr 19, 2012, 8:10:24 AM4/19/12
to version...@googlegroups.com

Ian,

 

J - not at all – I am also hoping it occurs again as I am just as intrigued to find out why it fails.

 

Anjum.

 

 

Anjum Naseer, Senior Software Engineer

Resilient Networks plc (web )

From: version...@googlegroups.com [mailto:version...@googlegroups.com] On Behalf Of ibuchanan
Sent: 19 April 2012 13:08
To: version...@googlegroups.com
Subject: Re: I am getting a NumberFormatException intermittently when reading the historical records of a Task [Latest Java ApiClient]

 

Anjum,

 

That's helpful clarification. If it's that infrequent, then it will certainly be hard to reproduce. And yet, I still can't imagine how it would happen so I'm only more intrigued. Is it wrong of me to wish you the misfortune of having it happen again? ;)

To post to this group, send email to version...@googlegroups.com.
To unsubscribe from this group, send email to versionone-de...@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/versionone-dev?hl=en.

--
You received this message because you are subscribed to the Google Groups "VersionOne-dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/versionone-dev/-/LbqIYTZml08J.

To post to this group, send email to version...@googlegroups.com.
To unsubscribe from this group, send email to versionone-de...@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/versionone-dev?hl=en.

--
You received this message because you are subscribed to the Google Groups "VersionOne-dev" group.

To post to this group, send email to version...@googlegroups.com.
To unsubscribe from this group, send email to versionone-de...@googlegroups.com.


For more options, visit this group at http://groups.google.com/group/versionone-dev?hl=en.

--
You received this message because you are subscribed to the Google Groups "VersionOne-dev" group.

To view this discussion on the web visit https://groups.google.com/d/msg/versionone-dev/-/SN7wFC9bticJ.
To post to this group, send email to version...@googlegroups.com.
To unsubscribe from this group, send email to versionone-de...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages