Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-39676

JIRA throws "java.lang.IllegalArgumentException: Illegal group reference" when database saves value with '$' sign

      Symptoms

      You will not be able to edit or transition any issues that contain a '$' sign in any field. This occurs only when SQL logging has been enabled.

      The following will appear in your atlassian-jira.log:

      2014-09-22 13:39:39,403 http-8080-14 ERROR XXXXXX ######## ##.##.##.##,127.0.0.1 /secure/CommentAssignIssue.jspa [atlassian.jira.workflow.OSWorkflowManager] Caught exception while attempting to perform action ### from workflow ####### on issue 'XXXXX-###'
      java.lang.IllegalArgumentException: Illegal group reference
              at java.util.regex.Matcher.appendReplacement(Matcher.java:713)
              at java.util.regex.Matcher.replaceFirst(Matcher.java:861)
              at java.lang.String.replaceFirst(String.java:2146)
              at com.atlassian.jira.ofbiz.OfBizLogHelper.formatSQL(OfBizLogHelper.java:30)
              at com.atlassian.jira.ofbiz.LoggingSQLInterceptor.afterExecutionImpl(LoggingSQLInterceptor.java:67)
      ...
      

      Or:

      2015-04-19 23:46:08,073 http-bio-8080-exec-38 ERROR cxue 1426x62252x6 1onb34q 10.110.121.121,10.119.20.32 /secure/CommentAssignIssue.jspa [atlassian.jira.workflow.OSWorkflowManager] Caught exception while attempting to perform action 11 from workflow 1052249 on issue 'ANE-28219'
      java.lang.IndexOutOfBoundsException: No group 1
      	at java.util.regex.Matcher.start(Unknown Source)
      	at java.util.regex.Matcher.appendReplacement(Unknown Source)
      	at java.util.regex.Matcher.replaceFirst(Unknown Source)
      	at java.lang.String.replaceFirst(Unknown Source)
      	at com.atlassian.jira.ofbiz.OfBizLogHelper.formatSQL(OfBizLogHelper.java:30)
      	at com.atlassian.jira.ofbiz.LoggingSQLInterceptor.afterExecutionImpl(LoggingSQLInterceptor.java:67)
      	at com.atlassian.jira.ofbiz.LoggingSQLInterceptor.afterSuccessfulExecution(LoggingSQLInterceptor.java:54)
      	at com.atlassian.jira.ofbiz.ChainedSQLInterceptor.afterSuccessfulExecution(ChainedSQLInterceptor.java:91)
      	at org.ofbiz.core.entity.jdbc.SQLProcessor.afterExecution(SQLProcessor.java:561)
      	at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:642)
      	at org.ofbiz.core.entity.GenericDAO.singleUpdate(GenericDAO.java:353)
      	at org.ofbiz.core.entity.GenericDAO.customUpdate(GenericDAO.java:279)
      	at org.ofbiz.core.entity.GenericDAO.update(GenericDAO.java:257)
      	at org.ofbiz.core.entity.GenericDAO.update(GenericDAO.java:226)
      	at org.ofbiz.core.entity.GenericHelperDAO.store(GenericHelperDAO.java:232)
      	at org.ofbiz.core.entity.GenericDelegator.store(GenericDelegator.java:1686)
      	at org.ofbiz.core.entity.GenericDelegator.store(GenericDelegator.java:1668)
      	at org.ofbiz.core.entity.GenericValue.store(GenericValue.java:102)
      	at com.atlassian.jira.issue.IssueImpl.store(IssueImpl.java:1319)
      	at com.atlassian.jira.workflow.function.issue.GenerateChangeHistoryFunction.execute(GenerateChangeHistoryFunction.java:46)
      	at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:1050)
      	at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1446)
      	at com.opensymphony.workflow.AbstractWorkflow.doAction(AbstractWorkflow.java:564)
      	at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowActionInsideTxn(OSWorkflowManager.java:957)
      	at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowAction(OSWorkflowManager.java:912)
      	at com.atlassian.jira.bc.issue.DefaultIssueService.transition(DefaultIssueService.java:450)
      	at com.atlassian.jira.web.action.issue.CommentAssignIssue.doExecute(CommentAssignIssue.java:192)
      	at webwork.action.ActionSupport.execute(ActionSupport.java:165)
      

      Cause

      To format SQL JIRA is using String.replaceFirst, which is using regexp replacement String as second argument, so it treats $ sign as a special character for replacing groups in regexp.

      Workaround

      This only occurs when SQL logging is enabled, so you can just disable SQL logging to avoid the issue.

            [JRASERVER-39676] JIRA throws "java.lang.IllegalArgumentException: Illegal group reference" when database saves value with '$' sign

            Dan Moran added a comment -

            We recently turned on SQL Logging on our JIRA server, based on a security requirement from our Information Security team. However, as documented in this ticket, issues with a "$" in them cannot be created or edited while SQL Logging is turned on. The ticket states that the workaround is to turn off SQL Logging, which is unacceptable from our Information Security team's point of view. Your ticket is marked "resolved" but the workaround isn't satisfactory, and in the meantime the many issues in our JIRA instance that contain valid dollar signs aren't editable at all. Please help us get some sort of resolution in place ASAP.

            Dan Moran added a comment - We recently turned on SQL Logging on our JIRA server, based on a security requirement from our Information Security team. However, as documented in this ticket, issues with a "$" in them cannot be created or edited while SQL Logging is turned on. The ticket states that the workaround is to turn off SQL Logging, which is unacceptable from our Information Security team's point of view. Your ticket is marked "resolved" but the workaround isn't satisfactory, and in the meantime the many issues in our JIRA instance that contain valid dollar signs aren't editable at all. Please help us get some sort of resolution in place ASAP.

            This made my day!
            If this option is enabled prevents Jquery execution because '$' usage
            So, i disable it and I can happily work with JQuery
            Jira Version: 6.2.1

            Thanks

            Eilyn Peña added a comment - This made my day! If this option is enabled prevents Jquery execution because '$' usage So, i disable it and I can happily work with JQuery Jira Version: 6.2.1 Thanks

              ohernandez@atlassian.com Oswaldo Hernandez (Inactive)
              pborkowski Przemyslaw Borkowski (Inactive)
              Affected customers:
              0 This affects my team
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: