Bug 1110278 - RHQ_EVENT tables detail field limit of 4000 character will break when using international character sets
Summary: RHQ_EVENT tables detail field limit of 4000 character will break when using i...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Database
Version: 4.12
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: GA
: RHQ 4.12
Assignee: Jay Shaughnessy
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On: 1110277
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-17 11:12 UTC by Tom Fonteyne
Modified: 2014-12-15 11:35 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1110277
Environment:
Last Closed: 2014-12-15 11:35:48 UTC
Embargoed:


Attachments (Terms of Use)

Description Tom Fonteyne 2014-06-17 11:12:14 UTC
+++ This bug was initially created as a clone of Bug #1110277 +++

JON 3.1.2 and JON 3.2.0

org/​ rhq/​ core/​ domain/​ event/​ Event.java

126     @Column(name = "DETAIL", length = 4000, nullable = false)
127     private String detail;

so the detail string is trimming the text to 4000 UTF8 characters.


org/​ rhq/​ enterprise/​ server/​ event/​ EventManagerBean.java 

is responsible to insert the event into the database:

112     public void addEventData(Map<EventSource, Set<Event>> events) {
...
167             // Then insert the "values" (i.e. the Events).
168             ps = conn.prepareStatement(statementSql);
169             try {
170                 for (EventSource eventSource : events.keySet()) {
171                     Set<Event> eventData = events.get(eventSource);
172                     for (Event event : eventData) {
....
181                         ps.setString(paramIndex++, event.getDetail());

However, then the database (oracle in our case) has not been setup to use UTF-8, but only a standard 8-bit character set then trying to insert a "detail" which has international (e.g. 16 bit) characters in it will break the 4000 limit with:

ORA-01461: can bind a LONG value only for insert into a LONG column

because the number of bytes form the "detail" will be bigger then 4000.

Solution:

- make the database being UTF-8 a requirement (JON installer to check)

or modify the above code:

  byte[] detailBytes = event.getDetail().getBytes();
  ps.setBytes(paramIndex++,Arrays.copyOf(detailBytes, 4000));

Comment 1 Jay Shaughnessy 2014-07-10 13:23:19 UTC
MASTER commit 1d836a790f8e8d2da79a31e8c796324e85ae7851

Setting to VERIFIED since the clone was verified with a master build.

Comment 2 Heiko W. Rupp 2014-12-15 11:35:48 UTC
Bulk close of items fixed in RHQ 4.12

If you think this is not solved, then please open a *new* BZ and link to this one.


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