Code: Alles auswählen
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Illegal group reference
at java.util.regex.Matcher.appendReplacement(Unknown Source)
at java.util.regex.Matcher.replaceAll(Unknown Source)
at java.lang.String.replaceAll(Unknown Source)
at service.SerHelper.replacePattern(SerHelper.java:284)
at service.SerHelper.createFileName(SerHelper.java:224)
at streaming.RecordControl.getFileName(RecordControl.java:250)
at streaming.RecordControl.getDirectory(RecordControl.java:263)
at control.ControlProgramTab.startRecordInInfoTab(ControlProgramTab.java:393)
at control.ControlProgramTab.startRecord(ControlProgramTab.java:368)
at control.ControlProgramTab.actionRecord(ControlProgramTab.java:249)
at control.ControlProgramTab.actionPerformed(ControlProgramTab.java:167)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Das %xxx% wird mit der replaceAll-Methode ersetzt. Allerdings hat das $- und \-Zeichen im replacestring eine spezielle Bedeutung. Eine Lösung wäre in service.SerHelper.replacePattern() den entsprechenden Zeichen im replacestring vorher ein \ voranzustellen.
Etwa so:
Code: Alles auswählen
replaceWith=replaceWith.replaceAll("\\\\","\\\\\\\\").replaceAll("\\$","\\\\\\$");