Why wouldn't we want this as a standard part of the framework? Also, it would be nice if the <log> operation included a line number in the log. -Adrian --- On Tue, 6/30/09, Adam Heath <[hidden email]> wrote: > From: Adam Heath <[hidden email]> > Subject: Re: svn commit: r790027 - /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java > To: [hidden email] > Date: Tuesday, June 30, 2009, 8:13 PM > [hidden email] > wrote: > > Author: doogie > > Date: Wed Jul 1 02:54:01 2009 > > New Revision: 790027 > > > > URL: http://svn.apache.org/viewvc?rev=790027&view=rev > > Log: > > Set the line number on the wrapped operation > instance. > > > > Modified: > > > ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java > > > > Modified: > ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java?rev=790027&r1=790026&r2=790027&view=diff > > > ============================================================================== > > --- > ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java > (original) > > +++ > ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java > Wed Jul 1 02:54:01 2009 > > @@ -857,6 +857,10 @@ > > > if > (UtilProperties.propertyValueEquals("webslinger-invoker.properties", > "wrap-calls", "true")) { > > > Wrap<MethodOperation> wrap = new > Wrap<MethodOperation>().fileName(simpleMethod.getLocationAndName()).wrappedClass(methodOp.getClass()); > > > wrap.wrap(methodOperationExecMethod); > > + > Object startLine = > curOperElem.getUserData("startLine"); > > + > if (startLine != null) { > > + > > wrap.lineNumber(((Integer) startLine).intValue()); > > + > } > > > methodOp = wrap.newInstance(new > Class<?>[] {Element.class, SimpleMethod.class}, new > Object[] {curOperElem, simpleMethod}); > > > } > > > methodOperations.add(methodOp); > > If one edits > framework/base/config/webslinger-invoker.properties, > setting wrap-calls=true, then if one has an exception > thrown in a > SimpleMethod operation, then one will get an exception > stack trace as > below: > > org.ofbiz.entity.GenericDelegator.createOrStore(GenericDelegator.java:871) > org.ofbiz.minilang.method.entityops.CreateValue.exec(CreateValue.java:76) > _$gen.file_58$.usr.share.ofbiz.applications.content.script.org.ofbiz.content.website.WebSiteServices_46$xml_35$createWebSiteRole.exec(file:/usr/share/ofbiz/applications/content/script/org/ofbiz/content/website/WebSiteServices.xml#createWebSiteRole:133) > org.ofbiz.minilang.SimpleMethod.runSubOps(SimpleMethod.java:926) > org.ofbiz.minilang.SimpleMethod.exec(SimpleMethod.java:744) > > > |
Adrian Crum wrote:
> Why wouldn't we want this as a standard part of the framework? Also, it would be nice if the <log> operation included a line number in the log. Because enabling it adds a stack frame to each operation. When several operations are called in series, this can add up. I don't care either way. |
In reply to this post by Adrian Crum-2
Hmm... let's say the simple method operations all kept line numbers in them. The exec method could catch all Exceptions, wrap the original Exception with a MiniLangException - which would also accept the method name and line number - and then throw the MiniLangException. You could still get a stack trace from that, right? -Adrian --- On Tue, 6/30/09, Adam Heath <[hidden email]> wrote: > From: Adam Heath <[hidden email]> > Subject: Re: svn commit: r790027 - /ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java > To: [hidden email] > Date: Tuesday, June 30, 2009, 8:27 PM > Adrian Crum wrote: > > Why wouldn't we want this as a standard part of the > framework? Also, it would be nice if the <log> > operation included a line number in the log. > > Because enabling it adds a stack frame to each > operation. When > several operations are called in series, this can add up. > > I don't care either way. > |
Adrian Crum wrote:
> Hmm... let's say the simple method operations all kept line numbers in them. The exec method could catch all Exceptions, wrap the original Exception with a MiniLangException - which would also accept the method name and line number - and then throw the MiniLangException. You could still get a stack trace from that, right? That would mean 2 ints or longs per object. Not to mention that each node also has 2 Integers. I think we should maybe have a combination of both. Seeing these things in the stack trace is extremely useful. You can see the path the call stack has taken, in addition to the final exception having embedded position information. |
Adam Heath wrote:
> Adrian Crum wrote: >> Hmm... let's say the simple method operations all kept line numbers in them. The exec method could catch all Exceptions, wrap the original Exception with a MiniLangException - which would also accept the method name and line number - and then throw the MiniLangException. You could still get a stack trace from that, right? > > That would mean 2 ints or longs per object. Not to mention that each > node also has 2 Integers. > > I think we should maybe have a combination of both. Seeing these > things in the stack trace is extremely useful. You can see the path > the call stack has taken, in addition to the final exception having > embedded position information. We could keep the object size small by having only a line number for each operation. The information won't be as detailed as what you have in webslinger, but at least it would be better than no line number at all. -Adrian |
In reply to this post by Adam Heath-2
On Jun 30, 2009, at 11:54 PM, Adam Heath wrote: > Adrian Crum wrote: >> Hmm... let's say the simple method operations all kept line numbers >> in them. The exec method could catch all Exceptions, wrap the >> original Exception with a MiniLangException - which would also >> accept the method name and line number - and then throw the >> MiniLangException. You could still get a stack trace from that, >> right? > > That would mean 2 ints or longs per object. Not to mention that each > node also has 2 Integers. > > I think we should maybe have a combination of both. Seeing these > things in the stack trace is extremely useful. You can see the path > the call stack has taken, in addition to the final exception having > embedded position information. This is a really cool extension and I think would be well worth the few (8 or 16 or whatever) extra bytes per object. Overall I don't think that would be too much memory. So yeah, I'm all for having it in and on by default... -David |
Free forum by Nabble | Edit this page |