Bug 736836 - config editor: simple props of type LONG with large values are displayed in scientific notation and flagged as invalid by field validator
Summary: config editor: simple props of type LONG with large values are displayed in s...
Alias: None
Product: RHQ Project
Classification: Other
Component: Core UI
Version: 4.1
Hardware: Unspecified
OS: Unspecified
high vote
Target Milestone: ---
: ---
Assignee: Ian Springer
QA Contact: Mike Foley
Depends On:
Blocks: rhq42
TreeView+ depends on / blocked
Reported: 2011-09-08 19:54 UTC by Ian Springer
Modified: 2013-08-06 00:40 UTC (History)
2 users (show)

Fixed In Version: 4.2
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed:

Attachments (Terms of Use)
screenshot (182.42 KB, image/png)
2011-09-08 19:55 UTC, Ian Springer
no flags Details
property not sticking (82.91 KB, image/png)
2011-10-24 20:57 UTC, Mike Foley
no flags Details

Description Ian Springer 2011-09-08 19:54:45 UTC
The prop of type LONG has the value "55555555555555555555555" but is displayed in the config editor as "5.5555555555555555e+22". In addition, the field has a "Must be a whole number." validation error. The validation error forces the user to change the prop's value in order to be able to save the config.

A screenshot is attached.

Comment 1 Ian Springer 2011-09-08 19:55:37 UTC
Created attachment 522192 [details]

Comment 2 Charles Crouch 2011-09-22 12:48:50 UTC
Test that the field can actually be updated at all

Comment 3 Ian Springer 2011-10-21 21:52:15 UTC
[master 33bd17b] fixes this. We now use TextItem+IsLongValidator, rather than IntegerItem+IsIntegerValidator for LONG props. IsLongValidator is a new custom validator that is able to validate longs that are represented as strings (using regular expression matching and other string operations).

The 'Long' prop on the #Test/Configuration/ConfigEditor page can be used to test the new long validation, but it should also be tested on some real Resource or plugin configuration containing one or more LONG props to make sure loading and saving work correctly.

Comment 4 Mike Foley 2011-10-24 20:57:43 UTC
Created attachment 529966 [details]
property not sticking

Comment 5 Mike Foley 2011-10-24 20:58:48 UTC
ian ... can you look at this again?  i am seeing issues with the value i enter not 'sticking'.  also, the 'save' button is not becoming enabled for me sometimes.

Comment 6 Mike Foley 2011-10-24 20:59:22 UTC
in the attached image, i am trying to update 'Server Discovery Period'

Comment 7 Ian Springer 2011-10-25 20:22:21 UTC
'Server Discovery Period' is an INTEGER property, not a LONG property. You'll need to test this fix by editing a LONG property. It's hard to distinguish an INTEGER prop from a LONG prop just by looking at the config editor in the GUI. The best way to find LONG props is to grep for them in Agent plugin descriptors.

                <c:simple-property name="foo" type="long" required="false"
                         description="a LONG prop"/>

For example, the Datasource Resource type in the jboss-as-7 plugin defines quite a few LONG props:

                <c:simple-property name="prepared-statements-cacheSize" type="long" readOnly="true" required="false"
                         description="The number of prepared statements per connection in an LRU cache"/>
                <c:simple-property name="share-prepared-statements" type="boolean" readOnly="true" required="false"
                         description="Whether to share prepare statements, i.e. whether asking for same statement twice without closing uses the same underlying prepared statement"/>
                <c:simple-property name="track-statements" type="string" readOnly="true" required="false"
                         description="Whether to check for unclosed statements when a connection is returned to the pool and result sets are closed when a statement is closed/return to the prepared statement cache. valid values are: false - do not track statements and results true - track statements and result sets and warn when they are not closed nowarn - track statements but do no warn about them being unclosed"/>
                <c:simple-property name="allocation-retry" type="integer" readOnly="true" required="false"
                         description="The allocation retry element indicates the number of times that allocating a connection should be tried before throwing an exception."/>
                <c:simple-property name="allocation-retry-wait-millis" type="long" readOnly="true" required="false"
                         description="Indicates the time in milliseconds to wait between retrying to allocate a connection."/>
                <c:simple-property name="blocking-timeout-wait-millis" type="long" readOnly="false" required="false"
                         description="The blocking-timeout-millis element indicates the maximum time in milliseconds to block while waiting for a connection before throwing an exception. Note that this blocks only while waiting for a permit for a connection, and will never throw an exception if creating a new connection takes an inordinately long time."/>
                <c:simple-property name="idle-timeout-minutes" type="long" readOnly="false" required="false"
                         description="The idle-timeout-minutes elements indicates the maximum time in minutes a connection may be idle before being closed. The actual maximum time depends also on the IdleRemover scan time, which is 1/2 the smallest idle-timeout-minutes of any pool. Changing this value require a server restart."/>
                <c:simple-property name="query-timeout" type="long" readOnly="true" required="false"
                         description="Any configured query timeout in seconds The default is no timeout"/>
                <c:simple-property name="use-try-lock" type="long" readOnly="true" required="false"
                         description="Any configured timeout for internal locks on the resource adapter objects in seconds"/>
                <c:simple-property name="set-tx-query-timeout" type="boolean" readOnly="true" required="false"
                         description="Whether to set the query timeout based on the time remaining until transaction timeout, any configured query timeout will be used if there is no transaction."/>
                <c:simple-property name="transaction-isolation" type="string" readOnly="true" required="false"
                         description="Set java.sql.Connection transaction isolation level to use. The constants defined by transaction-isolation-values are the possible transaction isolation levels and include: TRANSACTION_READ_UNCOMMITTED TRANSACTION_READ_COMMITTED TRANSACTION_REPEATABLE_READ TRANSACTION_SERIALIZABLE TRANSACTION_NONE"/>
                <c:simple-property name="check-valid-connection-sql" type="string" readOnly="true" required="false"
                         description="Specify an SQL statement to check validity of a pool connection. This may be called when managed connection is taken from pool for use."/>
                <c:simple-property name="exception-sorter-class-name" type="string" readOnly="true" required="false"
                         description="An org.jboss.jca.adapters.jdbc.ExceptionSorter that provides a boolean isExceptionFatal(SQLException e) method to validate is an exception should be broadcast to all javax.resource.spi.ConnectionEventListener as a connectionErrorOccurred"/>
                <c:simple-property name="stale-connection-checker-class-name" type="string" readOnly="true" required="false"
                         description="An org.jboss.jca.adapters.jdbc.StaleConnectionChecker that provides a boolean isStaleConnection(SQLException e) method which if it it returns true will wrap the exception in an org.jboss.jca.adapters.jdbc.StaleConnectionException"/>
                <c:simple-property name="valid-connection-checker-class-name" type="string" readOnly="true" required="false"
                         description="An org.jboss.jca.adapters.jdbc.ValidConnectionChecker that provides a SQLException isValidConnection(Connection e) method to validate is a connection is valid. An exception means the connection is destroyed. This overrides the check-valid-connection-sql when present."/>
                <c:simple-property name="background-validation-minutes" type="long" readOnly="false" required="false"
                         description="The background-validation-minutes element specifies the amount of time, in minutes, that background validation will run. Changing this value require a server restart."/>
                <c:simple-property name="background-validation" type="boolean" readOnly="false" required="false"
                         description="An element to specify that connections should be validated on a background thread versus being validated prior to use. Changing this value require a server restart."/>
                <c:simple-property name="use-fast-fail" type="boolean" readOnly="false" required="false"
                         description="Whether fail a connection allocation on the first connection if it is invalid (true) or keep trying until the pool is exhausted of all potential connections (false)"/>
                <c:simple-property name="validate-on-match" type="boolean" readOnly="true" required="false"
                         description="The validate-on-match element indicates whether or not connection level validation should be done when a connection factory attempts to match a managed connection for a given set. This is typically exclusive to the use of background validation"/>
                <c:simple-property name="spy" type="boolean" readOnly="true" required="false"
                         description="whatever spy or not the jdbc connection"/>
                <c:simple-property name="use-ccm" type="boolean" readOnly="true" required="false" description="Enable the use of a cached connection manager"/>

The issue with values of INTEGER properties not sticking is a regression caused by my recent switch to using spinner items for INTEGER props. Spinner items aren't working because the SmartGWT spinner item widget has a bug where it does not fire events when the spinner item's value changes. [master 9181a2e] (http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=9181a2e) switches back to using IntegerItems, rather than SpinnerItems, for INTEGER props, which should fix this regression. We can switch back to using SpinnerItems once SmartGWT fixes the bug.

Comment 8 Ian Springer 2011-10-25 21:06:21 UTC
I've reported the SpinnerItem bug on the SmartGWT forum: http://forums.smartclient.com/showthread.php?p=75158

Comment 9 Mike Foley 2011-10-26 14:53:35 UTC
10/26/2011 RHQ latest build ... i am still seeing INTEGER props not sticking.  i tested configuration of RHQ Agent resource ...the server discover period.  i set a value ... clicked Save ... went back and checked ... and the value did not stick.  ips ... please look at again?

Comment 10 Mike Foley 2011-10-26 17:44:10 UTC
previous comment based on testing with the rhq-agent down.  assigning back to ON_QA

Comment 11 Mike Foley 2011-10-26 18:02:27 UTC
verified INTEGERS.

verified LONGS ... specifically this one ... in the AS7 plugin.

 <c:simple-property name="blocking-timeout-wait-millis"
type="long" readOnly="false" required="false"
                         description="The blocking-timeout-millis element
indicates the maximum time in milliseconds to block while waiting for a
connection before throwing an exception. Note that this blocks only while
waiting for a permit for a connection, and will never throw an exception if
creating a new connection takes an inordinately long time."/>

Comment 12 Mike Foley 2012-02-07 19:31:46 UTC
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE

Comment 13 Mike Foley 2012-02-07 19:31:47 UTC

Note You need to log in before you can comment on or make changes to this bug.