#23 Wrong Handling of Exceptions which are missing line feeds

openMDX_v1
open
Harry
5
2012-07-22
2006-11-08
No

class: org.openmdx.kernel.exception.BasicException
method: breakupStackTraceAtParsing()

Problem:
If posEnd returns "-1" because there is no line feed
the else branch altough tries to get substring between
position 0 and -1, this results in
"StringOutOfBoundException".

Fix(Idea):
Better return original Exception when the format of the
Exception isn't as expected than trying to wrap it
generally.
That could be prooved
org.openmdx.base.exception.RuntimeServiceException
->RuntimeServiceException(Exception exception)
Here is the last code segement where the unwrapped
exception i still known.

Buggy Code:
while((posEnd != -1) && (posStart < stackTraceLen)) {
posEnd = stackTrace.indexOf('\n', posStart);
if (posEnd != -1) {
entry = stackTrace.substring(posStart, posEnd);
posStart = posEnd + 1;
}
else {
entry = stackTrace.substring(posStart, posEnd);
}
Exception StackTrace:

org.openmdx.base.exception.ServiceExceptionnull at
org.openmdx.compatibility.base.application.j2ee.SessionBean_1.ejbCreate(SessionBean_1.java:159)null
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)null at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)null
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)null
at
java.lang.reflect.Method.invoke(Method.java:324)null
at
org.openmdx.kernel.application.container.spi.ejb.BeanInstanceFactory.makeObject(BeanInstanceFactory.java:120)null
at
org.openmdx.uses.org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:816)null
at
org.openmdx.application.ejb.lightweight.AbstractEJBHome.acquireBeanInstance(AbstractEJBHome.java:111)null
at
org.openmdx.application.ejb.lightweight.AbstractEJBObject$Action.invoke(AbstractEJBObject.java:203)null
at
org.openmdx.compatibility.application.dataprovider.transport.ejb.lightweight.Dataprovider_1_0RemoteImpl.process(Dataprovider_1_0RemoteImpl.java:127)null
at
org.openmdx.compatibility.application.dataprovider.transport.ejb.cci.Dataprovider_1_0RemoteConnection.process(Dataprovider_1_0RemoteConnection.java:145)null
at
org.openmdx.compatibility.base.dataprovider.cci.RequestCollection.dispatch(RequestCollection.java:1347)null
at
org.openmdx.compatibility.base.dataprovider.cci.RequestCollection.dispatch(RequestCollection.java:1322)null
at
org.openmdx.compatibility.base.dataprovider.cci.RequestCollection.dispatch(RequestCollection.java:1288)null
at
org.openmdx.compatibility.base.dataprovider.cci.RequestCollection.addGetRequest(RequestCollection.java:341)null
at
org.openmdx.compatibility.base.dataprovider.transport.adapter.Provider_1.getDefaultFetchGroup(Provider_1.java:390)null
at
org.openmdx.compatibility.base.dataprovider.transport.delegation.Object_1.load(Object_1.java:435)null
at
org.openmdx.compatibility.base.dataprovider.transport.delegation.Object_1.assertObjectIsAccessible(Object_1.java:1564)null
at
org.openmdx.compatibility.base.dataprovider.transport.delegation.Object_1.objGetClass(Object_1.java:219)null
at
org.openmdx.base.accessor.generic.spi.DelegatingObject_1.objGetClass(DelegatingObject_1.java:165)null
at
org.openmdx.base.accessor.jmi.spi.RefRootPackage_1$RefObject_1Marshaller.createMarshalledObject(RefRootPackage_1.java:517)null
at
org.openmdx.compatibility.base.marshalling.CachingMarshaller.marshal(CachingMarshaller.java:209)null
at
org.openmdx.base.accessor.jmi.spi.RefRootPackage_1.marshal(RefRootPackage_1.java:275)null
at
org.openmdx.base.accessor.jmi.spi.RefContainer_1.get(RefContainer_1.java:208)null
at
org.openmdx.base.accessor.jmi.spi.RefObject_1.refGetValue(RefObject_1.java:1375)null
at
org.openmdx.base.cci.ProviderImpl.getSegment(ProviderImpl.java:69)null
at
de.corag.commission.abrechnung1.openmdx.AbrechnungSearchHelper.searchVermittler(AbrechnungSearchHelper.java:129)null
at
de.corag.commission.batch.module.AbrechnungBatchModul.process(AbrechnungBatchModul.java:154)null
at
de.corag.commission.batch.AbrechnungBatch.executeBatch(AbrechnungBatch.java:195)null
at
de.corag.ir.commission.batch.AbrechnungBatchIR.executeBatch(AbrechnungBatchIR.java:81)null
at
de.corag.ir.regressiontest.batch.AbstractBatchTest.execBatch(AbstractBatchTest.java:43)null
at
de.corag.ir.regressiontest.batch.AbrAbrechnungsTest.runBatch(AbrAbrechnungsTest.java:47)null
at
de.corag.ir.regressiontest.batch.AbstractBatchTest.testBatch(AbstractBatchTest.java:56)null
at
de.corag.ir.regressiontest.batch.BatchTestController.process(BatchTestController.java:133)null
at
de.corag.ir.regressiontest.batch.BatchTestController.main(BatchTestController.java:227)null

Discussion


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks