archimatetool / archi-modelrepository-plugin

coArchi - a plug-in to share and collaborate on Archi models.
153 stars 52 forks source link

Issue importing remote model to workspace #138

Closed TD-4242 closed 4 years ago

TD-4242 commented 4 years ago

Version of Archi, Operating System

Saved from Ubuntu 18.04 Archi 4.6.0 opened on Windows 10 Achi 4.6.0

Version of this plug-in

0.6.2.202004031233

Any other plug-ins installed?

None

Expected Behaviour

Open the Model

Actual Behaviour

There was an error: Content is not allowed in trailing section.

Steps to Reproduce the Behaviour

  1. Save model at work on Linux host and push to github
  2. at home on Windows 10 Refresh model and get error above
jbsarrodie commented 4 years ago

Hi,

Can you confirm exact version of Archi on both computers and provide a screenshot of error message and error log please.

TD-4242 commented 4 years ago

I'm not sure but this could be a crlf issue I found a log file in .metadata on windows 10, is this what you're looking for?

!SESSION 2020-05-26 20:37:52.975 -----------------------------------------------
eclipse.buildId=unknown
java.version=11.0.3
java.vendor=AdoptOpenJDK
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -clean

!ENTRY org.archicontribs.modelrepository 4 0 2020-05-26 20:38:24.823
!MESSAGE Error loading model
!STACK 0
org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Content is not allowed in trailing section.
    at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:195)
    at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261)
    at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1563)
    at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1342)
    at org.archicontribs.modelrepository.grafico.GraficoResourceLoader.load(GraficoResourceLoader.java:50)
    at org.archicontribs.modelrepository.grafico.GraficoResourceLoader.loadEObject(GraficoResourceLoader.java:30)
    at org.archicontribs.modelrepository.grafico.GraficoModelImporter.loadElement(GraficoModelImporter.java:301)
    at org.archicontribs.modelrepository.grafico.GraficoModelImporter.loadFolder(GraficoModelImporter.java:282)
    at org.archicontribs.modelrepository.grafico.GraficoModelImporter.loadFolder(GraficoModelImporter.java:285)
    at org.archicontribs.modelrepository.grafico.GraficoModelImporter.loadModel(GraficoModelImporter.java:255)
    at org.archicontribs.modelrepository.grafico.GraficoModelImporter.importAsModel(GraficoModelImporter.java:119)
    at org.archicontribs.modelrepository.grafico.GraficoModelLoader.lambda$0(GraficoModelLoader.java:84)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:72)
    at org.archicontribs.modelrepository.grafico.GraficoModelLoader.loadModel(GraficoModelLoader.java:82)
    at org.archicontribs.modelrepository.actions.CloneModelAction.run(CloneModelAction.java:113)
    at org.archicontribs.modelrepository.actions.CloneModelHandler.execute(CloneModelHandler.java:24)
    at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
    at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:95)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:318)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:252)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
    at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java:498)
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
    at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
    at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:438)
    at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:449)
    at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.lambda$2(AbstractContributionItem.java:475)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4173)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3986)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3585)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:633)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at com.archimatetool.editor.Application.start(Application.java:84)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:660)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1468)
Caused by: org.xml.sax.SAXParseExceptionpublicId: file:/C:/Users/wwarn/AppData/Roaming/Archi4/model-repository/archimate/model/diagrams/19736118-ff9f-4e45-90f8-e9bc4d32ce41/ArchimateDiagramModel_0563d990-1f4d-4fa8-bae0-2d94ba01a1bc.xml; systemId: file:/C:/Users/wwarn/AppData/Roaming/Archi4/model-repository/archimate/model/diagrams/19736118-ff9f-4e45-90f8-e9bc4d32ce41/ArchimateDiagramModel_0563d990-1f4d-4fa8-bae0-2d94ba01a1bc.xml; lineNumber: 514; columnNumber: 1; Content is not allowed in trailing section.
    at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$TrailingMiscDriver.next(Unknown Source)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
    at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
    ... 58 more
TD-4242 commented 4 years ago

image

TD-4242 commented 4 years ago

One other thing on checkout this file is changed:

modified: model/diagrams/19736118-ff9f-4e45-90f8-e9bc4d32ce41/ArchimateDiagramModel_0563d990-1f4d-4fa8-bae0-2d94ba01a1bc.xml

and all unix lf are replaced with crlf (^M)

Phillipus commented 4 years ago

Can you locate that file and examine its contents? Is it well formed XML? Is there anything after the closing tag?

TD-4242 commented 4 years ago

using xmllint I seem to be getting this error:

# xmllint ArchimateDiagramModel_0563d990-1f4d-4fa8-bae0-2d94ba01a1bc.xml --valid -o testfile.xml ArchimateDiagramModel_0563d990-1f4d-4fa8-bae0-2d94ba01a1bc.xml:5: validity error : Validation failed: no DTD found ! id="0563d990-1f4d-4fa8-bae0-2d94ba01a1bc">

