java.util.regex.PatternSyntaxException:索引58附近的未闭合字符类错误

时间:2017-10-20 10:55:00

标签: java eclipse cucumber cucumber-java

当我在Eclipse IDE中打开Cucumber编辑器时,我收到以下错误 -

java.util.regex.PatternSyntaxException: Unclosed character class near index 58
^User Selects "([^"]*)", "([^"]*)", "([^"]*)" and "([^]*)"$

我在之前的执行中收到此错误,因为我的步骤定义文件中存在错误。我已修复此问题,当我再次尝试打开该功能文件时,我收到此错误。有人可以帮我解决这个问题。附上了功能文件和程序。即使是重播也无效。

  

at java.util.regex.Pattern.error(Unknown Source)at   java.util.regex.Pattern.clazz(未知来源)at   java.util.regex.Pattern.sequence(未知来源)at   java.util.regex.Pattern.expr(未知来源)at   java.util.regex.Pattern.group0(未知来源)at   java.util.regex.Pattern.sequence(未知来源)at   java.util.regex.Pattern.expr(未知来源)at   java.util.regex.Pattern.compile(未知来源)at   java.util.regex.Pattern。(未知来源)at   java.util.regex.Pattern.compile(未知来源)at   cucumber.eclipse.steps.integration.Step.setText(Step.java:25)at   cucumber.eclipse.editor.steps.jdt.StepDefinitions.getCukeAnnotations(StepDefinitions.java:230)   在   cucumber.eclipse.editor.steps.jdt.StepDefinitions.getSteps(StepDefinitions.java:106)   在   cucumber.eclipse.editor.steps.ExtensionRegistryStepProvider.reloadSteps(ExtensionRegistryStepProvider.java:43)   在   cucumber.eclipse.editor.steps.ExtensionRegistryStepProvider。(ExtensionRegistryStepProvider.java:26)   在cucumber.eclipse.editor.editors.Editor.doSetInput(Editor.java:177)   在   org.eclipse.ui.texteditor.AbstractTextEditor $ 5.run(AbstractTextEditor.java:3154)   在   org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:437)   在org.eclipse.jface.operation.ModalContext.run(ModalContext.java:353)   在   org.eclipse.ui.internal.WorkbenchWindow $ 14.run(WorkbenchWindow.java:2195)   在   org.eclipse.swt.custom.BusyIndi​​cator.showWhile(BusyIndi​​cator.java:70)   在   org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2191)   在   org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3172)   在   org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3197)   在   org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:362)   在   org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:333)   at sun.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)at   sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)at   java.lang.reflect.Method.invoke(未知来源)at   org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)   在   org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:990)   在   org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:955)   在   org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:124)   在   org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:399)   在   org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318)   在   org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)   在   org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:105)   在   org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:74)   在   org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:56)   在   org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:129)   在   org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:992)   在   org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:661)   在   org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:767)   在   org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access $ 0(PartRenderingEngine.java:738)   在   org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine $ 2.run(PartRenderingEngine.java:732)   在org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)at   org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:716)   在   org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1293)   在   org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.lambda $ 0(LazyStackRenderer.java:68)   在   org.eclipse.e4.ui.services.internal.events.UIEventHandler $ 1.run(UIEventHandler.java:40)   在   org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:233)   在   org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:144)   在org.eclipse.swt.widgets.Display.syncExec(Display.java:4889)at   org.eclipse.e4.ui.internal.workbench.swt.E4Application $ 1.syncExec(E4Application.java:212)   在   org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36)   在   org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:201)   在   org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)   在   org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)   在   org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)   在   org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)   在   org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)   在   org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)   在   org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)   在   org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:52)   在   org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:60)   在   org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)   在   org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:173)   在   org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:620)   在   org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:584)   在   org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:769)   在   org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:401)   在   org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1188)   在   org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3261)   在   org.eclipse.ui.internal.WorkbenchPage.access $ 25(WorkbenchPage.java:3176)   在   org.eclipse.ui.internal.WorkbenchPage $ 10.run(WorkbenchPage.java:3158)   在   org.eclipse.swt.custom.BusyIndi​​cator.showWhile(BusyIndi​​cator.java:70)   在   org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3153)   在   org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3117)   在   org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3107)   在org.eclipse.ui.ide.IDE.openEditor(IDE.java:563)处   org.eclipse.ui.ide.IDE.openEditor(IDE.java:518)at   org.eclipse.ui.actions.OpenFileAction.openFile(OpenFileAction.java:100)   在   org.eclipse.ui.actions.OpenSystemEditorAction.run(OpenSystemEditorAction.java:97)   在org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:216)   在   org.eclipse.ui.navigator.CommonNavigatorManager $ 2.open(CommonNavigatorManager.java:191)   在   org.eclipse.ui.OpenAndLinkWithEditorHelper $ InternalListener.open(OpenAndLinkWithEditorHelper.java:46)   在   org.eclipse.jface.viewers.StructuredViewer $ 2.run(StructuredViewer.java:851)   在org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)at   org.eclipse.ui.internal.JFaceUtil.lambda $ 0(JFaceUtil.java:44)at at   org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)at at   org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:848)   在   org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1163)   在   org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:451)   在   org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:273)   在org.eclipse.jface.util.OpenStrategy.access $ 2(OpenStrategy.java:268)   在   org.eclipse.jface.util.OpenStrategy $ 1.handleEvent(OpenStrategy.java:308)   在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)   在org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3817)   在   org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine $ 5.run(PartRenderingEngine.java:1150)   在   org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)   在   org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039)   在   org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)   在org.eclipse.ui.internal.Workbench.lambda $ 3(Workbench.java:680)at   org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)   在   org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)   在   org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)   在   org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)   在   org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)   在   org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)   在   org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)   在   org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)   在   org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)at   sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)at   java.lang.reflect.Method.invoke(未知来源)at   org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)at at   org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)at at   org.eclipse.equinox.launcher.Main.run(Main.java:1499)

Code

打开要素文件时Eclipse IDE的错误屏幕截图: Cucumber editor error in eclipse

1 个答案:

答案 0 :(得分:0)

我认为这部分是错误的:

“([^])”$ - 在你的正则表达式的末尾

这没有任何意义[^] - 这意味着字符不是 - 而你并不是说它们不应该是什么:)例如[^ a]将是与'a'或你所​​写的不同的字符在那之前[^“] - 不是引用。但是[^]是一个错误