Re: [digester] Multiple paths mapped to one object
Hi Jan, looks like you stumbled in a weird bug that requires more time for me to get it adjusted - can you switch to rules binder ATM until I come up with a fix? TIA, Alles Gute! -Simo http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi On Thu, Mar 6, 2014 at 5:26 PM, Jan Fröhlich jan.froehl...@infomotion.de wrote: Hi Simo, I created a small maven project with 2 test cases inside. One works but is ugly, the other fails but would be great. As I don't want to spam this mailing list I uploaded it to our webserver as ZIP file. You can download it from http://www.infomotion.de/download/objectcreate-test.zip I didn't comment it at all, but tried to give it speaking names. Looking forward for your feedback. Thank you for your help so far! Jan -Ursprüngliche Nachricht- Von: simone.trip...@gmail.com [mailto:simone.trip...@gmail.com] Im Auftrag von Simone Tripodi Gesendet: Donnerstag, 6. März 2014 16:43 An: Commons Users List Betreff: Re: [digester] Multiple paths mapped to one object Hi Jan, could you submit a testcase, please? I will have a look at it and get back with a solution ASAP :) Alles Gute, -Simo http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi On Thu, Mar 6, 2014 at 1:09 PM, Jan Fröhlich jan.froehl...@infomotion.dewrote: Hi Simone, this is something I already tried. First: With a single @ObjectCreate for each table it works fine. Then: Changing only to @ObjectCreate.List - without any other modifications I get an error saying that there is no setter Method in the table class. Second: The @SetProperty attribute pattern is mandatory. Maybe this is something version dependent? I use dependency groupIdorg.apache.commons/groupId artifactIdcommons-digester3/artifactId version3.2/version /dependency Jan -Ursprüngliche Nachricht- Von: simone.trip...@gmail.com [mailto:simone.trip...@gmail.com] Im Auftrag von Simone Tripodi Gesendet: Donnerstag, 6. März 2014 12:05 An: Commons Users List Betreff: Re: [digester] Multiple paths mapped to one object Hi Jan, there's no kind of magic, just annotate the class fields as: @ObjectCreate.List(value = { @ObjectCreate(pattern = */HTABLE), @ObjectCreate(pattern = */VTABLE), @ObjectCreate(pattern = */XTABLE) }) public class Table { @SetProperty // you can omit the 'attributeName' since it is the same as in the attribute private String name; @SetProperty(attributeName = x) private Long posX; @SetProperty(attributeName = y) private Long posY; @BeanPropertySetter(pattern = */rows) private Long rows; } please let us know if it works! :) Alles Gute! -Simo http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi On Wed, Mar 5, 2014 at 11:55 AM, Jan Fröhlich jan.froehl...@infomotion.dewrote: Hi all, given an XML with something like REPORT XTABLE name=Table1 x=1200 y=2250 rows10/rows /XTABLE VTABLE name=Table2 x=1400 y=2250 rows14/rows /VTABLE HTABLE name=Table3 x=1600 y=2250 rows17/rows /HTABLE /REPORT I would like to map all nodes (XTABLE, VTABLE and HTABLE) to one class Table and set the properties. While learning digester I created a class for each tag, but now I want to improve that. For the class itself the following should work @ObjectCreate.List(value = { @ObjectCreate(pattern = */HTABLE), @ObjectCreate(pattern = */VTABLE), @ObjectCreate(pattern = */XTABLE) }) public class Table { private String name; private Long posX; private Long posY; private Long rows; } But how should I annotate the properties as I have to set the pattern attribute to all @SetProperty annotations and the pattern is different for all of them. Any help appreciated. Jan - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] Multiple paths mapped to one object
sorry to reply a little late, I've been quiet busy during the WE I am having a look at your test case tonight, stay tuned! Alles Gute, -Simo http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi On Thu, Mar 6, 2014 at 5:26 PM, Jan Fröhlich jan.froehl...@infomotion.dewrote: Hi Simo, I created a small maven project with 2 test cases inside. One works but is ugly, the other fails but would be great. As I don't want to spam this mailing list I uploaded it to our webserver as ZIP file. You can download it from http://www.infomotion.de/download/objectcreate-test.zip I didn't comment it at all, but tried to give it speaking names. Looking forward for your feedback. Thank you for your help so far! Jan -Ursprüngliche Nachricht- Von: simone.trip...@gmail.com [mailto:simone.trip...@gmail.com] Im Auftrag von Simone Tripodi Gesendet: Donnerstag, 6. März 2014 16:43 An: Commons Users List Betreff: Re: [digester] Multiple paths mapped to one object Hi Jan, could you submit a testcase, please? I will have a look at it and get back with a solution ASAP :) Alles Gute, -Simo http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi On Thu, Mar 6, 2014 at 1:09 PM, Jan Fröhlich jan.froehl...@infomotion.de wrote: Hi Simone, this is something I already tried. First: With a single @ObjectCreate for each table it works fine. Then: Changing only to @ObjectCreate.List - without any other modifications I get an error saying that there is no setter Method in the table class. Second: The @SetProperty attribute pattern is mandatory. Maybe this is something version dependent? I use dependency groupIdorg.apache.commons/groupId artifactIdcommons-digester3/artifactId version3.2/version /dependency Jan -Ursprüngliche Nachricht- Von: simone.trip...@gmail.com [mailto:simone.trip...@gmail.com] Im Auftrag von Simone Tripodi Gesendet: Donnerstag, 6. März 2014 12:05 An: Commons Users List Betreff: Re: [digester] Multiple paths mapped to one object Hi Jan, there's no kind of magic, just annotate the class fields as: @ObjectCreate.List(value = { @ObjectCreate(pattern = */HTABLE), @ObjectCreate(pattern = */VTABLE), @ObjectCreate(pattern = */XTABLE) }) public class Table { @SetProperty // you can omit the 'attributeName' since it is the same as in the attribute private String name; @SetProperty(attributeName = x) private Long posX; @SetProperty(attributeName = y) private Long posY; @BeanPropertySetter(pattern = */rows) private Long rows; } please let us know if it works! :) Alles Gute! -Simo http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi On Wed, Mar 5, 2014 at 11:55 AM, Jan Fröhlich jan.froehl...@infomotion.dewrote: Hi all, given an XML with something like REPORT XTABLE name=Table1 x=1200 y=2250 rows10/rows /XTABLE VTABLE name=Table2 x=1400 y=2250 rows14/rows /VTABLE HTABLE name=Table3 x=1600 y=2250 rows17/rows /HTABLE /REPORT I would like to map all nodes (XTABLE, VTABLE and HTABLE) to one class Table and set the properties. While learning digester I created a class for each tag, but now I want to improve that. For the class itself the following should work @ObjectCreate.List(value = { @ObjectCreate(pattern = */HTABLE), @ObjectCreate(pattern = */VTABLE), @ObjectCreate(pattern = */XTABLE) }) public class Table { private String name; private Long posX; private Long posY; private Long rows; } But how should I annotate the properties as I have to set the pattern attribute to all @SetProperty annotations and the pattern is different for all of them. Any help appreciated. Jan - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] Multiple paths mapped to one object
Hi Jan, there's no kind of magic, just annotate the class fields as: @ObjectCreate.List(value = { @ObjectCreate(pattern = */HTABLE), @ObjectCreate(pattern = */VTABLE), @ObjectCreate(pattern = */XTABLE) }) public class Table { @SetProperty // you can omit the 'attributeName' since it is the same as in the attribute private String name; @SetProperty(attributeName = x) private Long posX; @SetProperty(attributeName = y) private Long posY; @BeanPropertySetter(pattern = */rows) private Long rows; } please let us know if it works! :) Alles Gute! -Simo http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi On Wed, Mar 5, 2014 at 11:55 AM, Jan Fröhlich jan.froehl...@infomotion.dewrote: Hi all, given an XML with something like REPORT XTABLE name=Table1 x=1200 y=2250 rows10/rows /XTABLE VTABLE name=Table2 x=1400 y=2250 rows14/rows /VTABLE HTABLE name=Table3 x=1600 y=2250 rows17/rows /HTABLE /REPORT I would like to map all nodes (XTABLE, VTABLE and HTABLE) to one class Table and set the properties. While learning digester I created a class for each tag, but now I want to improve that. For the class itself the following should work @ObjectCreate.List(value = { @ObjectCreate(pattern = */HTABLE), @ObjectCreate(pattern = */VTABLE), @ObjectCreate(pattern = */XTABLE) }) public class Table { private String name; private Long posX; private Long posY; private Long rows; } But how should I annotate the properties as I have to set the pattern attribute to all @SetProperty annotations and the pattern is different for all of them. Any help appreciated. Jan
Re: [digester] Multiple paths mapped to one object
Hi Jan, could you submit a testcase, please? I will have a look at it and get back with a solution ASAP :) Alles Gute, -Simo http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi On Thu, Mar 6, 2014 at 1:09 PM, Jan Fröhlich jan.froehl...@infomotion.dewrote: Hi Simone, this is something I already tried. First: With a single @ObjectCreate for each table it works fine. Then: Changing only to @ObjectCreate.List - without any other modifications I get an error saying that there is no setter Method in the table class. Second: The @SetProperty attribute pattern is mandatory. Maybe this is something version dependent? I use dependency groupIdorg.apache.commons/groupId artifactIdcommons-digester3/artifactId version3.2/version /dependency Jan -Ursprüngliche Nachricht- Von: simone.trip...@gmail.com [mailto:simone.trip...@gmail.com] Im Auftrag von Simone Tripodi Gesendet: Donnerstag, 6. März 2014 12:05 An: Commons Users List Betreff: Re: [digester] Multiple paths mapped to one object Hi Jan, there's no kind of magic, just annotate the class fields as: @ObjectCreate.List(value = { @ObjectCreate(pattern = */HTABLE), @ObjectCreate(pattern = */VTABLE), @ObjectCreate(pattern = */XTABLE) }) public class Table { @SetProperty // you can omit the 'attributeName' since it is the same as in the attribute private String name; @SetProperty(attributeName = x) private Long posX; @SetProperty(attributeName = y) private Long posY; @BeanPropertySetter(pattern = */rows) private Long rows; } please let us know if it works! :) Alles Gute! -Simo http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi On Wed, Mar 5, 2014 at 11:55 AM, Jan Fröhlich jan.froehl...@infomotion.dewrote: Hi all, given an XML with something like REPORT XTABLE name=Table1 x=1200 y=2250 rows10/rows /XTABLE VTABLE name=Table2 x=1400 y=2250 rows14/rows /VTABLE HTABLE name=Table3 x=1600 y=2250 rows17/rows /HTABLE /REPORT I would like to map all nodes (XTABLE, VTABLE and HTABLE) to one class Table and set the properties. While learning digester I created a class for each tag, but now I want to improve that. For the class itself the following should work @ObjectCreate.List(value = { @ObjectCreate(pattern = */HTABLE), @ObjectCreate(pattern = */VTABLE), @ObjectCreate(pattern = */XTABLE) }) public class Table { private String name; private Long posX; private Long posY; private Long rows; } But how should I annotate the properties as I have to set the pattern attribute to all @SetProperty annotations and the pattern is different for all of them. Any help appreciated. Jan - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] XML rules, set-properties-rule, and ignoring missing properties
Hi Paul, thanks a lot for reporting, very appreciated. Can you fill a JIRA issue for that? As a Digester best practice, I suggest you to not go through the XML rules definition but, if you need a more compact way to express rules, refer to rules binder, which is pretty faster than mapping the XML document to rules. HTH, best, -Simo [1] http://commons.apache.org/proper/commons-digester/guide/binder.html http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi On Fri, Feb 28, 2014 at 5:57 PM, paul anderson paulanderson...@yahoo.comwrote: The javadoc on SetPropertiesRule: isIgnoreMissingProperty()Are attributes found in the xml without matching properties to be ignored? implies that one should be able to write a rule such as ***set-properties-rule ignoreMissingProperty=true/*** or ***set-properties-rule ignoreMissingProperties=true/*** but obviously these don't work. Surely it's a common use-case to want to digest arbitrarily complex XML without needing to specify one by one every attribute you don't care about? Requiring a user to catalog an exhaustive set of attributes all over their digester rules creates an extraordinary burden and would also clutter the rules as to make them near unreadable. Unless memory fails me, Digester used to silently ignore missing properties, so it seems we've lost something since then. Seems that either of the options marked *** would be a better solution than having scores of ignore-elements all over the place: set-properties-rule ignore attr-name=Id/ ignore attr-name=Address/ ignore attr-name=email/ ignore attr-name=favoriteBreakfast/ ignore attr-name=likesApples/ ignore attr-name=likesPeaches/ /set-properties-rule What is more, when the XML schema is extended to add attributes (common occurrence) this pattern of fail unless explicitly ignored causes a maintenance nightmare.
Re: [digester] Annotations handled multiple times
Hi Lars, please apologize for the late reply - could you please submit a testcase that proves the bug and fill an issue on JIRA? Many thanks in advance, all the best! -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Tue, Apr 30, 2013 at 6:13 PM, Lars Francke lars.fran...@gmail.com wrote: Hi, I'm using the Digester Annotations and everything works pretty well (looking forward to 3.3 for DIGESTER-174). We have a model where we share a contact class and have that annotated with an @ObjectCreate.List because it can live under multiple different elements and a tree-like structure where the top level element contains other elements that in turn have contacts. Here's a simplified version of the schema: A(/a) has B(/a/b) A(/a) has C(/a/c) B has D(/a/b/d + /a/c/d) C has D(/a/b/d + /a/c/d) The problem now is that the AnnotationHandler processes the D element multiple times because it's being reached through multiple branches of the tree, thus creating multiple instances of the ObjectCreateRule which are all fired and obviously screw up the stack. To me this seems like a bug and the AnnotationHandlers should check if they have already visited an element. I'm happy to file a JIRA but I wasn't sure if this might not be intended behavior for some reason I don't understand yet. Also: I might be completely wrong in my diagnosis of this problem. Any help is greatly appreciated. Cheers, Lars - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [fileupload] Expected encoding for Content-disposition 'filename' parameter
Hi Jaime, FILEUPLOAD-199 has been fixed on trunk, do you have the chance to give a try with current development version, by recompiling it by yourself? Many thanks in advance, all the best! -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] wildcard in plugin rules
Hi Lianna, please apologise for the late reply - I am quiet busy at work during these months. The sample you provided is not clear to me, there are details I can't immagine how they are implemented, I suggest you anyway to have a look at the TestCase implementation I gave for you[1], both tests pass now. For patterns configurations I suggest you to have a look at the core document[2] HTH, all the best! -Simo [1] https://gist.github.com/simonetripodi/5006064 [2] http://commons.apache.org/digester/guide/core.html http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Mon, Feb 11, 2013 at 12:59 PM, Kim Ragna Mertens kim.mert...@mertens-nord.de wrote: Hi, I try to use digester to parse something like : ptwebltl nottrue//not /ptwebltl I have created a plugin for ptwebltl, containing the following rules : pattern = ptwebltl d.addObjectCreate(pattern+/*/true, TRUE.class); // (1) d.addSetNext(pattern+/*/true, addFormula); d.addObjectCreate(pattern + /true, TRUE.class); //(2) d.addSetNext(pattern + /true, addFormula); d.addObjectCreate(pattern + /not, NOT.class); d.addSetNext(pattern + /not, addFormula); now I am able to parse with the (2) block something like ptwebltl true/ /ptwebltl but unfortunately the first rule block does not work, no rule is found for the pattern ptwebltl/not/true Is it possible to use wildcards in pluginrules ? If I write a rule like d.addObjectCreate(*/true, TRUE.class) I got the warning that a rule is specified that matches a pattern possible outside the plugin scope, If I do not use plugins, the rule work for creating a TRUE - Object whenever it is read in the xml file. How do I achieve the simular behavior in the plugin ? Thanks Lianna - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: SSL Self-signed certificate problem JDK1.5
Hi Susanta, The commons-httpclient is no longer maintained as commons component, it has a new home at HTTPComponents in ASF - I suggest you posting the question in the proper ML[1]. HTH, -Simo [1] http://hc.apache.org/httpclient-3.x/mail-lists.html http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Fri, Sep 7, 2012 at 9:39 PM, Susanta Mohapatra mohapatra.susa...@gmail.com wrote: Hi all, I am trying to import a self-signed certificate into the default java keystore cacerts ( Java version 1.5 ). The certificate is imported successfully but when I try to use HttpClient library to connect to the server, I run into the error sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target javax.net.ssl.SSLHandshakeException com.sun.net.ssl.internal.ssl.Alerts:getSSLException I found some articles by googling that you need to make a new jks keystore by importing the self-signed certificate. But I want to do it on the default keystore cacerts. I don't want to relax the constraints of certificate checks at client side. Please help me out with the correct solution for the issue. Thanks Susanta - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [VFS] SCM File System Support?
I like the idea! while for git there's Jgit[1] available - EPL licensed that's ALv2 license compatible - for svn the only pure svn java library that I know is svnkit which has a more restrictive TMate license[2] and I am not sure it is ALv2 compatible since not mentioned in category A license[3]. Are you aware of any alternative? TIA, all the best, -Simo [1] http://www.eclipse.org/jgit/ [2] http://svnkit.com/license.html [3] http://www.apache.org/legal/resolved.html#category-a http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Thu, Aug 30, 2012 at 9:01 PM, Mark Fortner phidia...@gmail.com wrote: I noticed that there's a dependency on the SCM project, and I was wondering if SCMs are now supported as file systems? It would be nice to be able to browse git and subversion repositories. Cheers, Mark - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Apache commons validator, bean properties to validate should all be string?
I would suggest you to have a look at Apache BVal[1] for Bean Validation - it is a JSR303 implementation - that sounds more appropriate for your use case. HTH, -Simo [1] http://bval.apache.org/ http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Mon, Aug 20, 2012 at 3:41 AM, pirzada rashid pirzada.ras...@gmail.com wrote: Anyone please help On Fri, Aug 17, 2012 at 7:05 PM, pirzada rashid pirzada.ras...@gmail.comwrote: I was working on apache commons validator latest. Problem explained below. My Bean is having 2 properties fullName (String) age (int). Validation required on both but age needed to be checked for integer as well. bean.setFullName(Tester); - Will Pass bean.setAge(Too Old); --- required Pass but integer Fail. results = validator.validate(); *Note:* Above is possible if age property is String but its not and setAge won't accept String value and throw exception before reaching validator.validate(). Validation should be checked before we set the bean. In above situation I need to make all properties string than in validation.xml check for integer/condition. *How I work with this when my age property is Integer. little confused?* - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: errors parsing soap
Hi Terry, could you share please your Digester configuration, please? That would be easier for me to provide feedbacks! TIA, all the best, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Wed, Jul 25, 2012 at 5:05 PM, Terry Gardner tgardner1...@gmail.com wrote: When using Digester to parse an XML document that looks like this: soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/ /soap:Envelope The following error is logged: Document root element soap:Envelope, must match DOCTYPE root null. What must be done to overcome this? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[ANN] Apache Commons DbUtils 1.5 Released!
Hi all, The Apache Commons Team is pleased to announce the immediate availability of Apache Commons DbUtils 1.5! The Apache Commons-DbUtils package is a set of Java utility classes for easing JDBC development, version 1.5 contains a number of improvements and bug fixes: Bug [DBUTILS-73] - .BasicRowProcessor.CaseInsensitiveHashMap uses default Locale for toLowerCase [DBUTILS-77] - drop view does not work from QueryRunner.update with SQLServer JDBC drivers. Same SQL works with a PreparedStatement just fine. [DBUTILS-93] - Source assembly artifact fails to build a site because of missing pmd-ruleset.xml Improvement [DBUTILS-66] - ScalarHandler, ColumnHandler and KeyedHandler are missing generics [DBUTILS-84] - BeanProcessor method processColumn should take SQLXML in consideration [DBUTILS-91] - Enhance BasicRowProcessor to have row mapping easier to configure New Feature [DBUTILS-67] - Add a BeanMapHandler [DBUTILS-76] - New handler StringColumnListHandler Task [DBUTILS-88] - Make AsyncQueryRunner be a decorator around a QueryRunner Test [DBUTILS-94] - Provide test coverage for org.apache.commons.dbutils.DbUtils Apache Commons DbUtils is available in source form from the following download page: http://commons.apache.org/dbutils/download_dbutils.cgi When downloading from a mirror site, please remember to verify the downloads using signatures found on the Apache site: http://www.apache.org/dist/commons/KEYS Apache Commons DbUtils is also available in binary form or for use using Maven 2 from the Central Maven Repository: http://repo1.maven.org/maven2/commons-dbutils/commons-dbutils For more information on Apache Commons DbUtils, visit the project home page: http://commons.apache.org/dbutils/ Have fun! - Simo, on behalf of the Apache Commons PMC http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Digester crashes in run mode and succeeds with java debugger
Hi Stepan, I guess that in debug mode, inside your IDE JVM, the invoked method is public void setFf(String date); OTOH, when running from console, log clearly show that JVM invokes public void setFf(Date date); You have two options: * drop the Date argument support (less good, IMHO); * Rely on Date only and configure BeanUtils doing its job - the Digester relies on BeanUtils to perform text to Java object unmarshalling, so for Date type you have to plug the needed converter. (which is a better/cleaner approach) Have a look at Data Type Conversions[1] to understand how to convert the extracted XML body text to Date; basically you have to instantiate a DateConverter[2] and register it via the ConvertUtils.html#register()[3] method. The Digester will do the rest. HTH and don't hesitate on writing back to the ML if needed! All the best, -Simo [1] http://commons.apache.org/beanutils/v1.8.3/apidocs/org/apache/commons/beanutils/package-summary.html#conversion [2] http://commons.apache.org/beanutils/v1.8.3/apidocs/org/apache/commons/beanutils/converters/DateConverter.html [3] http://commons.apache.org/beanutils/v1.8.3/apidocs/org/apache/commons/beanutils/ConvertUtils.html#register(org.apache.commons.beanutils.Converter,java.lang.Class) http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Mon, Jul 16, 2012 at 4:11 AM, Stepan Yakovenko stiv.pub...@gmail.com wrote: HI I've got application that uses digerster. There is a bean with two setters: public void setFf(String date); public void setFf(Date date); Crash happens here: org.apache.commons.beanutils.ConversionException: DateConverter does not support default String to 'Date' conversion. at org.apache.commons.beanutils.converters.DateTimeConverter.toDate(DateTimeConverter.java:468) at org.apache.commons.beanutils.converters.DateTimeConverter.convertToType(DateTimeConverter.java:343) at org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:156) at org.apache.commons.beanutils.converters.ConverterFacade.convert(ConverterFacade.java:60) at org.apache.commons.beanutils.ConvertUtilsBean.convert(ConvertUtilsBean.java:470) at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1014) at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:831) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:433) at org.apache.commons.digester3.SetPropertiesRule.begin(SetPropertiesRule.java:232) at org.apache.commons.digester3.Digester.startElement(Digester.java:1350) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.commons.digester3.Digester.parse(Digester.java:1642) (line numbers may slightly deviate because I've added tracing printlns) When I try to debug this, no crash happens. Is this a known issue? Thanx. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] Reading in Enums
Hi Neil, apologize for the late reply - the Digester relies on BeanUtils to perform text to Java object unmarshalling, so for your enumeration(s) type you have to plug the needed converter. Have a look at Data Type Conversions[1] to understand how to convert the extracted XML body text to OneDBarcodeFormat; basically you have to implement the Converter[2] interface and register it via the ConvertUtils.html#register()[3] method. The Digester will do the rest. HTH and don't hesitate on writing back to the ML if needed! All the best, -Simo [1] http://commons.apache.org/beanutils/v1.8.3/apidocs/org/apache/commons/beanutils/package-summary.html#conversion [2] http://commons.apache.org/beanutils/v1.8.3/apidocs/org/apache/commons/beanutils/Converter.html [3] http://commons.apache.org/beanutils/v1.8.3/apidocs/org/apache/commons/beanutils/ConvertUtils.html#register(org.apache.commons.beanutils.Converter, java.lang.Class) http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Wed, Jul 4, 2012 at 9:30 PM, Neil Benn neil.b...@ziath.com wrote: Hello, I have a class which holds a set of enums; I'm writing out to the xml file the name of the enum and I want to read it back in with Digester. However I'm having a hard time working out how to do that - has anyone managed to read in the enums. I'm currently trying: Digester digester = new Digester(); digester.addObjectCreate(barcodeScanner, BarcodeScannerModel.class); digester.addSetProperties(barcodeScanner); digester.addCallMethod(barcodeScanner/formats/OneDBarcodeFormat, addPossibleOneDBarcodeFormat, 1); digester.addCallParam(barcodeScanner/formats/OneDBarcodeFormat, 0, format); This however returns the error message of : java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 39; Error at line 4 char 39: No such accessible method: addPossibleOneDBarcodeFormat() on object: com.ziath.datapaq.application.BarcodeScannerModel at com.ziath.datapaq.application.ConfigureBarcodeScannerPanel$ConfigureFileReader.load(ConfigureBarcodeScannerPanel.java:443) The method is question is: public void addPossibleOneDBarcodeFormat(OneDBarcodeFormat format){ this.formats.add(format); } The method is there so I guess it is just the parameter that is the problem in that Digester is trying to pass a String whereas it needs an enum. So, if anyone can help that would be greatly appreciated. Thanks. Cheers, Neil -- Neil Benn MSc Ziath Ltd Phone: +44 (0) 1223 655577 http://www.ziath.com *Please consider the environment before printing this email.* Follow us on Facebook http://www.facebook.com/ziathltd, Twitterhttp://www.twitter.com/ziath_ltdor LinkedIn http://www.linkedin.com/company/ziath-ltd IMPORTANT NOTICE: This message, including any attached documents, is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify Ziath Ltd immediately by email at i...@ziath.com. Thank you. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester3] - can DigesterLoader instance be shared?
Thanks a lot for the feedbacks Torsten, as I commented in the issue, it would be really helpful if you could attach a testcase to reproduce the issue, in order to looking forward to a possible fix. Many thanks in advance! -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Wed, Mar 14, 2012 at 9:01 AM, Torsten Krah tk...@fachschaft.imn.htwk-leipzig.de wrote: Ticket is: https://issues.apache.org/jira/browse/DIGESTER-163 - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester3] - can DigesterLoader instance be shared?
Hi Torsten, yes, a configured loader instace can be shared across multiple components in the application, just create new Digester instance every time you have to perform a parse (or put them in a pool of digesters to save resources) HTH, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Tue, Mar 13, 2012 at 9:02 PM, Torsten Krah tk...@fachschaft.imn.htwk-leipzig.de wrote: Some addition: According to the employee servlet @ http://commons.apache.org/digester/guide/binder.html , it should be possible to share a loader, shouldn't it? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: parse xml Tag with same attributes
Hi Ramin, I would really like to help you but apologize, it is really hard for me reading that code embedded in email - could you please paste somewhere such as pastebin/gist? TIA, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ 2012/3/10 Ramin Heidari ramin.heid...@hotmail.com: Hi, i want to pars an xml but I have a got a problem in defining rule for below part of xml because there are two same Name tage with different attributes .i set the rule but it seems that i won't work(alway the value set null).Do you have any idea who i can fix it. XML Match MatchId=4616735 MatchDate2011-01-05T07:30:00/MatchDate Team1 TeamId=1029369 Name language=enWellington Phoenix FC/Name Name language=seWellington/Name /Team1 Team2 TeamId=529088nb sp; Name language=enMelbourne Victory/Name Name language=seMelbourne Victory/Name /Team2 . //A new Course instance digester.addObjectCreate(LivescoreData/Sport/Category/Tournament/Match, Match.class); //A new Course instance digester.addObjectCreate(LivescoreData/Sport/Category/Tournament/Match/Team1, Team1.class); digester.addSetProperties(LivescoreData/Sport/Category/Tournament/Match/Team1,TeamId,teamId); digester.addBeanPropertySetter(livescoreData/sport/Category/Tournament/Match/Team1/Name,name); // digester.addCallMethod(livescoreData/sport/Category/Tournament/Match/Team1/Name, setName, 1 ); digester.addSetNext(LivescoreData/Sport/Category/Tournament/Match/Team1, addTeam1); digester.addObjectCreate(LivescoreData/Sport/Category/Tournament/Match/Team2, Team2.class); digester.addBeanPropertySetter(livescoreData/sport/Category/Tournament/Match/Team2/Name,language_en); digester.addSetNext(LivescoreData/Sport/Category/Tournament/Match/Team2, addTeam2); thanks,Ramin - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Please don't update public site on SVN
Hi all, I asked INFRA to enable SvnPubSub (see INFRA-4513) they asked to wait on updating the site until they will have few infra issues solved. TIA, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Please don't update public site on SVN
ouch, apologize, that's why I didn't find my message in the proper list! :) Thanks! -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Fri, Mar 9, 2012 at 11:11 AM, sebb seb...@gmail.com wrote: On 9 March 2012 10:08, Simone Tripodi simonetrip...@apache.org wrote: Hi all, I asked INFRA to enable SvnPubSub (see INFRA-4513) they asked to wait on updating the site until they will have few infra issues solved. Wrong list; INFRA-4513 is about Cocoon. TIA, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [DbUtils] Could AsyncQueryRunner be a wrapper around a QueryRunner?
Hi Moandji, the ML is not the right place where attaching patches, can you please fill an issue on JIRA? TIA! -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Sat, Feb 11, 2012 at 8:53 AM, Moandji Ezana mwa...@gmail.com wrote: On Wed, Feb 8, 2012 at 5:04 AM, William Speirs wspe...@apache.org wrote: This is not a bad idea, but I would need to give it more thought. I tried to reduce code dup when I created AsyncQueryRunner by creating AbstractQueryRunner[1], could we just add more code to that class? I was thinking of having the AsyncQueryWrapper decorate the QueryRunner with async behaviour, in the same way a BufferedInputStream might decorate an InputStream. Here's a patch that shows what I mean. It causes all the interaction-based tests to fail, but I just wanted to get your take on whether this was a good/feasible idea. Moandji - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[ANNOUNCE] Apache Commons Validator-1.4.0 released!
The Apache Commons PMC is pleased to announce the Apache Commons Validator-1.4.0 release! The Apache Commons Validator component provides the building blocks for both client side validation and server side data validation. Changes in this version include: New features: o New generic CodeValidator that validates format, length and Check Digit for a code Issue: VALIDATOR-215. o New Regular Expression validator using JDK 1.4's Regex Issue: VALIDATOR-214. o Factor out Check Digit logic into separate implementations Issue: VALIDATOR-213. Fixed Bugs: o CheckStyle and FindBug Issues - inner classes and key sets Issue: VALIDATOR-301. Thanks to Jacob Zwiers. o Email validation fails with dash or hyphen at end of local address Issue: VALIDATOR-293. Thanks to Will Glass-Husain. o @localhost and @localhost.localdomain email addresses aren't correctly detected as valid Issue: VALIDATOR-292. o UrlValidator.isValid does not properly validate *.travel domains Issue: VALIDATOR-289. Thanks to GM. o isValid method for EmailValidator should return false for domain with special characters only Issue: VALIDATOR-286. o formatDate(String value, Locale locale) in GenericTypeValidator uses DateFormat.SHORT instead of DateFormat.DEFAULT Issue: VALIDATOR-282. o isValidURL call returns false for file scheme/protocol when URL is correct Issue: VALIDATOR-276. o gmail testing addresses do not validate Issue: VALIDATOR-271. Thanks to Ralf Hauser. o clirr Report - EmailValidator.isValidIpAddress() argument type change Issue: VALIDATOR-300. Thanks to Jacob Zwiers. o Null-Stream input to ValidatorResources leads to MalformedURLExceptions Issue: VALIDATOR-226. Thanks to Lian Ort. o EmailValidator fails with ArrayIndexOutOfBoundsException on domain names longer than 10 segments Issue: VALIDATOR-220. Thanks to Adam Gordon. o UrlValidator fail when path contains ( / ) Issue: VALIDATOR-218. Thanks to Stephen Chu. o UrlValidator rejects top-level domains (TLDs) with more than 4 characters Issue: VALIDATOR-216. Thanks to Kenji Matsuoka. Changes: o UrlValidator does not validate URL with simple domains (eg: http://hostname ) Issue: VALIDATOR-288. Thanks to feroze daud. o EmailValidator.isValid(String) follows RFC822 but violates RFC1034 Issue: VALIDATOR-275. Thanks to Adam Gordon. o Performance improvement of DomainValidator by change the regular expression Issue: VALIDATOR-252. Thanks to Makoto Uchino. o url with brackets is not validated thru URLvalidator class. Issue: VALIDATOR-251. Thanks to Meenal Gupta. o Banking CheckDigit implementations: ABA, CUSIP, IBAN, ISIN and Sedol Issue: VALIDATOR-250. o Add Diners card validation to CreditCardValidator Issue: VALIDATOR-249. o Add an option to allow 'localhost' as a valid hostname part in the URL Issue: VALIDATOR-248. Thanks to Sergey Nebolsin. o Move CreditCardValidator to routines package and refactor to use new CodeValidator Issue: VALIDATOR-247. Thanks to bspeakmon. o Move EmailValidator to routines package Issue: VALIDATOR-242. o New InetAdress Validator implementation Issue: VALIDATOR-241. Thanks to niallp. o Support the 65 prefix for Discover Card Issue: VALIDATOR-240. Thanks to Webb Morris. o Create 1.4 DTD Issue: VALIDATOR-234. Thanks to Paul Benedict. o Switch to using Version 0.4.3 of the Dojo Compressor from the maven repo Issue: VALIDATOR-233. Thanks to Paul Benedict. o Add script attribute to control script generation Issue: VALIDATOR-232. Thanks to Paul Benedict. o validatorUtilities.js - replace colon characters in the function name (JSF/Shale) Issue: VALIDATOR-224. Thanks to Hasan Turksoy. o Move the trim() function from validateRequired.js to validateUtilities.js Issue: VALIDATOR-223. Thanks to Hasan Turksoy. o Upgrade to Digester 1.8 Issue: VALIDATOR-211. o Refactor UrlValidator - especially the line 370-ish. Issue: VALIDATOR-203. Thanks to bayard. o Copy remaining Validation Routines to the new routines package Issue: VALIDATOR-197. o Removing ORO dep. from GenericValidator Issue: VALIDATOR-193. Thanks to Matthias Wessendorf. o Adding ISBNValidator to GenericValidator Issue: VALIDATOR-192. Thanks to Matthias Wessendorf. o Remove the dependency on Jakarta ORO (move to JDK 1.4 regular expression support) Issue: VALIDATOR-191. Thanks to Matthias Wessendorf. o Extend ISBN validator to support smooth transition to ISBN-13 / EAN-13 standard Issue: VALIDATOR-188. Thanks to Gabriel Belingueres. o JDK 1.4 - change minimum dependency for validator to be JDK 1.4 (was 1.3). Primary reason for this is to use JDK 1.4+ built in regular expression support and remove the dependency on Jakarta ORO. Have fun! -Simo, on behalf of the Apache Commons PMC http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail:
Re: [DbUtils] Returning the newly-generated primary key after an insert
Thanks! I should be able to make some time to make any necessary changes, like adding JavaDoc, a few more unit tests, etc. Moandji thanks, that would be really appreciated! best, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [DbUtils] Returning the newly-generated primary key after an insert
Hi Moandji, I had a quick look at the patch and IMHO it looks good. I assigned the issue to Bill who's more deep inside DbUtils than me :) All the best and thanks for contributing! -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Wed, Feb 1, 2012 at 7:58 AM, Moandji Ezana mwa...@gmail.com wrote: On Sun, Jan 29, 2012 at 6:21 PM, William Speirs wspe...@apache.org wrote: Interesting... would you be willing to donate your QueryRunner implementation? If so, open a JIRA ticket[1] with your request for this functionality, and upload your code. Done, with embryonic patch: https://issues.apache.org/jira/browse/DBUTILS-87 Moandji - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [DbUtils] Returning the newly-generated primary key after an insert
Hi Bill, we could manage at least the generated keys, using Statement#getGeneratedKeys()[1], requiring a non null ResultSetHandler. To not break APIs backward compatibility, that could be a new set of APIs... WDYT? best, -Simo [1] http://docs.oracle.com/javase/6/docs/api/java/sql/Statement.html#getGeneratedKeys() http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Sun, Jan 29, 2012 at 5:05 PM, William Speirs wspe...@apache.org wrote: That is a question more specific to the database you're using, than DBUtils. For some databases this means writing a stored procedure which performs the insert, and then a special select to get the primary key. You can of course use DBUtils to call this stored proc and read the primary key. Hope this helps... Bill- On Sun, Jan 29, 2012 at 9:44 AM, Moandji Ezana mwa...@gmail.com wrote: Is it possible with the current API to do an insert and get back the generated primary key, rather than the number of affected rows? Best regards, Moandji - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [dbutils] Mapping from JPA annotations
I personally use MyBatis[1] - which is DbUtils with superpowers -Simo [1] http://www.mybatis.org http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Thu, Jan 19, 2012 at 9:28 PM, Moandji Ezana mwa...@gmail.com wrote: On 19 Jan 2012 20:26, Gary Gregory garydgreg...@gmail.com wrote: So why not use Hibernate or any JPA provider? Gary Plenty of reasons, such as the library's simplicity and the control it affords. And I don't want the lazy-loading, 1st-level cache, etc. it provides. However, there are 2 big missing pieces: reducing the amount of duplication in SQL (which makes refactoring the code or the DB difficult) and mapping joins. Arguably, SQL generation is out of scope. Joins, however, shouldn't be. I think JPA annotations Out of curiosity, how do you guys manage the SQL strings and the joins in your projects? Moandji - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [dbutils] Mapping from JPA annotations
On Thu, Jan 19, 2012 at 9:34 PM, Gary Gregory garydgreg...@gmail.com wrote: On Thu, Jan 19, 2012 at 3:32 PM, Simone Tripodi simonetrip...@apache.orgwrote: I personally use MyBatis[1] - which is DbUtils with superpowers MyBatis does not have super powers, you have super powers Simo ;) lol, my only superpower is the ability of making pizza - which is very good (at least my family says that :D) Gary - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [ANNOUNCEMENT] Apache Commons Codec 1.6 is now available
congrats Gary!!! all the best, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Wed, Dec 7, 2011 at 6:53 PM, Gary Gregory ggreg...@apache.org wrote: The Commons Codec team is pleased to announce the commons-codec-1.6 release! The codec package contains simple encoder and decoders for various formats such as Base64 and Hexadecimal. In addition to these widely used encoders and decoders, the codec package also maintains a collection of phonetic encoding utilities. Changes in this version include: Fixed Bugs: o Use standard Maven directory layout. Issue: CODEC-129. Thanks to ggregory. o Documentation spelling fixes. Issue: CODEC-128. Thanks to ville.sky...@iki.fi. o Fix various character encoding issues in comments and test cases. Issue: CODEC-127. o ColognePhonetic Javadoc should use HTML entities for special characters. Issue: CODEC-123. Changes: o Implement a Beider-Morse phonetic matching codec. Issue: CODEC-125. Thanks to Matthew Pocock. o Migrate to Java 5. Issue: CODEC-119. o Migrate to JUnit 4. Issue: CODEC-120. Site: http://commons.apache.org/codec/ Download: http://commons.apache.org/codec/download_codec.cgi Have fun! -Commons Codec team -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org JUnit in Action, 2nd Ed: http://goog_1249600977http://bit.ly/ECvg0 Spring Batch in Action: http://s.apache.org/HOqhttp://bit.ly/bqpbCK Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[ANNOUNCEMENT] Apache Commons Digester 3.1 released!
The Apache Commons community is pleased to announce the Apache Commons Digester 3.1 release! The Apache Commons Digester package lets you configure an XML to Java object mapping module which triggers certain actions called rules whenever a particular pattern of nested XML elements is recognized. Apache Commons Digester is available in either binary or source form from the Digester downloads page: http://commons.apache.org/digester/download_digester.cgi When downloading the release, please check the signatures and md5 sums using the values linked on the download page. Apache Maven artifacts are available as well on Maven Central Repo: http://search.maven.org/#artifactdetails%7Corg.apache.commons%7Ccommons-digester3%7C3.1%7Cjar More information about Apache Commons Digester can be found at the Digester main site at http://commons.apache.org/digester/ Changes in this version include: New features: o Use Java5 Concurrent APIs to asynchronous parse() Issue: DIGESTER-150. Have fun! -Simo, on behalf of Apache Commons PMC http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Digester rules problem.
Hi Eric, I can provide you the solution but I'll be busy for the whole morning. Please wait I'll send you the hints ASAP. All the best, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Oct 6, 2011 at 5:02 AM, Eric Chow eric...@gmail.com wrote: Hello, response query=10.70.0.2,v2p,3,1,0 result=true attribute name=ip10.70.0.2/attribute attribute name=slot3/attribute attribute name=port1/attribute attribute name=statusactive/attribute /record In the above XML, I have a bean as following: public class Response { private String query; private boolean result; private String ip; private String slot; private String port; private String status; } For the query, result, I can easy to use the following codes to parse. Digester digester = new Digester(); digester.setNamespaceAware( true ); digester.setXIncludeAware( true ); digester.addObjectCreate( response, Response .class ); digester.addSetProperties( response, query, query ); digester.addSetProperties( response, result, result ); But, how can I set those attribute/ into the related properties? Please help. Thanks. Eric - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Digester rules problem.
Hi Mau, thanks for providing to Eric the needed help, very appreciated! Just a minor hint: the double SetProperties rule declaration can be replaced by just one call: public class ResponseTest { @Test public void buildTest() throws IOException, SAXException { Digester digester = new Digester(); digester.addObjectCreate(response, Response.class); digester.addSetProperties(response, new String[]{ query, result }, new String[]{ query, result }); [OMISS] } } since attribute names are exactly the properties names, the attributes/properties arrays can be omitted: public class ResponseTest { @Test public void buildTest() throws IOException, SAXException { Digester digester = new Digester(); digester.addObjectCreate( response, Response.class ); digester.addSetProperties( response ); [OMISS] } } if you use the Digester3 rules binder (which I prefer, yuk yuk), you can write the rules as new AbstractRulesModule() { @Override public void configure() { forPattern( response ) .createObject().ofType( Response.class ) .then() .setProperties() .addAlias( query, query ) .addAlias( result, result ), forPattern( response/attribute ) .setBeanProperty().extractPropertyNameFromAttribute( name ); } } About your question: currently there's NO full XPath rule matcher engine :( if you are interested on providing an implementation we can discuss about it on the dev@ ML HTH, have a nice day!!! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Oct 6, 2011 at 12:38 PM, Maurizio Cucchiara mcucchi...@apache.org wrote: Hi Simo, looking at the http://s.apache.org/OQ0 I realized that Digester uses an xpath-like string, I am wondering if there is a way (or a rule) which allows using full xpath syntax (Eric could have used something like response/attribute[@name='ip' ]). Is there any Rule implementation about this specific topic? Maurizio Cucchiara On 6 October 2011 09:40, Simone Tripodi simonetrip...@apache.org wrote: Hi Eric, I can provide you the solution but I'll be busy for the whole morning. Please wait I'll send you the hints ASAP. All the best, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Oct 6, 2011 at 5:02 AM, Eric Chow eric...@gmail.com wrote: Hello, response query=10.70.0.2,v2p,3,1,0 result=true attribute name=ip10.70.0.2/attribute attribute name=slot3/attribute attribute name=port1/attribute attribute name=statusactive/attribute /record In the above XML, I have a bean as following: public class Response { private String query; private boolean result; private String ip; private String slot; private String port; private String status; } For the query, result, I can easy to use the following codes to parse. Digester digester = new Digester(); digester.setNamespaceAware( true ); digester.setXIncludeAware( true ); digester.addObjectCreate( response, Response .class ); digester.addSetProperties( response, query, query ); digester.addSetProperties( response, result, result ); But, how can I set those attribute/ into the related properties? Please help. Thanks. Eric - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: problem with SetPropertyRule
Nice to hear that it finally worked, have a nice day! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Sep 26, 2011 at 10:57 AM, tushar mishra tush_mis...@yahoo.co.in wrote: Thanks much Simone !! That works so good. I spent a day for this problem :) - Tushar From: Simone Tripodi simonetrip...@apache.org To: Commons Users List user@commons.apache.org Sent: Sunday, 25 September 2011 8:53 PM Subject: Re: problem with SetPropertyRule Hi Tushar, looks like you misinterpreted the SetProperty rule, read the javadoc[1] for its description. What would fit for your case is the SetPropertiesRule[2], so your code should be changed to private static void addRules(Digester digester) { digester.addObjectCreate( foo, mypackage.Foo ); digester.addSetProperties( foo, fooName, name ); } HTH, have a nice day! Simo [1] http://s.apache.org/G2t [2] http://s.apache.org/DuX http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, Sep 25, 2011 at 2:37 PM, tushar mishra tush_mis...@yahoo.co.in wrote: From: tushar mishra tush_mis...@yahoo.co.in To: user@commons.apache.org user@commons.apache.org Sent: Sunday, 25 September 2011 4:36 PM Subject: problem with SetPropertyRule Hi, I am facing problem running a simple example using digester. Reference - http://commons.apache.org/digester/guide/core.html File Name - foo.xml ?xml version='1.0'? foo fooName=The Parent bar id=123 title=The First Child / bar id=456 title=The Second Child / /foo File Name - Foo.javapackage mypackage; import java.util.Iterator; public class Foo {String name;public String getName(){ return name; } public void setName(String name) { this.name = name; } } File Name - Client.java package mypackage; import org.apache.commons.digester3.Digester; public class Client { public static void main(String[] args) { String filename = C:\\development\\projects\\test\\resources\\foo.xml; Foo foo = null; Digester d = new Digester(); d.setValidating(false); addRules(d); // Process the input file. try { java.io.File srcfile = new java.io.File(filename); foo = (Foo) d.parse(srcfile); } catch (java.io.IOException ioe) { System.out.println(Error reading input file: + ioe.getMessage()); System.exit(-1); } catch (org.xml.sax.SAXException se) { System.out.println(Error parsing input file: + se.getMessage()); System.exit(-1); } System.out.println(foo.getName()); } private static void addRules(Digester digester) { digester.addObjectCreate(foo, mypackage.Foo); digester.addSetProperty(foo, fooName, name);} } Output Error parsing input file:Error at line 2 char 27: Bean has no property named The Parent Sep 25, 2011 4:12:48 PM org.apache.commons.digester3.Digester startElement SEVERE: Begin event threw exception java.lang.NoSuchMethodException:Bean has no property named The Parent at org.apache.commons.digester3.SetPropertyRule.begin(SetPropertyRule.java:133) at org.apache.commons.digester3.Digester.startElement(Digester.java:1319) Question Analysis Class - SetPropertyRule if ( attributeName.equals( this.name ) ) { actualName = value; } 1. What is this check for ? The documents gets parsed. It also finds the attribute names correctly. But here, due to this condition, the attribute name - fooName changes to The Parent. What am I missing ? Thanks for your time. - Tushar - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: problem with SetPropertyRule
Hi Tushar, looks like you misinterpreted the SetProperty rule, read the javadoc[1] for its description. What would fit for your case is the SetPropertiesRule[2], so your code should be changed to private static void addRules(Digester digester) { digester.addObjectCreate( foo, mypackage.Foo ); digester.addSetProperties( foo, fooName, name ); } HTH, have a nice day! Simo [1] http://s.apache.org/G2t [2] http://s.apache.org/DuX http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, Sep 25, 2011 at 2:37 PM, tushar mishra tush_mis...@yahoo.co.in wrote: From: tushar mishra tush_mis...@yahoo.co.in To: user@commons.apache.org user@commons.apache.org Sent: Sunday, 25 September 2011 4:36 PM Subject: problem with SetPropertyRule Hi, I am facing problem running a simple example using digester. Reference - http://commons.apache.org/digester/guide/core.html File Name - foo.xml ?xml version='1.0'? foo fooName=The Parent bar id=123 title=The First Child / bar id=456 title=The Second Child / /foo File Name - Foo.javapackage mypackage; import java.util.Iterator; public class Foo {String name;public String getName(){ return name; } public void setName(String name) { this.name = name; } } File Name - Client.java package mypackage; import org.apache.commons.digester3.Digester; public class Client { public static void main(String[] args) { String filename = C:\\development\\projects\\test\\resources\\foo.xml; Foo foo = null; Digester d = new Digester(); d.setValidating(false); addRules(d); // Process the input file. try { java.io.File srcfile = new java.io.File(filename); foo = (Foo) d.parse(srcfile); } catch (java.io.IOException ioe) { System.out.println(Error reading input file: + ioe.getMessage()); System.exit(-1); } catch (org.xml.sax.SAXException se) { System.out.println(Error parsing input file: + se.getMessage()); System.exit(-1); } System.out.println(foo.getName()); } private static void addRules(Digester digester) { digester.addObjectCreate(foo, mypackage.Foo); digester.addSetProperty(foo, fooName, name);} } Output Error parsing input file:Error at line 2 char 27: Bean has no property named The Parent Sep 25, 2011 4:12:48 PM org.apache.commons.digester3.Digester startElement SEVERE: Begin event threw exception java.lang.NoSuchMethodException:Bean has no property named The Parent at org.apache.commons.digester3.SetPropertyRule.begin(SetPropertyRule.java:133) at org.apache.commons.digester3.Digester.startElement(Digester.java:1319) Question Analysis Class - SetPropertyRule if ( attributeName.equals( this.name ) ) { actualName = value; } 1. What is this check for ? The documents gets parsed. It also finds the attribute names correctly. But here, due to this condition, the attribute name - fooName changes to The Parent. What am I missing ? Thanks for your time. - Tushar - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Object graph validation
Hi Jeff, I suggest you to have a look at Apache BeanValidation[1] that is the implementation of JSR303 BeanValidation. HTH, Simo [1] http://incubator.apache.org/bval/cwiki/index.html http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Sep 19, 2011 at 12:23 PM, jeff mutonho linuxedhum...@gmail.com wrote: Is there utility in the commons library that one can use to do recursive object graph validation? I'm looking for something similar to the Oval project( http://oval.sourceforge.net/userguide.html#d4e841 ) I would like to be able to do something similar to what's specified in section 3.1 of the aforementioned Oval project user guide. Thanks - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Object graph validation
Hi Jeff, both ApacheBVAL and Hibernate Validator implement exactly the same specification, the Apache version offers more extra features not included in the spec. I suggest you to move the discussion anyway to BeanValidation ML because this one is related to Commons components only ;) Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Sep 19, 2011 at 1:00 PM, jeff mutonho linuxedhum...@gmail.com wrote: Thanks for the response. I wasn't aware of this project. I see the need to contribute towards some usage documentation. How does this compare with the Hibernate Validator though? On Mon, Sep 19, 2011 at 12:31 PM, Simone Tripodi simonetrip...@apache.orgwrote: Hi Jeff, I suggest you to have a look at Apache BeanValidation[1] that is the implementation of JSR303 BeanValidation. HTH, Simo [1] http://incubator.apache.org/bval/cwiki/index.html http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Sep 19, 2011 at 12:23 PM, jeff mutonho linuxedhum...@gmail.com wrote: Is there utility in the commons library that one can use to do recursive object graph validation? I'm looking for something similar to the Oval project( http://oval.sourceforge.net/userguide.html#d4e841 ) I would like to be able to do something similar to what's specified in section 3.1 of the aforementioned Oval project user guide. Thanks - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [ANNOUNCEMENT] Commons Configuration 1.7 Released
I agree, quite unfair comment :( Commons, like the rest of the Apache communities, is a group of volunteers maintaining projects, that means no one of us is paid nor has a lot of time to during the day to dedicate to get component released. So everybody is welcomed on submitting patches, participating in the ML, getting involved, and release. Of course it takes time. The same time you spent on waiting instead of participating. Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Sep 8, 2011 at 3:06 PM, Jörg Schaible joerg.schai...@scalaris.com wrote: Jesse Farinacci wrote: Congratulations! On Thu, Sep 8, 2011 at 7:45 AM, Oliver Heger ohe...@apache.org wrote: The Apache Commons team is pleased to announce the availability of Commons Configuration 1.7. Only 33 months since the previous release.. ;-) Means that for an earlier release date you'd had plenty of time to get involved and finally release it yourself as release manager. ;-) - Jörg - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Betwixt] is betwixt thread safe ?
Hi Patrick, indeed, when ingesting XML documents you have to make sure the Digester instance is not used in other running threads; sometimes creating new BeanReader instances could require time, that's why I suggested you using a Pool of BeanReader. Sure, paste your code on pastie.org or similar (it makes more readable than in the email) and I'll more than glad to help you! Have a nice day, all the best! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Aug 15, 2011 at 9:02 PM, patrick daures patrick.dau...@gmail.com wrote: Hi again, From what I found on the web, it's not safe to reuse the same instance of a Digester between different threads. But what I'm currently doing is creating a new instance of BeanReader (which extends the Digester class) for every call, which means that I shouldn't have any multithreading issue with the Digester lib. I will find more information about the lib's version and maybe send some code so you can tell me what is the problem. Thanks Patrick 2011/8/15 Simone Tripodi simonetrip...@apache.org Hi Patrick, sorry for the misunderstanding I made, for deserializer I meant the BeanReader :P Sorry again, have a nice day! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Aug 15, 2011 at 9:57 AM, patrick daures patrick.dau...@gmail.com wrote: Hi, I have another question to ask you, you said get/release a deserializer for each request. For the moment, I don't use any deserializer, I only use BeanReader and BeanWriter objects. What I do is create a new instance of one of this object every time I need to serialize / unserialize data. Could you please give me an example of code using this deserializer to help me to write the code needed ? Thank you Patrick 2011/8/14 Simone Tripodi simonetrip...@apache.org Hi Patrick! you're welcome, let us know about your results! Have nice day, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, Aug 14, 2011 at 8:54 PM, Patrick Daures patrick.dau...@gmail.com wrote: Ok, thank you very much for your advice. I will take the 3rd solution Patrick Le 14 août 2011 à 20:24, Simone Tripodi a écrit : Hi Patrick!!! for the XML - Object mapping, Betwixt relies on Digester, which is NOT thread safe. You have 3 options: - synchronize the blocks as you did - anyway it's not the best way IMHO; - re-create the deserializer for each request; - use Betwixt in combination with commons-pool, get/release a deserializer for each request (same pattern you would do with JDBC Connection in a DataSource). My preferred is the #3, but it's just a matter of tastes ;) Have a nice day, all the best!!! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, Aug 13, 2011 at 8:31 PM, patrick daures patrick.dau...@gmail.com wrote: Hi, i'm currently using betwixt in produit to serialize and unserialize objects in XML. Each thread is using a new instance of beanreader to unserialize XML. I had a problem with my application, i added a synchronized around the call to the betwixt lib and everything went fine. Maybe the problem comes from my app, but i wanted to be sure the lib is thread safe. Thanks. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Betwixt] is betwixt thread safe ?
Hi Patrick, sorry for the misunderstanding I made, for deserializer I meant the BeanReader :P Sorry again, have a nice day! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Aug 15, 2011 at 9:57 AM, patrick daures patrick.dau...@gmail.com wrote: Hi, I have another question to ask you, you said get/release a deserializer for each request. For the moment, I don't use any deserializer, I only use BeanReader and BeanWriter objects. What I do is create a new instance of one of this object every time I need to serialize / unserialize data. Could you please give me an example of code using this deserializer to help me to write the code needed ? Thank you Patrick 2011/8/14 Simone Tripodi simonetrip...@apache.org Hi Patrick! you're welcome, let us know about your results! Have nice day, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, Aug 14, 2011 at 8:54 PM, Patrick Daures patrick.dau...@gmail.com wrote: Ok, thank you very much for your advice. I will take the 3rd solution Patrick Le 14 août 2011 à 20:24, Simone Tripodi a écrit : Hi Patrick!!! for the XML - Object mapping, Betwixt relies on Digester, which is NOT thread safe. You have 3 options: - synchronize the blocks as you did - anyway it's not the best way IMHO; - re-create the deserializer for each request; - use Betwixt in combination with commons-pool, get/release a deserializer for each request (same pattern you would do with JDBC Connection in a DataSource). My preferred is the #3, but it's just a matter of tastes ;) Have a nice day, all the best!!! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, Aug 13, 2011 at 8:31 PM, patrick daures patrick.dau...@gmail.com wrote: Hi, i'm currently using betwixt in produit to serialize and unserialize objects in XML. Each thread is using a new instance of beanreader to unserialize XML. I had a problem with my application, i added a synchronized around the call to the betwixt lib and everything went fine. Maybe the problem comes from my app, but i wanted to be sure the lib is thread safe. Thanks. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Betwixt] is betwixt thread safe ?
Hi Patrick!!! for the XML - Object mapping, Betwixt relies on Digester, which is NOT thread safe. You have 3 options: - synchronize the blocks as you did - anyway it's not the best way IMHO; - re-create the deserializer for each request; - use Betwixt in combination with commons-pool, get/release a deserializer for each request (same pattern you would do with JDBC Connection in a DataSource). My preferred is the #3, but it's just a matter of tastes ;) Have a nice day, all the best!!! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, Aug 13, 2011 at 8:31 PM, patrick daures patrick.dau...@gmail.com wrote: Hi, i'm currently using betwixt in produit to serialize and unserialize objects in XML. Each thread is using a new instance of beanreader to unserialize XML. I had a problem with my application, i added a synchronized around the call to the betwixt lib and everything went fine. Maybe the problem comes from my app, but i wanted to be sure the lib is thread safe. Thanks. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Betwixt] is betwixt thread safe ?
Hi Patrick! you're welcome, let us know about your results! Have nice day, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, Aug 14, 2011 at 8:54 PM, Patrick Daures patrick.dau...@gmail.com wrote: Ok, thank you very much for your advice. I will take the 3rd solution Patrick Le 14 août 2011 à 20:24, Simone Tripodi a écrit : Hi Patrick!!! for the XML - Object mapping, Betwixt relies on Digester, which is NOT thread safe. You have 3 options: - synchronize the blocks as you did - anyway it's not the best way IMHO; - re-create the deserializer for each request; - use Betwixt in combination with commons-pool, get/release a deserializer for each request (same pattern you would do with JDBC Connection in a DataSource). My preferred is the #3, but it's just a matter of tastes ;) Have a nice day, all the best!!! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, Aug 13, 2011 at 8:31 PM, patrick daures patrick.dau...@gmail.com wrote: Hi, i'm currently using betwixt in produit to serialize and unserialize objects in XML. Each thread is using a new instance of beanreader to unserialize XML. I had a problem with my application, i added a synchronized around the call to the betwixt lib and everything went fine. Maybe the problem comes from my app, but i wanted to be sure the lib is thread safe. Thanks. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[digester] Apache Commons Digester3 is on JaxEnter!
Hi all guys, just to let you aware that Apache Commons Digester 3 release has been announced on JaxEnter[1]! All the best, have a nice day Simo [1] http://jaxenter.com/first-rc-of-jdk7-arrives-36709.html http://people.apache.org/~simonetripodi/ http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[digester] Jaxenter interview about Digester3!!!
Hi all guys, just to share with you all a small interview I had with Jaxenter today during lunch-time, I hope that my fellows appreciate how things have been exposed! Agreements section is not missing! :) Have a nice day, all the best! Simo [1] http://jaxenter.com/what-s-new-in-apache-commons-digester-3-0-36817.html http://people.apache.org/~simonetripodi/ http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] Jaxenter interview about Digester3!!!
Dankeshen Christian, very appreciated! :) All the best!!! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Tue, Jul 12, 2011 at 8:00 PM, Christian Grobmeier grobme...@gmail.com wrote: Reads great! Love to see things like that On Tue, Jul 12, 2011 at 7:43 PM, Simone Tripodi simonetrip...@apache.org wrote: Hi all guys, just to share with you all a small interview I had with Jaxenter today during lunch-time, I hope that my fellows appreciate how things have been exposed! Agreements section is not missing! :) Have a nice day, all the best! Simo [1] http://jaxenter.com/what-s-new-in-apache-commons-digester-3-0-36817.html http://people.apache.org/~simonetripodi/ http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org -- http://www.grobmeier.de - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] Jaxenter interview about Digester3!!!
Hi Martin, The new DigesterLoader (not Deployer) is able to load all kind of rules modules, so you can 'merge' your different Digester configuration. That means you can define some rules via annotations, some others via manual binding, and let the DigesterLoader load them, i.e. {code} Digester digester = DigesterLoader.newLoader( new FromAnnotationsRuleModule() { @Override protected void configureRules() { bindRulesFrom( Feed.class ); } }, new AbstractRulesModule() { @Override protected void configure() { forPattern( feed/entry ).createObject().ofType( Entry.class ) .then() .setNext( addEntry ); forPattern( feed/entry/title ).setBeanProperty(); forPattern( feed/entry/link ).setProperties().addAlias( href, link ); forPattern( feed/entry/updated ).setBeanProperty(); forPattern( feed/entry/id ).setBeanProperty(); forPattern( feed/entry/content ).setBeanProperty(); } } ).newDigester(); {code} HTH, have a nice day!!! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Tue, Jul 12, 2011 at 9:36 PM, Martin Gainty mgai...@hotmail.com wrote: one of the situations I have seen is a traditional container will hot deploy refactored elements in a webapp descriptor. Lately we've seen rather large descriptor complex data elements declared and populated thru annotations. since each extension used its own 'digester-loader' so there was no ability to merge the 2 will Digester3 Universal Deployer be able to load both annotations and traditional descriptor elements to a hot-deployable aware container ? many thanks christian and simone Martin __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: grobme...@gmail.com Date: Tue, 12 Jul 2011 20:00:14 +0200 Subject: Re: [digester] Jaxenter interview about Digester3!!! To: user@commons.apache.org CC: d...@commons.apache.org Reads great! Love to see things like that On Tue, Jul 12, 2011 at 7:43 PM, Simone Tripodi simonetrip...@apache.org wrote: Hi all guys, just to share with you all a small interview I had with Jaxenter today during lunch-time, I hope that my fellows appreciate how things have been exposed! Agreements section is not missing! :) Have a nice day, all the best! Simo [1] http://jaxenter.com/what-s-new-in-apache-commons-digester-3-0-36817.html http://people.apache.org/~simonetripodi/ http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org -- http://www.grobmeier.de - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[ANNOUNCE] Apache Commons Digester 3.0 released!
The Apache Commons team is pleased to announce the Apache Commons Digester 3.0 release! The Apache Commons Digester package lets you configure an XML to Java object mapping module which triggers certain actions called rules whenever a particular pattern of nested XML elements is recognized. The Apache Commons Digester 3.0 is an almost complete rewrite of the original Digester implementation, which offers: o A universal loader: core features and extensions became not so easy to maintain, since every contribution was created with a different approach; a fresh new architecture is able to load modules that allow users write and include easily their own extensions; o Reusability of Digester configurations: what was missing is a way to describe how the Digester instances have to be built and not how to set rules given an existing instance; o Rules are now expressed via EDSL: the key feature of Digester3 is expressing rule bindings using a fluent APIs collection, that speak more in English rather than in a programming language; o Improved errors reporting: rules binding debug operations have made easier, a detailed errors list of wrong binding is reported just when the loader attempts to create a new Digester instance, and not when running it. Moreover, changes in this version include: New features: o Allow SetNextRule to fire on begin Issue: DIGESTER-72. o Include filename or uri if Digester.parse(File file or String uri throws a SAXException Issue: DIGESTER-85. o xmlrules does not support setNamespaceURI Issue: DIGESTER-90. o Need to process [attribute id=name]somename[/attribute] Issue: DIGESTER-105. o Allow DigesterLoader to accept an instance of a preconfigured Digester Issue: DIGESTER-127. o Allow recursive match in ExtendedBaseRules. Issue: DIGESTER-131. o Add a CompoundSubstitutor to support more than one Substitutors at a time. Issue: DIGESTER-132. Fixed Bugs: o Default ClassLoader policy unusable in EAR archive Issue: DIGESTER-28. o xmlrules does not support NodeCreateRule Issue: DIGESTER-103. o ObjectCreateRule shouldn't keep className as a field. Issue: DIGESTER-118. o xmlrules dtd does not define xmlattrs for node-create-rule Issue: DIGESTER-123. o Bug in SetPropertyRule. Issue: DIGESTER-134. Changes: o Public/protected static fields which intended as constants, but which are not marked final. Issue: DIGESTER-137. Have fun! -Simo, on behalf of the Apache Commons community http://people.apache.org/~simonetripodi/ http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Digester] new Digester SNAPSHOT available
Hi again guys, Is there any user that gave an opportunity to the new Digester to be tried? All the best, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, Jun 18, 2011 at 2:28 PM, Simone Tripodi simonetrip...@apache.org wrote: Hi all guys, during the last months we've been working on a new Digester version that's still under development/finalization, anyway we would be very glad on collect feedbacks from users as much as it is possible. The new SNAPSHOT site has been published[1] and we would like to emphasize the new feature, the RulesBinder[2] that allows express Rules configurations via fluent APIs. The SNAPSHOT artifact is also available, add the Apache SNAPSHOT repository in your pom[3] and update the dependency as shown below. Any feedback/suggestion/request/contribution will be much more than appreciated, many thanks in advance!!! All the best, Simo [1] http://commons.apache.org/digester/ [2] http://commons.apache.org/digester/guide/binder.html [3] https://repository.apache.org/content/groups/snapshots {{{ dependency groupIdorg.apache.commons/groupId artifactIdcommons-digester3/artifactId version3.0-SNAPSHOT/version /dependency }}} http://people.apache.org/~simonetripodi/ http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[Digester] new Digester SNAPSHOT available
Hi all guys, during the last months we've been working on a new Digester version that's still under development/finalization, anyway we would be very glad on collect feedbacks from users as much as it is possible. The new SNAPSHOT site has been published[1] and we would like to emphasize the new feature, the RulesBinder[2] that allows express Rules configurations via fluent APIs. The SNAPSHOT artifact is also available, add the Apache SNAPSHOT repository in your pom[3] and update the dependency as shown below. Any feedback/suggestion/request/contribution will be much more than appreciated, many thanks in advance!!! All the best, Simo [1] http://commons.apache.org/digester/ [2] http://commons.apache.org/digester/guide/binder.html [3] https://repository.apache.org/content/groups/snapshots {{{ dependency groupIdorg.apache.commons/groupId artifactIdcommons-digester3/artifactId version3.0-SNAPSHOT/version /dependency }}} http://people.apache.org/~simonetripodi/ http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Retrying a HTTP call..
Hi Mani, HTTP client has been moved to Http Componentes[1] I suggest you asking on their ML HTH, have a nice day! Simo [1] http://hc.apache.org/ http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, May 27, 2011 at 3:00 PM, Manikandan R maniraj...@gmail.com wrote: Hi Everyone, I've started using apache commons httpclient library (version no. 3.1) to make the http calls recently. In production environment, seeing the following exceptions in logs: 1. Broken Pipe 2. Connection Reset 3. Connection Timeout 4. Read Time out etc Whenever these exceptions, we get the complaints from customers not completing the tasks. So, we repeat the work manually. To avoid doing it manually, program should take care of the retries without causing any duplicates. I am not sure when to do the retry. Basically, for what type of exceptions, Should I do retry so that it won't end up in duplicates? Please suggest. Thanks, Mani - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [io] Tailer returning partial lines returned when EOF before newline
Hi Frank, What I suggest you is following the usual workflow, I mean opening an Issue on ASF Jira - see Niall's link - and build a patch against the /trunk and attach it to the filled Issue. Otherwise it will be very hard that IO maintainers could notice and apply a textual patch inside the ML. HTH, have a nice day! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Tue, May 24, 2011 at 10:39 PM, frankgrimes97 frankgrime...@gmail.com wrote: The following is a patch against 2.0.1 in SVN which seems to address the limitation: Index: src/main/java/org/apache/commons/io/input/Tailer.java === --- src/main/java/org/apache/commons/io/input/Tailer.java (revision 1127267) +++ src/main/java/org/apache/commons/io/input/Tailer.java (working copy) @@ -335,12 +335,56 @@ * @throws java.io.IOException if an I/O error occurs. */ private long readLines(RandomAccessFile reader) throws IOException { - String line = reader.readLine(); + String line = readLine(reader); while (line != null) { listener.handle(line); - line = reader.readLine(); + line = readLine(reader); } return reader.getFilePointer(); } + /** + * Copied from RandomAccessFile.readLine() but returns null and resets file pointer on EOF. + * @param reader + * @return + * @throws IOException + */ + private final String readLine(RandomAccessFile reader) throws IOException { + long start = reader.getFilePointer(); + StringBuffer input = new StringBuffer(); + int c = -1; + boolean eol = false; + boolean eof = false; + + while (!eol !eof) { + switch (c = reader.read()) { + case -1: + eof = true; + break; + case '\n': + eol = true; + break; + case '\r': + eol = true; + long cur = reader.getFilePointer(); + if ((reader.read()) != '\n') { + reader.seek(cur); + } + break; + default: + input.append((char)c); + break; + } + } + + if ((c == -1) (input.length() == 0)) { + return null; + } + if (eof) { + reader.seek(start); + return null; + } + + return input.toString(); + } } Index: src/test/java/org/apache/commons/io/input/TailerTest.java === --- src/test/java/org/apache/commons/io/input/TailerTest.java (revision 1127267) +++ src/test/java/org/apache/commons/io/input/TailerTest.java (working copy) @@ -45,6 +45,38 @@ protected void tearDown() throws Exception { FileUtils.deleteDirectory(getTestDirectory()); } + + public void testTailerEof() throws Exception { + // Create start the Tailer + long delay = 50; + final File file = new File(getTestDirectory(), tailer2-test.txt); + createFile(file, 0); + final TestTailerListener listener = new TestTailerListener(); + final Tailer tailer = new Tailer(file, listener, delay, false); + final Thread thread = new Thread(tailer); + thread.start(); + + // Write some lines to the file + FileWriter writer = null; + try { + writeString(file, Line); + + Thread.sleep(delay * 2); + ListString lines = listener.getLines(); + assertEquals(1 line count, 0, lines.size()); + + writeString(file, one\n); + Thread.sleep(delay * 2); + lines = listener.getLines(); + + assertEquals(1 line count, 1, lines.size()); + assertEquals(1 line 1, Line one, lines.get(0)); + + listener.clear(); + } finally { + IOUtils.closeQuietly(writer); + } + } public void testTailer() throws Exception { @@ -142,6 +174,17 @@ IOUtils.closeQuietly(writer); } } + + /** Append a string to a file */ + private void writeString(File file, String string) throws Exception { + FileWriter writer = null; + try { + writer = new FileWriter(file, true); + writer.write(string); + } finally { + IOUtils.closeQuietly(writer); + } + } public void testStopWithNoFile() throws Exception { final File file = new File(getTestDirectory(),nosuchfile); On Tue, May 24, 2011 at 1:32 PM, frankgrimes97 frankgrime...@gmail.comwrote: Hi All, We are using org.apache.commons.io.input.Tailer to process log files for insertion into a database. What we are seeing is that occasionally a line fails to process because it is incomplete. In reviewing the code, it appears that Tailer.readLines delegates to java.io.RandomAccessFile.readLine which returns a partial line if EOF is reached. Shouldn't Tailer be providing a
Re: [io] Tailer returning partial lines returned when EOF before newline
I didn't check the patch, I was referring to the process. sorry for the misunderstanding http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Wed, May 25, 2011 at 3:12 PM, Jörg Schaible joerg.schai...@scalaris.com wrote: Hi, Simone Tripodi wrote: Great, that's the way to go, well done and thanks for your contribution! actually I think, it's not the way to go. The Javadoc in the patch implies that Frank simply took the code from the JDK and adjusted it a bit. This is not possible! We cannot simply relicense Oracle's IP. - Jörg - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] how can I print children tags instead of only tag content ?
IIUC = if I understand correctly ;) A quick hint: why don't you manage the logic inside your business logic? I mean, you configure the digester: Digester digester = new Digester(); digester.setRules( new RegexRules( new SimpleRegexMatcher() ) ); digester.addCallMethod( collection/doc/categ/*, myMethod, 0 ); then check the 'myMethod' has already been invoked: boolean check = false; public void myMethod( String arg ) { if ( !check ) { System.out.println( arg ); check = true; } } HTH, let me know your progress! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, May 15, 2011 at 8:58 AM, Patrick Diviacco patrick.divia...@gmail.com wrote: what does IIUC mean ? Yeah. I mean, more exactly, I just need to know if the element has at least a child: bool = hasChild(myPattern) thanks On 15 May 2011 02:09, Simone Tripodi simonetrip...@apache.org wrote: IIUC, no matters which kind of children your node has, you're interested only on the first child, right? http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, May 14, 2011 at 10:51 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: ps. the children names are completely different, there is no way to use a regex to discriminate between them. On 14 May 2011 22:50, Patrick Diviacco patrick.divia...@gmail.com wrote: hi Simone, ok, it was just matter of adding one line :) By the way I still have an issue in the case of multiple children and I don't know how to solve it. If I have a document containing: parent child1/child1 child2/child2 /parent I don't want to trigger the method twice, but just once... in other terms I want to trigger the method only once per document and only if the parent tag has at least 1 child. I copy my code again: Digester digester = new Digester(); digester.setRules( new RegexRules( new SimpleRegexMatcher() ) ); digester.addCallMethod(collection/doc/categ/*, myMethod, 0); thanks Patrick On 14 May 2011 21:54, Simone Tripodi simonetrip...@apache.org wrote: Hi Patrick, I thought it was more intuitive, sounds we have to update de doc. Anyway, to reply to your questions: 1) just create the Digester instance, set the RegexRules and start binding your rules: Digester digester = new Digester(); digester.setRules( new RegexRules( new SimpleRegexMatcher() ) ); digester.addCallMethod( collection/doc/categ/*, myMethod, 0 ); 2) yes, as reported in the javadoc I pointed: * matches any sequence of none, one or more characters like in the bash syntax; if you want to apply kind of filters, bind the rules with restrictive patterns (prefixes/postfixes); ie. given the rule: digester.addCallMethod( collection/doc/categ/patt*, myMethod, 0 ); collection/doc/categ/patt - matches collection/doc/categ/pattern - matches collection/doc/categ/patteRn - matches collection/doc/categ/pattern - matches collection/doc/categ/paBtern - does not match HTH, have a nice weekend, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, May 14, 2011 at 8:58 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: Thanks, 1) Is there any tutorial explaining how to use it ? 2) In my case, if I have more than one child, is the pattern detected multiple times ? help is very appreciated! On 14 May 2011 01:36, Simone Tripodi simonetrip...@apache.org wrote: Hi Patrick, follow the Konstantin's suggestion, that's the way to achieve it. Have a read also to http://commons.apache.org/digester/apidocs/index.html?org/apache/commons/digester/SimpleRegexMatcher.html HTH, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, May 13, 2011 at 8:28 PM, Konstantin Kolinko knst.koli...@gmail.com wrote: 2011/5/13 Patrick Diviacco patrick.divia...@gmail.com: mhm, sorry.. just to be more clear. Is there a way in Commons Digester to trigger a method only if a xml element has a child ? i.e. digester.addCallMethod(collection/doc/categ/*, myMethod, 0); This doesn't work. The * is allowed in the prefix only, as documented in http://commons.apache.org/digester/commons-digester-2.1/docs/api/org/apache/commons/digester/RulesBase.html You may try to use a different rules matcher. See RegexMatchers chapter here: http://commons.apache.org/digester/commons-digester-2.1/core.html But it is actually what I need. If element categ has at least a child, then trigger myMethod Best regards, Konstantin Kolinko - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h
Re: [digester] how can I print children tags instead of only tag content ?
nice!!! di nulla, è un piacere ;) Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, May 15, 2011 at 12:24 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: OK. Solved, thanks - grazie mille On 15 May 2011 11:28, Simone Tripodi simonetrip...@apache.org wrote: IIUC = if I understand correctly ;) A quick hint: why don't you manage the logic inside your business logic? I mean, you configure the digester: Digester digester = new Digester(); digester.setRules( new RegexRules( new SimpleRegexMatcher() ) ); digester.addCallMethod( collection/doc/categ/*, myMethod, 0 ); then check the 'myMethod' has already been invoked: boolean check = false; public void myMethod( String arg ) { if ( !check ) { System.out.println( arg ); check = true; } } HTH, let me know your progress! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, May 15, 2011 at 8:58 AM, Patrick Diviacco patrick.divia...@gmail.com wrote: what does IIUC mean ? Yeah. I mean, more exactly, I just need to know if the element has at least a child: bool = hasChild(myPattern) thanks On 15 May 2011 02:09, Simone Tripodi simonetrip...@apache.org wrote: IIUC, no matters which kind of children your node has, you're interested only on the first child, right? http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, May 14, 2011 at 10:51 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: ps. the children names are completely different, there is no way to use a regex to discriminate between them. On 14 May 2011 22:50, Patrick Diviacco patrick.divia...@gmail.com wrote: hi Simone, ok, it was just matter of adding one line :) By the way I still have an issue in the case of multiple children and I don't know how to solve it. If I have a document containing: parent child1/child1 child2/child2 /parent I don't want to trigger the method twice, but just once... in other terms I want to trigger the method only once per document and only if the parent tag has at least 1 child. I copy my code again: Digester digester = new Digester(); digester.setRules( new RegexRules( new SimpleRegexMatcher() ) ); digester.addCallMethod(collection/doc/categ/*, myMethod, 0); thanks Patrick On 14 May 2011 21:54, Simone Tripodi simonetrip...@apache.org wrote: Hi Patrick, I thought it was more intuitive, sounds we have to update de doc. Anyway, to reply to your questions: 1) just create the Digester instance, set the RegexRules and start binding your rules: Digester digester = new Digester(); digester.setRules( new RegexRules( new SimpleRegexMatcher() ) ); digester.addCallMethod( collection/doc/categ/*, myMethod, 0 ); 2) yes, as reported in the javadoc I pointed: * matches any sequence of none, one or more characters like in the bash syntax; if you want to apply kind of filters, bind the rules with restrictive patterns (prefixes/postfixes); ie. given the rule: digester.addCallMethod( collection/doc/categ/patt*, myMethod, 0 ); collection/doc/categ/patt - matches collection/doc/categ/pattern - matches collection/doc/categ/patteRn - matches collection/doc/categ/pattern - matches collection/doc/categ/paBtern - does not match HTH, have a nice weekend, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, May 14, 2011 at 8:58 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: Thanks, 1) Is there any tutorial explaining how to use it ? 2) In my case, if I have more than one child, is the pattern detected multiple times ? help is very appreciated! On 14 May 2011 01:36, Simone Tripodi simonetrip...@apache.org wrote: Hi Patrick, follow the Konstantin's suggestion, that's the way to achieve it. Have a read also to http://commons.apache.org/digester/apidocs/index.html?org/apache/commons/digester/SimpleRegexMatcher.html HTH, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, May 13, 2011 at 8:28 PM, Konstantin Kolinko knst.koli...@gmail.com wrote: 2011/5/13 Patrick Diviacco patrick.divia...@gmail.com: mhm, sorry.. just to be more clear. Is there a way in Commons Digester to trigger a method only if a xml element has a child ? i.e. digester.addCallMethod(collection/doc/categ/*, myMethod, 0); This doesn't work. The * is allowed in the prefix only, as documented in http://commons.apache.org/digester/commons-digester-2.1/docs/api/org/apache/commons/digester/RulesBase.html You may try to use
Re: [digester] how can I print children tags instead of only tag content ?
Hi Patrick, I thought it was more intuitive, sounds we have to update de doc. Anyway, to reply to your questions: 1) just create the Digester instance, set the RegexRules and start binding your rules: Digester digester = new Digester(); digester.setRules( new RegexRules( new SimpleRegexMatcher() ) ); digester.addCallMethod( collection/doc/categ/*, myMethod, 0 ); 2) yes, as reported in the javadoc I pointed: * matches any sequence of none, one or more characters like in the bash syntax; if you want to apply kind of filters, bind the rules with restrictive patterns (prefixes/postfixes); ie. given the rule: digester.addCallMethod( collection/doc/categ/patt*, myMethod, 0 ); collection/doc/categ/patt - matches collection/doc/categ/pattern - matches collection/doc/categ/patteRn - matches collection/doc/categ/pattern - matches collection/doc/categ/paBtern - does not match HTH, have a nice weekend, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, May 14, 2011 at 8:58 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: Thanks, 1) Is there any tutorial explaining how to use it ? 2) In my case, if I have more than one child, is the pattern detected multiple times ? help is very appreciated! On 14 May 2011 01:36, Simone Tripodi simonetrip...@apache.org wrote: Hi Patrick, follow the Konstantin's suggestion, that's the way to achieve it. Have a read also to http://commons.apache.org/digester/apidocs/index.html?org/apache/commons/digester/SimpleRegexMatcher.html HTH, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, May 13, 2011 at 8:28 PM, Konstantin Kolinko knst.koli...@gmail.com wrote: 2011/5/13 Patrick Diviacco patrick.divia...@gmail.com: mhm, sorry.. just to be more clear. Is there a way in Commons Digester to trigger a method only if a xml element has a child ? i.e. digester.addCallMethod(collection/doc/categ/*, myMethod, 0); This doesn't work. The * is allowed in the prefix only, as documented in http://commons.apache.org/digester/commons-digester-2.1/docs/api/org/apache/commons/digester/RulesBase.html You may try to use a different rules matcher. See RegexMatchers chapter here: http://commons.apache.org/digester/commons-digester-2.1/core.html But it is actually what I need. If element categ has at least a child, then trigger myMethod Best regards, Konstantin Kolinko - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] how can I print children tags instead of only tag content ?
IIUC, no matters which kind of children your node has, you're interested only on the first child, right? http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, May 14, 2011 at 10:51 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: ps. the children names are completely different, there is no way to use a regex to discriminate between them. On 14 May 2011 22:50, Patrick Diviacco patrick.divia...@gmail.com wrote: hi Simone, ok, it was just matter of adding one line :) By the way I still have an issue in the case of multiple children and I don't know how to solve it. If I have a document containing: parent child1/child1 child2/child2 /parent I don't want to trigger the method twice, but just once... in other terms I want to trigger the method only once per document and only if the parent tag has at least 1 child. I copy my code again: Digester digester = new Digester(); digester.setRules( new RegexRules( new SimpleRegexMatcher() ) ); digester.addCallMethod(collection/doc/categ/*, myMethod, 0); thanks Patrick On 14 May 2011 21:54, Simone Tripodi simonetrip...@apache.org wrote: Hi Patrick, I thought it was more intuitive, sounds we have to update de doc. Anyway, to reply to your questions: 1) just create the Digester instance, set the RegexRules and start binding your rules: Digester digester = new Digester(); digester.setRules( new RegexRules( new SimpleRegexMatcher() ) ); digester.addCallMethod( collection/doc/categ/*, myMethod, 0 ); 2) yes, as reported in the javadoc I pointed: * matches any sequence of none, one or more characters like in the bash syntax; if you want to apply kind of filters, bind the rules with restrictive patterns (prefixes/postfixes); ie. given the rule: digester.addCallMethod( collection/doc/categ/patt*, myMethod, 0 ); collection/doc/categ/patt - matches collection/doc/categ/pattern - matches collection/doc/categ/patteRn - matches collection/doc/categ/pattern - matches collection/doc/categ/paBtern - does not match HTH, have a nice weekend, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, May 14, 2011 at 8:58 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: Thanks, 1) Is there any tutorial explaining how to use it ? 2) In my case, if I have more than one child, is the pattern detected multiple times ? help is very appreciated! On 14 May 2011 01:36, Simone Tripodi simonetrip...@apache.org wrote: Hi Patrick, follow the Konstantin's suggestion, that's the way to achieve it. Have a read also to http://commons.apache.org/digester/apidocs/index.html?org/apache/commons/digester/SimpleRegexMatcher.html HTH, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, May 13, 2011 at 8:28 PM, Konstantin Kolinko knst.koli...@gmail.com wrote: 2011/5/13 Patrick Diviacco patrick.divia...@gmail.com: mhm, sorry.. just to be more clear. Is there a way in Commons Digester to trigger a method only if a xml element has a child ? i.e. digester.addCallMethod(collection/doc/categ/*, myMethod, 0); This doesn't work. The * is allowed in the prefix only, as documented in http://commons.apache.org/digester/commons-digester-2.1/docs/api/org/apache/commons/digester/RulesBase.html You may try to use a different rules matcher. See RegexMatchers chapter here: http://commons.apache.org/digester/commons-digester-2.1/core.html But it is actually what I need. If element categ has at least a child, then trigger myMethod Best regards, Konstantin Kolinko - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] Grabbing data from sub-element attributes
Hi Christopher, I suggest you following Rahul's suggestion, SetNestedPropertiesRule is not efficient as a direct invocation. Moreover, for foo/bar properties, there's a 3rd way to set them: d.addObjectCreate(entities/entity, Entity.class); d.addBeanPropertySetter(entities/entity/foo); d.addBeanPropertySetter(entities/entity/bar); d.addCallMethod(entities/entity/baz, setBaz, 1); d.addCallParam(entities/entity/baz, 0, id); HTH, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, May 14, 2011 at 12:11 AM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Rahul, On 5/13/2011 5:53 PM, Rahul Akolkar wrote: Yeah, and probably more than one way even with out of the box rules: d.addObjectCreate(entities/entity, Entity.class); d.addCallMethod(entities/entity/foo, setFoo, 0); d.addCallMethod(entities/entity/bar, setBar, 0); d.addCallMethod(entities/entity/baz, setBaz, 1); d.addCallParam(entities/entity/baz, 0, id); Thanks for the tip... that might actually be somewhat simpler code than I have now. I'm using setNestedProperties and enumerating them because I need to re-name some of the properties. But, that requires that I enumerate all of them, even those I want to ignore, otherwise I'll get an error. If I use addCallMethod, the Digester will probably ignore anything for which there is no rule. Thanks, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk3NrH4ACgkQ9CaO5/Lv0PASVwCfSEYMFGwDYuOj0fZvaFuDl+YD 9tkAoIOnGQk4ERImSnU7LVW501rYjYEF =7vJb -END PGP SIGNATURE- - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] how can I print children tags instead of only tag content ?
Hi Patrick, follow the Konstantin's suggestion, that's the way to achieve it. Have a read also to http://commons.apache.org/digester/apidocs/index.html?org/apache/commons/digester/SimpleRegexMatcher.html HTH, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, May 13, 2011 at 8:28 PM, Konstantin Kolinko knst.koli...@gmail.com wrote: 2011/5/13 Patrick Diviacco patrick.divia...@gmail.com: mhm, sorry.. just to be more clear. Is there a way in Commons Digester to trigger a method only if a xml element has a child ? i.e. digester.addCallMethod(collection/doc/categ/*, myMethod, 0); This doesn't work. The * is allowed in the prefix only, as documented in http://commons.apache.org/digester/commons-digester-2.1/docs/api/org/apache/commons/digester/RulesBase.html You may try to use a different rules matcher. See RegexMatchers chapter here: http://commons.apache.org/digester/commons-digester-2.1/core.html But it is actually what I need. If element categ has at least a child, then trigger myMethod Best regards, Konstantin Kolinko - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[ANNOUNCEMENT] Apache Commons Discovery 0.5 released!
The Apache Commons team is pleased to announce the commons-discovery-0.5 release! The Apache Commons Discovery component is about discovering, or finding, implementations for pluggable interfaces. Changes in this version include: Fixed Bugs: o Enumeration in Service class is broken. Issue: DISCOVERY-3. o [discovery] Doesn't work with ClassLoaders that do not support getResource() Issue: DISCOVERY-6. o Service.providers Enumeration does not catch and discard UnsatisfiedLinkErrors and ExceptionInInitializerErrors. Issue: DISCOVERY-11. o SPI implementation class searching logic has some issues: it discards all errors; it only considers first className in supplied classNames array. Issue: DISCOVERY-12. o Problem with Oracle JVM classLoader. Issue: DISCOVERY-13. o Enumeration returned by Service.providers has a broken behavior. Issue: DISCOVERY-17. Changes: o Discovery failed to load an inner class. Issue: DISCOVERY-7. o Documentation of other use cases. Issue: DISCOVERY-9. o Moved to Java5 APIs, used Generics. Issue: DISCOVERY-14. o Custom org.apache.commons.discovery.log.Log implementation replaced by default commons-logging behavior. Issue: DISCOVERY-15. o The setLog() methods are not thread-safe and should be deprecated. Issue: DISCOVERY-16. Don't miss to check the Apache Commons component page on http://commons.apache.org/discovery/ Have fun! -Simo, on behalf of Apache Commons team http://people.apache.org/~simonetripodi/ http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [ANNOUNCEMENT] Apache Commons Discovery 0.5 released!
Thank you Gary for the help!!! And a big thank you! goes also to Phil Steiz and Brian Demers, without them it would have been hard! Habe a nice day! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, May 5, 2011 at 2:57 PM, Gary Gregory garydgreg...@gmail.com wrote: Congratulations to Simone for pushing this release out! Gary On May 5, 2011, at 8:26, Simone Tripodi simonetrip...@apache.org wrote: The Apache Commons team is pleased to announce the commons-discovery-0.5 release! The Apache Commons Discovery component is about discovering, or finding, implementations for pluggable interfaces. Changes in this version include: Fixed Bugs: o Enumeration in Service class is broken. Issue: DISCOVERY-3. o [discovery] Doesn't work with ClassLoaders that do not support getResource() Issue: DISCOVERY-6. o Service.providers Enumeration does not catch and discard UnsatisfiedLinkErrors and ExceptionInInitializerErrors. Issue: DISCOVERY-11. o SPI implementation class searching logic has some issues: it discards all errors; it only considers first className in supplied classNames array. Issue: DISCOVERY-12. o Problem with Oracle JVM classLoader. Issue: DISCOVERY-13. o Enumeration returned by Service.providers has a broken behavior. Issue: DISCOVERY-17. Changes: o Discovery failed to load an inner class. Issue: DISCOVERY-7. o Documentation of other use cases. Issue: DISCOVERY-9. o Moved to Java5 APIs, used Generics. Issue: DISCOVERY-14. o Custom org.apache.commons.discovery.log.Log implementation replaced by default commons-logging behavior. Issue: DISCOVERY-15. o The setLog() methods are not thread-safe and should be deprecated. Issue: DISCOVERY-16. Don't miss to check the Apache Commons component page on http://commons.apache.org/discovery/ Have fun! -Simo, on behalf of Apache Commons team http://people.apache.org/~simonetripodi/ http://www.99soft.org/ - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] digester performance..
I'd discourage XPath since implies maintaining the DOM in memory, if the XML document Patrick is parsing is large is thousand and thousand of Megabytes, XPath is not efficient as well. Patrick, honestly I didn't understand the problem :) sounds a Lucene performance problem, did you already try writing on Lucene ML? Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Tue, Apr 5, 2011 at 11:24 PM, Jimmy Zhang crack...@comcast.net wrote: Have you considered using xpath instead of digester? -Original Message- From: Patrick Diviacco Sent: Tuesday, April 05, 2011 4:08 AM To: Commons Users List Subject: [digester] digester performance.. hi, I've a java app and I've stopped to use Digester recently because all my data is now kept in RAM and I don't need to write/parse xml files anymore. However, since I don't use Digester and external xml files, the performance of my app got worse. I now have the same data stored in a ArrayListArrayListString and I'm iterate them with a for cycle. Before they were in a xml file with the following structure: collection doc field1/field1 .. /doc .. /collection Is really Digester much faster in iterating my data from xml file than a for loop iterating an ArrayList with the same content? thanks - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] digester performance..
Hi Patrick, if the Digester program you're speaking about is the one you pasted here time ago... well, there were a lot of optimization missed. For example I suggested you using the Lucene rules instead of storing all the properties in a POJO then creating the Lucene Document, in that way you limit the amount of stored data. When parsing large XML document - like your case - I suggest you mapping to Object as less as possible and stream more. HTH, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ 2011/4/5 Weiwei Wang ww.wang...@gmail.com: I don't not think your program becomes slower because you are not using Digester, RAM should be much faster. Suggest you make your main part of your program simple and paste it in the email so as others can help On Tue, Apr 5, 2011 at 7:08 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: hi, I've a java app and I've stopped to use Digester recently because all my data is now kept in RAM and I don't need to write/parse xml files anymore. However, since I don't use Digester and external xml files, the performance of my app got worse. I now have the same data stored in a ArrayListArrayListString and I'm iterate them with a for cycle. Before they were in a xml file with the following structure: collection doc field1/field1 .. /doc .. /collection Is really Digester much faster in iterating my data from xml file than a for loop iterating an ArrayList with the same content? thanks -- 王巍巍 Cell: 18911288489 MSN: ww.wang...@gmail.com Blog: http://whisper.eyesay.org 围脖:http://t.sina.com/lolorosa - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] why addCallMethod doesn't work?
Nice to know you fixed the issues ;) About the Digetser3: if/when it will be released dependes also by you users, if you don't have the need of it then it's hard to release something nobody wants, so please give a try if you have spare time (remember the you have to checkout and compile the code because is a sandbox) and send your release request via ML :P Have a nice day, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sat, Apr 2, 2011 at 4:05 AM, Kurt Xu fxbird1...@163.com wrote: Yes,addObjectParam is the point. I've wrongly used addCallParam. And using Regular Expression here to parse Constant and Mutable is very simple and clean. The alternative setTable method is as following: d.addSetProperties(pattern + /Handler, class, handler); d.addObjectCreate(pathClass+/*/Constant,ConstantProp.class); d.addSetNext(pathClass+/*/Constant,addConstantProp); d.addSetProperties(pathClass+/*/Constant); d.addObjectCreate(pathClass+/*/Mutable,MutableProp.class); d.addSetNext(pathClass+/*/Mutable,addMutableProp); d.addSetProperties(pathClass+/*/Mutable); d.addCallMethod(pattern, setType, 1); d.addObjectParam(pattern, 0, type); First I think it won't work because of some other issue. Now I'm happy it's fine. Thanks Simone. For the coming Digester 3 , I hope it will be provided with a complete document that is rich in examples. You know current document is not easy to understand, I see after using it for a while. Kurt On Fri, 01 Apr 2011 22:32:12 +0800, Simone Tripodi simonetrip...@apache.org wrote: Not sure to understand the question, but try with d.addCallMethod(pattern, setType, 1); d.addCallParam(pattern, 0, type); if you want to extract the type from the XML (note the type instead of simply type) Otherwise, d.addCallMethod(pattern, setType, 1); d.addObjectParam(pattern, 0, type); if you need to set the type variable reference HTH, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 3:53 PM, Kurt Xu fxbird1...@163.com wrote: Hello Simone: Just below in method setTable is woring. d.addCallMethod(pattern, setType, 1); d.addCallParam(pattern, 0, type); other part is ok. Thanks. Kurt On Fri, 01 Apr 2011 21:05:08 +0800, Simone Tripodi simonetrip...@apache.org wrote: Holy cow, Kurt!!! :D can you be more precise and highlight which is the part that doesn't work? For what I see, there's one assCallParam() set in your Digetser and that's for the Handler Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ 2011/4/1 Kurt Xu fxbird1...@163.com: Hi all digester users developers: Today I use addCallMethod but it doesn't work as before. the xml is below: ?xml version=1.0 encoding=UTF-8? Project name=project1 Functionality description=add comment url= Action class=com.mygame.action.UserAction method=entry/ BasicInfo kpiCategoryId=K01002 contentType=thread statisticsType=处理日/ Class name=com.mygame.bo.UserBOImpl method=entry TextTable type=insert name=MOCO_CODICMT Handler class=com.mytest.siamon.util.DefaultSiamonHandler/ Main Constant column=DeviceType value=pc/ Mutable property=cmtno argidx=0 column=PrimaryKey1/ /Main Sub Mutable property=writeid argidx=0 column=WriterId/ Mutable property=contents argidx=0 column=Content/ Constant column=TestType value=test/ /Sub /TextTable /Class /Functionality /Project there's a code about Mutable and Constant that they both can show up under Main or Sub, the former represents a mutable property and the latter represents a constant property in out business logic. But the question is when TextTable element shows up, I want to set TableMap(XXXTable related class, pojo)'s type as txt through addCallMethod. I research on official sample but it is not right in my code, it looks just the same as the sample. related java file: 1)ClassItem.java package com.siamon.model.config; import java.util.ArrayList; import java.util.List; public class ClassItem { private String method; private String name; private ListTableMap tableMapList=new ArrayListTableMap(); public ClassItem(String name, String method, ListTableMap tableMapList) { this.name = name; this.method = method; this.tableMapList = tableMapList; } public ClassItem() { } public String getMethod() { return method; } public void setMethod(String method) { this.method = method; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void addTableMap(TableMap tm){ getTableMapList().add(tm
Re: Re: [digester]How to use SimpleRegexMatcher?
Hi Kurt, glad you fixed your issue, but honestly I didn't understand your last question, apologizes :( Can you provide more details/some sample? Thanks! Simo PS nope, I'm from Italy :P http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 3:21 AM, Kurt Xu fxbird1...@163.com wrote: Hi Simone: I tried by myself after emailing and resovled it . the method is the same as your reply. I have a question still though. What if I want do set two customized rule . The second setRules can reset or override the first calling, can't it? btw: why u say ni hao, r u from China? Many thanks. Kurt On Thu, 31 Mar 2011 14:39:59 +0800, Simone Tripodi simonetrip...@apache.org wrote: Ni hao again Kurt, just realized that the ParaItemRule implementation is incomplete, use the one below. Simo public final class ParaItemRule extends org.apache.commons.digester.Rule { @Override public void body(String namespace, String name, String text) throws Exception { digester.push(new ParaItem(name, text)); } @Override public void end() throws Exception { digester.pop(); } http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Mar 31, 2011 at 8:36 AM, Simone Tripodi simonetrip...@apache.org wrote: Hi Kurt, calling the setRules() method in the way you did, makes the Rules instance is reset, so you loose the already set patterns. modify the code in order that the setRules() method is invoked before setting patterns/rules. HTH, Simo private void parseProject2(URL url) throws IOException, SAXException { Digester d = new Digester(); d.setRules(new RegexRules(new SimpleRegexMatcher())); String pathFunc = Project/Functionality; String pathClass = pathFunc + /Class; String pathPara = pathClass + /Parameter; d.addObjectCreate(Project, Project.class); d.addSetProperties(Project); d.addObjectCreate(pathFunc, Functionality.class); d.addSetNext(pathFunc, addFunctionality); d.addSetProperties(pathFunc); // d.addSetProperties(pathFunc + /BasicInfo); d.addObjectCreate(pathClass, ClassItem.class); d.addSetNext(pathClass, addClassItem); d.addSetProperties(pathClass); d.addObjectCreate(pathPara, Parameter.class); d.addSetNext(pathPara, addParameter); d.addRule(pathPara+/Main/*, new ParaItemRule()); d.addSetNext(pathPara+/Main/*, addMainParaItem); d.addRule(pathPara +SubText/*, new ParaItemRule()); d.addSetNext(pathPara +SubText/*, addSubParaItem); d.parse(url); Project project = (Project) d.getRoot(); System.out.println(); } http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Mar 31, 2011 at 5:44 AM, Kurt Xu fxbird1...@163.com wrote: Sorry Simone: I need to paste the full xml and java file to help u locate the error,:) xml: ?xml version=1.0 encoding=UTF-8? Project name=project1 Functionality description=add comment url=http://dev.mygame.co.jp/user/register.do; actionName=com.mygame.action.UserAction actionMethod=register Class name=com.mygame.bo.UserBOImpl method=register Parameter name=user index=0 type=insert Main DeviceType constant=truepc/DeviceType CheckStatus constant=trueN/CheckStatus ValidCheck constant=trueYes/ValidCheck CheckDescfirst check desc/CheckDesc UserIduserid/UserId PrimaryKey1cmtno/PrimaryKey1 /Main SubText !--Type constant=true/false/Type-- !--Titletitle/Title-- Contentcontents/Content WriterIdwriteid/WriterId WriterUserNameuserid/WriterUserName /SubText /Parameter Parameter name=postVO index=1 type=update table=MOCO_CODICMT . /Parameter /Class /Functionality /Project java code: parser method: private void parseProject2(URL url) throws IOException, SAXException { Digester d = new Digester(); String pathFunc = Project/Functionality; String pathClass = pathFunc + /Class; String pathPara = pathClass + /Parameter; d.addObjectCreate(Project, Project.class); d.addSetProperties(Project); d.addObjectCreate(pathFunc, Functionality.class); d.addSetNext(pathFunc, addFunctionality); d.addSetProperties(pathFunc); // d.addSetProperties(pathFunc + /BasicInfo); d.addObjectCreate(pathClass, ClassItem.class); d.addSetNext(pathClass, addClassItem); d.addSetProperties(pathClass); d.addObjectCreate(pathPara, Parameter.class); d.addSetNext(pathPara, addParameter); d.setRules(new RegexRules(new SimpleRegexMatcher())); d.addRule(pathPara
Re: Re: Re: [digester]How to use SimpleRegexMatcher?
Hi Kurt Ok now I get it: exactly, calling Digetser.setRules() you loose all the already set Rules instance, so it would be better if you call it first. HTH, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 9:14 AM, Kurt Xu fxbird1...@163.com wrote: Hi Simone: I mean if I implement rules ,say RulesA, RulesB , then setRules(new RulesA()),setRules(new RulesB()). the second calling setRules would reset the first call, right? Thanks. Kurt Hi Kurt, glad you fixed your issue, but honestly I didn't understand your last question, apologizes :( Can you provide more details/some sample? Thanks! Simo PS nope, I'm from Italy :P http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 3:21 AM, Kurt Xu fxbird1...@163.com wrote: Hi Simone: I tried by myself after emailing and resovled it . the method is the same as your reply. I have a question still though. What if I want do set two customized rule . The second setRules can reset or override the first calling, can't it? btw: why u say ni hao, r u from China? Many thanks. Kurt On Thu, 31 Mar 2011 14:39:59 +0800, Simone Tripodi simonetrip...@apache.org wrote: Ni hao again Kurt, just realized that the ParaItemRule implementation is incomplete, use the one below. Simo public final class ParaItemRule extends org.apache.commons.digester.Rule { @Override public void body(String namespace, String name, String text) throws Exception { digester.push(new ParaItem(name, text)); } @Override public void end() throws Exception { digester.pop(); } http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Mar 31, 2011 at 8:36 AM, Simone Tripodi simonetrip...@apache.org wrote: Hi Kurt, calling the setRules() method in the way you did, makes the Rules instance is reset, so you loose the already set patterns. modify the code in order that the setRules() method is invoked before setting patterns/rules. HTH, Simo private void parseProject2(URL url) throws IOException, SAXException { Digester d = new Digester(); d.setRules(new RegexRules(new SimpleRegexMatcher())); String pathFunc = Project/Functionality; String pathClass = pathFunc + /Class; String pathPara = pathClass + /Parameter; d.addObjectCreate(Project, Project.class); d.addSetProperties(Project); d.addObjectCreate(pathFunc, Functionality.class); d.addSetNext(pathFunc, addFunctionality); d.addSetProperties(pathFunc); // d.addSetProperties(pathFunc + /BasicInfo); d.addObjectCreate(pathClass, ClassItem.class); d.addSetNext(pathClass, addClassItem); d.addSetProperties(pathClass); d.addObjectCreate(pathPara, Parameter.class); d.addSetNext(pathPara, addParameter); d.addRule(pathPara+/Main/*, new ParaItemRule()); d.addSetNext(pathPara+/Main/*, addMainParaItem); d.addRule(pathPara +SubText/*, new ParaItemRule()); d.addSetNext(pathPara +SubText/*, addSubParaItem); d.parse(url); Project project = (Project) d.getRoot(); System.out.println(); } http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Mar 31, 2011 at 5:44 AM, Kurt Xu fxbird1...@163.com wrote: Sorry Simone: I need to paste the full xml and java file to help u locate the error,:) xml: ?xml version=1.0 encoding=UTF-8? Project name=project1 Functionality description=add comment url=http://dev.mygame.co.jp/user/register.do; actionName=com.mygame.action.UserAction actionMethod=register Class name=com.mygame.bo.UserBOImpl method=register Parameter name=user index=0 type=insert Main DeviceType constant=truepc/DeviceType CheckStatus constant=trueN/CheckStatus ValidCheck constant=trueYes/ValidCheck CheckDescfirst check desc/CheckDesc UserIduserid/UserId PrimaryKey1cmtno/PrimaryKey1 /Main SubText !--Type constant=true/false/Type-- !--Titletitle/Title-- Contentcontents/Content WriterIdwriteid/WriterId WriterUserNameuserid/WriterUserName /SubText /Parameter Parameter name=postVO index=1 type=update table=MOCO_CODICMT . /Parameter /Class /Functionality /Project java code: parser method: private void parseProject2(URL url) throws IOException, SAXException { Digester d = new Digester(); String pathFunc = Project/Functionality; String pathClass = pathFunc + /Class; String pathPara = pathClass + /Parameter; d.addObjectCreate(Project, Project.class); d.addSetProperties(Project); d.addObjectCreate(pathFunc, Functionality.class); d.addSetNext
Re: [digester] NullPointerException
Nice! :) As a side note: I'd like to ask you to test the Digester3 on Sandbox[1], any feedback would be very appreciated :) Many thanks in advance, have a nice day, Simo [1] http://commons.apache.org/sandbox/digester3/ http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 10:05 AM, Patrick Diviacco patrick.divia...@gmail.com wrote: Cool thanks, solved. On 1 April 2011 01:00, Simone Tripodi simonetrip...@apache.org wrote: Patrick, just replace 71 digester.addObjectCreate(collection, XMLReader.class); with digester.push(this); Otherwise 30 ArrayListArrayListString docs; with 30 ArrayListArrayListString docs = new ArrayListArrayListString(); and remove line 64 I suggest you the first option Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 12:36 AM, Patrick Diviacco patrick.divia...@gmail.com wrote: Sure, here you are http://dl.dropbox.com/u/72686/trainSmall.xml and http://dl.dropbox.com/u/72686/testSmall.xml I was wondering if the issue is that XMLReader has been created as static object... thanks On 1 April 2011 00:26, Simone Tripodi simonetrip...@apache.org wrote: Hi Patrick, can you link also to the XML you're trying to parse? Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Mar 31, 2011 at 10:24 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: Hi, I'm trying to store the content of a xml file into memory but for some reason I get following NullPointerException.. (this is the code: http://pastie.org/1740948): Clusterer... Reading XML... Mar 31, 2011 10:19:17 PM org.apache.commons.digester.Digester endElement SEVERE: End event threw exception java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216) at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220) at org.apache.commons.digester.Rule.end(Rule.java:257) at org.apache.commons.digester.Digester.endElement(Digester.java:1345) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at org.apache.commons.digester.Digester.parse(Digester.java:1871) at XMLReader.read(XMLReader.java:74) at Clusterer.init(Clusterer.java:49) at Main.main(Main.java:11) Caused by: java.lang.NullPointerException at XMLReader$FlickrCollection.addDocument(XMLReader.java:108) ... 22 more java.lang.NullPointerException at org.apache.commons.digester.Digester.createSAXException(Digester.java:3363) at org.apache.commons.digester.Digester.createSAXException(Digester.java:3389) at org.apache.commons.digester.Digester.endElement(Digester.java:1348) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808
Re: Re: Re: [digester]How to use SimpleRegexMatcher?
Sorry, I lost you, didn't understand :( Please provide me a more concrete sample, please Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 9:37 AM, Kurt Xu fxbird1...@163.com wrote: Hi Simone: Maybe you got me wrong. Two RulesX needs calling setRules twice ,right? How could be just set once. Thanks Kurt On Fri, 01 Apr 2011 15:27:09 +0800, Simone Tripodi simonetrip...@apache.org wrote: Hi Kurt Ok now I get it: exactly, calling Digetser.setRules() you loose all the already set Rules instance, so it would be better if you call it first. HTH, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 9:14 AM, Kurt Xu fxbird1...@163.com wrote: Hi Simone: I mean if I implement rules ,say RulesA, RulesB , then setRules(new RulesA()),setRules(new RulesB()). the second calling setRules would reset the first call, right? Thanks. Kurt Hi Kurt, glad you fixed your issue, but honestly I didn't understand your last question, apologizes :( Can you provide more details/some sample? Thanks! Simo PS nope, I'm from Italy :P http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 3:21 AM, Kurt Xu fxbird1...@163.com wrote: Hi Simone: I tried by myself after emailing and resovled it . the method is the same as your reply. I have a question still though. What if I want do set two customized rule . The second setRules can reset or override the first calling, can't it? btw: why u say ni hao, r u from China? Many thanks. Kurt On Thu, 31 Mar 2011 14:39:59 +0800, Simone Tripodi simonetrip...@apache.org wrote: Ni hao again Kurt, just realized that the ParaItemRule implementation is incomplete, use the one below. Simo public final class ParaItemRule extends org.apache.commons.digester.Rule { @Override public void body(String namespace, String name, String text) throws Exception { digester.push(new ParaItem(name, text)); } @Override public void end() throws Exception { digester.pop(); } http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Mar 31, 2011 at 8:36 AM, Simone Tripodi simonetrip...@apache.org wrote: Hi Kurt, calling the setRules() method in the way you did, makes the Rules instance is reset, so you loose the already set patterns. modify the code in order that the setRules() method is invoked before setting patterns/rules. HTH, Simo private void parseProject2(URL url) throws IOException, SAXException { Digester d = new Digester(); d.setRules(new RegexRules(new SimpleRegexMatcher())); String pathFunc = Project/Functionality; String pathClass = pathFunc + /Class; String pathPara = pathClass + /Parameter; d.addObjectCreate(Project, Project.class); d.addSetProperties(Project); d.addObjectCreate(pathFunc, Functionality.class); d.addSetNext(pathFunc, addFunctionality); d.addSetProperties(pathFunc); // d.addSetProperties(pathFunc + /BasicInfo); d.addObjectCreate(pathClass, ClassItem.class); d.addSetNext(pathClass, addClassItem); d.addSetProperties(pathClass); d.addObjectCreate(pathPara, Parameter.class); d.addSetNext(pathPara, addParameter); d.addRule(pathPara+/Main/*, new ParaItemRule()); d.addSetNext(pathPara+/Main/*, addMainParaItem); d.addRule(pathPara +SubText/*, new ParaItemRule()); d.addSetNext(pathPara +SubText/*, addSubParaItem); d.parse(url); Project project = (Project) d.getRoot(); System.out.println(); } http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Mar 31, 2011 at 5:44 AM, Kurt Xu fxbird1...@163.com wrote: Sorry Simone: I need to paste the full xml and java file to help u locate the error,:) xml: ?xml version=1.0 encoding=UTF-8? Project name=project1 Functionality description=add comment url=http://dev.mygame.co.jp/user/register.do; actionName=com.mygame.action.UserAction actionMethod=register Class name=com.mygame.bo.UserBOImpl method=register Parameter name=user index=0 type=insert Main DeviceType constant=truepc/DeviceType CheckStatus constant=trueN/CheckStatus ValidCheck constant=trueYes/ValidCheck CheckDescfirst check desc/CheckDesc UserIduserid/UserId PrimaryKey1cmtno/PrimaryKey1 /Main SubText !--Type constant=true/false/Type-- !--Titletitle/Title-- Contentcontents/Content WriterIdwriteid/WriterId WriterUserNameuserid/WriterUserName /SubText /Parameter Parameter name=postVO index=1 type=update table=MOCO_CODICMT . /Parameter /Class /Functionality /Project java code: parser method
Re: Re: Re: [digester]How to use SimpleRegexMatcher?
Hi Kurt, OK now I got it :D The Digester instance supports only 1 Rules instance at time, you can't use 2 or more Rules instance at the same time. BTW all Rules implementations should support the basic matching pattern, so the Regexp one I suggested you would work as well for your case. Even if I joined the team on 2010, yes, I'm one of Digester committers; there's a new version of Digester in Sandbox[1] I developed, I would really appreciate if you users can provide feedbacks, contains then same features but quite different APIs, thanks in advance :) Have a nice day, Simo [1] http://commons.apache.org/sandbox/digester3/ http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 1:08 PM, Kurt Xu fxbird1...@163.com wrote: Ok, let me change the asking way. How to set RulesA and RulesB at the same time? btw:r u the digester developer? :) Thanks. On Fri, 01 Apr 2011 18:48:09 +0800, Simone Tripodi simonetrip...@apache.org wrote: Sorry, I lost you, didn't understand :( Please provide me a more concrete sample, please Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 9:37 AM, Kurt Xu fxbird1...@163.com wrote: Hi Simone: Maybe you got me wrong. Two RulesX needs calling setRules twice ,right? How could be just set once. Thanks Kurt On Fri, 01 Apr 2011 15:27:09 +0800, Simone Tripodi simonetrip...@apache.org wrote: Hi Kurt Ok now I get it: exactly, calling Digetser.setRules() you loose all the already set Rules instance, so it would be better if you call it first. HTH, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 9:14 AM, Kurt Xu fxbird1...@163.com wrote: Hi Simone: I mean if I implement rules ,say RulesA, RulesB , then setRules(new RulesA()),setRules(new RulesB()). the second calling setRules would reset the first call, right? Thanks. Kurt Hi Kurt, glad you fixed your issue, but honestly I didn't understand your last question, apologizes :( Can you provide more details/some sample? Thanks! Simo PS nope, I'm from Italy :P http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 3:21 AM, Kurt Xu fxbird1...@163.com wrote: Hi Simone: I tried by myself after emailing and resovled it . the method is the same as your reply. I have a question still though. What if I want do set two customized rule . The second setRules can reset or override the first calling, can't it? btw: why u say ni hao, r u from China? Many thanks. Kurt On Thu, 31 Mar 2011 14:39:59 +0800, Simone Tripodi simonetrip...@apache.org wrote: Ni hao again Kurt, just realized that the ParaItemRule implementation is incomplete, use the one below. Simo public final class ParaItemRule extends org.apache.commons.digester.Rule { @Override public void body(String namespace, String name, String text) throws Exception { digester.push(new ParaItem(name, text)); } @Override public void end() throws Exception { digester.pop(); } http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Mar 31, 2011 at 8:36 AM, Simone Tripodi simonetrip...@apache.org wrote: Hi Kurt, calling the setRules() method in the way you did, makes the Rules instance is reset, so you loose the already set patterns. modify the code in order that the setRules() method is invoked before setting patterns/rules. HTH, Simo private void parseProject2(URL url) throws IOException, SAXException { Digester d = new Digester(); d.setRules(new RegexRules(new SimpleRegexMatcher())); String pathFunc = Project/Functionality; String pathClass = pathFunc + /Class; String pathPara = pathClass + /Parameter; d.addObjectCreate(Project, Project.class); d.addSetProperties(Project); d.addObjectCreate(pathFunc, Functionality.class); d.addSetNext(pathFunc, addFunctionality); d.addSetProperties(pathFunc); // d.addSetProperties(pathFunc + /BasicInfo); d.addObjectCreate(pathClass, ClassItem.class); d.addSetNext(pathClass, addClassItem); d.addSetProperties(pathClass); d.addObjectCreate(pathPara, Parameter.class); d.addSetNext(pathPara, addParameter); d.addRule(pathPara+/Main/*, new ParaItemRule()); d.addSetNext(pathPara+/Main/*, addMainParaItem); d.addRule(pathPara +SubText/*, new ParaItemRule()); d.addSetNext(pathPara +SubText/*, addSubParaItem); d.parse(url); Project project = (Project) d.getRoot(); System.out.println(); } http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Mar 31, 2011 at 5:44 AM, Kurt Xu fxbird1...@163.com wrote: Sorry Simone: I need to paste the full xml and java file to help u locate the error,:) xml: ?xml version=1.0 encoding=UTF-8? Project name=project1 Functionality description=add comment url=http://dev.mygame.co.jp/user/register.do
Re: [digester] why addCallMethod doesn't work?
Holy cow, Kurt!!! :D can you be more precise and highlight which is the part that doesn't work? For what I see, there's one assCallParam() set in your Digetser and that's for the Handler Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ 2011/4/1 Kurt Xu fxbird1...@163.com: Hi all digester users developers: Today I use addCallMethod but it doesn't work as before. the xml is below: ?xml version=1.0 encoding=UTF-8? Project name=project1 Functionality description=add comment url= Action class=com.mygame.action.UserAction method=entry/ BasicInfo kpiCategoryId=K01002 contentType=thread statisticsType=处理日/ Class name=com.mygame.bo.UserBOImpl method=entry TextTable type=insert name=MOCO_CODICMT Handler class=com.mytest.siamon.util.DefaultSiamonHandler/ Main Constant column=DeviceType value=pc/ Mutable property=cmtno argidx=0 column=PrimaryKey1/ /Main Sub Mutable property=writeid argidx=0 column=WriterId/ Mutable property=contents argidx=0 column=Content/ Constant column=TestType value=test/ /Sub /TextTable /Class /Functionality /Project there's a code about Mutable and Constant that they both can show up under Main or Sub, the former represents a mutable property and the latter represents a constant property in out business logic. But the question is when TextTable element shows up, I want to set TableMap(XXXTable related class, pojo)'s type as txt through addCallMethod. I research on official sample but it is not right in my code, it looks just the same as the sample. related java file: 1)ClassItem.java package com.siamon.model.config; import java.util.ArrayList; import java.util.List; public class ClassItem { private String method; private String name; private ListTableMap tableMapList=new ArrayListTableMap(); public ClassItem(String name, String method, ListTableMap tableMapList) { this.name = name; this.method = method; this.tableMapList = tableMapList; } public ClassItem() { } public String getMethod() { return method; } public void setMethod(String method) { this.method = method; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void addTableMap(TableMap tm){ getTableMapList().add(tm); } public ListTableMap getTableMapList() { return tableMapList; } } 2)Project.java package com.siamon.model; import com.siamon.model.config.Functionality; import java.util.ArrayList; import java.util.List; public class Project { private String name; private ListFunctionality functionalities=new ArrayListFunctionality(); public void addFunctionality(Functionality func){ functionalities.add(func); } public String getName() { return name; } public void setName(String name) { this.name = name; } public ListFunctionality getFunctionalities() { return functionalities; } } 3)ConstantProp.java package com.siamon.model.config; public class ConstantProp { private String column; private String value; public String getColumn() { return column; } public void setColumn(String column) { this.column = column; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } @Override public String toString() { return ConstantProp [ + column=' + column + '\'' + , value=' + value + '\'' + ] ; } } 4)MutableProp.java package com.siamon.model.config; public class MutableProp { private String property; private int argIndex; private String column; private String value; public String getProperty() { return property; } public void setProperty(String property) { this.property = property; } public int getArgIndex() { return argIndex; } public void setArgIndex(int argIndex) { this.argIndex = argIndex; } public String getColumn() { return column; } public void setColumn(String column) { this.column = column; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } @Override public String toString() { return MutableProp [ + property=' + property + '\'' + , argIndex= + argIndex + , column=' + column + '\'' + , value=' + value + '\'' + ] ; } }
Re: Re: [digester]How to use SimpleRegexMatcher?
Hi Kurt, calling the setRules() method in the way you did, makes the Rules instance is reset, so you loose the already set patterns. modify the code in order that the setRules() method is invoked before setting patterns/rules. HTH, Simo private void parseProject2(URL url) throws IOException, SAXException { Digester d = new Digester(); d.setRules(new RegexRules(new SimpleRegexMatcher())); String pathFunc = Project/Functionality; String pathClass = pathFunc + /Class; String pathPara = pathClass + /Parameter; d.addObjectCreate(Project, Project.class); d.addSetProperties(Project); d.addObjectCreate(pathFunc, Functionality.class); d.addSetNext(pathFunc, addFunctionality); d.addSetProperties(pathFunc); //d.addSetProperties(pathFunc + /BasicInfo); d.addObjectCreate(pathClass, ClassItem.class); d.addSetNext(pathClass, addClassItem); d.addSetProperties(pathClass); d.addObjectCreate(pathPara, Parameter.class); d.addSetNext(pathPara, addParameter); d.addRule(pathPara+/Main/*, new ParaItemRule()); d.addSetNext(pathPara+/Main/*, addMainParaItem); d.addRule(pathPara +SubText/*, new ParaItemRule()); d.addSetNext(pathPara +SubText/*, addSubParaItem); d.parse(url); Project project = (Project) d.getRoot(); System.out.println(); } http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Mar 31, 2011 at 5:44 AM, Kurt Xu fxbird1...@163.com wrote: Sorry Simone: I need to paste the full xml and java file to help u locate the error,:) xml: ?xml version=1.0 encoding=UTF-8? Project name=project1 Functionality description=add comment url=http://dev.mygame.co.jp/user/register.do; actionName=com.mygame.action.UserAction actionMethod=register Class name=com.mygame.bo.UserBOImpl method=register Parameter name=user index=0 type=insert Main DeviceType constant=truepc/DeviceType CheckStatus constant=trueN/CheckStatus ValidCheck constant=trueYes/ValidCheck CheckDescfirst check desc/CheckDesc UserIduserid/UserId PrimaryKey1cmtno/PrimaryKey1 /Main SubText !--Type constant=true/false/Type-- !--Titletitle/Title-- Contentcontents/Content WriterIdwriteid/WriterId WriterUserNameuserid/WriterUserName /SubText /Parameter Parameter name=postVO index=1 type=update table=MOCO_CODICMT . /Parameter /Class /Functionality /Project java code: parser method: private void parseProject2(URL url) throws IOException, SAXException { Digester d = new Digester(); String pathFunc = Project/Functionality; String pathClass = pathFunc + /Class; String pathPara = pathClass + /Parameter; d.addObjectCreate(Project, Project.class); d.addSetProperties(Project); d.addObjectCreate(pathFunc, Functionality.class); d.addSetNext(pathFunc, addFunctionality); d.addSetProperties(pathFunc); // d.addSetProperties(pathFunc + /BasicInfo); d.addObjectCreate(pathClass, ClassItem.class); d.addSetNext(pathClass, addClassItem); d.addSetProperties(pathClass); d.addObjectCreate(pathPara, Parameter.class); d.addSetNext(pathPara, addParameter); d.setRules(new RegexRules(new SimpleRegexMatcher())); d.addRule(pathPara+/Main/*, new ParaItemRule()); d.addSetNext(pathPara+/Main/*, addMainParaItem); d.addRule(pathPara +SubText/*, new ParaItemRule()); d.addSetNext(pathPara +SubText/*, addSubParaItem); d.parse(url); Project project = (Project) d.getRoot(); System.out.println(); } ClassItem.java ---a pojo for saving all its Parameters public class ClassItem { private String method; private String name; private String handler=; private ListParameter parameters; public ClassItem(String name, String method, ListParameter parameters) { this.name = name; this.method = method; this.parameters = parameters; } public ClassItem() { } public String getMethod() { return method; } public void setMethod(String method) { this.method = method; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void addParameter(Parameter parameter){ System.out.println(add parameter); if (parameters==null){ parameters=new ArrayListParameter(); } parameters.add(parameter); } public
Re: [digester] NullPointerException
Hi Patrick, can you link also to the XML you're trying to parse? Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Mar 31, 2011 at 10:24 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: Hi, I'm trying to store the content of a xml file into memory but for some reason I get following NullPointerException.. (this is the code: http://pastie.org/1740948): Clusterer... Reading XML... Mar 31, 2011 10:19:17 PM org.apache.commons.digester.Digester endElement SEVERE: End event threw exception java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216) at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220) at org.apache.commons.digester.Rule.end(Rule.java:257) at org.apache.commons.digester.Digester.endElement(Digester.java:1345) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at org.apache.commons.digester.Digester.parse(Digester.java:1871) at XMLReader.read(XMLReader.java:74) at Clusterer.init(Clusterer.java:49) at Main.main(Main.java:11) Caused by: java.lang.NullPointerException at XMLReader$FlickrCollection.addDocument(XMLReader.java:108) ... 22 more java.lang.NullPointerException at org.apache.commons.digester.Digester.createSAXException(Digester.java:3363) at org.apache.commons.digester.Digester.createSAXException(Digester.java:3389) at org.apache.commons.digester.Digester.endElement(Digester.java:1348) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) Reading XML... at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at org.apache.commons.digester.Digester.parse(Digester.java:1871) at XMLReader.read(XMLReader.java:74) at Clusterer.init(Clusterer.java:49) at Main.main(Main.java:11) Caused by: java.lang.NullPointerException at XMLReader$FlickrCollection.addDocument(XMLReader.java:108) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216) at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220) at org.apache.commons.digester.Rule.end(Rule.java:257) at org.apache.commons.digester.Digester.endElement(Digester.java:1345) ... 14 more Mar 31, 2011 10:19:17 PM org.apache.commons.digester.Digester endElement SEVERE: End event threw exception java.lang.reflect.InvocationTargetException at
Re: [digester] NullPointerException
Patrick, just replace 71digester.addObjectCreate(collection, XMLReader.class); with digester.push(this); Otherwise 30ArrayListArrayListString docs; with 30ArrayListArrayListString docs = new ArrayListArrayListString(); and remove line 64 I suggest you the first option Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Apr 1, 2011 at 12:36 AM, Patrick Diviacco patrick.divia...@gmail.com wrote: Sure, here you are http://dl.dropbox.com/u/72686/trainSmall.xml and http://dl.dropbox.com/u/72686/testSmall.xml I was wondering if the issue is that XMLReader has been created as static object... thanks On 1 April 2011 00:26, Simone Tripodi simonetrip...@apache.org wrote: Hi Patrick, can you link also to the XML you're trying to parse? Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Thu, Mar 31, 2011 at 10:24 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: Hi, I'm trying to store the content of a xml file into memory but for some reason I get following NullPointerException.. (this is the code: http://pastie.org/1740948): Clusterer... Reading XML... Mar 31, 2011 10:19:17 PM org.apache.commons.digester.Digester endElement SEVERE: End event threw exception java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216) at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220) at org.apache.commons.digester.Rule.end(Rule.java:257) at org.apache.commons.digester.Digester.endElement(Digester.java:1345) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at org.apache.commons.digester.Digester.parse(Digester.java:1871) at XMLReader.read(XMLReader.java:74) at Clusterer.init(Clusterer.java:49) at Main.main(Main.java:11) Caused by: java.lang.NullPointerException at XMLReader$FlickrCollection.addDocument(XMLReader.java:108) ... 22 more java.lang.NullPointerException at org.apache.commons.digester.Digester.createSAXException(Digester.java:3363) at org.apache.commons.digester.Digester.createSAXException(Digester.java:3389) at org.apache.commons.digester.Digester.endElement(Digester.java:1348) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) Reading XML... at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at org.apache.commons.digester.Digester.parse(Digester.java:1871) at XMLReader.read(XMLReader.java:74) at Clusterer.init(Clusterer.java:49) at Main.main(Main.java:11) Caused
Re: [digester] java.lang.NullPointerException only for a specific file
Hi Patrick, I'd say: it depends! I don't know the domain you're working on, I'd say once you import the XML into Lucene index you don't need the XML anymore. Do you need data have to be persisted to be reused in a second time? So use a DB. Do you need analyze documents just to populate the Lucene index? Avoid the DB, you don't need yet another layer! It is question strictly related to your architecture and not to Digester, if I were you I'd stop codiing for a little while and back to analyze. HTH, just my 2 cents, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Tue, Mar 29, 2011 at 11:20 AM, Patrick Diviacco patrick.divia...@gmail.com wrote: hey Simone, I was now wondering if isn't better to import my xml doc in a database and working with mysql. I guess it is faster to scan a mysql database with java rather than a xml doc, what do you think ? I'm using Digester combined with Apache Lucene to perform queries (all together they are 65MBs in a xml file) against a collection (65MBs in XML again). thanks On 28 March 2011 17:20, Simone Tripodi simonetrip...@apache.org wrote: Hi Patrick, take a look at this example[1]: all you have to do is obtaining a ContentHandler instance as shown, then invoking SAX events while parsing the original document. It's more efficient and consumes less memory Simo [1] http://www.stylusstudio.com/xmldev/200502/post20440.html http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Mar 28, 2011 at 4:56 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: hi! What should I use instead of StringBuffer ? Any example or tutorial ? thanks Patrick On 28 March 2011 16:53, Simone Tripodi simonetrip...@apache.org wrote: Hi Patrick, nice to know you quickly fixed the issue before anybody could have provided his help! :) As a side note, I would suggest you taking in consideration a different solution for the XML generation rather the StringBuffer, since you're parsing large dataset, streaming data while parsing would improve the performances and reduce the consumed memory. Just my 2 cents, have a nice day, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Mar 28, 2011 at 2:28 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: I've solved. the issue was a row in train.xml file. To solve the issue I've printed the source file rows while processing. However it has been possible only because the parsing takes 4 minutes. I'm wondering how to debug such issues with a much bigger text file. thanks On 28 March 2011 14:14, Patrick Diviacco patrick.divia...@gmail.com wrote: And these are the files: http://dl.dropbox.com/u/72686/test.xml http://dl.dropbox.com/u/72686/train.xml thanks On 28 March 2011 14:13, Patrick Diviacco patrick.divia...@gmail.com wrote: Hi, I've a 74MB xml document and I've split it into 2 docs:52MB and 22MB respectively. I'm parsing the file using common Digester library, and everything works perfectly for the small file, but I get a NullPointerExceptio with the big one. I don't think the issue is the code because it works for the small file... I guess the problem is with the file itself. I've parsed the files with the same parser, so I don't think the files have issues either. In conclusion I dunno where the issue is. This is the code: http://pastie.org/1726063 This is the exception SEVERE: End event threw exception java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216) at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220) at org.apache.commons.digester.Rule.end(Rule.java:257) at org.apache.commons.digester.Digester.endElement(Digester.java:1345) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808
Re: [digester] java.lang.NullPointerException only for a specific file
Hi Patrick, nice to know you quickly fixed the issue before anybody could have provided his help! :) As a side note, I would suggest you taking in consideration a different solution for the XML generation rather the StringBuffer, since you're parsing large dataset, streaming data while parsing would improve the performances and reduce the consumed memory. Just my 2 cents, have a nice day, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Mar 28, 2011 at 2:28 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: I've solved. the issue was a row in train.xml file. To solve the issue I've printed the source file rows while processing. However it has been possible only because the parsing takes 4 minutes. I'm wondering how to debug such issues with a much bigger text file. thanks On 28 March 2011 14:14, Patrick Diviacco patrick.divia...@gmail.com wrote: And these are the files: http://dl.dropbox.com/u/72686/test.xml http://dl.dropbox.com/u/72686/train.xml thanks On 28 March 2011 14:13, Patrick Diviacco patrick.divia...@gmail.comwrote: Hi, I've a 74MB xml document and I've split it into 2 docs:52MB and 22MB respectively. I'm parsing the file using common Digester library, and everything works perfectly for the small file, but I get a NullPointerExceptio with the big one. I don't think the issue is the code because it works for the small file... I guess the problem is with the file itself. I've parsed the files with the same parser, so I don't think the files have issues either. In conclusion I dunno where the issue is. This is the code: http://pastie.org/1726063 This is the exception SEVERE: End event threw exception java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216) at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220) at org.apache.commons.digester.Rule.end(Rule.java:257) at org.apache.commons.digester.Digester.endElement(Digester.java:1345) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at org.apache.commons.digester.Digester.parse(Digester.java:1871) at CentroidGenerator.main(CentroidGenerator.java:137) Caused by: java.lang.NullPointerException at CentroidGenerator.nextItem(CentroidGenerator.java:62) ... 19 more Exception in thread main java.lang.NullPointerException at org.apache.commons.digester.Digester.createSAXException(Digester.java:3363) at org.apache.commons.digester.Digester.createSAXException(Digester.java:3389) at org.apache.commons.digester.Digester.endElement(Digester.java:1348) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at
Re: [digester] java.lang.NullPointerException only for a specific file
Hi Patrick, take a look at this example[1]: all you have to do is obtaining a ContentHandler instance as shown, then invoking SAX events while parsing the original document. It's more efficient and consumes less memory Simo [1] http://www.stylusstudio.com/xmldev/200502/post20440.html http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Mar 28, 2011 at 4:56 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: hi! What should I use instead of StringBuffer ? Any example or tutorial ? thanks Patrick On 28 March 2011 16:53, Simone Tripodi simonetrip...@apache.org wrote: Hi Patrick, nice to know you quickly fixed the issue before anybody could have provided his help! :) As a side note, I would suggest you taking in consideration a different solution for the XML generation rather the StringBuffer, since you're parsing large dataset, streaming data while parsing would improve the performances and reduce the consumed memory. Just my 2 cents, have a nice day, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Mar 28, 2011 at 2:28 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: I've solved. the issue was a row in train.xml file. To solve the issue I've printed the source file rows while processing. However it has been possible only because the parsing takes 4 minutes. I'm wondering how to debug such issues with a much bigger text file. thanks On 28 March 2011 14:14, Patrick Diviacco patrick.divia...@gmail.com wrote: And these are the files: http://dl.dropbox.com/u/72686/test.xml http://dl.dropbox.com/u/72686/train.xml thanks On 28 March 2011 14:13, Patrick Diviacco patrick.divia...@gmail.com wrote: Hi, I've a 74MB xml document and I've split it into 2 docs:52MB and 22MB respectively. I'm parsing the file using common Digester library, and everything works perfectly for the small file, but I get a NullPointerExceptio with the big one. I don't think the issue is the code because it works for the small file... I guess the problem is with the file itself. I've parsed the files with the same parser, so I don't think the files have issues either. In conclusion I dunno where the issue is. This is the code: http://pastie.org/1726063 This is the exception SEVERE: End event threw exception java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216) at org.apache.commons.digester.SetNextRule.end(SetNextRule.java:220) at org.apache.commons.digester.Rule.end(Rule.java:257) at org.apache.commons.digester.Digester.endElement(Digester.java:1345) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at org.apache.commons.digester.Digester.parse(Digester.java:1871) at CentroidGenerator.main(CentroidGenerator.java:137) Caused by: java.lang.NullPointerException at CentroidGenerator.nextItem(CentroidGenerator.java:62) ... 19 more Exception in thread main java.lang.NullPointerException at org.apache.commons.digester.Digester.createSAXException(Digester.java:3363) at org.apache.commons.digester.Digester.createSAXException(Digester.java:3389) at org.apache.commons.digester.Digester.endElement(Digester.java:1348) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next
[Digester][Sandbox] please test the experimental new Digester
Hi all Commons users, I'd like you involved on testing the prototypal Digester on Sandbox[1]; since it is staged at Sandbox, interested people have to checkout the code and build by themselves, it would be a good chance to be more involved. Every suggestion/feedback/wish list/bug would be very appreciated. Many thanks in advance! Simo [1] http://commons.apache.org/sandbox/digester3/ http://people.apache.org/~simonetripodi/ http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Digester] Maven 2 Repository
Hi Russell, if you mean the 2.X, it is in the Central Repo, if you instead would get the 3.0[1], you have to checkout the code[2] and build it by yourself since it is still in the sandbox. I really would appreciate if you can test it and send your feedbacks here in the users ML, suggestions/wishlist/reported bugs are more than appreciated. Many thanks in advance, have a nice day! Simo [1] http://commons.apache.org/sandbox/digester3/ [2] https://svn.apache.org/repos/asf/commons/sandbox/digester3/trunk http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Mar 7, 2011 at 6:17 PM, Collins, Russell rcoll...@corelogic.com wrote: Which maven repository should I point to in order to get the latest Digester versions? Russell Collins Sr. Software Engineer CoreLogic Spatial Solutions Direct: 512.977.3206 rcoll...@corelogic.commailto:rcoll...@corelogic.com Do or do not, there is no try. - Yoda *** This message may contain confidential or proprietary information intended only for the use of the addressee(s) named above or may contain information that is legally privileged. If you are not the intended addressee, or the person responsible for delivering it to the intended addressee, you are hereby notified that reading, disseminating, distributing or copying this message is strictly prohibited. If you have received this message by mistake, please immediately notify us by replying to the message and delete the original message and any copies immediately thereafter. Thank you. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [daemon] The ivy resolver can't version 1.0.3, 1.0.4 or 1.0.5
Olà Felipe, looks like the commons-daemon 1.0.3 IS on maven central repo, take a look at http://repo1.maven.org/maven2/commons-daemon/commons-daemon/1.0.3/ It seems to me that's more ivy-related problem, I'd ask to ivy ML why it is not resolved. Sorte, até Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Tue, Mar 8, 2011 at 12:20 PM, Filipe Sousa nat...@gmail.com wrote: Hi, I want to do some experiments with commons-daemon, but I am having a problem. The project where I want to use the commons-daemon uses the Ivy to resolve dependencies. I have this in file ivy.xml: dependency org=commons-daemon name=commons-daemon rev=1.0.3 / that gives me the following error: ivy:retrieve] WARNINGS [ivy:retrieve] :: [ivy:retrieve] :: UNRESOLVED DEPENDENCIES :: [ivy:retrieve] :: [ivy:retrieve] :: commons-daemon#commons-daemon;1.0.3: java.text.ParseException: inconsistent module descriptor file found in 'http://repo1.maven.org/maven2/commons-daemon/commons-daemon/1.0.3/commons-daemon-1.0.3.pom': bad organisation: expected='commons-daemon' found='org.apache.commons'; [ivy:retrieve] :: [ivy:retrieve] ERRORS [ivy:retrieve] ibiblio: bad organisation found in http://repo1.maven.org/maven2/commons-daemon/commons-daemon/1.0.3/commons-daemon-1.0.3.pom: expected='commons-daemon' found='org.apache.commons' [ivy:retrieve] [ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS The case gets worse if I try to use rev=1.0.5. This version does not appear to exist in the maven central. I tried to change the org for org.apache.commons insted of commons-daemon, but also does not help [ivy:retrieve] WARNINGS [ivy:retrieve] module not found: org.apache.commons#commons-daemon;1.0.3 [ivy:retrieve] ibiblio: tried [ivy:retrieve] http://repo1.maven.org/maven2/org/apache/commons/commons-daemon/1.0.3/commons-daemon-1.0.3.pom [ivy:retrieve] -- artifact org.apache.commons#commons-daemon;1.0.3!commons-daemon.jar: [ivy:retrieve] http://repo1.maven.org/maven2/org/apache/commons/commons-daemon/1.0.3/commons-daemon-1.0.3.jar Thanks -- Filipe Sousa - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Digester] Maven 2 Repository
Hi Russell, for version numbers I meant about the Digester release, not Maven :P Sorry for the misunderstanding! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Tue, Mar 8, 2011 at 3:38 PM, Collins, Russell rcoll...@corelogic.com wrote: Thank you for the response. Currently, we are using Maven 2. If we decide to upgrade to Maven 3, I will try your suggestion and provide the feedback. Russell Collins Sr. Software Engineer CoreLogic Spatial Solutions Do or do not, there is no try. - Yoda -Original Message- From: simone.trip...@gmail.com [mailto:simone.trip...@gmail.com] On Behalf Of Simone Tripodi Sent: Tuesday, March 08, 2011 3:09 AM To: Commons Users List Subject: Re: [Digester] Maven 2 Repository Hi Russell, if you mean the 2.X, it is in the Central Repo, if you instead would get the 3.0[1], you have to checkout the code[2] and build it by yourself since it is still in the sandbox. I really would appreciate if you can test it and send your feedbacks here in the users ML, suggestions/wishlist/reported bugs are more than appreciated. Many thanks in advance, have a nice day! Simo [1] http://commons.apache.org/sandbox/digester3/ [2] https://svn.apache.org/repos/asf/commons/sandbox/digester3/trunk http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Mar 7, 2011 at 6:17 PM, Collins, Russell rcoll...@corelogic.com wrote: Which maven repository should I point to in order to get the latest Digester versions? Russell Collins Sr. Software Engineer CoreLogic Spatial Solutions Direct: 512.977.3206 rcoll...@corelogic.commailto:rcoll...@corelogic.com Do or do not, there is no try. - Yoda *** This message may contain confidential or proprietary information intended only for the use of the addressee(s) named above or may contain information that is legally privileged. If you are not the intended addressee, or the person responsible for delivering it to the intended addressee, you are hereby notified that reading, disseminating, distributing or copying this message is strictly prohibited. If you have received this message by mistake, please immediately notify us by replying to the message and delete the original message and any copies immediately thereafter. Thank you. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org *** This message may contain confidential or proprietary information intended only for the use of the addressee(s) named above or may contain information that is legally privileged. If you are not the intended addressee, or the person responsible for delivering it to the intended addressee, you are hereby notified that reading, disseminating, distributing or copying this message is strictly prohibited. If you have received this message by mistake, please immediately notify us by replying to the message and delete the original message and any copies immediately thereafter. Thank you. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [daemon] The ivy resolver can't version 1.0.3, 1.0.4 or 1.0.5
Olà Felipe, I'm just trying to figure out how the groupId could become different from the path since it is Maven itself that generates the path... :O BTW thanks for the notification! Obrigado, até mais, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Tue, Mar 8, 2011 at 4:06 PM, Filipe Sousa nat...@gmail.com wrote: On Tue, Mar 8, 2011 at 11:49 AM, Simone Tripodi simonetrip...@apache.org wrote: Olà Felipe, looks like the commons-daemon 1.0.3 IS on maven central repo, take a look at http://repo1.maven.org/maven2/commons-daemon/commons-daemon/1.0.3/ It seems to me that's more ivy-related problem, I'd ask to ivy ML why it is not resolved. Sorte, até Simo Hi, After having contacted the ivy mailing list, I was told that I'm getting this this because the POM of commons-daemon is not correct. It contains the following: groupIdorg.apache.commons/groupId artifactIdcommons-daemon/artifactId However, according to the URL, it should be: groupIdcommons-daemon/groupId artifactIdcommons-daemon/artifactId Thanks -- Filipe Sousa - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [digester] How to deal with flexible XML ?
Hi Patrick, I used Field.Index different values just to show that the Lucene rule accepts parameters. Unfortunately your question is more Lucene/domain related, I suggest you asking on Lucene ML. HTH, have a nice WE, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, Feb 27, 2011 at 10:39 AM, Patrick Diviacco patrick.divia...@gmail.com wrote: hi, thanks for the snipper. I see in your code you are using Field.Index.NOT_ANALYZED for the title. It is not clear to me what I should analyze and what not. I need to add tf-idf weights to all terms of all fields. Should I use Field.Index.ANALYZED for all of them ? thnks On 27 February 2011 09:55, Simone Tripodi simonetrip...@apache.org wrote: Hi Patrick, I quickly had a look at your code and l didn't see anything wrong, the Digester should work either the geo tag is empty or not. When you will have documents such doc .. geo/geo /doc the `collection/doc/geo/(latitude|longitude)` pattern will never match, so set(Latitude|Longitude) methods won't be invoked. I can suggest you 2 options: * quick solution: when building the Lucene document, check if the latitude/longitude is not null before setting it if (flickrDoc.getLatitude() != null) { document.add(new Field(latitude, flickrDoc.getLatitude(), Field.Store.YES, Field.Index.ANALYZED)); } * a little more complex - but more efficient - solution I wrote for you and paste on[1], it parses index the document into Lucene Document in one shot; the LuceneFieldRule is parametrized just in case you need to configure the Lucene Field depending on the matching pattern. HTH, Simo [1] http://pastie.org/1612471 http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Fri, Feb 25, 2011 at 9:21 PM, Patrick Diviacco patrick.divia...@gmail.com wrote: hi, I need to understand how to deal changing xml fields such as these ones: doc .. geo/geo /doc doc .. geo latitude2432/latitude longitude2342/longitude /geo /doc As you can see geo element can be empty or parent element. I need to build an apposite parser to deal with it. THis is my current code, but I get error since latitude not always works... http://codepad.org/jpKXmGZq - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[Sandbox][Digetser3] Meet the Sandbox Digester3, it could worth the value!
Hi all commons-users, during my spare time I started reimplementing a new version of Digester - I lazily called Digester3[1] - focused few concepts: * A universal loader (core extensions are loaded in the same way); * Reusability of Digester configurations; * Rules are now expressed via fluent APIs through EDSL; * Improved errors reporting; * Architecture simplification for integrating extensions. The component status is that currently supports all the features of the proper Digester, but it could contain some bug. Documentation is still a big TODO, but enough to get started :P I'm looking for feedbacks, suggestions, ideas... everything is welcome!!! I'd like to encourage you all to submit what you think about and, above all, to actively participate. Contributions are accepted via Jira, patches are more than appreciated. Please take in consideration that * just replacing the current Digester with this new one, won't work; * this component is in the sandbox, so no binaries available from any repository, people interested have to checkout the code and install binaries locally. If Digester users are interested in a release... participate, it's the only one way we havo to submit it to the PMC :) Please give a try... it could worth the value!!! Have a nice day, all the best, Simo [1] http://commons.apache.org/sandbox/digester3/ http://people.apache.org/~simonetripodi/ http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [commons-email] Problem sending emails to groups
Hola Lorenzo, please don't send the same email message to both dev/users MLs, dev is not for supporting this kind of questions. Apologize but personally I'm not [email] expert, can't provide any help :( Hasta pronto, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Wed, Feb 23, 2011 at 2:25 PM, Lorenzo Solano lorenzo_sol...@claro.com.do wrote: Hello, I'm sending messages using SimpleMail class; and have this problem: All email recipients, that are individual email accounts on my company receive the message; but when I add a group email ID; none of the members are not reached. Code snnipet: Email email = new SimpleEmail(); email.setHostName(XXX.XXX.XXX.XXX); email.setAuthenticator(new DefaultAuthenticator( X, )); MapString, String flags = new HashMapString, String(); String categoryFlag = null; switch (cat) { case INFO: categoryFlag = 4 (low); break; case WARN: categoryFlag = 3 (normal); break; case ERROR: categoryFlag = 2 (high); break; case FATAL: categoryFlag = 1 (highest); } flags.put(X-Priority, categoryFlag); email.setHeaders(flags); email.setTLS(true); email.setFrom(du...@my.domain.commailto:du...@my.domain.com); email.setSubject(Test Mail Using Apache SimpleEmail, from commons); email.setMsg(Test Mail Using Apache SimpleEmail, from commons.\n\n Please do not reply.); email.addTo(valid_individual_email...@my.domain.com mailto:valid_individual_email...@my.domain.com%20 ); //This address is reached just fine. email.addTo(Valid_Group_Email_Id @my.domain.com ); //This address, and any other group; is not reached! email.send(); Did someone has faced this problem before? Notes: We are using MS-Exchange. Regards, Saludos, Lorenzo Solano IT, BILLING SYSTEM * (809)220-5225 * lorenzo_sol...@codetel.com.domailto:lorenzo_sol...@codetel.com.do Antipatrones de diseño de software / Software design anti-patterns Reinventar la rueda: Enfrentarse a las situaciones buscando soluciones desde cero, sin tener en cuenta otras que puedan existir ya para afrontar los mismos problemas. Reinventing the wheel: Failing to adopt an existing, adequate solution Reinventar la rueda cuadrada: Crear una solución pobre cuando ya existe una buena. Reinventing the square wheel: To create a poor solution when a good one already exists. Este mensaje puede contener información privilegiada y confidencial. Dicha información es exclusivamente para el uso del individuo o entidad al cual es enviada. Si el lector de este mensaje no es el destinatario del mismo, queda formalmente notificado que cualquier divulgación, distribución, reproducción o copiado de esta comunicación está estrictamente prohibido. Si este es el caso, favor de eliminar el mensaje de su computadora e informar al emisor a través de un mensaje de respuesta. Las opiniones expresadas en este mensaje son propias del autor y no necesariamente coinciden con las de la Compañía Dominicana de Teléfonos. Gracias. Compañía Dominicana de Teléfonos This message may contain information that is priviliged and confidential. It is intended only for the use of the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, reproduction or copying of this communication is strictly prohibited. If this is the case, please proceed to destroy the message from your computer and inform the sender through reply mail. Information in this message that does not directly relate to the official business of the company shall be understood as neither given nor endorsed by it. Thank you. Compañía Dominicana de Teléfonos - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Digester] Rules on Attributes
Hi Russell, use the SetPropertiesRule[1] to extract properties from attributes, this is what you need for your purpose! HTH, Simo [1] http://s.apache.org/zJ http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Tue, Feb 22, 2011 at 9:49 PM, Collins, Russell rcoll...@corelogic.com wrote: I am new to Digester so bear with me if this has been answered before. I would like to create rules based on the attributes of elements. From what I am seeing, the way to create rules is based on documents that look like this: parent child namechild1/name /child /parent What I would like to be able to do is parse a document that looks like this: parent childid=2 name=Something / parent childid=4 name=SomethingElse / Can this be accomplished with digester? If not, is there another tool that would parse this information easier? Russell Collins Sr. Software Engineer CoreLogic Spatial Solutions Direct: 512.977.3206 mailto:rcoll...@corelogic.com Do or do not, there is no try. - Yoda *** This message may contain confidential or proprietary information intended only for the use of the addressee(s) named above or may contain information that is legally privileged. If you are not the intended addressee, or the person responsible for delivering it to the intended addressee, you are hereby notified that reading, disseminating, distributing or copying this message is strictly prohibited. If you have received this message by mistake, please immediately notify us by replying to the message and delete the original message and any copies immediately thereafter. Thank you. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[compress] Zip password compressed archive
Hi all guys, do you know is there any way to protect with a password the produced zip archive, with [compress] APIs? Many thanks in advance, have a nice day! Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [compress] Zip password compressed archive
Thanks a lot for all the suggestions guys, very appreciated! Have a nice day, Simo http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Feb 7, 2011 at 12:15 PM, Stefan Bodewig bode...@apache.org wrote: On 2011-02-07, Simone Tripodi wrote: do you know is there any way to protect with a password the produced zip archive, with [compress] APIs? No, compress currently doesn't support any of the various encryption options of the ZIP format. https://issues.apache.org/jira/browse/COMPRESS-88 Note that different ZIP tools have different understandings on what password protected ZIPs are. The traditional version uses a pretty weak encryption algo that could be implemented inside compress but hasn't been (yet?). This most likely is what you are looking for since it is supported by many of the existing tools. Strong encryption is used in different ways by PKWARE and WinZip. The PKWARE approach comes with legal strings attached that makes it difficult to implement (if at all possible) inside commons-compress. The WinZIP approach can certainly be implemented in Java (see Antonio's link which ultimately leads to http://code.google.com/p/winzipaes/) but isn't widely supported in tools other than WinZIP. Stefan - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] 1.3 snapshot
Hi Nate!!! :) looks like the commons-email-1.3 is not available yet on apache snapshot repository[1], BTW you can bookmark the snapshot repo URL for future usages. HTH, Simo [1] http://repository.apache.org/snapshots/commons-email/commons-email/ http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, Jan 23, 2011 at 7:14 PM, Nathan Maves nathan.ma...@gmail.com wrote: I just saw the new ImageHtmlEmail class and would love to test it out. I don't seem to be able to find the 1.3-SNAPSHOT in any of the repositories. Is it available anywhere or do we have to install it locally by hand? Nathan - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [email] 1.3 snapshot
cool, next time I'll avoid replying http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Jan 24, 2011 at 3:40 PM, Nathan Maves nathan.ma...@gmail.com wrote: Simo! Thanks captain obvious! I know where it should be :0 Just giving you a hard time. Nate On Mon, Jan 24, 2011 at 4:29 AM, Simone Tripodi simonetrip...@apache.org wrote: Hi Nate!!! :) looks like the commons-email-1.3 is not available yet on apache snapshot repository[1], BTW you can bookmark the snapshot repo URL for future usages. HTH, Simo [1] http://repository.apache.org/snapshots/commons-email/commons-email/ http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Sun, Jan 23, 2011 at 7:14 PM, Nathan Maves nathan.ma...@gmail.com wrote: I just saw the new ImageHtmlEmail class and would love to test it out. I don't seem to be able to find the 1.3-SNAPSHOT in any of the repositories. Is it available anywhere or do we have to install it locally by hand? Nathan - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[ANNOUNCEMENT] Apache Commons Digester 2.1 Released
The Apache Commons team is pleased to announce the release of version 2.1 of Commons Digester. The Digester package lets you configure an XML to Java object mapping module which triggers certain actions called rules whenever a particular pattern of nested XML elements is recognized. Version 2.1 is a minor release with new features, Digester rules can be now defined also through Java5 Annotations meta-data. Source and binary distributions are available for download from the Apache Commons Digester download site: http://commons.apache.org/digester/download_digester.cgi Please verify signatures using the KEYS file available at the above location when downloading the release. For more information on Apache Commons Digester, visit the Digester home page: http://commons.apache.org/digester/ Feedback, suggestions for improvement or bug reports are welcome via the Mailing Lists and Issue Tracking links here: http://commons.apache.org/digester/project-info.html Simone Tripodi - On behalf of the Apache Commons community http://people.apache.org/~simonetripodi/ http://www.99soft.org/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: commons-exec
Hi Sigfried, I take advance to notify you the homepage still reports Jakarta Commons Exec... shouldn't be just Commons Exec instead? Best regards, Simo http://people.apache.org/~simonetripodi/ On Sun, Jan 31, 2010 at 1:24 PM, Siegfried Goeschl siegfried.goes...@it20one.at wrote: Hi, correct - it wraps the existing Java API, adds some bells and whistles and makes sure that this all runs on a wide range of OS and Java versions - I assume that I need to update the documentation ... :-) Cheers, Siegfried Goeschl maven apache wrote: Hi: What is the reason for using commons-exec? Since I read the tutorial at : http://commons.apache.org/exec/tutorial.html. It seems that the commons-exec just wrap the command string, it can solove the space problem and etc.. However I do not think this is the reason, is there other feature of commons-exec? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: problem with numActive counter
Ciao Daniele ;) First, I suggest you to start the subject line with [componentname], i.e. [POOL] if you're referring commons-pool, otherwise people risk to get confused and not able to reply. I don't know the Pool so deeply and maybe I didn't understand the problem, but reading your code I'm worried 'invalidateObject()' always takes 'null' as argument... take a look at this with the logger/debugger. All the best, Simo On Fri, Jan 15, 2010 at 10:53 AM, Daniele Bonetto daniele.bone...@dnshosting.it wrote: Hello everyone! I notice a problem using GenericObjectPool. My code is like this: Object obj = null; try { obj = this.borrowObject(); } catch(NoSuchElementException ex) { log.error(no such element exception, ex); this.invalidateObject(obj); throw new NicProviderPoolException(no such element exception, ex); } catch(Exception ex) { log.error(exception, ex); this.invalidateObject(obj); throw new Exception(exception, ex); } return (NicProvider)obj; When the borrowObject throws an exception and i invalidate the borrowedObject the numActive counter was decreased by 1. The problem is that the counter will not be increased in case of exception... So, my numActive counter will be -1 and isn't correct. Someone has noticed this problem too? Thanks in advance, Byez! Daniele Bonetto - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org -- http://people.apache.org/~simonetripodi/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [GenericObjectPool] problem with numActive counter
In the example, the catch group catches exceptions that could be thrown by the object _use_, I *suppose* whenever you catch a java.util.NoSuchElementException you don't need to invalidate the object, that's what Mark was pointing. let us know, all the best, Simo On Fri, Jan 15, 2010 at 11:26 AM, Daniele Bonetto daniele.bone...@dnshosting.it wrote: Ok, if the borrow throws an exceptin the obj was null. But i'm not sure that the invalidate was unnecessary. take a look at this: http://commons.apache.org/pool/apidocs/org/apache/commons/pool/ObjectPool.html Example of use: Object obj =|null|; |try| { obj = pool.borrowObject(); |//...use the object...| }|catch|(Exception e) { |// invalidate the object| pool.invalidateObject(obj); |// do not return the object to the pool twice| obj =|null|; }|finally| { |// make sure the object is returned to the pool| |if|(|null| != obj) { pool.returnObject(obj); } } In this example u can see that if the borrow throws an exception u have to invalidate the object from pool. So. What happends to the object that i tried to borrow? I have maxActive = 2 and without invalidate if i try more than 2 times the pool returns always: java.util.NoSuchElementException: Timeout waiting for idle object I think that without the invalidate the object remains in idle and it locks my pool... With invalidateObject the pool works correctly, but the counter wasn't correct. Thanks guys for your replies. Byez! Daniele Bonetto Il 15/01/2010 11.08, Mark Thomas ha scritto: On 15/01/2010 10:03, Simone Tripodi wrote: Ciao Daniele ;) First, I suggest you to start the subject line with [componentname], i.e. [POOL] if you're referring commons-pool, otherwise people risk to get confused and not able to reply. I don't know the Pool so deeply and maybe I didn't understand the problem, but reading your code I'm worried 'invalidateObject()' always takes 'null' as argument... take a look at this with the logger/debugger. Yep. That's the problem. That call is almost certainly unnecessary. If want to keep it, wrap it in acodeif (obj != null)/code test. Mark All the best, Simo On Fri, Jan 15, 2010 at 10:53 AM, Daniele Bonetto daniele.bone...@dnshosting.it wrote: Hello everyone! I notice a problem using GenericObjectPool. My code is like this: Object obj = null; try { obj = this.borrowObject(); } catch(NoSuchElementException ex) { log.error(no such element exception, ex); this.invalidateObject(obj); throw new NicProviderPoolException(no such element exception, ex); } catch(Exception ex) { log.error(exception, ex); this.invalidateObject(obj); throw new Exception(exception, ex); } return (NicProvider)obj; When the borrowObject throws an exception and i invalidate the borrowedObject the numActive counter was decreased by 1. The problem is that the counter will not be increased in case of exception... So, my numActive counter will be -1 and isn't correct. Someone has noticed this problem too? Thanks in advance, Byez! Daniele Bonetto - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org -- http://people.apache.org/~simonetripodi/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [GenericObjectPool] problem with numActive counter
It sounds invalidating the object doesn't afflict the pool status, since in some cases you invalidate null. try following Mark suggestions. all the best, Simo On Fri, Jan 15, 2010 at 11:59 AM, Daniele Bonetto daniele.bone...@dnshosting.it wrote: yes, but if i don't invalidate the object i continue to have the problem Timeout waiting for idle object that blocks my pool as u can see in the following examples... :( */Example 1: without invalidateObject/* MaxActive = 2 NumActive = 0 -- Network is ok. Borrow obj1 -- ok [numActive 1] Borrow obj2 -- ok [numActive 2] Borrow obj3 -- nok, maxActive reached [numActive 2] Return obj1 [numActive 1] Return obj2 [numActive 0] Borrow obj3 -- ok [numActive 1] Return obj3 [numActive 0] -- Network turns nok. Borrow obj1 -- nok, cannot create an activated object [numActive 0] Borrow obj2 -- nok, cannot create an activated object [numActive 0] Borrow obj3 -- nok, timeout waiting for idle object [numActive 0] -- Network turns ok. Borrow obj1 -- nok, timeout waiting for idle object [numActive 0] Borrow obj2 -- nok, timeout waiting for idle object [numActive 0] Borrow obj3 -- nok, timeout waiting for idle object [numActive 0] and so on... It persists forever, locking my pool... */Example 2: with invalidateObject/* MaxActive = 2 NumActive = 0 -- Network is ok. Borrow obj1 -- ok [numActive 1] Borrow obj2 -- ok [numActive 2] Borrow obj3 -- nok, maxActive reached [numActive 2] Return obj1 [numActive 1] Return obj2 [numActive 0] Borrow obj3 -- ok [numActive 1] Return obj3 [numActive 0] -- Network turns nok. Borrow obj1 -- nok, cannot create an activated object [numActive 0] Invalidate obj1 [numActive -1] Borrow obj2 -- nok, cannot create an activated object [numActive -1] Invalidate obj2 [numActive -2] Borrow obj3 -- nok, cannot create an activated object [numActive -2] Invalidate obj3 [numActive -3] -- Network turns ok. Borrow obj1 -- ok [numActive -2] Borrow obj2 -- ok [numActive -1] Borrow obj3 -- ok [numActive 0] Return obj1 [numActive -1] Return obj2 [numActive -2] Return obj3 [numActive -3] In this case the object are correctly borrowed and the pool works well, but the numActive counter isn't correct and it make me borrow more than 2 objects (and it's a big problem cause i have limited connections to respect). Byez! Daniele Bonetto Il 15/01/2010 11.37, Simone Tripodi ha scritto: In the example, the catch group catches exceptions that could be thrown by the object _use_, I *suppose* whenever you catch a java.util.NoSuchElementException you don't need to invalidate the object, that's what Mark was pointing. let us know, all the best, Simo On Fri, Jan 15, 2010 at 11:26 AM, Daniele Bonetto daniele.bone...@dnshosting.it wrote: Ok, if the borrow throws an exceptin the obj was null. But i'm not sure that the invalidate was unnecessary. take a look at this: http://commons.apache.org/pool/apidocs/org/apache/commons/pool/ObjectPool.html Example of use: Object obj =|null|; |try| { obj = pool.borrowObject(); |//...use the object...| }|catch|(Exception e) { |// invalidate the object| pool.invalidateObject(obj); |// do not return the object to the pool twice| obj =|null|; }|finally| { |// make sure the object is returned to the pool| |if|(|null| != obj) { pool.returnObject(obj); } } In this example u can see that if the borrow throws an exception u have to invalidate the object from pool. So. What happends to the object that i tried to borrow? I have maxActive = 2 and without invalidate if i try more than 2 times the pool returns always: java.util.NoSuchElementException: Timeout waiting for idle object I think that without the invalidate the object remains in idle and it locks my pool... With invalidateObject the pool works correctly, but the counter wasn't correct. Thanks guys for your replies. Byez! Daniele Bonetto Il 15/01/2010 11.08, Mark Thomas ha scritto: On 15/01/2010 10:03, Simone Tripodi wrote: Ciao Daniele ;) First, I suggest you to start the subject line with [componentname], i.e. [POOL] if you're referring commons-pool, otherwise people risk to get confused and not able to reply. I don't know the Pool so deeply and maybe I didn't understand the problem, but reading your code I'm worried 'invalidateObject()' always takes 'null' as argument... take a look at this with the logger/debugger. Yep. That's the problem. That call is almost certainly unnecessary. If want to keep it, wrap it in acodeif (obj != null)/code test. Mark All the best, Simo On Fri, Jan 15, 2010 at 10:53 AM, Daniele Bonetto daniele.bone...@dnshosting.it wrote: Hello everyone! I notice a problem using GenericObjectPool. My code is like this: Object obj = null; try { obj = this.borrowObject(); } catch
Re: [GenericObjectPool] problem with numActive counter
don't worry, the community is here to solve problems :) Ciao ;) Simo On Fri, Jan 15, 2010 at 1:58 PM, Daniele Bonetto daniele.bone...@dnshosting.it wrote: i've found the problem. it was fixed in the latest release (1.5.4), but rebuilding the source eclipse doesn't change the lib in webapp (that remains 1.5.2). i confirm that if borrowObject throws an exception the pool invalidates the broken object, so is unnecessary invalidate the object in the catch expression. many thanks to all, sorry for wasting your time. best regards, Daniele Bonetto Il 15/01/2010 13.11, Mark Thomas ha scritto: On 15/01/2010 12:07, Daniele Bonetto wrote: I've already the latest version... :((( Other suggestions?? Could be a pool bug. Could you provide some more detail about what your obejct factory is doing when the network is down. Does it create objects? Does it validate them? Mark Daniele Il 15/01/2010 12.23, Mark Thomas ha scritto: On 15/01/2010 10:59, Daniele Bonetto wrote: yes, but if i don't invalidate the object i continue to have the problem Timeout waiting for idle object that blocks my pool as u can see in the following examples... :( Which version of pool are you using? If not 1.5.4, try upgrading as there were a couple of bugs in the earlier 1.5.x releases that could cause this. Mark */Example 1: without invalidateObject/* MaxActive = 2 NumActive = 0 -- Network is ok. Borrow obj1 -- ok [numActive 1] Borrow obj2 -- ok [numActive 2] Borrow obj3 -- nok, maxActive reached [numActive 2] Return obj1 [numActive 1] Return obj2 [numActive 0] Borrow obj3 -- ok [numActive 1] Return obj3 [numActive 0] -- Network turns nok. Borrow obj1 -- nok, cannot create an activated object [numActive 0] Borrow obj2 -- nok, cannot create an activated object [numActive 0] Borrow obj3 -- nok, timeout waiting for idle object [numActive 0] -- Network turns ok. Borrow obj1 -- nok, timeout waiting for idle object [numActive 0] Borrow obj2 -- nok, timeout waiting for idle object [numActive 0] Borrow obj3 -- nok, timeout waiting for idle object [numActive 0] and so on... It persists forever, locking my pool... */Example 2: with invalidateObject/* MaxActive = 2 NumActive = 0 -- Network is ok. Borrow obj1 -- ok [numActive 1] Borrow obj2 -- ok [numActive 2] Borrow obj3 -- nok, maxActive reached [numActive 2] Return obj1 [numActive 1] Return obj2 [numActive 0] Borrow obj3 -- ok [numActive 1] Return obj3 [numActive 0] -- Network turns nok. Borrow obj1 -- nok, cannot create an activated object [numActive 0] Invalidate obj1 [numActive -1] Borrow obj2 -- nok, cannot create an activated object [numActive -1] Invalidate obj2 [numActive -2] Borrow obj3 -- nok, cannot create an activated object [numActive -2] Invalidate obj3 [numActive -3] -- Network turns ok. Borrow obj1 -- ok [numActive -2] Borrow obj2 -- ok [numActive -1] Borrow obj3 -- ok [numActive 0] Return obj1 [numActive -1] Return obj2 [numActive -2] Return obj3 [numActive -3] In this case the object are correctly borrowed and the pool works well, but the numActive counter isn't correct and it make me borrow more than 2 objects (and it's a big problem cause i have limited connections to respect). Byez! Daniele Bonetto Il 15/01/2010 11.37, Simone Tripodi ha scritto: In the example, the catch group catches exceptions that could be thrown by the object _use_, I *suppose* whenever you catch a java.util.NoSuchElementException you don't need to invalidate the object, that's what Mark was pointing. let us know, all the best, Simo On Fri, Jan 15, 2010 at 11:26 AM, Daniele Bonetto daniele.bone...@dnshosting.it wrote: Ok, if the borrow throws an exceptin the obj was null. But i'm not sure that the invalidate was unnecessary. take a look at this: http://commons.apache.org/pool/apidocs/org/apache/commons/pool/ObjectPool.html Example of use: Object obj =|null|; |try| { obj = pool.borrowObject(); |//...use the object...| }|catch|(Exception e) { |// invalidate the object| pool.invalidateObject(obj); |// do not return the object to the pool twice| obj =|null|; }|finally| { |// make sure the object is returned to the pool| |if|(|null| != obj) { pool.returnObject(obj); } } In this example u can see that if the borrow throws an exception u have to invalidate the object from pool. So. What happends to the object that i tried to borrow? I have maxActive = 2 and without invalidate if i try more than 2 times the pool returns always: java.util.NoSuchElementException: Timeout waiting for idle object I think that without the invalidate the object remains in idle and it locks my pool... With invalidateObject the pool works correctly, but the counter wasn't correct. Thanks guys for your replies. Byez
Re: Null safe dateformat?
Hi Ludwig, I suggest you to include, between square brackets, the commons component name, which you are interested, in the mail subject, otherwise people can get confused and not able to reply properly. Have a nice day, Simo On Tue, Jan 12, 2010 at 10:28 AM, Ludwig Magnusson lud...@itcatapult.com wrote: Hi! Commons is famous for its null-safe methods, but are there no null safe dateFormat methods? I'm looking for something that looks like DateformatClass.format(date, formatString) that returns an empty string or null (but at least does not throw an exception) if the date is null. I looked at DateFormatUtils but it doesn't seem to work like that.. /Ludwig -- http://people.apache.org/~simonetripodi/ - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Commons betwixt 0.8 - reading Map from XML
Hi Dimitry, my pleasure :) Best regards, Simone 2008/9/5 Dmitriy Kuznetsov [EMAIL PROTECTED]: Simone Tripodi wrote: Hi Dmitriy, you don't you use just the commons-digester rules to map the xml to your map? It's also a betwixt dependency library, and maybe it could be easier. Best regards, Simone Well, i've made some changes since first time. The XML now looks like following: metadata group name=... entry name=... header.../header width.../width /entry entry name=... hideable.../hideable tooltip.../tooltip /entry /group group name=... entry name=... align.../align width.../width /entry /group /metadata And as Simone suggested, i've used commons Digester instead of Betwixt: Digester digester = new Digester(); digester.setValidating(false); digester.addObjectCreate(metadata, Hashtable.class); digester.addObjectCreate(metadata/group, ListOrderedMap.class); Rule r = new CallMethodRule(1, put, 2); digester.addRule(metadata/group, r); digester.addCallParam(metadata/group, 0, name); digester.addCallParam(metadata/group, 1, true); // MetadataEntry is a simple bean that holds values of entry/ section digester.addObjectCreate(metadata/group/entry, MetadataEntry.class); r = new SetNestedPropertiesRule(); digester.addRule(metadata/group/entry, r); r = new CallMethodRule(1, put, 2); digester.addRule(metadata/group/entry, r); digester.addCallParam(metadata/group/entry, 0, name); digester.addCallParam(metadata/group/entry, 1, true); // a little later InputStream is = servletContext.getResourceAsStream(WEB-INF/classes/metadata.xml); Object result = digester.parse(is); And it works. The resulting data structure is: MapString, MapString, MetadataEntry Simone, thanks! =) -- View this message in context: http://www.nabble.com/Commons-betwixt-0.8---reading-Map-from-XML-tp19255879p19336473.html Sent from the Commons - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- My LinkedIn profile: http://www.linkedin.com/in/simonetripodi My GoogleCode profile: http://code.google.com/u/simone.tripodi/ My Sourceforge: https://sourceforge.net/users/stripodi My Picasa: http://picasaweb.google.com/simone.tripodi/ My Tube: http://www.youtube.com/user/stripodi My Del.icio.us: http://del.icio.us/simone.tripodi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Commons betwixt 0.8 - reading Map from XML
Hi Dmitriy, you don't you use just the commons-digester rules to map the xml to your map? It's also a betwixt dependency library, and maybe it could be easier. Best regards, Simone 2008/9/1 Dmitriy Kuznetsov [EMAIL PROTECTED]: Hi. I am trying to load a map of String, Object from XML back to java using betwixt - with no success. I've exported a Hashtable of String, Object to XML using Betwixt 0.8. The XML i've got is: ?xml version=1.0 encoding=UTF-8 ? metadata map emptytrue/empty entry keygabbaGabbaHey/key valuemd-id-2/value /entry entry keyEntry1/key value123/value /entry entry keyhalooppoRoste/key value-3.76/value /entry /map /metadata After that, i am trying to load the XML back by the following code: BeanReader beanReader = new BeanReader(); beanReader.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(false); beanReader.getBindingConfiguration().setMapIDs(false); try { beanReader.registerBeanClass(map, Hashtable.class); beanReader.registerBeanClass(entry/value, String.class); Object tmp; File srcFile = new File(metadata.xml); tmp = instance.beanReader.parse(srcFile); } catch (Exception ex) { logger.log(Level.SEVERE, Failed to read metadata., ex); return null; } I played with beanReader.registerBeanClass - tried to set metadata/map and metadata/map/entry/value as first parameter, disable registerBeanClass commands, remove metadata tags from XML, but the only results i've got are null in tmp variable, or EmptyStackException Sep 1, 2008 5:39:52 PM org.apache.commons.digester.Digester endElement SEVERE: End event threw exception java.util.EmptyStackException at org.apache.commons.collections.ArrayStack.peek(ArrayStack.java:94) at org.apache.commons.betwixt.io.read.ReadContext.getBean(ReadContext.java:351) at org.apache.commons.betwixt.expression.CollectionUpdater.update(CollectionUpdater.java:47) at org.apache.commons.betwixt.io.read.BeanBindAction.update(BeanBindAction.java:171) at org.apache.commons.betwixt.io.read.BeanBindAction.end(BeanBindAction.java:158) at org.apache.commons.betwixt.io.BeanRuleSet$ActionMappingRule.end(BeanRuleSet.java:316) at org.apache.commons.digester.Digester.endElement(Digester.java:1222) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1728) at com.aleri.lms.ui.beans.XMLMetadataProvider.loadMetadata(XMLMetadataProvider.java:83) at com.aleri.lms.ui.beans.XMLMetadataProvider.main(XMLMetadataProvider.java:74) java.util.EmptyStackException at org.apache.commons.digester.Digester.createSAXException(Digester.java:3181) at org.apache.commons.digester.Digester.createSAXException(Digester.java:3207) at org.apache.commons.digester.Digester.endElement(Digester.java:1225) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)