Paste as Link Issue in oXygen v23

Post here questions and problems related to oXygen frameworks/document types.
ashukuma
Posts: 20
Joined: Fri Nov 14, 2014 10:04 am

Paste as Link Issue in oXygen v23

Post by ashukuma »

Hi Radu,

This case was already raise through different forum. But, I am raising it here again with more details as you requested.

We had developed an extension to merge Paste as Link (keyref and href) when we started with oXygen 18.0 version
(topic13766.html) .

This extension has been working good until oXygen 22.0. We are currently in the process of verifying oXygen v23.0 and found that the this is not working any more. We did try to update the extension and recreated jar file using oXygen 23 sdk. But, it is failing. The error that we are
receiving for inserting as keyref is as follows:

Error: java.lang.illegalargumentexception uri has a fragment component


Code:

Code: Select all

 public void doOperation(AuthorAccess authorAccess, ArgumentsMap args) throws IllegalArgumentException, AuthorOperationException {
     String topicID = "";
     String elementID = "";
     Shell oxygenFrame = (Shell)
	 authorAccess.getWorkspaceAccess().getParentFrame();
     int caretOffset = authorAccess.getEditorAccess().getCaretOffset();
     AuthorClipboardObject clip = authorAccess.getAuthorObjectFromClipboard();
     AuthorDocumentFragmentClipboardObject[] fragment = clip.getFragments();
     ContentDescription description = fragment[0].getContentDescription();
     String clipboardLocation = description.getSystemID();
     URL editorLocation = authorAccess.getEditorAccess().getEditorLocation();
     String editorLocationString = editorLocation.toString();

     if (!clipboardLocation.equals(editorLocationString)) {
       DITAAccess.pasteAsReference(authorAccess, DITAAccess.PasteInfo.PASTE_AS_KEYREF);
     } else {
       DITAAccess.pasteAsReference(authorAccess, DITAAccess.PasteInfo.PASTE_AS_REFERENCE);
     }
   }

StackTrace for the problem:

Code: Select all

java.lang.IllegalArgumentException: URI has a fragment component
	at java.io.File.<init>(File.java:425)
	at com.ixiasoft.dita.eclipse.utils.DocumentUtils.getCdoFromURL(DocumentUtils.java:122)
	at com.ixiasoft.eclipse.oxygen.utils.DitaKeyProvider.getKeyDefinitionForTarget(DitaKeyProvider.java:972)
	at ro.sync.ecss.dita.reference.keyref.t.getKeyDefinitionForTarget(Unknown Source)
	at ro.sync.ecss.dita.mapeditor.i.getKeyDefinitionForTarget(Unknown Source)
	at ro.sync.ecss.dita.bb.getKeyDefinitionForTarget(Unknown Source)
	at ro.sync.ecss.dita.reference.keyref.b.k(Unknown Source)
	at ro.sync.ecss.dita.DITAAccess.getKeyForUrl(Unknown Source)
	at ro.sync.ecss.dita.DITAAccess.pasteClipboardFragmentsAsReference(Unknown Source)
	at ro.sync.ecss.dita.DITAAccess.pasteAsReference(Unknown Source)
	at radndom.oxygen.custom.PasteDynamicLink.doOperation(PasteDynamicLink.java:34)
	at ro.sync.ecss.extensions.o.f(Unknown Source)
	at ro.sync.ecss.extensions.o.b(Unknown Source)
	at ro.sync.ecss.extensions.o.c(Unknown Source)
	at ro.sync.ecss.extensions.j.d(Unknown Source)
	at ro.sync.ecss.extensions.j.y(Unknown Source)
	at ro.sync.ecss.extensions.j.performAction(Unknown Source)
	at com.oxygenxml.editor.editors.author.l.c.yze(Unknown Source)
	at com.oxygenxml.editor.h.jaf(Unknown Source)
	at com.oxygenxml.editor.h.runWithEvent(Unknown Source)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
	at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4428)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4238)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3817)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
	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:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
Radu
Posts: 8992
Joined: Fri Jul 09, 2004 5:18 pm

Re: Paste as Link Issue in oXygen v23

Post by Radu »

Hi,

Thanks for reporting the entire stack trace of the problem, as you see at the top of the exception stack trace:

Code: Select all

java.lang.IllegalArgumentException: URI has a fragment component
	at java.io.File.<init>(File.java:425)
	at com.ixiasoft.dita.eclipse.utils.DocumentUtils.getCdoFromURL(DocumentUtils.java:122)
	at com.ixiasoft.eclipse.oxygen.utils.DitaKeyProvider.getKeyDefinitionForTarget(DitaKeyProvider.java:972)
the failure is in the code Ixiasoft used to implement our APIs. So you should report this problem to Ixiasoft.
Whenever a new version of Oxygen is available for you to use in Eclipse it's possible that the Ixiasoft Java extensions are updated as well.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply