Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion I am getting a NumberFormatException intermittently when reading the historical records of a Task [Latest Java ApiClient]
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Anjum Naseer  
View profile  
 More options Apr 18 2012, 7:52 am
From: Anjum Naseer <A.Nas...@Resilientplc.com>
Date: Wed, 18 Apr 2012 11:52:41 +0000
Local: Wed, Apr 18 2012 7:52 am
Subject: RE: I am getting a NumberFormatException intermittently when reading the historical records of a Task [Latest Java ApiClient]

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

From: versionone-dev@googlegroups.com [mailto:versionone-dev@googlegroups.com] On Behalf Of Anjum Naseer
Sent: 18 April 2012 12:32
To: versionone-dev@googlegroups.com
Subject: I am getting a NumberFormatException intermittently when reading the historical records of a Task [Latest Java ApiClient]

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:8 32)
        at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
        at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingW orker.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.j ava:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.jav a:211)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:1 28)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.jav a: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.jav a:79)
        at com.versionone.apiclient.SingleValueAttribute.loadValue(SingleValueAttribut e.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:3 96)
        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.j ava: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:1 110)
        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.Nickna me"));
      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

--
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<mailto:versionone-dev@googlegroups.com>.
To unsubscribe from this group, send email to versionone-dev+unsubscribe@googlegroups.com<mailto:versionone-dev+unsubscri be@googlegroups.com>.
For more options, visit this group at http://groups.google.com/group/versionone-dev?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.