Logon issue : can't log in twice ! (MySQL problem ?)

15 views
Skip to first unread message

vankeisb

unread,
Aug 9, 2006, 10:11:15 AM8/9/06
to jmatter-dev
Hi all,

First, off, congrats for your work Eitan & al, this framework is
something I've been dreaming of since years ;-P

OK, nothing's perfect, so I found a bug directly...

I've tried it with several examples and the problem is always there :
1/ I cd into the app folder
2/ I create the db in mysql (create database contactmgr)
3/ I generate, compile and launch the app (and run)
4/ I log in as admin,admin
5/ I close the app
6/ I try to log in again as admin
7/ I get a StringIndexOutOfBounds exception in the console (see stack
trace at the end of the email) :-/

Apparently, the admin user is created at first app launch, and then
everything works fine (or almost - I wasn't able to set genres in the
mytunes example). I can create new users and any other type of
entities, browse them etc.

At second login, something goes wrong, and none of the previously
created credentials work.

I've reproduced the bug with MySQL 5.0.16-nt (under windows, with
jdk1.5.0_06-b05) and 5.0.18 (under linux, with 1.5.0_06-b05 as well).

I've just finished downloading the jmatter sources to investigate this
on my side, since I (or more exactly Google) did not find an answer to
my problem.

Has anyone ran into similar problems ? Is this related to MySQL ? I'd
be glad if someone could save me a few useless hours spent in that... I
feel it's something minor, and I'm frustrated : I want to MODEL and
test JMatter...

BTW, should I report this into JMatter's bug report system (trac) ?

Thanks for any help.

Have fun,

Remi

vankeisb

unread,
Aug 9, 2006, 10:13:30 AM8/9/06
to jmatter-dev
ooops, forgot the stack trace :

vankeisb@everest:~/java/jmatter/demo-apps/ContactMgr> ant run
Buildfile: build.xml

init:

compile:

bind:

genhbm:

run:
[java] INFO: time to build session factory and open session:
2845(ms)
[java] Exception in thread "Thread-1"
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
[java] at java.lang.String.charAt(String.java:558)
[java] at
org.hibernate.type.CharacterType.get(CharacterType.java:29)
[java] at
org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
[java] at
com.u2d.persist.type.CharEOUserType.nullSafeGet(CharEOUserType.java:24)
[java] at
org.hibernate.type.CustomType.nullSafeGet(CustomType.java:104)
[java] at
org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
[java] at
org.hibernate.type.ComponentType.hydrate(ComponentType.java:506)
[java] at
org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1899)
[java] at
org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1372)
[java] at
org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1300)
[java] at org.hibernate.loader.Loader.getRow(Loader.java:1197)
[java] at
org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:569)
[java] at org.hibernate.loader.Loader.doQuery(Loader.java:689)
[java] at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
[java] at org.hibernate.loader.Loader.doList(Loader.java:2145)
[java] at
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
[java] at org.hibernate.loader.Loader.list(Loader.java:2024)
[java] at
org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
[java] at
org.hibernate.impl.SessionImpl.list(SessionImpl.java:1533)
[java] at
org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
[java] at
org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305)
[java] at
com.u2d.app.Application.setupUser(Application.java:256)
[java] at
com.u2d.app.ApplicationContext$AuthMap_Default$AuthMap_LoggedOutState.onLogin(ApplicationContext.java:216)
[java] at
com.u2d.app.ApplicationContext.onLogin(ApplicationContext.java:28)
[java] at
com.u2d.app.Application.onLogin(Application.java:361)
[java] at
com.u2d.view.swing.LoginDialog$2$1.run(LoginDialog.java:118)

Eitan Suez

unread,
Aug 9, 2006, 7:22:11 PM8/9/06
to jmatt...@googlegroups.com
Hi Remi,

  if you can do this for me:

    assuming you have the source distribution of jmatter..
    ..diff com.u2d.persist.type.CharEOUserType.java
    with the latest version in svn.

  i believe i've come across and fixed this issue a few weeks
  ago while testing mysql but may not have made a new release
  since then.

  i will try to put out a new release soon.

thanks, eitan

vankeisb

unread,
Aug 10, 2006, 4:19:37 AM8/10/06
to jmatter-dev
Hiya Eitan,

On 8/10/06, Eitan Suez <eitan...@gmail.com> wrote:
> assuming you have the source distribution of jmatter..

I have just dowloaded jmatter-src-20060627.tgz from jmatter.org

> ..diff com.u2d.persist.type.CharEOUserType.java
> with the latest version in svn.

He he, yep there's something I think you're right :

diff SVN-version TGZ-version :
7,9d6
< import java.util.logging.Logger;
< import java.util.logging.Level;
<
27,36c24,25
< String checkValue = rs.getString(names[0]);
< if (checkValue.length() == 0) // this condition turns out to
be true with MySQL..
< {
< return new CharEO();
< }
< else
< {
< Character value = (Character)
Hibernate.CHARACTER.nullSafeGet(rs, names[0]);
< return (value==null) ? null : new CharEO(value.charValue());
< }
---
> Character value = (Character) Hibernate.CHARACTER.nullSafeGet(rs, names[0]);
> return (value==null) ? null : new CharEO(value.charValue());

> i believe i've come across and fixed this issue a few weeks
> ago while testing mysql but may not have made a new release
> since then.

Okay, thanks a lot. Do you recommend using the SVN version maybe ? Is
it stable enough so that a newbie like me can use it ?

Anyway thanks for your help, and CONGRATS for this great piece of a
framework ! That's just amazing :-)

Have fun,

Remi

eitan

unread,
Aug 10, 2006, 10:30:27 AM8/10/06
to jmatter-dev
hi Remi,

> Do you recommend using the SVN version maybe ? Is
> it stable enough so that a newbie like me can use it ?

at the moment it is.
i typically commit to svn at stable points but it's no guarantee.
i want to say yes. but if you just want that one fix, you can simply
replace that one file in the distribution.

one area where jmatter is somewhat weak is in having a
strong suite of tests, so i can answer that question reliably.

i will put together a new distribution today or tomorrow.

thanks, eitan

Reply all
Reply to author
Forward
0 new messages