Re: [BLOCKER] SQLTransformer bug 1594 - cause found

2013-01-20 Thread Francesco Chicchiriccò

On 19/01/2013 17:38, kompromiss wrote:

UPD: I added this:

/public String getAllText() {
 return this.buffer.toString();
 }/

into the TextRecorder.java, and this:

/public String endTextRecording()
 throws SAXException {
 sendEndPrefixMapping();

 TextRecorder recorder = (TextRecorder) removeRecorder();
 String text = recorder.getAllText();
 if (getLogger().isDebugEnabled()) {
 getLogger().debug("End text recording. Text=" + text);
 }
 return text;
 }/

into the SQLTransformer.class. After that I recompiled
cocoon-databases-impl-1.0.0.jar and cocoon-pipeline-impl-1.0.0.jar, and now
it works - spaces are not trimmed in substitute and ancestor variables.

Don't know, was it exactly right thing to do, but it works for now...


Hi,
nice catch! This could be even more interesting since 2.2 SQLTransformer 
was also ported to C3 and might be affected by the same problem.


Please file an issue on JIRA, possibly referencing the original issue in 
C2.1 (COCOON-1594), and the two mail threads you are referring to [1] 
[2]. Then attach a patch with your fix: please remember to generate your 
patch [3] against current SVN trunk [4].


Thanks!

[1] 
http://cocoon.10839.n7.nabble.com/BLOCKER-SQLTransformer-bug-1594-cause-found-td28461.html#a57549
[2] 
http://cocoon.10839.n7.nabble.com/sql-transformer-in-cocoon-2-2-td20170.html

[3] https://commons.apache.org/patches.html
[4] https://svn.apache.org/repos/asf/cocoon/trunk

--
Francesco Chicchiriccò

ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/



Re: [BLOCKER] SQLTransformer bug 1594 - cause found

2013-01-19 Thread kompromiss
UPD: I added this:

/public String getAllText() {
return this.buffer.toString();
}/

into the TextRecorder.java, and this:

/public String endTextRecording()
throws SAXException {
sendEndPrefixMapping();

TextRecorder recorder = (TextRecorder) removeRecorder();
String text = recorder.getAllText();
if (getLogger().isDebugEnabled()) {
getLogger().debug("End text recording. Text=" + text);
}
return text;
}/

into the SQLTransformer.class. After that I recompiled
cocoon-databases-impl-1.0.0.jar and cocoon-pipeline-impl-1.0.0.jar, and now
it works - spaces are not trimmed in substitute and ancestor variables.

Don't know, was it exactly right thing to do, but it works for now...



--
View this message in context: 
http://cocoon.10839.n7.nabble.com/BLOCKER-SQLTransformer-bug-1594-cause-found-tp28461p57549.html
Sent from the Cocoon - Dev mailing list archive at Nabble.com.


Re: [BLOCKER] SQLTransformer bug 1594 - cause found

2013-01-19 Thread kompromiss
Francesco, thank you for your answer. This old thread is all I could find
about problem with sql transformer.
Later I've found another piece of information - now it's clearly about
problem with cocoon 2.2 - and from 2009:

http://www.junlu.com/list/59/462718.html

I've compared source code for two classes - TextRecorder and SQLTransformer
- from cocoon 2.1.11 and 2.2.0.

2.1.11 - There is function getAllText in TextRecorder, and SQLTransformer
uses this function.
2.2.0 - there is no such function in TextRecorder.

I use maven 2.2.1.

Excerpt from my pom.xml:
...

  org.apache.cocoon
  cocoon-core
  2.2.0

...





--
View this message in context: 
http://cocoon.10839.n7.nabble.com/BLOCKER-SQLTransformer-bug-1594-cause-found-tp28461p57547.html
Sent from the Cocoon - Dev mailing list archive at Nabble.com.


Re: [BLOCKER] SQLTransformer bug 1594 - cause found

2013-01-19 Thread Francesco Chicchiriccò

On 18/01/2013 07:16, kompromiss wrote:

Hi All

I have this problem right now with cocoon 2.2 - swallowing spaces with
substitution and ancestor variables.
I've read about trimming text in class TextRecorder
(org.apache.cocoon.transformation.helpers)
Was the class TextRecorder in cocoon 2.2 fixed too?


Wow, that's an old thread from 2005!

I don't think that fix for mentioned issue [1] was applied to 2.2 
basically because I don't think that 2.2 existed at that time.
However, I'd think that SQLTransformer in 2.2 did originate from latest 
in 2.1, so I wouldn't expect that this issue is still there.


FYI, here's the latest 2.2.X SQLTransformer source code: [2]

HTH
Regards.

[1] https://issues.apache.org/jira/browse/COCOON-1594
[2] 
https://svn.apache.org/repos/asf/cocoon/trunk/blocks/cocoon-databases/cocoon-databases-impl/src/main/java/org/apache/cocoon/transformation/SQLTransformer.java


--
Francesco Chicchiriccò

ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/



Re: [BLOCKER] SQLTransformer bug 1594 - cause found

2013-01-17 Thread kompromiss
Hi All

I have this problem right now with cocoon 2.2 - swallowing spaces with
substitution and ancestor variables.
I've read about trimming text in class TextRecorder
(org.apache.cocoon.transformation.helpers)
Was the class TextRecorder in cocoon 2.2 fixed too?




--
View this message in context: 
http://cocoon.10839.n7.nabble.com/BLOCKER-SQLTransformer-bug-1594-cause-found-tp28461p57506.html
Sent from the Cocoon - Dev mailing list archive at Nabble.com.


Re: [BLOCKER] SQLTransformer bug 1594 - cause found

2005-11-02 Thread Jeremy Quinn

Thanks for your reply, Carsten,

I will do as you suggest.

best regards

Jeremy

On 2 Nov 2005, at 18:38, Carsten Ziegeler wrote:


Jeremy Quinn wrote:

On 2 Nov 2005, at 18:11, Jeremy Quinn wrote:



I can see two solutions to this bug :

1. remove the .trim() from the TextRecorder.getText() method, but I
do not know if something else relies on this.

2. Treat SQLTransformer.startSubstituteValueElement (and probably
startAncestorValueElement as well) as a special case, and always
add a space to the preceding text.


WDYT ?




I suppose another option would be to override
o.a.c.transformation.AbstractSAXTransformer.endTextRecording in
SQLTransformer, with a call to an alternative TextRecorder.getAllText
() method.

I'm getting old...I can't remember why the trim() was a "good  
think" :(
I think, we should do a fix which has as little impact as possible,  
so I
would vote for your last suggestion (getAllText()) for now. We can  
then
have a look at the TextRecorder and it's use after the 2.1.8  
release and

perhaps provide a "better bug fix" if possible.

Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/




smime.p7s
Description: S/MIME cryptographic signature


Re: [BLOCKER] SQLTransformer bug 1594 - cause found

2005-11-02 Thread Carsten Ziegeler
Jeremy Quinn wrote:
> On 2 Nov 2005, at 18:11, Jeremy Quinn wrote:
> 
> 
>>I can see two solutions to this bug :
>>
>>1. remove the .trim() from the TextRecorder.getText() method, but I  
>>do not know if something else relies on this.
>>
>>2. Treat SQLTransformer.startSubstituteValueElement (and probably  
>>startAncestorValueElement as well) as a special case, and always  
>>add a space to the preceding text.
>>
>>
>>WDYT ?
> 
> 
> 
> I suppose another option would be to override  
> o.a.c.transformation.AbstractSAXTransformer.endTextRecording in  
> SQLTransformer, with a call to an alternative TextRecorder.getAllText 
> () method.
> 
I'm getting old...I can't remember why the trim() was a "good think" :(
I think, we should do a fix which has as little impact as possible, so I
would vote for your last suggestion (getAllText()) for now. We can then
have a look at the TextRecorder and it's use after the 2.1.8 release and
perhaps provide a "better bug fix" if possible.

Carsten
-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/


Re: [BLOCKER] SQLTransformer bug 1594 - cause found

2005-11-02 Thread Jeremy Quinn


On 2 Nov 2005, at 18:11, Jeremy Quinn wrote:


I can see two solutions to this bug :

1. remove the .trim() from the TextRecorder.getText() method, but I  
do not know if something else relies on this.


2. Treat SQLTransformer.startSubstituteValueElement (and probably  
startAncestorValueElement as well) as a special case, and always  
add a space to the preceding text.



WDYT ?



I suppose another option would be to override  
o.a.c.transformation.AbstractSAXTransformer.endTextRecording in  
SQLTransformer, with a call to an alternative TextRecorder.getAllText 
() method.


regards Jeremy

smime.p7s
Description: S/MIME cryptographic signature