Error exporting to MS Project casting cost to number

I tried exporting my project to MS Project (text and XML) and got an error. I have not used costs in this project, though I may have played around with a cost in one task, but I’ve now confirmed that all my tasks are “Set explicitly: 0.0” which was the default. All my resources have cost 0.

Here’s the last bit of the log file with a backtrace:

WARNING: Export failure. Failed subtask: Export project
java.lang.RuntimeException: Export failure. Failed subtask: Export project
at net.sourceforge.ganttproject.export.ExporterBase$2.run(ExporterBase.java:167)
at org.bardsoftware.impl.eclipsito.JobManagerImpl$GroupWorker.run(JobManagerImpl.java:163)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
at net.sf.mpxj.Task.getCost(Task.java:1791)
at net.sf.mpxj.mspdi.MSPDIWriter.writeTask(MSPDIWriter.java:1017)
at net.sf.mpxj.mspdi.MSPDIWriter.writeTasks(MSPDIWriter.java:986)
at net.sf.mpxj.mspdi.MSPDIWriter.write(MSPDIWriter.java:193)
at net.sf.mpxj.writer.AbstractProjectWriter.write(AbstractProjectWriter.java:55)
at biz.ganttproject.impex.msproject2.ExporterToMsProjectFile$2.run(ExporterToMsProjectFile.java:120)
at net.sourceforge.ganttproject.export.ExporterBase$2.run(ExporterBase.java:165)
… 2 more

I’m running GanttProject 2.8.5 Pilsen (build 2179) on Win 7

Please share the project file.

Here you go.

Sanitized project plan.gan (18.3 KB)

You have a custom field with the name “Cost” and type “Text”. In MS Project model there is also a field named “Cost” with numeric type, that’s why the exporting code fails.

The easiest way to fix it is to delete your custom field or to set its type to Double. Save the file after that and restart GanttProject.

The fixed file (Cost type changed to Double) is attached.

Sanitized project plan.gan (18.3 KB)

That’s odd. I didn’t create that on purpose. I bet it crept in when I
exported to csv, added a bunch of rows, and imported.

Thanks,
Adam

Oh, good catch! Thanks for elaborating. I have submitted a bug report to the tracker: https://github.com/bardsoftware/ganttproject/issues/1434

FWIW, I was not able to export after changing the Cost field to Double, but
was after deleting it. I haven’t yet had a chance to see if it imports into
MS Project yet as I’m on vacation.

Thanks,
Adam