Phillipus commented 4 years ago

Can you locate that file and examine its contents? Is it well formed XML? Is there anything after the closing tag?

Please look at the file in a text editor.

TD-4242 commented 4 years ago

sorry, yes I did that as well and it looks like valid XML there doesn't seem to be any printable or nonprintable characters after any of the closing tags.

Phillipus commented 4 years ago

Can you please attach the xml file or, if that is not possible, please look at line 514. Possibly an extra ">" or "<".

The error message is stating that there is something there that shouldn't be.

Phillipus commented 4 years ago

The file in the error log is:

C:/Users/wwarn/AppData/Roaming/Archi4/model-repository/archimate/model/diagrams/19736118-ff9f-4e45-90f8-e9bc4d32ce41/ArchimateDiagramModel_0563d990-1f4d-4fa8-bae0-2d94ba01a1bc.xml

TD-4242 commented 4 years ago

Line 514 is full of ^@^@^@^@^@^@ for several pages

TD-4242 commented 4 years ago

image

Phillipus commented 4 years ago

Is this the case also for this file on both copies? i.e on the Ubuntu and Windows files.

Trying to figure out where this happened in the sequence of events. Did this get published (pushed) to the git server and the corrupt file got pulled down?

TD-4242 commented 4 years ago

let me double check. I'm no longer at home with the windows host this is what was pushed to github from the linux host.

Right now the linux host is on another branch but it too is not right:

...
      </children>
      <archimateElement
          xsi:type="archimate:SystemSoftware"
          href="SystemSoftware_5c4fc800-4127-47ea-b462-70d5a4ad8d3b.xml#5c4fc800-4127-47ea-b46  2-70d5a4ad8d3b"/>
    </children>
  </archimate:ArchimateDiagramModel>
>>78126dd-65bf-4366-9cc2-db142c299c3f.xml#d78126dd-65bf-4366-9cc2-db142c299c3f"/>
    </children>
    <children
        xsi:type="archimate:DiagramModelArchimateObject"
        id="14c2104a-a7d6-4955-9cfc-b63e920c38d1"
        targetConnections="262b4bc2-7c62-49f0-ac01-232d0e0b9306">
      <sourceConnections
...

so far it hasn't complained about it though.

jbsarrodie commented 4 years ago

Are you sure that push has only been done from within Archi and never through any other git tool?

This seems like a potential push with conflicts (adding some >>>>> and <<<<< markers) or a potential branch merge done online from a pull request (which should never been used with Archi).

TD-4242 commented 4 years ago

that would be it then. I've been pushing to a branch and doing PRs to master. Am I hosed?

I guess I can revert the PR and merges.

TD-4242 commented 4 years ago

OK, most of the PR merges I've done had no conflicts but there was one yesterday that had to have conflicts resolved. I'm guessing I can revert to just prior to that and only lose a small amount.

jbsarrodie commented 4 years ago

To make it clear again (sorry but this has been written dozens of times in issues and on the forum):

Nothing else than Archi itself should be used!

Git is not able to merge a model, there are half a dozen of anti-corruption layers coded in the plugin to make sure everything is done right.

Git repository is only used a a kind of proprietary storage solution and is absolutely not meant to be accessed other than through the Archi.

jbsarrodie commented 4 years ago

OK, most of the PR merges I've done had no conflicts but there was one yesterday that had to have conflicts resolved. I'm guessing I can revert to just prior to that and only lose a small amount.

That's not even sure. If you already used PR on your model, you might have several hidden corruptions. This one is most certainly only the visible part of the iceberg.

TD-4242 commented 4 years ago

Sorry still new to Archi and assumed a normal git PR to master type workflow. I just reverted all of my git repo branches to the commit just prior to the conflict merge and at first glance (opening all diagrams) it looks like all the diagrams are working as expected.

My own fault.

Phillipus commented 4 years ago

@TD-4242 How do you think we can make this clearer? Genuinely interested to know how we could improve on this...

TD-4242 commented 4 years ago

Not really sure, I still haven't looked to see it in the documentation so I'm not sure how clear or unclear it is there, again assuming but I'd guess you guys have clearly outlined it and it was my laziness that caused the issue. I will make a point of going over it more thoroughly today.

I think 10 years of working with Git has ingrained certain workflows into my head and I just fell into them when I started using it here. Perhaps initializing a README.md in the repo with some info and warnings could help? I plan to add notes to not do PRs and handle all merges in the app in my README.md that I currently have. It contains some instructions for where to download Archi and the coArchi plugin.

TD-4242 commented 4 years ago

Of course I just realized I have no way of merging this README into the branches now, but this is what the repo in github looks like

image