You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
(387) |
May
(1066) |
Jun
(689) |
Jul
(504) |
Aug
(697) |
Sep
(660) |
Oct
(591) |
Nov
(393) |
Dec
(324) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(567) |
Feb
(448) |
Mar
(461) |
Apr
(368) |
May
(887) |
Jun
(243) |
Jul
(429) |
Aug
(670) |
Sep
(648) |
Oct
(684) |
Nov
(599) |
Dec
(317) |
2008 |
Jan
(388) |
Feb
(400) |
Mar
(323) |
Apr
(214) |
May
(228) |
Jun
(120) |
Jul
(168) |
Aug
(64) |
Sep
(78) |
Oct
(127) |
Nov
(28) |
Dec
|
2009 |
Jan
|
Feb
(1) |
Mar
(22) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:28
|
Update of /cvsroot/springframework/spring/src/org/springframework/remoting/rmi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/remoting/rmi Modified Files: Tag: mbranch-1-2 RmiClientInterceptorUtils.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: RmiClientInterceptorUtils.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/remoting/rmi/RmiClientInterceptorUtils.java,v retrieving revision 1.8 retrieving revision 1.8.4.1 diff -C2 -d -r1.8 -r1.8.4.1 *** RmiClientInterceptorUtils.java 17 Sep 2005 17:05:31 -0000 1.8 --- RmiClientInterceptorUtils.java 21 Apr 2006 00:13:49 -0000 1.8.4.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 30,34 **** import java.util.Arrays; - import org.aopalliance.aop.AspectException; import org.aopalliance.intercept.MethodInvocation; import org.apache.commons.logging.Log; --- 30,33 ---- *************** *** 37,40 **** --- 36,40 ---- import org.springframework.remoting.RemoteAccessException; import org.springframework.remoting.RemoteConnectFailureException; + import org.springframework.remoting.RemoteProxyFailureException; /** *************** *** 92,97 **** */ public static Object doInvoke(MethodInvocation invocation, Remote stub) throws InvocationTargetException { try { - Method method = invocation.getMethod(); if (method.getDeclaringClass().isInstance(stub)) { // directly implemented --- 92,97 ---- */ public static Object doInvoke(MethodInvocation invocation, Remote stub) throws InvocationTargetException { + Method method = invocation.getMethod(); try { if (method.getDeclaringClass().isInstance(stub)) { // directly implemented *************** *** 107,112 **** throw ex; } catch (Throwable ex) { ! throw new AspectException("Local remote service proxy invocation failed", ex); } } --- 107,115 ---- throw ex; } + catch (NoSuchMethodException ex) { + throw new RemoteProxyFailureException("No matching RMI stub method found for: " + method, ex); + } catch (Throwable ex) { ! throw new RemoteProxyFailureException("Invocation of RMI stub method failed: " + method, ex); } } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:28
|
Update of /cvsroot/springframework/spring/src/org/springframework/transaction/interceptor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/transaction/interceptor Modified Files: Tag: mbranch-1-2 TransactionAspectSupport.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: TransactionAspectSupport.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/transaction/interceptor/TransactionAspectSupport.java,v retrieving revision 1.18 retrieving revision 1.18.2.1 diff -C2 -d -r1.18 -r1.18.2.1 *** TransactionAspectSupport.java 7 Nov 2005 20:34:06 -0000 1.18 --- TransactionAspectSupport.java 21 Apr 2006 00:13:50 -0000 1.18.2.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 63,73 **** /** ! * Holder to support the currentTransactionStatus() method, and communication ! * between different cooperating advices (e.g. before and after advice) ! * if the aspect involves more than a single method (as will be the case for ! * around advice). */ private static ThreadLocal currentTransactionInfo = new ThreadLocal(); /** * Return the transaction status of the current method invocation. --- 63,74 ---- /** ! * Holder to support the <code>currentTransactionStatus()</code> method, ! * and to support communication between different cooperating advices ! * (e.g. before and after advice) if the aspect involves more than a ! * single method (as will be the case for around advice). */ private static ThreadLocal currentTransactionInfo = new ThreadLocal(); + /** * Return the transaction status of the current method invocation. *************** *** 294,304 **** } else { ! // we don't roll back on this exception if (logger.isDebugEnabled()) { logger.debug(txInfo.joinpointIdentification() + " threw throwable [" + ex + "] but this does not force transaction rollback"); } ! // will still roll back if TransactionStatus.rollbackOnly is true ! this.transactionManager.commit(txInfo.getTransactionStatus()); } } --- 295,315 ---- } else { ! // We don't roll back on this exception. if (logger.isDebugEnabled()) { logger.debug(txInfo.joinpointIdentification() + " threw throwable [" + ex + "] but this does not force transaction rollback"); } ! // Will still roll back if TransactionStatus.isRollbackOnly() is true. ! try { ! this.transactionManager.commit(txInfo.getTransactionStatus()); ! } ! catch (RuntimeException ex2) { ! logger.error("Application exception overridden by commit exception", ex); ! throw ex2; ! } ! catch (Error err) { ! logger.error("Application exception overridden by commit error", ex); ! throw err; ! } } } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:28
|
Update of /cvsroot/springframework/spring/src/org/springframework/scheduling/timer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/scheduling/timer Modified Files: Tag: mbranch-1-2 TimerFactoryBean.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: TimerFactoryBean.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/scheduling/timer/TimerFactoryBean.java,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** TimerFactoryBean.java 13 Oct 2005 21:13:33 -0000 1.11 --- TimerFactoryBean.java 21 Apr 2006 00:13:49 -0000 1.11.2.1 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 83,104 **** this.timer = createTimer(this.daemon); ! // register all ScheduledTimerTasks ! for (int i = 0; i < this.scheduledTimerTasks.length; i++) { ! ScheduledTimerTask scheduledTask = this.scheduledTimerTasks[i]; ! if (scheduledTask.getPeriod() > 0) { ! // repeated task execution ! if (scheduledTask.isFixedRate()) { ! this.timer.scheduleAtFixedRate( ! scheduledTask.getTimerTask(), scheduledTask.getDelay(), scheduledTask.getPeriod()); } else { ! this.timer.schedule( ! scheduledTask.getTimerTask(), scheduledTask.getDelay(), scheduledTask.getPeriod()); } } - else { - // one-time task execution - this.timer.schedule(scheduledTask.getTimerTask(), scheduledTask.getDelay()); - } } } --- 83,106 ---- this.timer = createTimer(this.daemon); ! // Register all ScheduledTimerTasks. ! if (this.scheduledTimerTasks != null) { ! for (int i = 0; i < this.scheduledTimerTasks.length; i++) { ! ScheduledTimerTask scheduledTask = this.scheduledTimerTasks[i]; ! if (scheduledTask.getPeriod() > 0) { ! // repeated task execution ! if (scheduledTask.isFixedRate()) { ! this.timer.scheduleAtFixedRate( ! scheduledTask.getTimerTask(), scheduledTask.getDelay(), scheduledTask.getPeriod()); ! } ! else { ! this.timer.schedule( ! scheduledTask.getTimerTask(), scheduledTask.getDelay(), scheduledTask.getPeriod()); ! } } else { ! // One-time task execution. ! this.timer.schedule(scheduledTask.getTimerTask(), scheduledTask.getDelay()); } } } } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:25
|
Update of /cvsroot/springframework/spring/src/org/springframework/orm/hibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/orm/hibernate Modified Files: Tag: mbranch-1-2 LocalSessionFactoryBean.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: LocalSessionFactoryBean.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/orm/hibernate/LocalSessionFactoryBean.java,v retrieving revision 1.36.4.3 retrieving revision 1.36.4.4 diff -C2 -d -r1.36.4.3 -r1.36.4.4 *** LocalSessionFactoryBean.java 23 Feb 2006 22:37:05 -0000 1.36.4.3 --- LocalSessionFactoryBean.java 21 Apr 2006 00:13:49 -0000 1.36.4.4 *************** *** 605,609 **** public Object doInHibernate(Session session) throws HibernateException, SQLException { Connection con = session.connection(); ! final Dialect dialect = Dialect.getDialect(configuration.getProperties()); String[] sql = configuration.generateSchemaCreationScript(dialect); executeSchemaScript(con, sql); --- 605,609 ---- public Object doInHibernate(Session session) throws HibernateException, SQLException { Connection con = session.connection(); ! Dialect dialect = Dialect.getDialect(configuration.getProperties()); String[] sql = configuration.generateSchemaCreationScript(dialect); executeSchemaScript(con, sql); *************** *** 624,633 **** * <p>Uses the SessionFactory that this bean generates for accessing a JDBC * connection to perform the script. ! * @throws HibernateException in case of Hibernate initialization errors * @see #setSchemaUpdate * @see net.sf.hibernate.cfg.Configuration#generateSchemaUpdateScript * @see net.sf.hibernate.tool.hbm2ddl.SchemaUpdate */ ! public void updateDatabaseSchema() throws HibernateException { logger.info("Updating database schema for Hibernate SessionFactory"); HibernateTemplate hibernateTemplate = new HibernateTemplate(this.sessionFactory); --- 624,633 ---- * <p>Uses the SessionFactory that this bean generates for accessing a JDBC * connection to perform the script. ! * @throws DataAccessException in case of script execution errors * @see #setSchemaUpdate * @see net.sf.hibernate.cfg.Configuration#generateSchemaUpdateScript * @see net.sf.hibernate.tool.hbm2ddl.SchemaUpdate */ ! public void updateDatabaseSchema() throws DataAccessException { logger.info("Updating database schema for Hibernate SessionFactory"); HibernateTemplate hibernateTemplate = new HibernateTemplate(this.sessionFactory); *************** *** 637,641 **** public Object doInHibernate(Session session) throws HibernateException, SQLException { Connection con = session.connection(); ! final Dialect dialect = Dialect.getDialect(configuration.getProperties()); DatabaseMetadata metadata = new DatabaseMetadata(con, dialect); String[] sql = configuration.generateSchemaUpdateScript(dialect, metadata); --- 637,641 ---- public Object doInHibernate(Session session) throws HibernateException, SQLException { Connection con = session.connection(); ! Dialect dialect = Dialect.getDialect(configuration.getProperties()); DatabaseMetadata metadata = new DatabaseMetadata(con, dialect); String[] sql = configuration.generateSchemaUpdateScript(dialect, metadata); |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:25
|
Update of /cvsroot/springframework/spring/src/org/springframework/orm/hibernate3/support In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/orm/hibernate3/support Modified Files: Tag: mbranch-1-2 BlobStringType.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: BlobStringType.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/orm/hibernate3/support/BlobStringType.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** BlobStringType.java 9 Jan 2006 22:46:03 -0000 1.1.2.2 --- BlobStringType.java 21 Apr 2006 00:13:49 -0000 1.1.2.3 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 80,85 **** byte[] bytes = lobHandler.getBlobAsBytes(rs, names[0]); ! String encoding = getCharacterEncoding(); ! return (encoding != null ? new String(bytes, encoding) : new String(bytes)); } --- 80,90 ---- byte[] bytes = lobHandler.getBlobAsBytes(rs, names[0]); ! if (bytes != null) { ! String encoding = getCharacterEncoding(); ! return (encoding != null ? new String(bytes, encoding) : new String(bytes)); ! } ! else { ! return null; ! } } *************** *** 88,95 **** throws SQLException, UnsupportedEncodingException { ! String str = (String) value; ! String encoding = getCharacterEncoding(); ! byte[] bytes = (encoding != null ? str.getBytes(encoding) : str.getBytes()); ! lobCreator.setBlobAsBytes(ps, index, bytes); } --- 93,105 ---- throws SQLException, UnsupportedEncodingException { ! if (value != null) { ! String str = (String) value; ! String encoding = getCharacterEncoding(); ! byte[] bytes = (encoding != null ? str.getBytes(encoding) : str.getBytes()); ! lobCreator.setBlobAsBytes(ps, index, bytes); ! } ! else { ! lobCreator.setBlobAsBytes(ps, index, null); ! } } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:25
|
Update of /cvsroot/springframework/spring/src/org/springframework/remoting/jaxrpc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/remoting/jaxrpc Modified Files: Tag: mbranch-1-2 JaxRpcPortClientInterceptor.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: JaxRpcPortClientInterceptor.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/remoting/jaxrpc/JaxRpcPortClientInterceptor.java,v retrieving revision 1.13.4.2 retrieving revision 1.13.4.3 diff -C2 -d -r1.13.4.2 -r1.13.4.3 *** JaxRpcPortClientInterceptor.java 17 Jan 2006 21:29:35 -0000 1.13.4.2 --- JaxRpcPortClientInterceptor.java 21 Apr 2006 00:13:49 -0000 1.13.4.3 *************** *** 5,11 **** * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 5,11 ---- * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 531,535 **** // Create JAX-RPC call object, using the method name as operation name. ! Call call = service.createCall(portQName, invocation.getMethod().getName()); // Apply properties to JAX-RPC stub. --- 531,539 ---- // Create JAX-RPC call object, using the method name as operation name. ! // Synchronized because of non-thread-safe Axis implementation! ! Call call = null; ! synchronized (service) { ! call = service.createCall(portQName, invocation.getMethod().getName()); ! } // Apply properties to JAX-RPC stub. |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:24
|
Update of /cvsroot/springframework/spring/src/org/springframework/jdbc/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/jdbc/core Modified Files: Tag: mbranch-1-2 JdbcTemplate.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: JdbcTemplate.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/core/JdbcTemplate.java,v retrieving revision 1.106.2.1 retrieving revision 1.106.2.2 diff -C2 -d -r1.106.2.1 -r1.106.2.2 *** JdbcTemplate.java 23 Dec 2005 13:50:11 -0000 1.106.2.1 --- JdbcTemplate.java 21 Apr 2006 00:13:48 -0000 1.106.2.2 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 518,522 **** * @throws DataAccessException if there is any problem */ ! protected Object query( PreparedStatementCreator psc, final PreparedStatementSetter pss, final ResultSetExtractor rse) throws DataAccessException { --- 518,522 ---- * @throws DataAccessException if there is any problem */ ! public Object query( PreparedStatementCreator psc, final PreparedStatementSetter pss, final ResultSetExtractor rse) throws DataAccessException { *************** *** 658,667 **** } ! public List queryForList(String sql, Object[] args, int[] argTypes, Class elementType) ! throws DataAccessException { return query(sql, args, argTypes, getSingleColumnRowMapper(elementType)); } ! public List queryForList(String sql, final Object[] args, Class elementType) throws DataAccessException { return query(sql, args, getSingleColumnRowMapper(elementType)); } --- 658,666 ---- } ! public List queryForList(String sql, Object[] args, int[] argTypes, Class elementType) throws DataAccessException { return query(sql, args, argTypes, getSingleColumnRowMapper(elementType)); } ! public List queryForList(String sql, Object[] args, Class elementType) throws DataAccessException { return query(sql, args, getSingleColumnRowMapper(elementType)); } *************** *** 671,683 **** } ! public List queryForList(String sql, final Object[] args) throws DataAccessException { return query(sql, args, getColumnMapRowMapper()); } ! public SqlRowSet queryForRowSet(String sql, final Object[] args, int[] argTypes) throws DataAccessException { return (SqlRowSet) query(sql, args, argTypes, new SqlRowSetResultSetExtractor()); } ! public SqlRowSet queryForRowSet(String sql, final Object[] args) throws DataAccessException { return (SqlRowSet) query(sql, args, new SqlRowSetResultSetExtractor()); } --- 670,682 ---- } ! public List queryForList(String sql, Object[] args) throws DataAccessException { return query(sql, args, getColumnMapRowMapper()); } ! public SqlRowSet queryForRowSet(String sql, Object[] args, int[] argTypes) throws DataAccessException { return (SqlRowSet) query(sql, args, argTypes, new SqlRowSetResultSetExtractor()); } ! public SqlRowSet queryForRowSet(String sql, Object[] args) throws DataAccessException { return (SqlRowSet) query(sql, args, new SqlRowSetResultSetExtractor()); } *************** *** 751,763 **** } ! public int update(String sql, final PreparedStatementSetter pss) throws DataAccessException { return update(new SimplePreparedStatementCreator(sql), pss); } ! public int update(String sql, final Object[] args, final int[] argTypes) throws DataAccessException { return update(sql, new ArgTypePreparedStatementSetter(args, argTypes)); } ! public int update(String sql, final Object[] args) throws DataAccessException { return update(sql, new ArgPreparedStatementSetter(args)); } --- 750,762 ---- } ! public int update(String sql, PreparedStatementSetter pss) throws DataAccessException { return update(new SimplePreparedStatementCreator(sql), pss); } ! public int update(String sql, Object[] args, int[] argTypes) throws DataAccessException { return update(sql, new ArgTypePreparedStatementSetter(args, argTypes)); } ! public int update(String sql, Object[] args) throws DataAccessException { return update(sql, new ArgPreparedStatementSetter(args)); } *************** *** 849,853 **** } ! public Object execute(final String callString, CallableStatementCallback action) throws DataAccessException { return execute(new SimpleCallableStatementCreator(callString), action); } --- 848,852 ---- } ! public Object execute(String callString, CallableStatementCallback action) throws DataAccessException { return execute(new SimpleCallableStatementCreator(callString), action); } *************** *** 1041,1045 **** if (isIgnoreWarnings()) { if (logger.isWarnEnabled()) { ! logger.warn("SQLWarning ignored: " + warning); } } --- 1040,1045 ---- if (isIgnoreWarnings()) { if (logger.isWarnEnabled()) { ! logger.warn("SQLWarning ignored: SQL state '" + warning.getSQLState() + "', error code '" + ! warning.getErrorCode() + "', message [" + warning.getMessage() + "]"); } } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:24
|
Update of /cvsroot/springframework/spring/src/org/springframework/beans/factory/support In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/beans/factory/support Modified Files: Tag: mbranch-1-2 AbstractBeanFactory.java DefaultListableBeanFactory.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: AbstractBeanFactory.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/beans/factory/support/AbstractBeanFactory.java,v retrieving revision 1.103.2.7 retrieving revision 1.103.2.8 diff -C2 -d -r1.103.2.7 -r1.103.2.8 *** AbstractBeanFactory.java 23 Feb 2006 22:55:02 -0000 1.103.2.7 --- AbstractBeanFactory.java 21 Apr 2006 00:13:48 -0000 1.103.2.8 *************** *** 262,272 **** public boolean containsBean(String name) { ! String beanName = transformedBeanName(name); ! synchronized (this.singletonCache) { ! if (this.singletonCache.containsKey(beanName)) { ! return true; ! } ! } ! if (containsBeanDefinition(beanName)) { return true; } --- 262,266 ---- public boolean containsBean(String name) { ! if (containsLocalBean(name)) { return true; } *************** *** 561,571 **** logger.info("Destroying singletons in factory {" + this + "}"); } - synchronized (this.disposableBeans) { - String[] disposableBeanName = StringUtils.toStringArray(this.disposableBeans.keySet()); - for (int i = 0; i < disposableBeanName.length; i++) { - destroyDisposableBean(disposableBeanName[i]); - } - } synchronized (this.singletonCache) { this.singletonCache.clear(); } --- 555,565 ---- logger.info("Destroying singletons in factory {" + this + "}"); } synchronized (this.singletonCache) { + synchronized (this.disposableBeans) { + String[] disposableBeanNames = StringUtils.toStringArray(this.disposableBeans.keySet()); + for (int i = 0; i < disposableBeanNames.length; i++) { + destroyDisposableBean(disposableBeanNames[i]); + } + } this.singletonCache.clear(); } *************** *** 854,877 **** public boolean isFactoryBean(String name) throws NoSuchBeanDefinitionException { String beanName = transformedBeanName(name); - Object beanInstance = null; synchronized (this.singletonCache) { ! beanInstance = this.singletonCache.get(beanName); } ! if (beanInstance != null) { ! return (beanInstance instanceof FactoryBean); } ! else { ! // No singleton instance found -> check bean definition. ! if (!containsBeanDefinition(beanName) && getParentBeanFactory() instanceof AbstractBeanFactory) { ! // No bean definition found in this factory -> delegate to parent. ! return ((AbstractBeanFactory) getParentBeanFactory()).isFactoryBean(name); ! } ! ! RootBeanDefinition bd = getMergedBeanDefinition(beanName, false); ! return (bd.hasBeanClass() && FactoryBean.class.equals(bd.getBeanClass())); ! } } --- 848,867 ---- public boolean isFactoryBean(String name) throws NoSuchBeanDefinitionException { String beanName = transformedBeanName(name); synchronized (this.singletonCache) { ! Object beanInstance = this.singletonCache.get(beanName); ! if (beanInstance != null) { ! return (beanInstance instanceof FactoryBean); ! } } ! // No singleton instance found -> check bean definition. ! if (!containsBeanDefinition(beanName) && getParentBeanFactory() instanceof AbstractBeanFactory) { ! // No bean definition found in this factory -> delegate to parent. ! return ((AbstractBeanFactory) getParentBeanFactory()).isFactoryBean(name); } ! RootBeanDefinition bd = getMergedBeanDefinition(beanName, false); ! return (bd.hasBeanClass() && FactoryBean.class.equals(bd.getBeanClass())); } *************** *** 1011,1023 **** */ protected void destroyBean(String beanName, Object bean) { - if (logger.isDebugEnabled()) { - logger.debug("Retrieving dependent beans for bean '" + beanName + "'"); - } - Set dependencies = null; synchronized (this.dependentBeanMap) { dependencies = (Set) this.dependentBeanMap.remove(beanName); } if (dependencies != null) { for (Iterator it = dependencies.iterator(); it.hasNext();) { String dependentBeanName = (String) it.next(); --- 1001,1013 ---- */ protected void destroyBean(String beanName, Object bean) { Set dependencies = null; synchronized (this.dependentBeanMap) { dependencies = (Set) this.dependentBeanMap.remove(beanName); } + if (dependencies != null) { + if (logger.isDebugEnabled()) { + logger.debug("Retrieved dependent beans for bean '" + beanName + "': " + dependencies); + } for (Iterator it = dependencies.iterator(); it.hasNext();) { String dependentBeanName = (String) it.next(); Index: DefaultListableBeanFactory.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/beans/factory/support/DefaultListableBeanFactory.java,v retrieving revision 1.53.2.2 retrieving revision 1.53.2.3 diff -C2 -d -r1.53.2.2 -r1.53.2.3 *** DefaultListableBeanFactory.java 21 Feb 2006 18:21:59 -0000 1.53.2.2 --- DefaultListableBeanFactory.java 21 Apr 2006 00:13:48 -0000 1.53.2.3 *************** *** 271,275 **** for (Iterator it = this.beanDefinitionNames.iterator(); it.hasNext();) { String beanName = (String) it.next(); ! if (containsBeanDefinition(beanName)) { RootBeanDefinition bd = getMergedBeanDefinition(beanName, false); if (!bd.isAbstract() && bd.isSingleton() && !bd.isLazyInit()) { --- 271,275 ---- for (Iterator it = this.beanDefinitionNames.iterator(); it.hasNext();) { String beanName = (String) it.next(); ! if (!containsSingleton(beanName) && containsBeanDefinition(beanName)) { RootBeanDefinition bd = getMergedBeanDefinition(beanName, false); if (!bd.isAbstract() && bd.isSingleton() && !bd.isLazyInit()) { |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:24
|
Update of /cvsroot/springframework/spring/src/org/springframework/aop/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/aop/framework Modified Files: Tag: mbranch-1-2 Cglib2AopProxy.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: Cglib2AopProxy.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/aop/framework/Cglib2AopProxy.java,v retrieving revision 1.41.4.1 retrieving revision 1.41.4.2 diff -C2 -d -r1.41.4.1 -r1.41.4.2 *** Cglib2AopProxy.java 13 Jan 2006 16:54:57 -0000 1.41.4.1 --- Cglib2AopProxy.java 21 Apr 2006 00:13:48 -0000 1.41.4.2 *************** *** 73,85 **** // Constants for CGLIB callback array indices private static final int AOP_PROXY = 0; - private static final int INVOKE_TARGET = 1; - private static final int NO_OVERRIDE = 2; - private static final int DISPATCH_TARGET = 3; - private static final int DISPATCH_ADVISED = 4; - private static final int INVOKE_EQUALS = 5; --- 73,80 ---- *************** *** 96,102 **** ! /** ! * Config used to configure this proxy ! */ protected final AdvisedSupport advised; --- 91,95 ---- ! /** Config used to configure this proxy */ protected final AdvisedSupport advised; *************** *** 105,111 **** private Class[] constructorArgTypes; ! /** ! * Dispatcher used for methods on <code>Advised</code> ! */ private final transient AdvisedDispatcher advisedDispatcher = new AdvisedDispatcher(); --- 98,102 ---- private Class[] constructorArgTypes; ! /** Dispatcher used for methods on Advised */ private final transient AdvisedDispatcher advisedDispatcher = new AdvisedDispatcher(); *************** *** 164,173 **** } ! Enhancer enhancer = new Enhancer(); try { Class rootClass = this.advised.getTargetSource().getTargetClass(); Class proxySuperClass = (AopUtils.isCglibProxyClass(rootClass)) ? rootClass.getSuperclass() : rootClass; ! // validate the class, writing log messages as necessary validateClassIfNecessary(proxySuperClass); --- 155,169 ---- } ! Enhancer enhancer = createEnhancer(); try { Class rootClass = this.advised.getTargetSource().getTargetClass(); Class proxySuperClass = (AopUtils.isCglibProxyClass(rootClass)) ? rootClass.getSuperclass() : rootClass; ! // Create proxy in specific ClassLoader, if given. ! if (classLoader != null) { ! enhancer.setClassLoader(classLoader); ! } ! ! // Validate the class, writing log messages as necessary. validateClassIfNecessary(proxySuperClass); *************** *** 181,185 **** enhancer.setCallbacks(callbacks); ! if(CglibUtils.canSkipConstructorInterception()) { enhancer.setInterceptDuringConstruction(false); } --- 177,181 ---- enhancer.setCallbacks(callbacks); ! if (CglibUtils.canSkipConstructorInterception()) { enhancer.setInterceptDuringConstruction(false); } *************** *** 191,195 **** enhancer.setCallbackTypes(types); ! // generate the proxy class and create a proxy instance Object proxy; if (this.constructorArgs != null) { --- 187,191 ---- enhancer.setCallbackTypes(types); ! // Generate the proxy class and create a proxy instance. Object proxy; if (this.constructorArgs != null) { *************** *** 221,224 **** --- 217,228 ---- /** + * Creates the CGLIB {@link Enhancer}. Subclasses may wish to override this to return a custom + * {@link Enhancer} implementation. + */ + protected Enhancer createEnhancer() { + return new Enhancer(); + } + + /** * Checks to see whether the supplied <code>Class</code> has already been validated and * validates it if not. *************** *** 417,422 **** } ! public Object intercept(Object proxy, Method method, Object[] args, ! MethodProxy methodProxy) throws Throwable { Object oldProxy = null; try { --- 421,425 ---- } ! public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object oldProxy = null; try { *************** *** 439,450 **** private class DynamicUnadvisedInterceptor implements MethodInterceptor, Serializable { ! public Object intercept(Object proxy, Method method, Object[] args, ! MethodProxy methodProxy) throws Throwable { ! Object target = advised.getTargetSource().getTarget(); - try { Object retVal = methodProxy.invoke(target, args); - return massageReturnTypeIfNecessary(proxy, target, retVal); } --- 442,449 ---- private class DynamicUnadvisedInterceptor implements MethodInterceptor, Serializable { ! public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object target = advised.getTargetSource().getTarget(); try { Object retVal = methodProxy.invoke(target, args); return massageReturnTypeIfNecessary(proxy, target, retVal); } *************** *** 461,475 **** private class DynamicUnadvisedExposedInterceptor implements MethodInterceptor, Serializable { ! public Object intercept(Object proxy, Method method, Object[] args, ! MethodProxy methodProxy) throws Throwable { ! Object oldProxy = null; Object target = advised.getTargetSource().getTarget(); - try { oldProxy = AopContext.setCurrentProxy(proxy); - Object retVal = methodProxy.invoke(target, args); - return massageReturnTypeIfNecessary(proxy, target, retVal); } --- 460,469 ---- private class DynamicUnadvisedExposedInterceptor implements MethodInterceptor, Serializable { ! public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object oldProxy = null; Object target = advised.getTargetSource().getTarget(); try { oldProxy = AopContext.setCurrentProxy(proxy); Object retVal = methodProxy.invoke(target, args); return massageReturnTypeIfNecessary(proxy, target, retVal); } *************** *** 524,532 **** } ! public Object intercept(Object proxy, Method method, Object[] args, ! MethodProxy methodProxy) throws Throwable { ! Object other = args[0]; - if (other == null) { return Boolean.FALSE; --- 518,523 ---- } ! public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object other = args[0]; if (other == null) { return Boolean.FALSE; *************** *** 535,541 **** return Boolean.TRUE; } - AdvisedSupport otherAdvised = null; - if (other instanceof Factory) { Callback callback = ((Factory) other).getCallback(INVOKE_EQUALS); --- 526,530 ---- *************** *** 549,553 **** return Boolean.FALSE; } - return new Boolean(AopProxyUtils.equalsInProxy(this.advised, otherAdvised)); } --- 538,541 ---- *************** *** 573,587 **** public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { - Object retVal = null; - - MethodInvocation invocation = new CglibMethodInvocation(proxy, this.target, method, args, this.targetClass, this.adviceChain, methodProxy); - // If we get here, we need to create a MethodInvocation. retVal = invocation.proceed(); - - retVal = massageReturnTypeIfNecessary(proxy, this.target, retVal); return retVal; --- 561,569 ---- *************** *** 597,603 **** private class DynamicAdvisedInterceptor implements MethodInterceptor, Serializable { ! public Object intercept(Object proxy, Method method, Object[] args, ! MethodProxy methodProxy) throws Throwable { ! MethodInvocation invocation = null; Object oldProxy = null; --- 579,583 ---- private class DynamicAdvisedInterceptor implements MethodInterceptor, Serializable { ! public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { MethodInvocation invocation = null; Object oldProxy = null; *************** *** 609,613 **** try { Object retVal = null; ! if (advised.exposeProxy) { // Make invocation available if necessary. --- 589,593 ---- try { Object retVal = null; ! if (advised.exposeProxy) { // Make invocation available if necessary. *************** *** 748,754 **** * <dt>For non-advised methods:</dt> * <dd>Where it can be determined that the method will not return ! * <code>this</code> or when ProxyFactory.getExposeProxy() return false ! * then a Dispatcher is used. For static targets the StaticDispatcher ! * is used and for dynamic targets a DynamicUnadvisedInterceptor is used. * If it possible for the method to return <code>this</code> then a * StaticUnadvisedInterceptor is used for static targets - the --- 728,734 ---- * <dt>For non-advised methods:</dt> * <dd>Where it can be determined that the method will not return ! * <code>this</code> or when <code>ProxyFactory.getExposeProxy()</code> returns ! * <code>false</code>, then a Dispatcher is used. For static targets, the StaticDispatcher ! * is used; and for dynamic targets, a DynamicUnadvisedInterceptor is used. * If it possible for the method to return <code>this</code> then a * StaticUnadvisedInterceptor is used for static targets - the |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:24
|
Update of /cvsroot/springframework/spring/src/org/springframework/aop/interceptor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/aop/interceptor Modified Files: Tag: mbranch-1-2 AbstractTraceInterceptor.java CustomizableTraceInterceptor.java JamonPerformanceMonitorInterceptor.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: AbstractTraceInterceptor.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/aop/interceptor/AbstractTraceInterceptor.java,v retrieving revision 1.3.4.2 retrieving revision 1.3.4.3 diff -C2 -d -r1.3.4.2 -r1.3.4.3 *** AbstractTraceInterceptor.java 23 Feb 2006 22:36:42 -0000 1.3.4.2 --- AbstractTraceInterceptor.java 21 Apr 2006 00:13:48 -0000 1.3.4.3 *************** *** 108,112 **** public Object invoke(MethodInvocation invocation) throws Throwable { Log logger = getLoggerForInvocation(invocation); ! if (isLogEnabled(logger)) { return invokeUnderTrace(invocation, logger); } --- 108,112 ---- public Object invoke(MethodInvocation invocation) throws Throwable { Log logger = getLoggerForInvocation(invocation); ! if (isInterceptorEnabled(invocation, logger)) { return invokeUnderTrace(invocation, logger); } *************** *** 154,160 **** /** ! * Is the {@link Log} instance enabled. Default implementation returns ! * <code>true</code> when <code>TRACE</code> level is enabled. Sub-classes ! * can override this to change the level under which 'tracing' occurs. */ protected boolean isLogEnabled(Log logger) { --- 154,176 ---- /** ! * Determine whether the interceptor should kick in, that is, ! * whether the <code>invokeUnderTrace</code> method should be called. ! * <p>Default behavior is to check whether the given <code>Log</code> ! * instance is enabled. Subclasses can override this to apply the ! * interceptor in other cases as well. ! * @param invocation the <code>MethodInvocation</code> being traced ! * @param logger the <code>Log</code> instance to check ! * @see #invokeUnderTrace ! * @see #isLogEnabled ! */ ! protected boolean isInterceptorEnabled(MethodInvocation invocation, Log logger) { ! return isLogEnabled(logger); ! } ! ! /** ! * Determine whether the given {@link Log} instance is enabled. ! * <p>Default is <code>true</code> when the "trace" level is enabled. ! * Subclasses can override this to change the level under which 'tracing' occurs. ! * @param logger the <code>Log</code> instance to check */ protected boolean isLogEnabled(Log logger) { *************** *** 162,165 **** --- 178,182 ---- } + /** * Subclasses must override this method to perform any tracing around the *************** *** 167,176 **** * ensuring that the <code>MethodInvocation</code> actually executes by * calling <code>MethodInvocation.proceed()</code>. ! * <p>The passed-in <code>Log</code> instance will have log level "trace" ! * enabled. Subclasses do not have to check for this again. * @param logger the <code>Log</code> to write trace messages to * @return the result of the call to <code>MethodInvocation.proceed()</code> * @throws Throwable if the call to <code>MethodInvocation.proceed()</code> * encountered any errors */ protected abstract Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable; --- 184,197 ---- * ensuring that the <code>MethodInvocation</code> actually executes by * calling <code>MethodInvocation.proceed()</code>. ! * <p>By default, the passed-in <code>Log</code> instance will have log level ! * "trace" enabled. Subclasses do not have to check for this again, unless ! * they overwrite the <code>isInterceptorEnabled</code> method to modify ! * the default behavior. * @param logger the <code>Log</code> to write trace messages to * @return the result of the call to <code>MethodInvocation.proceed()</code> * @throws Throwable if the call to <code>MethodInvocation.proceed()</code> * encountered any errors + * @see #isInterceptorEnabled + * @see #isLogEnabled */ protected abstract Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable; Index: CustomizableTraceInterceptor.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/aop/interceptor/CustomizableTraceInterceptor.java,v retrieving revision 1.5 retrieving revision 1.5.4.1 diff -C2 -d -r1.5 -r1.5.4.1 *** CustomizableTraceInterceptor.java 13 Sep 2005 21:23:13 -0000 1.5 --- CustomizableTraceInterceptor.java 21 Apr 2006 00:13:48 -0000 1.5.4.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 102,106 **** /** * The <code>$[argumentTypes]</code> placeholder. ! * Replaced with a comma seperated list of the argument types for the * method invocation. Argument types are written as short class names. */ --- 102,106 ---- /** * The <code>$[argumentTypes]</code> placeholder. ! * Replaced with a comma-separated list of the argument types for the * method invocation. Argument types are written as short class names. */ *************** *** 272,276 **** catch (Throwable ex) { exitThroughException = true; ! logger.trace(replacePlaceholders(this.exceptionMessage, invocation, null, ex, -1), ex); throw ex; } --- 272,276 ---- catch (Throwable ex) { exitThroughException = true; ! logger.trace(replacePlaceholders(this.exceptionMessage, invocation, null, ex, stopWatch.getTotalTimeMillis()), ex); throw ex; } Index: JamonPerformanceMonitorInterceptor.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.java,v retrieving revision 1.8.2.1 retrieving revision 1.8.2.2 diff -C2 -d -r1.8.2.1 -r1.8.2.2 *** JamonPerformanceMonitorInterceptor.java 22 Feb 2006 21:28:51 -0000 1.8.2.1 --- JamonPerformanceMonitorInterceptor.java 21 Apr 2006 00:13:48 -0000 1.8.2.2 *************** *** 38,41 **** --- 38,44 ---- public class JamonPerformanceMonitorInterceptor extends AbstractMonitoringInterceptor { + private boolean trackAllInvocations = false; + + /** * Create a new JamonPerformanceMonitorInterceptor with a static logger. *************** *** 54,58 **** --- 57,102 ---- } + /** + * Create a new JamonPerformanceMonitorInterceptor with a dynamic or static logger, + * according to the given flag. + * @param useDynamicLogger whether to use a dynamic logger or a static logger + * @param trackAllInvocations whether to track all invocations that go through + * this interceptor, or just invocations with trace logging enabled + * @see #setUseDynamicLogger + */ + public JamonPerformanceMonitorInterceptor(boolean useDynamicLogger, boolean trackAllInvocations) { + setUseDynamicLogger(useDynamicLogger); + setTrackAllInvocations(trackAllInvocations); + } + + + /** + * Set whether to track all invocations that go through this interceptor, + * or just invocations with trace logging enabled. + * <p>Default is "false": Only invocations with trace logging enabled will + * be monitored. Specify "true" to let JAMon track all invocations, + * gathering statistics even when trace logging is disabled. + */ + public void setTrackAllInvocations(boolean trackAllInvocations) { + this.trackAllInvocations = trackAllInvocations; + } + + + /** + * Always applies the interceptor if the "trackAllInvocations" flag has been set; + * else just kicks in if the log is enabled. + * @see #setTrackAllInvocations + * @see #isLogEnabled + */ + protected boolean isInterceptorEnabled(MethodInvocation invocation, Log logger) { + return (this.trackAllInvocations || isLogEnabled(logger)); + } + /** + * Wraps the invocation with a JAMon Monitor and writes the current + * performance statistics to the log (if enabled). + * @see com.jamonapi.MonitorFactory#start + * @see com.jamonapi.Monitor#stop + */ protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable { String name = createInvocationTraceName(invocation); *************** *** 63,67 **** finally { monitor.stop(); ! logger.trace("JAMon performance statistics for method [" + name + "]:\n" + monitor); } } --- 107,113 ---- finally { monitor.stop(); ! if (!this.trackAllInvocations || isLogEnabled(logger)) { ! logger.trace("JAMon performance statistics for method [" + name + "]:\n" + monitor); ! } } } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:24
|
Update of /cvsroot/springframework/spring/src/org/springframework/core/io/support In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/core/io/support Modified Files: Tag: mbranch-1-2 PropertiesLoaderSupport.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: PropertiesLoaderSupport.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/core/io/support/PropertiesLoaderSupport.java,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** PropertiesLoaderSupport.java 2 Oct 2005 19:42:41 -0000 1.4 --- PropertiesLoaderSupport.java 21 Apr 2006 00:13:48 -0000 1.4.2.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 46,50 **** protected final Log logger = LogFactory.getLog(getClass()); ! private Properties properties; private Resource[] locations; --- 46,50 ---- protected final Log logger = LogFactory.getLog(getClass()); ! private Properties[] localProperties; private Resource[] locations; *************** *** 65,69 **** */ public void setProperties(Properties properties) { ! this.properties = properties; } --- 65,77 ---- */ public void setProperties(Properties properties) { ! this.localProperties = new Properties[] {properties}; ! } ! ! /** ! * Set local properties, e.g. via the "props" tag in XML bean definitions, ! * allowing for merging multiple properties sets into one. ! */ ! public void setPropertiesArray(Properties[] propertiesArray) { ! this.localProperties = propertiesArray; } *************** *** 139,147 **** } ! if (this.properties != null) { ! // Use propertyNames enumeration to also catch default properties. ! for (Enumeration en = this.properties.propertyNames(); en.hasMoreElements();) { ! String key = (String) en.nextElement(); ! result.setProperty(key, this.properties.getProperty(key)); } } --- 147,158 ---- } ! if (this.localProperties != null) { ! for (int i = 0; i < this.localProperties.length; i++) { ! Properties props = this.localProperties[i]; ! // Use propertyNames enumeration to also catch default properties. ! for (Enumeration en = props.propertyNames(); en.hasMoreElements();) { ! String key = (String) en.nextElement(); ! result.setProperty(key, props.getProperty(key)); ! } } } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:23
|
Update of /cvsroot/springframework/spring/src/org/springframework/beans/propertyeditors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/beans/propertyeditors Modified Files: Tag: mbranch-1-2 ByteArrayPropertyEditor.java CharacterEditor.java Added Files: Tag: mbranch-1-2 CharArrayPropertyEditor.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: CharacterEditor.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/beans/propertyeditors/CharacterEditor.java,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** CharacterEditor.java 2 Aug 2005 14:27:05 -0000 1.2 --- CharacterEditor.java 21 Apr 2006 00:13:48 -0000 1.2.4.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 29,32 **** --- 29,33 ---- * * @author Juergen Hoeller + * @author Rob Harrop * @since 1.2 * @see java.lang.Character *************** *** 35,38 **** --- 36,44 ---- public class CharacterEditor extends PropertyEditorSupport { + private static final String UNICODE_PREFIX = "\\u"; + + private static final int UNICODE_LENGTH = 6; + + private final boolean allowEmpty; *************** *** 40,52 **** /** * Create a new CharacterEditor instance. ! * <p>The "allowEmpty" parameter states if an empty String should ! * be allowed for parsing, i.e. get interpreted as null value. ! * Else, an IllegalArgumentException gets thrown in that case. ! * @param allowEmpty if empty strings should be allowed */ public CharacterEditor(boolean allowEmpty) { this.allowEmpty = allowEmpty; } ! public void setAsText(String text) throws IllegalArgumentException { --- 46,59 ---- /** * Create a new CharacterEditor instance. ! * <p>The "allowEmpty" parameter controls whether an empty String is ! * to be allowed in parsing, i.e. be interpreted as ! * the <code>null</code> value. Else, an IllegalArgumentException gets ! * thrown in that case. ! * @param allowEmpty if empty strings are to be allowed */ public CharacterEditor(boolean allowEmpty) { this.allowEmpty = allowEmpty; } ! public void setAsText(String text) throws IllegalArgumentException { *************** *** 55,61 **** setValue(null); } else if (text.length() != 1) { ! throw new IllegalArgumentException( ! "String [" + text + "] with length " + text.length() + " cannot be converted to char type"); } else { --- 62,72 ---- setValue(null); } + else if (text.startsWith(UNICODE_PREFIX) && text.length() == UNICODE_LENGTH) { + int code = Integer.parseInt(text.substring(UNICODE_PREFIX.length()), 16); + setValue(new Character((char) code)); + } else if (text.length() != 1) { ! throw new IllegalArgumentException("String [" + text + "] with length " + ! text.length() + " cannot be converted to char type"); } else { Index: ByteArrayPropertyEditor.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/beans/propertyeditors/ByteArrayPropertyEditor.java,v retrieving revision 1.7 retrieving revision 1.7.4.1 diff -C2 -d -r1.7 -r1.7.4.1 *** ByteArrayPropertyEditor.java 27 May 2005 19:49:56 -0000 1.7 --- ByteArrayPropertyEditor.java 21 Apr 2006 00:13:48 -0000 1.7.4.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 30,34 **** public void setAsText(String text) { ! setValue(text.getBytes()); } --- 30,34 ---- public void setAsText(String text) { ! setValue(text != null ? text.getBytes() : null); } --- NEW FILE: CharArrayPropertyEditor.java --- /* * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.beans.propertyeditors; import java.beans.PropertyEditorSupport; /** * Editor for char arrays. Strings will simply be converted to * their corresponding char representations. * * @author Juergen Hoeller * @since 1.2.8 * @see String#toCharArray() */ public class CharArrayPropertyEditor extends PropertyEditorSupport { public void setAsText(String text) { setValue(text != null ? text.toCharArray() : null); } public String getAsText() { char[] value = (char[]) getValue(); return (value != null ? new String(value) : ""); } } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:23
|
Update of /cvsroot/springframework/spring/src/org/springframework/beans/factory/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/beans/factory/config Modified Files: Tag: mbranch-1-2 FieldRetrievingFactoryBean.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: FieldRetrievingFactoryBean.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -d -r1.4 -r1.4.4.1 *** FieldRetrievingFactoryBean.java 9 Apr 2005 11:16:35 -0000 1.4 --- FieldRetrievingFactoryBean.java 21 Apr 2006 00:13:48 -0000 1.4.4.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 18,21 **** --- 18,22 ---- import java.lang.reflect.Field; + import java.lang.reflect.Modifier; import org.springframework.beans.factory.BeanNameAware; *************** *** 152,156 **** } ! // try to parse static field into class and field int lastDotIndex = this.staticField.lastIndexOf('.'); if (lastDotIndex == -1 || lastDotIndex == this.staticField.length()) { --- 153,157 ---- } ! // Try to parse static field into class and field. int lastDotIndex = this.staticField.lastIndexOf('.'); if (lastDotIndex == -1 || lastDotIndex == this.staticField.length()) { *************** *** 166,174 **** else if (this.targetField == null) { ! // either targetClass or targetObject specified throw new IllegalArgumentException("targetField is required"); } ! // try to get the exact method first Class targetClass = (this.targetObject != null) ? this.targetObject.getClass() : this.targetClass; this.fieldObject = targetClass.getField(this.targetField); --- 167,175 ---- else if (this.targetField == null) { ! // Either targetClass or targetObject specified. throw new IllegalArgumentException("targetField is required"); } ! // Try to get the exact method first. Class targetClass = (this.targetObject != null) ? this.targetObject.getClass() : this.targetClass; this.fieldObject = targetClass.getField(this.targetField); *************** *** 177,180 **** --- 178,186 ---- public Object getObject() throws IllegalAccessException { + if (!Modifier.isPublic(this.fieldObject.getModifiers()) || + !Modifier.isPublic(this.fieldObject.getDeclaringClass().getModifiers())) { + this.fieldObject.setAccessible(true); + } + if (this.targetObject != null) { // instance field |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:23
|
Update of /cvsroot/springframework/spring/src/org/springframework/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/core Modified Files: Tag: mbranch-1-2 NestedCheckedException.java NestedRuntimeException.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: NestedCheckedException.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/core/NestedCheckedException.java,v retrieving revision 1.15 retrieving revision 1.15.4.1 diff -C2 -d -r1.15 -r1.15.4.1 *** NestedCheckedException.java 9 Sep 2005 09:45:20 -0000 1.15 --- NestedCheckedException.java 21 Apr 2006 00:13:48 -0000 1.15.4.1 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 73,76 **** --- 73,77 ---- } + /** * Return the nested cause, or <code>null</code> if none. *************** *** 89,99 **** */ public String getMessage() { ! if (getCause() == null) { ! return super.getMessage(); ! } ! else { ! return super.getMessage() + "; nested exception is " + getCause().getClass().getName() + ! ": " + getCause().getMessage(); } } --- 90,99 ---- */ public String getMessage() { ! String message = super.getMessage(); ! Throwable cause = getCause(); ! if (cause != null) { ! return message + "; nested exception is " + cause; } + return message; } *************** *** 108,111 **** --- 108,112 ---- else { ps.println(this); + ps.print("Caused by: "); getCause().printStackTrace(ps); } *************** *** 122,125 **** --- 123,127 ---- else { pw.println(this); + pw.print("Caused by: "); getCause().printStackTrace(pw); } Index: NestedRuntimeException.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/core/NestedRuntimeException.java,v retrieving revision 1.15 retrieving revision 1.15.4.1 diff -C2 -d -r1.15 -r1.15.4.1 *** NestedRuntimeException.java 9 Sep 2005 09:45:20 -0000 1.15 --- NestedRuntimeException.java 21 Apr 2006 00:13:48 -0000 1.15.4.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 73,76 **** --- 73,77 ---- } + /** * Return the nested cause, or <code>null</code> if none. *************** *** 89,99 **** */ public String getMessage() { ! if (getCause() == null) { ! return super.getMessage(); ! } ! else { ! return super.getMessage() + "; nested exception is " + getCause().getClass().getName() + ! ": " + getCause().getMessage(); } } --- 90,99 ---- */ public String getMessage() { ! String message = super.getMessage(); ! Throwable cause = getCause(); ! if (cause != null) { ! return message + "; nested exception is " + cause; } + return message; } *************** *** 108,111 **** --- 108,112 ---- else { ps.println(this); + ps.print("Caused by: "); getCause().printStackTrace(ps); } *************** *** 122,125 **** --- 123,127 ---- else { pw.println(this); + pw.print("Caused by: "); getCause().printStackTrace(pw); } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:23
|
Update of /cvsroot/springframework/spring/src/org/springframework/beans In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/beans Modified Files: Tag: mbranch-1-2 BeanUtils.java BeanWrapperImpl.java MutablePropertyValues.java PropertyEditorRegistrar.java PropertyEditorRegistrySupport.java Added Files: Tag: mbranch-1-2 BeanInstantiationException.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: PropertyEditorRegistrar.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/beans/PropertyEditorRegistrar.java,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** PropertyEditorRegistrar.java 14 Nov 2005 11:55:32 -0000 1.1 --- PropertyEditorRegistrar.java 21 Apr 2006 00:13:48 -0000 1.1.2.1 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 23,35 **** * a corresponding registrar and reuse that in each case. * - * <p>Serves as super-interface for the BeanWrapper interface. - * Implemented by BeanWrapperImpl and also by the DataBinder class - * in the validation package. - * * @author Juergen Hoeller * @since 1.2.6 ! * @see BeanWrapper ! * @see BeanWrapperImpl ! * @see org.springframework.validation.DataBinder * @see java.beans.PropertyEditor */ --- 23,29 ---- * a corresponding registrar and reuse that in each case. * * @author Juergen Hoeller * @since 1.2.6 ! * @see PropertyEditorRegistry * @see java.beans.PropertyEditor */ *************** *** 41,44 **** --- 35,40 ---- * @param registry the PropertyEditorRegistry to register the custom * PropertyEditors with + * @see BeanWrapper + * @see org.springframework.validation.DataBinder */ void registerCustomEditors(PropertyEditorRegistry registry); Index: BeanWrapperImpl.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/beans/BeanWrapperImpl.java,v retrieving revision 1.86.2.4 retrieving revision 1.86.2.5 diff -C2 -d -r1.86.2.4 -r1.86.2.5 *** BeanWrapperImpl.java 21 Feb 2006 18:14:52 -0000 1.86.2.4 --- BeanWrapperImpl.java 21 Apr 2006 00:13:48 -0000 1.86.2.5 *************** *** 917,921 **** return result; } ! else { // A plain value: convert it to an array with a single component. Object result = Array.newInstance(componentType, 1); --- 917,921 ---- return result; } ! else if (convertedValue != null) { // A plain value: convert it to an array with a single component. Object result = Array.newInstance(componentType, 1); Index: MutablePropertyValues.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/beans/MutablePropertyValues.java,v retrieving revision 1.15.4.1 retrieving revision 1.15.4.2 diff -C2 -d -r1.15.4.1 -r1.15.4.2 *** MutablePropertyValues.java 17 Jan 2006 21:29:34 -0000 1.15.4.1 --- MutablePropertyValues.java 21 Apr 2006 00:13:48 -0000 1.15.4.2 *************** *** 5,11 **** * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 5,11 ---- * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 137,153 **** /** - * Overloaded version of addPropertyValue that takes - * a property name and a property value. - * @param propertyName name of the property - * @param propertyValue value of the property - * @return this object to allow creating objects, adding multiple - * PropertyValues in a single statement - * @see #addPropertyValue(PropertyValue) - */ - public MutablePropertyValues addPropertyValue(String propertyName, Object propertyValue) { - return addPropertyValue(new PropertyValue(propertyName, propertyValue)); - } - - /** * Add a PropertyValue object, replacing any existing one * for the corresponding property. --- 137,140 ---- *************** *** 169,172 **** --- 156,170 ---- /** + * Overloaded version of <code>addPropertyValue</code> that takes + * a property name and a property value. + * @param propertyName name of the property + * @param propertyValue value of the property + * @see #addPropertyValue(PropertyValue) + */ + public void addPropertyValue(String propertyName, Object propertyValue) { + addPropertyValue(new PropertyValue(propertyName, propertyValue)); + } + + /** * Modify a PropertyValue object held in this object. * Indexed from 0. *************** *** 177,181 **** /** ! * Overloaded version of removePropertyValue that takes a property name. * @param propertyName name of the property * @see #removePropertyValue(PropertyValue) --- 175,179 ---- /** ! * Overloaded version of <code>removePropertyValue</code> that takes a property name. * @param propertyName name of the property * @see #removePropertyValue(PropertyValue) --- NEW FILE: BeanInstantiationException.java --- /* * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.beans; /** * Exception thrown when instantiation of a bean failed. * Carries the offending bean class. * * @author Juergen Hoeller * @since 1.2.8 */ public class BeanInstantiationException extends FatalBeanException { private Class beanClass; /** * Create a new BeanInstantiationException. * @param beanClass the offending bean class * @param msg the detail message */ public BeanInstantiationException(Class beanClass, String msg) { this(beanClass, msg, null); } /** * Create a new BeanInstantiationException. * @param beanClass the offending bean class * @param msg the detail message * @param ex the root cause */ public BeanInstantiationException(Class beanClass, String msg, Throwable ex) { super("Could not instantiate bean class [" + beanClass.getName() + "]: " + msg, ex); this.beanClass = beanClass; } /** * Return the offending bean class. */ public Class getBeanClass() { return beanClass; } } Index: BeanUtils.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/beans/BeanUtils.java,v retrieving revision 1.41.2.1 retrieving revision 1.41.2.2 diff -C2 -d -r1.41.2.1 -r1.41.2.2 *** BeanUtils.java 18 Feb 2006 13:17:20 -0000 1.41.2.1 --- BeanUtils.java 21 Apr 2006 00:13:48 -0000 1.41.2.2 *************** *** 149,154 **** } catch (NoSuchMethodException ex) { ! throw new FatalBeanException("Could not instantiate class [" + clazz.getName() + ! "]: no default constructor found", ex); } } --- 149,153 ---- } catch (NoSuchMethodException ex) { ! throw new BeanInstantiationException(clazz, "No default constructor found", ex); } } *************** *** 164,168 **** */ public static Object instantiateClass(Constructor ctor, Object[] args) throws BeansException { ! Assert.notNull(ctor, "ctor must not be null"); try { if (!Modifier.isPublic(ctor.getModifiers()) || --- 163,167 ---- */ public static Object instantiateClass(Constructor ctor, Object[] args) throws BeansException { ! Assert.notNull(ctor, "Constructor must not be null"); try { if (!Modifier.isPublic(ctor.getModifiers()) || *************** *** 173,190 **** } catch (InstantiationException ex) { ! throw new FatalBeanException("Could not instantiate class [" + ctor.getDeclaringClass().getName() + ! "]: Is it an abstract class?", ex); } catch (IllegalAccessException ex) { ! throw new FatalBeanException("Could not instantiate class [" + ctor.getDeclaringClass().getName() + ! "]: Has the class definition changed? Is the constructor accessible?", ex); } catch (IllegalArgumentException ex) { ! throw new FatalBeanException("Could not instantiate class [" + ctor.getDeclaringClass().getName() + ! "]: illegal args for constructor", ex); } catch (InvocationTargetException ex) { ! throw new FatalBeanException("Could not instantiate class [" + ctor.getDeclaringClass().getName() + ! "]; constructor threw exception", ex.getTargetException()); } } --- 172,189 ---- } catch (InstantiationException ex) { ! throw new BeanInstantiationException(ctor.getDeclaringClass(), ! "Is it an abstract class?", ex); } catch (IllegalAccessException ex) { ! throw new BeanInstantiationException(ctor.getDeclaringClass(), ! "Has the class definition changed? Is the constructor accessible?", ex); } catch (IllegalArgumentException ex) { ! throw new BeanInstantiationException(ctor.getDeclaringClass(), ! "Illegal arguments for constructor", ex); } catch (InvocationTargetException ex) { ! throw new BeanInstantiationException(ctor.getDeclaringClass(), ! "Constructor threw exception", ex.getTargetException()); } } *************** *** 200,204 **** * @param methodName the name of the method to find * @param paramTypes the parameter types of the method to find ! * @return the method object, or <code>null</code> if not found * @see java.lang.Class#getMethod * @see #findDeclaredMethod --- 199,203 ---- * @param methodName the name of the method to find * @param paramTypes the parameter types of the method to find ! * @return the Method object, or <code>null</code> if not found * @see java.lang.Class#getMethod * @see #findDeclaredMethod *************** *** 221,225 **** * @param methodName the name of the method to find * @param paramTypes the parameter types of the method to find ! * @return the method object, or <code>null</code> if not found * @see java.lang.Class#getDeclaredMethod */ --- 220,224 ---- * @param methodName the name of the method to find * @param paramTypes the parameter types of the method to find ! * @return the Method object, or <code>null</code> if not found * @see java.lang.Class#getDeclaredMethod */ *************** *** 245,249 **** * @param clazz the class to check * @param methodName the name of the method to find ! * @return the method object, or <code>null</code> if not found * @see java.lang.Class#getMethods * @see #findDeclaredMethodWithMinimalParameters --- 244,248 ---- * @param clazz the class to check * @param methodName the name of the method to find ! * @return the Method object, or <code>null</code> if not found * @see java.lang.Class#getMethods * @see #findDeclaredMethodWithMinimalParameters *************** *** 456,461 **** throws BeansException { ! Assert.notNull(source, "source must not be null"); ! Assert.notNull(target, "target must not be null"); Class actualEditable = target.getClass(); --- 455,460 ---- throws BeansException { ! Assert.notNull(source, "Source must not be null"); ! Assert.notNull(target, "Target must not be null"); Class actualEditable = target.getClass(); Index: PropertyEditorRegistrySupport.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/beans/PropertyEditorRegistrySupport.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** PropertyEditorRegistrySupport.java 18 Feb 2006 13:22:01 -0000 1.1.2.1 --- PropertyEditorRegistrySupport.java 21 Apr 2006 00:13:48 -0000 1.1.2.2 *************** *** 35,38 **** --- 35,39 ---- import org.springframework.beans.propertyeditors.ByteArrayPropertyEditor; + import org.springframework.beans.propertyeditors.CharArrayPropertyEditor; import org.springframework.beans.propertyeditors.CharacterEditor; import org.springframework.beans.propertyeditors.ClassEditor; *************** *** 106,110 **** // Simple editors, without parameterization capabilities. // The JDK does not contain a default editor for any of these target types. - this.defaultEditors.put(byte[].class, new ByteArrayPropertyEditor()); this.defaultEditors.put(Class.class, new ClassEditor()); this.defaultEditors.put(File.class, new FileEditor()); --- 107,110 ---- *************** *** 123,126 **** --- 123,130 ---- this.defaultEditors.put(List.class, new CustomCollectionEditor(List.class)); + // Default editors for primitive arrays. + this.defaultEditors.put(byte[].class, new ByteArrayPropertyEditor()); + this.defaultEditors.put(char[].class, new CharArrayPropertyEditor()); + // Default instances of character and boolean editors. // Can be overridden by registering custom instances of those as custom editors. |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:23
|
Update of /cvsroot/springframework/spring/src/org/springframework/jdbc/support/nativejdbc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/jdbc/support/nativejdbc Modified Files: Tag: mbranch-1-2 NativeJdbcExtractorAdapter.java SimpleNativeJdbcExtractor.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: SimpleNativeJdbcExtractor.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/support/nativejdbc/SimpleNativeJdbcExtractor.java,v retrieving revision 1.12 retrieving revision 1.12.4.1 diff -C2 -d -r1.12 -r1.12.4.1 *** SimpleNativeJdbcExtractor.java 17 Sep 2005 17:05:29 -0000 1.12 --- SimpleNativeJdbcExtractor.java 21 Apr 2006 00:13:49 -0000 1.12.4.1 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 33,43 **** * and will also work with any plain JDBC driver. Note that a pool can still wrap * Statements, PreparedStatements, etc: The only requirement of this extractor is ! * that java.sql.DatabaseMetaData does not get wrapped, returning the native ! * Connection of the JDBC driver on <code>metaData.getConnection()</code>. * * <p>Customize this extractor by setting the "nativeConnectionNecessaryForXxx" * flags accordingly: If Statements, PreparedStatements, and/or CallableStatements * are wrapped by your pool, set the corresponding "nativeConnectionNecessaryForXxx" ! * flags to true. If none of the statement types is wrapped - or you solely need * Connection unwrapping in the first place -, the defaults are fine. * --- 33,43 ---- * and will also work with any plain JDBC driver. Note that a pool can still wrap * Statements, PreparedStatements, etc: The only requirement of this extractor is ! * that <code>java.sql.DatabaseMetaData</code> does not get wrapped, returning the ! * native Connection of the JDBC driver on <code>metaData.getConnection()</code>. * * <p>Customize this extractor by setting the "nativeConnectionNecessaryForXxx" * flags accordingly: If Statements, PreparedStatements, and/or CallableStatements * are wrapped by your pool, set the corresponding "nativeConnectionNecessaryForXxx" ! * flags to "true". If none of the statement types is wrapped - or you solely need * Connection unwrapping in the first place -, the defaults are fine. * *************** *** 60,64 **** * Statement objects are wrapped, therefore no special unwrapping is necessary). * <li>Use a SimpleNativeJdbcExtractor with all "nativeConnectionNecessaryForXxx" ! * flags set to true for OC4J and C3P0 (all JDBC Statement objects are wrapped, * but none of the wrappers allow for unwrapping). * <li>Use a CommonsDbcpNativeJdbcExtractor for Jakarta Commons DBCP respectively --- 60,64 ---- * Statement objects are wrapped, therefore no special unwrapping is necessary). * <li>Use a SimpleNativeJdbcExtractor with all "nativeConnectionNecessaryForXxx" ! * flags set to "true" for OC4J and C3P0 (all JDBC Statement objects are wrapped, * but none of the wrappers allow for unwrapping). * <li>Use a CommonsDbcpNativeJdbcExtractor for Jakarta Commons DBCP respectively *************** *** 81,86 **** public class SimpleNativeJdbcExtractor extends NativeJdbcExtractorAdapter { - protected final Log logger = LogFactory.getLog(getClass()); - private boolean nativeConnectionNecessaryForNativeStatements = false; --- 81,84 ---- *************** *** 150,166 **** } - - /** - * Retrieve the Connection via the DatabaseMetaData object, which will - * result in the native JDBC Connection with many connection pools. - * @see java.sql.DatabaseMetaData#getConnection - */ - protected Connection doGetNativeConnection(Connection con) throws SQLException { - Connection nativeCon = con.getMetaData().getConnection(); - if (logger.isDebugEnabled()) { - logger.debug("Returning native Connection [" + nativeCon + "] for given Connection handle [" + con + "]"); - } - return nativeCon; - } - } --- 148,150 ---- Index: NativeJdbcExtractorAdapter.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/support/nativejdbc/NativeJdbcExtractorAdapter.java,v retrieving revision 1.6 retrieving revision 1.6.4.1 diff -C2 -d -r1.6 -r1.6.4.1 *** NativeJdbcExtractorAdapter.java 22 Sep 2005 22:05:48 -0000 1.6 --- NativeJdbcExtractorAdapter.java 21 Apr 2006 00:13:49 -0000 1.6.4.1 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 19,22 **** --- 19,23 ---- import java.sql.CallableStatement; import java.sql.Connection; + import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; import java.sql.ResultSet; *************** *** 29,33 **** * Abstract adapter class for the NativeJdbcExtractor interface, * for simplified implementation of basic extractors. ! * Returns the passed-in JDBC objects on all methods. * * <p><code>getNativeConnection</code> checks for a ConnectionProxy chain, --- 30,34 ---- * Abstract adapter class for the NativeJdbcExtractor interface, * for simplified implementation of basic extractors. ! * Basically returns the passed-in JDBC objects on all methods. * * <p><code>getNativeConnection</code> checks for a ConnectionProxy chain, *************** *** 37,40 **** --- 38,49 ---- * recommended to participate in ConnectionProxy unwrapping. * + * <p><code>getNativeConnection</code> also applies a fallback if the first + * native extraction process failed, that is, returned the same Connection as + * passed in. It assumes that some additional proxying is going in this case: + * Hence, it retrieves the underlying native Connection from the DatabaseMetaData + * via <code>conHandle.getMetaData().getConnection()</code> and retries the native + * extraction process based on that Connection handle. This works, for example, + * for the Connection proxies exposed by Hibernate 3.1's <code>Session.connection()</code>. + * * <p>The <code>getNativeConnectionFromStatement</code> method is implemented * to simply delegate to <code>getNativeConnection</code> with the Statement's *************** *** 84,89 **** */ public Connection getNativeConnection(Connection con) throws SQLException { ! Connection conToUse = DataSourceUtils.getTargetConnection(con); ! return doGetNativeConnection(conToUse); } --- 93,115 ---- */ public Connection getNativeConnection(Connection con) throws SQLException { ! Connection targetCon = DataSourceUtils.getTargetConnection(con); ! Connection nativeCon = doGetNativeConnection(targetCon); ! if (nativeCon == targetCon) { ! // We haven't received a different Connection, so we'll assume that there's ! // some additional proxying going on. Let's check whether we get something ! // different back from the DatabaseMetaData.getConnection() call. ! DatabaseMetaData metaData = targetCon.getMetaData(); ! // The following check is only really there for mock Connections ! // which might not carry a DatabaseMetaData instance. ! if (metaData != null) { ! Connection metaCon = metaData.getConnection(); ! if (metaCon != targetCon) { ! // We've received a different Connection there: ! // Let's retry the native extraction process with it. ! nativeCon = doGetNativeConnection(metaCon); ! } ! } ! } ! return nativeCon; } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:23
|
Update of /cvsroot/springframework/spring/src/org/springframework/jndi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/jndi Modified Files: Tag: mbranch-1-2 JndiObjectFactoryBean.java JndiTemplate.java Added Files: Tag: mbranch-1-2 TypeMismatchNamingException.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: JndiObjectFactoryBean.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jndi/JndiObjectFactoryBean.java,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** JndiObjectFactoryBean.java 13 Oct 2005 21:12:35 -0000 1.13 --- JndiObjectFactoryBean.java 21 Apr 2006 00:13:49 -0000 1.13.2.1 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 64,67 **** --- 64,69 ---- private boolean cache = true; + private Object defaultObject; + private Object jndiObject; *************** *** 108,120 **** /** * Look up the JNDI object and store it. */ ! public void afterPropertiesSet() throws NamingException { super.afterPropertiesSet(); if (this.proxyInterface != null) { // We need a proxy and a JndiObjectTargetSource. this.jndiObject = JndiObjectProxyFactory.createJndiObjectProxy(this); } else { if (!this.lookupOnStartup || !this.cache) { --- 110,140 ---- /** + * Specify a default object to fall back to if the JNDI lookup fails. + * Default is none. + * <p>This can be an arbitrary bean reference or literal value. + * It is typically used for literal values in scenarios where the JNDI environment + * might define specific config settings but those are not required to be present. + * <p>Note: This is only supported for lookup on startup. + * @see #setLookupOnStartup + */ + public void setDefaultObject(Object defaultObject) { + this.defaultObject = defaultObject; + } + + + /** * Look up the JNDI object and store it. */ ! public void afterPropertiesSet() throws IllegalArgumentException, NamingException { super.afterPropertiesSet(); if (this.proxyInterface != null) { + if (this.defaultObject != null) { + throw new IllegalArgumentException("'defaultObject' is not supported in combination with proxyInterface"); + } // We need a proxy and a JndiObjectTargetSource. this.jndiObject = JndiObjectProxyFactory.createJndiObjectProxy(this); } + else { if (!this.lookupOnStartup || !this.cache) { *************** *** 122,127 **** "Cannot deactivate 'lookupOnStartup' or 'cache' without specifying a 'proxyInterface'"); } // Locate specified JNDI object. ! this.jndiObject = lookup(); } } --- 142,183 ---- "Cannot deactivate 'lookupOnStartup' or 'cache' without specifying a 'proxyInterface'"); } + if (this.defaultObject != null && getExpectedType() != null && + !getExpectedType().isInstance(this.defaultObject)) { + throw new IllegalArgumentException("Default object [" + this.defaultObject + + "] of type [" + this.defaultObject.getClass().getName() + + "] is not of expected type [" + getExpectedType().getName() + "]"); + } // Locate specified JNDI object. ! this.jndiObject = lookupWithFallback(); ! } ! } ! ! /** ! * Lookup variant that that returns the specified "defaultObject" ! * (if any) in case of lookup failure. ! * @return the located object, or the "defaultObject" as fallback ! * @throws NamingException in case of lookup failure without fallback ! * @see #setDefaultObject ! */ ! protected Object lookupWithFallback() throws NamingException { ! try { ! return lookup(); ! } ! catch (TypeMismatchNamingException ex) { ! // Always let TypeMismatchNamingException through - ! // we don't want to fall back to the defaultObject in this case. ! throw ex; ! } ! catch (NamingException ex) { ! if (this.defaultObject != null) { ! if (logger.isDebugEnabled()) { ! logger.debug("JNDI lookup failed - returning specified default object instead", ex); ! } ! else if (logger.isInfoEnabled()) { ! logger.debug("JNDI lookup failed - returning specified default object instead: " + ex); ! } ! return this.defaultObject; ! } ! throw ex; } } Index: JndiTemplate.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jndi/JndiTemplate.java,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** JndiTemplate.java 13 Oct 2005 21:12:35 -0000 1.13 --- JndiTemplate.java 21 Apr 2006 00:13:49 -0000 1.13.2.1 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 21,24 **** --- 21,25 ---- import javax.naming.Context; import javax.naming.InitialContext; + import javax.naming.NameNotFoundException; import javax.naming.NamingException; *************** *** 116,120 **** */ public Object lookup(final String name) throws NamingException { ! if (logger.isInfoEnabled()) { logger.debug("Looking up JNDI object with name [" + name + "]"); } --- 117,121 ---- */ public Object lookup(final String name) throws NamingException { ! if (logger.isDebugEnabled()) { logger.debug("Looking up JNDI object with name [" + name + "]"); } *************** *** 123,127 **** Object located = ctx.lookup(name); if (located == null) { ! throw new NamingException( "JNDI object with [" + name + "] not found: JNDI implementation returned null"); } --- 124,128 ---- Object located = ctx.lookup(name); if (located == null) { ! throw new NameNotFoundException( "JNDI object with [" + name + "] not found: JNDI implementation returned null"); } *************** *** 146,150 **** Object jndiObject = lookup(name); if (requiredType != null && !requiredType.isInstance(jndiObject)) { ! throw new NamingException( "Object [" + jndiObject + "] available at JNDI location [" + name + "] is not assignable to [" + requiredType.getName() + "]"); --- 147,151 ---- Object jndiObject = lookup(name); if (requiredType != null && !requiredType.isInstance(jndiObject)) { ! throw new TypeMismatchNamingException( "Object [" + jndiObject + "] available at JNDI location [" + name + "] is not assignable to [" + requiredType.getName() + "]"); *************** *** 160,165 **** */ public void bind(final String name, final Object object) throws NamingException { ! if (logger.isInfoEnabled()) { ! logger.info("Binding JNDI object with name [" + name + "]"); } execute(new JndiCallback() { --- 161,166 ---- */ public void bind(final String name, final Object object) throws NamingException { ! if (logger.isDebugEnabled()) { ! logger.debug("Binding JNDI object with name [" + name + "]"); } execute(new JndiCallback() { *************** *** 179,184 **** */ public void rebind(final String name, final Object object) throws NamingException { ! if (logger.isInfoEnabled()) { ! logger.info("Rebinding JNDI object with name [" + name + "]"); } execute(new JndiCallback() { --- 180,185 ---- */ public void rebind(final String name, final Object object) throws NamingException { ! if (logger.isDebugEnabled()) { ! logger.debug("Rebinding JNDI object with name [" + name + "]"); } execute(new JndiCallback() { *************** *** 196,201 **** */ public void unbind(final String name) throws NamingException { ! if (logger.isInfoEnabled()) { ! logger.info("Unbinding JNDI object with name [" + name + "]"); } execute(new JndiCallback() { --- 197,202 ---- */ public void unbind(final String name) throws NamingException { ! if (logger.isDebugEnabled()) { ! logger.debug("Unbinding JNDI object with name [" + name + "]"); } execute(new JndiCallback() { --- NEW FILE: TypeMismatchNamingException.java --- /* * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.jndi; import javax.naming.NamingException; /** * Exception thrown if a type mismatch is encountered for an object * located in a JNDI environment. Thrown by JndiTemplate. * * @author Juergen Hoeller * @since 1.2.8 * @see JndiTemplate#lookup(String, Class) */ public class TypeMismatchNamingException extends NamingException { /** * Construct a new TypeMismatchNamingException. * @param explanation the explanation text */ public TypeMismatchNamingException(String explanation) { super(explanation); } } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:23
|
Update of /cvsroot/springframework/spring/src/org/springframework/orm/hibernate/support In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/orm/hibernate/support Modified Files: Tag: mbranch-1-2 BlobStringType.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: BlobStringType.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/orm/hibernate/support/BlobStringType.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** BlobStringType.java 9 Jan 2006 22:46:03 -0000 1.1.2.2 --- BlobStringType.java 21 Apr 2006 00:13:49 -0000 1.1.2.3 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 79,84 **** byte[] bytes = lobHandler.getBlobAsBytes(rs, index); ! String encoding = getCharacterEncoding(); ! return (encoding != null ? new String(bytes, encoding) : new String(bytes)); } --- 79,89 ---- byte[] bytes = lobHandler.getBlobAsBytes(rs, index); ! if (bytes != null) { ! String encoding = getCharacterEncoding(); ! return (encoding != null ? new String(bytes, encoding) : new String(bytes)); ! } ! else { ! return null; ! } } *************** *** 86,93 **** throws SQLException, UnsupportedEncodingException { ! String str = (String) value; ! String encoding = getCharacterEncoding(); ! byte[] bytes = (encoding != null ? str.getBytes(encoding) : str.getBytes()); ! lobCreator.setBlobAsBytes(ps, index, bytes); } --- 91,103 ---- throws SQLException, UnsupportedEncodingException { ! if (value != null) { ! String str = (String) value; ! String encoding = getCharacterEncoding(); ! byte[] bytes = (encoding != null ? str.getBytes(encoding) : str.getBytes()); ! lobCreator.setBlobAsBytes(ps, index, bytes); ! } ! else { ! lobCreator.setBlobAsBytes(ps, index, null); ! } } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:22
|
Update of /cvsroot/springframework/spring/src/org/springframework/context/support In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/context/support Modified Files: Tag: mbranch-1-2 AbstractMessageSource.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: AbstractMessageSource.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/context/support/AbstractMessageSource.java,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -C2 -d -r1.19 -r1.19.2.1 *** AbstractMessageSource.java 6 Nov 2005 16:02:23 -0000 1.19 --- AbstractMessageSource.java 21 Apr 2006 00:13:48 -0000 1.19.2.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 68,71 **** --- 68,72 ---- public abstract class AbstractMessageSource implements HierarchicalMessageSource { + /** Logger available to subclasses */ protected final Log logger = LogFactory.getLog(getClass()); *************** *** 226,229 **** --- 227,231 ---- locale = Locale.getDefault(); } + Object[] argsToUse = args; if (!isAlwaysUseMessageFormat() && ObjectUtils.isEmpty(args)) { *************** *** 237,245 **** } } else { MessageFormat messageFormat = resolveCode(code, locale); if (messageFormat != null) { synchronized (messageFormat) { ! return messageFormat.format(resolveArguments(args, locale)); } } --- 239,253 ---- } } + else { + // Resolve arguments eagerly, for the case where the message + // is defined in a parent MessageSource but resolvable arguments + // are defined in the child MessageSource. + argsToUse = resolveArguments(args, locale); + MessageFormat messageFormat = resolveCode(code, locale); if (messageFormat != null) { synchronized (messageFormat) { ! return messageFormat.format(argsToUse); } } *************** *** 247,251 **** // Not found -> check parent, if any. ! return getMessageFromParent(code, args, locale); } --- 255,259 ---- // Not found -> check parent, if any. ! return getMessageFromParent(code, argsToUse, locale); } *************** *** 388,392 **** /** * Subclasses can override this method to resolve a message without ! * arguments in an optimized fashion, i.e. to resolve a message * without involving a MessageFormat. * <p>The default implementation <i>does</i> use MessageFormat, --- 396,400 ---- /** * Subclasses can override this method to resolve a message without ! * arguments in an optimized fashion, that is, to resolve a message * without involving a MessageFormat. * <p>The default implementation <i>does</i> use MessageFormat, |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:22
|
Update of /cvsroot/springframework/spring/src/org/springframework/mail/javamail In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/mail/javamail Modified Files: Tag: mbranch-1-2 JavaMailSenderImpl.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: JavaMailSenderImpl.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/mail/javamail/JavaMailSenderImpl.java,v retrieving revision 1.22 retrieving revision 1.22.4.1 diff -C2 -d -r1.22 -r1.22.4.1 *** JavaMailSenderImpl.java 12 Sep 2005 20:35:31 -0000 1.22 --- JavaMailSenderImpl.java 21 Apr 2006 00:13:49 -0000 1.22.4.1 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 79,83 **** protected final Log logger = LogFactory.getLog(getClass()); ! private Session session = Session.getInstance(new Properties()); private String protocol = DEFAULT_PROTOCOL; --- 79,83 ---- protected final Log logger = LogFactory.getLog(getClass()); ! private Session session = Session.getInstance(new Properties(), null); private String protocol = DEFAULT_PROTOCOL; *************** *** 117,121 **** */ public void setJavaMailProperties(Properties javaMailProperties) { ! this.session = Session.getInstance(javaMailProperties); } --- 117,121 ---- */ public void setJavaMailProperties(Properties javaMailProperties) { ! this.session = Session.getInstance(javaMailProperties, null); } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:04
|
Update of /cvsroot/springframework/spring/src/org/springframework/web/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/web/util Modified Files: Tag: mbranch-1-2 JavaScriptUtils.java NestedServletException.java WebUtils.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: WebUtils.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/web/util/WebUtils.java,v retrieving revision 1.29.2.1 retrieving revision 1.29.2.2 diff -C2 -d -r1.29.2.1 -r1.29.2.2 *** WebUtils.java 17 Jan 2006 21:29:36 -0000 1.29.2.1 --- WebUtils.java 21 Apr 2006 00:13:51 -0000 1.29.2.2 *************** *** 51,59 **** /** * Standard Servlet spec context attribute that specifies a temporary ! * directory for the current web application, of type java.io.File */ public static final String TEMP_DIR_CONTEXT_ATTRIBUTE = "javax.servlet.context.tempdir"; /** * HTML escape parameter at the servlet context level * (i.e. a context-param in <code>web.xml</code>): "defaultHtmlEscape". --- 51,65 ---- /** * Standard Servlet spec context attribute that specifies a temporary ! * directory for the current web application, of type <code>java.io.File</code>. */ public static final String TEMP_DIR_CONTEXT_ATTRIBUTE = "javax.servlet.context.tempdir"; /** + * Standard Servlet spec request attribute that implies that we're within an include + * request. Any of the attributes associated with include paths does the job here. + */ + private static final String INCLUDE_REQUEST_ATTRIBUTE = "javax.servlet.include.request_uri"; + + /** * HTML escape parameter at the servlet context level * (i.e. a context-param in <code>web.xml</code>): "defaultHtmlEscape". *************** *** 70,79 **** public static final String DEFAULT_WEB_APP_ROOT_KEY = "webapp.root"; - /* Key for the mutex session attribute */ - public static final String SESSION_MUTEX_ATTRIBUTE = WebUtils.class.getName() + ".MUTEX"; - /** Name suffixes in case of image buttons */ public static final String[] SUBMIT_IMAGE_SUFFIXES = {".x", ".y"}; /** --- 76,85 ---- public static final String DEFAULT_WEB_APP_ROOT_KEY = "webapp.root"; /** Name suffixes in case of image buttons */ public static final String[] SUBMIT_IMAGE_SUFFIXES = {".x", ".y"}; + /* Key for the mutex session attribute */ + public static final String SESSION_MUTEX_ATTRIBUTE = WebUtils.class.getName() + ".MUTEX"; + /** *************** *** 346,349 **** --- 352,367 ---- /** + * Determine whether the given request is an include request, + * that is, not a top-level HTTP request coming in from the outside. + * <p>Checks the presence of the "javax.servlet.include.request_uri" + * request attribute. Could check any request attribute that is only + * present in an include request. + * @param request current servlet request + */ + public static boolean isIncludeRequest(ServletRequest request) { + return (request.getAttribute(INCLUDE_REQUEST_ATTRIBUTE) != null); + } + + /** * Check if a specific input type="submit" parameter was sent in the request, * either via a button (directly with name) or via an image (name + ".x" or Index: NestedServletException.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/web/util/NestedServletException.java,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** NestedServletException.java 17 Sep 2005 17:05:34 -0000 1.2 --- NestedServletException.java 21 Apr 2006 00:13:51 -0000 1.2.4.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 59,62 **** --- 59,63 ---- } + /** * Return the nested cause, or <code>null</code> if none. *************** *** 75,85 **** */ public String getMessage() { ! if (getCause() == null) { ! return super.getMessage(); ! } ! else { ! return super.getMessage() + "; nested exception is " + getRootCause().getClass().getName() + ! ": " + getRootCause().getMessage(); } } --- 76,85 ---- */ public String getMessage() { ! String message = super.getMessage(); ! Throwable cause = getCause(); ! if (cause != null) { ! return message + "; nested exception is " + cause; } + return message; } *************** *** 94,97 **** --- 94,98 ---- else { ps.println(this); + ps.print("Caused by: "); getCause().printStackTrace(ps); } *************** *** 108,111 **** --- 109,113 ---- else { pw.println(this); + pw.print("Caused by: "); getCause().printStackTrace(pw); } Index: JavaScriptUtils.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/web/util/JavaScriptUtils.java,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** JavaScriptUtils.java 1 Aug 2005 09:52:27 -0000 1.3 --- JavaScriptUtils.java 21 Apr 2006 00:13:51 -0000 1.3.4.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 27,30 **** --- 27,31 ---- * * @author Juergen Hoeller + * @author Rob Harrop * @since 1.1.1 */ *************** *** 56,59 **** --- 57,63 ---- filtered.append("\\\\"); } + else if (c == '/') { + filtered.append("\\/"); + } else if (c == '\t') { filtered.append("\\t"); |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:04
|
Update of /cvsroot/springframework/spring/test/org/springframework/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/test/org/springframework/util Modified Files: Tag: mbranch-1-2 CollectionUtilsTests.java StringUtilsTests.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: StringUtilsTests.java =================================================================== RCS file: /cvsroot/springframework/spring/test/org/springframework/util/StringUtilsTests.java,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -C2 -d -r1.7.2.1 -r1.7.2.2 *** StringUtilsTests.java 2 Jan 2006 15:17:19 -0000 1.7.2.1 --- StringUtilsTests.java 21 Apr 2006 00:13:51 -0000 1.7.2.2 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 158,174 **** ! public void testUnqualify() throws Exception { String qualified = "i.am.not.unqualified"; assertEquals("unqualified", StringUtils.unqualify(qualified)); } ! public void testUncapitalize() throws Exception { String capitalized = "I am capitalized"; assertEquals("i am capitalized", StringUtils.uncapitalize(capitalized)); } ! public void testCapitalize() throws Exception { ! String capitalized = "i am not capitalized"; ! assertEquals("I am not capitalized", StringUtils.capitalize(capitalized)); } --- 158,230 ---- ! public void testQuote() { ! assertEquals("'myString'", StringUtils.quote("myString")); ! assertEquals("''", StringUtils.quote("")); ! assertNull(StringUtils.quote(null)); ! } ! ! public void testQuoteIfString() { ! assertEquals("'myString'", StringUtils.quoteIfString("myString")); ! assertEquals("''", StringUtils.quoteIfString("")); ! assertEquals(new Integer(5), StringUtils.quoteIfString(new Integer(5))); ! assertNull(StringUtils.quoteIfString(null)); ! } ! ! public void testUnqualify() { String qualified = "i.am.not.unqualified"; assertEquals("unqualified", StringUtils.unqualify(qualified)); } ! public void testCapitalize() { ! String capitalized = "i am not capitalized"; ! assertEquals("I am not capitalized", StringUtils.capitalize(capitalized)); ! } ! ! public void testUncapitalize() { String capitalized = "I am capitalized"; assertEquals("i am capitalized", StringUtils.uncapitalize(capitalized)); } ! public void testGetFilename() { ! assertEquals(null, StringUtils.getFilename(null)); ! assertEquals("", StringUtils.getFilename("")); ! assertEquals("myfile", StringUtils.getFilename("myfile")); ! assertEquals("myfile", StringUtils.getFilename("mypath/myfile")); ! assertEquals("myfile.", StringUtils.getFilename("myfile.")); ! assertEquals("myfile.", StringUtils.getFilename("mypath/myfile.")); ! assertEquals("myfile.txt", StringUtils.getFilename("myfile.txt")); ! assertEquals("myfile.txt", StringUtils.getFilename("mypath/myfile.txt")); ! } ! ! public void testGetFilenameExtension() { ! assertEquals(null, StringUtils.getFilenameExtension(null)); ! assertEquals(null, StringUtils.getFilenameExtension("")); ! assertEquals(null, StringUtils.getFilenameExtension("myfile")); ! assertEquals(null, StringUtils.getFilenameExtension("myPath/myfile")); ! assertEquals("", StringUtils.getFilenameExtension("myfile.")); ! assertEquals("", StringUtils.getFilenameExtension("myPath/myfile.")); ! assertEquals("txt", StringUtils.getFilenameExtension("myfile.txt")); ! assertEquals("txt", StringUtils.getFilenameExtension("mypath/myfile.txt")); ! } ! ! public void testStripFilenameExtension() { ! assertEquals(null, StringUtils.stripFilenameExtension(null)); ! assertEquals("", StringUtils.stripFilenameExtension("")); ! assertEquals("myfile", StringUtils.stripFilenameExtension("myfile")); ! assertEquals("mypath/myfile", StringUtils.stripFilenameExtension("mypath/myfile")); ! assertEquals("myfile", StringUtils.stripFilenameExtension("myfile.")); ! assertEquals("mypath/myfile", StringUtils.stripFilenameExtension("mypath/myfile.")); ! assertEquals("myfile", StringUtils.stripFilenameExtension("myfile.txt")); ! assertEquals("mypath/myfile", StringUtils.stripFilenameExtension("mypath/myfile.txt")); ! } ! ! public void testCleanPath() { ! assertEquals("mypath/myfile", StringUtils.cleanPath("mypath/myfile")); ! assertEquals("mypath/myfile", StringUtils.cleanPath("mypath\\myfile")); ! assertEquals("mypath/myfile", StringUtils.cleanPath("mypath/../mypath/myfile")); ! assertEquals("mypath/myfile", StringUtils.cleanPath("mypath/myfile/../../mypath/myfile")); ! assertEquals("../mypath/myfile", StringUtils.cleanPath("../mypath/myfile")); ! assertEquals("../mypath/myfile", StringUtils.cleanPath("../mypath/../mypath/myfile")); ! assertEquals("../mypath/myfile", StringUtils.cleanPath("mypath/../../mypath/myfile")); } *************** *** 219,222 **** --- 275,296 ---- + public void testSortStringArray() { + String[] input = new String[] {"myString2"}; + input = StringUtils.addStringToArray(input, "myString1"); + assertEquals("myString2", input[0]); + assertEquals("myString1", input[1]); + + StringUtils.sortStringArray(input); + assertEquals("myString1", input[0]); + assertEquals("myString2", input[1]); + } + + public void testRemoveDuplicateStrings() { + String[] input = new String[] {"myString2", "myString1", "myString2"}; + input = StringUtils.removeDuplicateStrings(input); + assertEquals("myString1", input[0]); + assertEquals("myString2", input[1]); + } + public void testSplitArrayElementsIntoProperties() { String[] input = new String[] {"key1=value1 ", "key2 =\"value2\""}; *************** *** 350,355 **** --- 424,433 ---- String suffix = "fOo"; + assertTrue(StringUtils.endsWithIgnoreCase("foo", suffix)); + assertTrue(StringUtils.endsWithIgnoreCase("Foo", suffix)); assertTrue(StringUtils.endsWithIgnoreCase("barfoo", suffix)); + assertTrue(StringUtils.endsWithIgnoreCase("barbarfoo", suffix)); assertTrue(StringUtils.endsWithIgnoreCase("barFoo", suffix)); + assertTrue(StringUtils.endsWithIgnoreCase("barBarFoo", suffix)); assertTrue(StringUtils.endsWithIgnoreCase("barfoO", suffix)); assertTrue(StringUtils.endsWithIgnoreCase("barFOO", suffix)); Index: CollectionUtilsTests.java =================================================================== RCS file: /cvsroot/springframework/spring/test/org/springframework/util/CollectionUtilsTests.java,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -C2 -d -r1.1.4.1 -r1.1.4.2 *** CollectionUtilsTests.java 9 Jan 2006 22:48:23 -0000 1.1.4.1 --- CollectionUtilsTests.java 21 Apr 2006 00:13:51 -0000 1.1.4.2 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 17,23 **** package org.springframework.util; ! import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; --- 17,26 ---- package org.springframework.util; ! import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; + import java.util.Hashtable; + import java.util.Iterator; + import java.util.LinkedList; import java.util.List; import java.util.Map; *************** *** 28,41 **** /** * @author Rob Harrop */ public class CollectionUtilsTests extends TestCase { public void testIsEmpty() { ! assertTrue(CollectionUtils.isEmpty((Set)null)); ! assertTrue(CollectionUtils.isEmpty((Map)null)); assertTrue(CollectionUtils.isEmpty(new HashMap())); assertTrue(CollectionUtils.isEmpty(new HashSet())); ! List list = new ArrayList(); list.add(new Object()); assertFalse(CollectionUtils.isEmpty(list)); --- 31,45 ---- /** * @author Rob Harrop + * @author Juergen Hoeller */ public class CollectionUtilsTests extends TestCase { public void testIsEmpty() { ! assertTrue(CollectionUtils.isEmpty((Set) null)); ! assertTrue(CollectionUtils.isEmpty((Map) null)); assertTrue(CollectionUtils.isEmpty(new HashMap())); assertTrue(CollectionUtils.isEmpty(new HashSet())); ! List list = new LinkedList(); list.add(new Object()); assertFalse(CollectionUtils.isEmpty(list)); *************** *** 46,48 **** --- 50,85 ---- } + public void testHasUniqueObject() { + List list = new LinkedList(); + list.add("myElement"); + list.add("myOtherElement"); + assertFalse(CollectionUtils.hasUniqueObject(list)); + + list = new LinkedList(); + list.add("myElement"); + assertTrue(CollectionUtils.hasUniqueObject(list)); + + list = new LinkedList(); + list.add("myElement"); + list.add(null); + assertFalse(CollectionUtils.hasUniqueObject(list)); + + list = new LinkedList(); + list.add(null); + list.add("myElement"); + assertFalse(CollectionUtils.hasUniqueObject(list)); + + list = new LinkedList(); + list.add(null); + list.add(null); + assertTrue(CollectionUtils.hasUniqueObject(list)); + + list = new LinkedList(); + list.add(null); + assertTrue(CollectionUtils.hasUniqueObject(list)); + + list = new LinkedList(); + assertFalse(CollectionUtils.hasUniqueObject(list)); + } + } |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:03
|
Update of /cvsroot/springframework/spring/test/org/springframework/jdbc/support In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/test/org/springframework/jdbc/support Modified Files: Tag: mbranch-1-2 NativeJdbcExtractorTests.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: NativeJdbcExtractorTests.java =================================================================== RCS file: /cvsroot/springframework/spring/test/org/springframework/jdbc/support/NativeJdbcExtractorTests.java,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -d -r1.4 -r1.4.4.1 *** NativeJdbcExtractorTests.java 25 Mar 2005 09:28:27 -0000 1.4 --- NativeJdbcExtractorTests.java 21 Apr 2006 00:13:51 -0000 1.4.4.1 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 33,36 **** --- 33,37 ---- /** * @author Andre Biryukov + * @author Juergen Hoeller */ public class NativeJdbcExtractorTests extends TestCase { *************** *** 107,112 **** MockControl stmtControl = MockControl.createControl(Statement.class); Statement stmt = (Statement) stmtControl.getMock(); stmt.getConnection(); ! stmtControl.setReturnValue(con); conControl.replay(); stmtControl.replay(); --- 108,115 ---- MockControl stmtControl = MockControl.createControl(Statement.class); Statement stmt = (Statement) stmtControl.getMock(); + con.getMetaData(); + conControl.setReturnValue(null, 2); stmt.getConnection(); ! stmtControl.setReturnValue(con, 1); conControl.replay(); stmtControl.replay(); |
From: Juergen H. <jho...@us...> - 2006-04-21 00:14:01
|
Update of /cvsroot/springframework/spring/test/org/springframework/orm/hibernate3/support In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/test/org/springframework/orm/hibernate3/support Modified Files: Tag: mbranch-1-2 LobTypeTests.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: LobTypeTests.java =================================================================== RCS file: /cvsroot/springframework/spring/test/org/springframework/orm/hibernate3/support/LobTypeTests.java,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** LobTypeTests.java 11 May 2005 12:34:54 -0000 1.3 --- LobTypeTests.java 21 Apr 2006 00:13:51 -0000 1.3.4.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 33,38 **** import junit.framework.TestCase; - import org.easymock.ArgumentsMatcher; import org.easymock.MockControl; import org.hibernate.SessionFactory; import org.hibernate.classic.Session; --- 33,38 ---- import junit.framework.TestCase; import org.easymock.MockControl; + import org.easymock.internal.ArrayMatcher; import org.hibernate.SessionFactory; import org.hibernate.classic.Session; *************** *** 239,242 **** --- 239,356 ---- } + public void testBlobStringType() throws Exception { + String content = "content"; + byte[] contentBytes = content.getBytes(); + lobHandler.getBlobAsBytes(rs, "column"); + lobHandlerControl.setReturnValue(contentBytes); + lobCreator.setBlobAsBytes(ps, 1, contentBytes); + lobCreatorControl.setMatcher(new ArrayMatcher()); + + lobHandlerControl.replay(); + lobCreatorControl.replay(); + + BlobStringType type = new BlobStringType(lobHandler, null); + assertEquals(1, type.sqlTypes().length); + assertEquals(Types.BLOB, type.sqlTypes()[0]); + assertEquals(String.class, type.returnedClass()); + assertTrue(type.equals("content", "content")); + assertEquals("content", type.deepCopy("content")); + assertFalse(type.isMutable()); + + assertEquals(content, type.nullSafeGet(rs, new String[] {"column"}, null)); + TransactionSynchronizationManager.initSynchronization(); + try { + type.nullSafeSet(ps, content, 1); + List synchs = TransactionSynchronizationManager.getSynchronizations(); + assertEquals(1, synchs.size()); + ((TransactionSynchronization) synchs.get(0)).beforeCompletion(); + ((TransactionSynchronization) synchs.get(0)).afterCompletion(TransactionSynchronization.STATUS_COMMITTED); + } + finally { + TransactionSynchronizationManager.clearSynchronization(); + } + } + + public void testBlobStringTypeWithNull() throws Exception { + lobHandler.getBlobAsBytes(rs, "column"); + lobHandlerControl.setReturnValue(null); + lobCreator.setBlobAsBytes(ps, 1, null); + + lobHandlerControl.replay(); + lobCreatorControl.replay(); + + BlobStringType type = new BlobStringType(lobHandler, null); + assertEquals(null, type.nullSafeGet(rs, new String[] {"column"}, null)); + TransactionSynchronizationManager.initSynchronization(); + try { + type.nullSafeSet(ps, null, 1); + List synchs = TransactionSynchronizationManager.getSynchronizations(); + assertEquals(1, synchs.size()); + ((TransactionSynchronization) synchs.get(0)).beforeCompletion(); + } + finally { + TransactionSynchronizationManager.clearSynchronization(); + } + } + + public void testBlobStringTypeWithJtaSynchronization() throws Exception { + MockControl tmControl = MockControl.createControl(TransactionManager.class); + TransactionManager tm = (TransactionManager) tmControl.getMock(); + MockJtaTransaction transaction = new MockJtaTransaction(); + tm.getStatus(); + tmControl.setReturnValue(Status.STATUS_ACTIVE, 1); + tm.getTransaction(); + tmControl.setReturnValue(transaction, 1); + + String content = "content"; + byte[] contentBytes = content.getBytes(); + lobHandler.getBlobAsBytes(rs, "column"); + lobHandlerControl.setReturnValue(contentBytes); + lobCreator.setBlobAsBytes(ps, 1, contentBytes); + lobCreatorControl.setMatcher(new ArrayMatcher()); + + lobHandlerControl.replay(); + lobCreatorControl.replay(); + + BlobStringType type = new BlobStringType(lobHandler, tm); + assertEquals(content, type.nullSafeGet(rs, new String[] {"column"}, null)); + tmControl.replay(); + type.nullSafeSet(ps, content, 1); + Synchronization synch = transaction.getSynchronization(); + assertNotNull(synch); + synch.beforeCompletion(); + synch.afterCompletion(Status.STATUS_COMMITTED); + tmControl.verify(); + } + + public void testBlobStringTypeWithJtaSynchronizationAndRollback() throws Exception { + MockControl tmControl = MockControl.createControl(TransactionManager.class); + TransactionManager tm = (TransactionManager) tmControl.getMock(); + MockJtaTransaction transaction = new MockJtaTransaction(); + tm.getStatus(); + tmControl.setReturnValue(Status.STATUS_ACTIVE, 1); + tm.getTransaction(); + tmControl.setReturnValue(transaction, 1); + + String content = "content"; + byte[] contentBytes = content.getBytes(); + lobHandler.getBlobAsBytes(rs, "column"); + lobHandlerControl.setReturnValue(contentBytes); + lobCreator.setBlobAsBytes(ps, 1, contentBytes); + lobCreatorControl.setMatcher(new ArrayMatcher()); + + lobHandlerControl.replay(); + lobCreatorControl.replay(); + + BlobStringType type = new BlobStringType(lobHandler, tm); + assertEquals(content, type.nullSafeGet(rs, new String[] {"column"}, null)); + tmControl.replay(); + type.nullSafeSet(ps, content, 1); + Synchronization synch = transaction.getSynchronization(); + assertNotNull(synch); + synch.afterCompletion(Status.STATUS_ROLLEDBACK); + tmControl.verify(); + } + public void testBlobByteArrayType() throws Exception { byte[] content = "content".getBytes(); *************** *** 337,348 **** lobHandlerControl.setReturnValue(new ByteArrayInputStream(baos.toByteArray())); lobCreator.setBlobAsBytes(ps, 1, baos.toByteArray()); ! lobCreatorControl.setMatcher(new ArgumentsMatcher() { ! public boolean matches(Object[] o1, Object[] o2) { ! return Arrays.equals((byte[]) o1[2], (byte[]) o2[2]); ! } ! public String toString(Object[] objects) { ! return null; ! } ! }); lobHandlerControl.replay(); --- 451,455 ---- lobHandlerControl.setReturnValue(new ByteArrayInputStream(baos.toByteArray())); lobCreator.setBlobAsBytes(ps, 1, baos.toByteArray()); ! lobCreatorControl.setMatcher(new ArrayMatcher()); lobHandlerControl.replay(); *************** *** 408,419 **** lobHandlerControl.setReturnValue(new ByteArrayInputStream(baos.toByteArray())); lobCreator.setBlobAsBytes(ps, 1, baos.toByteArray()); ! lobCreatorControl.setMatcher(new ArgumentsMatcher() { ! public boolean matches(Object[] o1, Object[] o2) { ! return Arrays.equals((byte[]) o1[2], (byte[]) o2[2]); ! } ! public String toString(Object[] objects) { ! return null; ! } ! }); lobHandlerControl.replay(); --- 515,519 ---- lobHandlerControl.setReturnValue(new ByteArrayInputStream(baos.toByteArray())); lobCreator.setBlobAsBytes(ps, 1, baos.toByteArray()); ! lobCreatorControl.setMatcher(new ArrayMatcher()); lobHandlerControl.replay(); *************** *** 453,464 **** lobHandlerControl.setReturnValue(new ByteArrayInputStream(baos.toByteArray())); lobCreator.setBlobAsBytes(ps, 1, baos.toByteArray()); ! lobCreatorControl.setMatcher(new ArgumentsMatcher() { ! public boolean matches(Object[] o1, Object[] o2) { ! return Arrays.equals((byte[]) o1[2], (byte[]) o2[2]); ! } ! public String toString(Object[] objects) { ! return null; ! } ! }); lobHandlerControl.replay(); --- 553,557 ---- lobHandlerControl.setReturnValue(new ByteArrayInputStream(baos.toByteArray())); lobCreator.setBlobAsBytes(ps, 1, baos.toByteArray()); ! lobCreatorControl.setMatcher(new ArrayMatcher()); lobHandlerControl.replay(); |
From: Juergen H. <jho...@us...> - 2006-04-21 00:13:58
|
Update of /cvsroot/springframework/spring/test/org/springframework/scheduling/timer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/test/org/springframework/scheduling/timer Modified Files: Tag: mbranch-1-2 TimerSupportTests.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: TimerSupportTests.java =================================================================== RCS file: /cvsroot/springframework/spring/test/org/springframework/scheduling/timer/TimerSupportTests.java,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -d -r1.4 -r1.4.4.1 *** TimerSupportTests.java 13 Aug 2005 11:41:00 -0000 1.4 --- TimerSupportTests.java 21 Apr 2006 00:13:51 -0000 1.4.4.1 *************** *** 1,11 **** /* * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 94,97 **** --- 94,103 ---- } + public void testPlainTimerFactoryBean() { + TimerFactoryBean tfb = new TimerFactoryBean(); + tfb.afterPropertiesSet(); + tfb.destroy(); + } + private static class TestTimerTask extends TimerTask { |