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

Incorrect behavior of Number custom field

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Low
    • None
    • 7.1.4
    • Issue - Fields

    Description

      Summary

      A Number custom field in JIRA has type Numeric(18,6) in table customfieldvalue in the database (MS SQL). That means, it supports a maximum of 18 digits only, 12 before and 6 after the decimal point e.g. 111222333444.555666

      However, when trying to enter a very big value e.g. 111222333444555666777888999, the field says it supports the maximum value of 100000000000000, which is 15 digits before the decimal point.

      This is incorrect, as it exceeds the number of digits before the decimal point and there will be not enough space for the decimal digits. And the fact is, the field doesn't accept a number which has more than 12 digits before the decimal point.

      Steps to reproduce

      1. create a Number custom field
      2. create an issue and enter the following value for the field: 111222333444555666777888999
      3. the field will say the maximum value allowed is 100000000000000
      4. now enter a different value with more than 12 and less than 15 digits before the decimal point e.g. 1000000000000 (13 digits)
      5. click Create

      Expected behavior

      1. JIRA should accept the value as it's less than the maximum value allowed
      2. The issue should be created with the Number value and indexed normally

      Actual behavior

      1. JIRA throws an error:
      2. The following error is seen in JIRA_Home/log/atlassian-jira.log:
        2016-04-29 03:01:20,269 http-nio-8714-exec-17 ERROR admin 181x2025x1 54hyjn 0:0:0:0:0:0:0:1 /secure/QuickCreateIssue.jspa [c.a.j.bc.issue.DefaultIssueService] Error creating issue: 
        com.atlassian.jira.exception.CreateException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:CustomFieldValue][parentkey,null][customfield,10101][issue,10039][id,10042][numbervalue,1.0E12] (SQL Exception while executing the following:INSERT INTO dbo.customfieldvalue (ID, ISSUE, CUSTOMFIELD, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) (Data truncation))
        	at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:588)
        	at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:494)
        	at com.atlassian.jira.bc.issue.DefaultIssueService.create(DefaultIssueService.java:230)
        	at com.atlassian.jira.bc.issue.DefaultIssueService.create(DefaultIssueService.java:199)
        	at sun.reflect.GeneratedMethodAccessor1330.invoke(Unknown Source)
        	... 1 filtered
        ...
        Caused by: java.sql.DataTruncation: Data truncation
        	at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:386)
        	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
        	at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671)
        	at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:613)
        	at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:572)
        	at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeUpdate(JtdsPreparedStatement.java:727)
        	at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98)
        	at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:98)
        	at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:673)
        	... 259 more
        
      3. The issue is still created in JIRA without the Number value - this can be seen from the database:

        in my test, 39 issues are created but only 15 Number values are accepted
      4. However, the created issue is not indexed, so it's invisible from Issue Navigator and users might think it's not created at all:

        only the issues whose Number value is accepted are indexed

      Notes

      1. Re-indexing JIRA will make all the issues visible in Issue Navigator
      2. Only values up to 999999999999.999938 (12 digits before the decimal point) will be accepted and rounded up to 100000000000000 (13 digits), like the issue TEST-37 in index.png. It's however stored as 999999999999.999880 (12 digits before the decimal point) in the database like in database.png.
      3. More than 6 decimal digits can be accepted (which is expected as they can be rounded)

      Suggestion

      1. The warning message about the maximum value allowed must be correct
      2. Values should be displayed exactly the same as they're stored in the database

      Attachments

        1. create.png
          create.png
          9 kB
        2. database.png
          database.png
          48 kB
        3. index.png
          index.png
          17 kB
        4. number.png
          number.png
          7 kB

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vdung Andy Nguyen (Inactive)
              Votes:
              10 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated: