Bug 476730 - need to field check custom errata creation
Summary: need to field check custom errata creation
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: WebUI
Version: 0.4
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: ---
Assignee: Jesus M. Rodriguez
QA Contact: wes hayutin
URL: https://rlx-0-14.rhndev.redhat.com/rh...
Whiteboard:
Depends On:
Blocks: space04
TreeView+ depends on / blocked
 
Reported: 2008-12-16 19:57 UTC by wes hayutin
Modified: 2009-01-22 16:31 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-01-22 16:31:16 UTC
Embargoed:


Attachments (Terms of Use)

Description wes hayutin 2008-12-16 19:57:53 UTC
Description of problem:

I'm entering in a name that is too long and I'm getting an ISE

recreate:
1. go to errata, manage errata, create custom errata
2. enter names and entries longer than 32 characters..

get 
2008-12-16 14:40:01,548 [TP-Processor1] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with 
session
org.hibernate.exception.GenericJDBCException: could not insert: [com.redhat.rhn.domain.errata.impl.UnpublishedErrata]
        at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2267)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2660)
        at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:56)
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
        at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
        at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
        at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
        at com.redhat.rhn.common.hibernate.ConnectionManager.commitTransaction(ConnectionManager.java:201)
        at com.redhat.rhn.common.hibernate.HibernateFactory.commitTransaction(HibernateFactory.java:274)
        at com.redhat.rhn.frontend.servlets.SessionFilter.doFilter(SessionFilter.java:56)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at com.redhat.rhn.frontend.servlets.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:97)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
        at java.lang.Thread.run(Thread.java:636)
Caused by: java.sql.SQLException: ORA-12899: value too large for column "SPACEWALK"."RHNERRATATMP"."ADVISORY" (actual: 34, maximum: 32)

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
        at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
        at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
        at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3368)
        at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:1986)
        at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2247)
        ... 31 more


j

Comment 1 Jesus M. Rodriguez 2009-01-09 22:32:59 UTC
Diagnosis
-----------
rhnErrata(Tmp) tables have the following definition:

 Name					   Null?    Type
 ----------------------------------------- -------- ----------------------------
 ADVISORY				   NOT NULL VARCHAR2(32)
 ADVISORY_TYPE				   NOT NULL VARCHAR2(32)
 ADVISORY_NAME				   NOT NULL VARCHAR2(32)
 ADVISORY_REL				   NOT NULL NUMBER

ADVISORY is actually the concatenation of ADVISORY_NAME and ADVISORY_REL seperated by a hyphen(-). For example, if ADVISORY_NAME were 'HELLO MY DARLING'
and ADVISORY_REL were 9999, ADVISORY would be assigned the value:
'HELLO MY DARLING-9999'

This 32 character limit is only a problem for customer errata where the 
user is able to enter anything for ADVISORY_NAME. Official and cloned errata
have a defined structure which is less than 32 characters for the ADVISORY.
That is ADVISORY_NAME is of the format RHXX-YYYY:ZZZZZ and the ADVISORY_REL
is limited to 9999. Therefore, the maximum ADVISORY length would be 20.

Comment 2 Jesus M. Rodriguez 2009-01-09 22:38:05 UTC
one approach is to increase the ADVISORY column to be 37 which is 32 + 1 (hyphen) + 4 (digits of ADVISORY_REL). Not ideal, IMO.

Another approach is to shorten the ADVISORY_NAME column to be 27 that is account
for the maximum 5 extra spaces needed for ADVISORY_REL with a value of 9999.
Again not ideal.

I'd like to enforce this in the UI layer, if the user enters a maximum value
of 32 characters for the ADVISORY_NAME and 4 digits for ADVISORY_REL, a message
is posted to the user explaining that the total number of characters for
ADVISORY_NAME and ADVISORY_REL can not exceed 32 characters. This gives them
the chance to edit their values accordingly.

Comment 3 Clifford Perry 2009-01-11 22:46:12 UTC
Thinking of regressions for upgrades. Decrease in Advisory is not ideal, same could be same for Advisory_name, though in theory a customer could never have entered anything above 30 - <name-up-to-30>-X. Humm - we also have to consider that Satellite would consume any code change. RHN Hosted is the source for Errata for Satellite - we have to ensure any changes we make to schema will always be compatible with Red Hat Errata in future that we sync. So - maybe:

Advisory_name - 32
Advisory_rel - number - app and api code enforce 4 to be entered. 
Advisory - 37 (increase)

We also do enforce for creation of custom errata. 

There is also a chance that in the future we want 5 digit Errata numbers, we once only did 3 digit only. 

Cliff

Comment 4 Jesus M. Rodriguez 2009-01-12 21:04:11 UTC
83317b2a0e275a2a06b870c305bee94f7f353cb7 - increases advisory column to 37
35d62eb0f2f7ba0efe2cd376e135db1025f4d8e6 - ensure we validate the content from ui and api.

Comment 5 Jesus M. Rodriguez 2009-01-15 03:19:36 UTC
Entered the following values:

advisory (name): abcd:efgh:ijkl:mnop:qrst:uvwx:yz
advisory release: 9999

Resulted in Advisory of abcd:efgh:ijkl:mnop:qrst:uvwx:yz-9999
Which is greater than the 32 columns from the bug.


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