JPL-IMCE / gov.nasa.jpl.imce.oml

Ontology Modeling Language (OML) Workbench
14 stars 1 forks source link

"Invalid URI file extension" thrown when invoking save on an omlzip resource and passing a http uri containing a "." #274

Open sjiherzig opened 6 years ago

sjiherzig commented 6 years ago

When invoking "save" on an OMLZipResource, and passing in an http URI that contains, in the last segment, a dot ("."), anything after the dot seems to be interpreted as a file extension. This leads to the EMF framework throwing an java.lang.IllegalArgumentException. See below for an example:

IRI is: http://caesar/simple2/user-model2/authorities/WBS_06SpacecraftSystem_ID__18_0_6_f060354_1505321573841_796820_14618/WBS_06.05CommandandDataHandlingSubsystem_ID__18_0_6_f060354_1505321633511_103181_14620

Format: omlzip

Resource type: gov.nasa.jpl.imce.oml.zip.OMLZipResource

java.lang.IllegalArgumentException: CatalogURIConverter.createOutputStream() invalid URI file extension 05CommandandDataHandlingSubsystem_ID__18_0_6_f060354_1505321633511_103181_14620 should be instead omlzip in normalized URI: file:/Users/sherzig/Documents/Projects/IMCE%20Infrastructure/CAESAR%202.0/Tool%20Adapter%20and%20Model%20Linker/MagicDraw/0.3.0/ontologies/caesar/simple2/user-model2/authorities/WBS_06SpacecraftSystem_ID__18_0_6_f060354_1505321573841_796820_14618/WBS_06.05CommandandDataHandlingSubsystem_ID__18_0_6_f060354_1505321633511_103181_14620
    at gov.nasa.jpl.imce.oml.model.extensions.CatalogURIConverter.createOutputStream(CatalogURIConverter.java:379)
    at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:996)
    at gov.nasa.jpl.caesar.adapters.utilities.helpers.OMLUtilities.saveOMLModel(OMLUtilities.java:192)
    at gov.nasa.jpl.caesar.adapters.magicdraw.transformation.app.MDExporter.mdOml2Oml(MDExporter.java:335)
    at gov.nasa.jpl.caesar.adapters.magicdraw.transformation.app.MDExporter.md2Oml(MDExporter.java:280)
    at gov.nasa.jpl.caesar.adapters.magicdraw.transformation.app.MDExporter.execute(MDExporter.java:234)
    at gov.nasa.jpl.caesar.adapters.magicdraw.transformation.app.MDExporter.main(MDExporter.java:490)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.nomagic.magicdraw.MainMethodLauncher.launch(MainMethodLauncher.java:26)
    at com.nomagic.magicdraw.ApplicationGateway.start(ApplicationGateway.java:46)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at com.nomagic.osgi.launcher.FrameworkLauncher$DefaultApplication.run(FrameworkLauncher.java:226)
    at com.nomagic.osgi.launcher.FrameworkLauncher.runFrameworkApplication(FrameworkLauncher.java:176)
    at com.nomagic.osgi.launcher.FrameworkLauncher.run(FrameworkLauncher.java:113)
    at com.nomagic.osgi.launcher.FrameworkLauncher.run(FrameworkLauncher.java:92)
    at com.nomagic.osgi.launcher.ProductionFrameworkLauncher.run(ProductionFrameworkLauncher.java:70)
    at com.nomagic.osgi.launcher.ProductionFrameworkLauncher.main(ProductionFrameworkLauncher.java:57)

A workaround is adding .omlzip to the above IRI, i.e.: http://caesar/simple2/user-model2/authorities/WBS_06SpacecraftSystem_ID__18_0_6_f060354_1505321573841_796820_14618/WBS_06.05CommandandDataHandlingSubsystem_ID__18_0_6_f060354_1505321633511_103181_14620.omlzip