Giter Club home page Giter Club logo

jlibs's Introduction

LICENSE: http://www.gnu.org/licenses/lgpl-2.1.html
JAVA   : 1.6+

The 3rdparty libraries used in jlibs are not included in this distribution.
Run the ant file in $JLIBS_HOME/lib/external to download them.

Dependencies:
+---------------+--------------+-----------------------------------------------+
| Module        | Dependencies | 3rdparty Libraries                            |
+---------------+--------------+-----------------------------------------------+
| jlibs-core    |              |                                               |
| jlibs-jdbc    | jlibs-core   |                                               |
| jlibs-xml     | jlibs-core   | xercelImpl.jar (version 2.11.0)               |
|               |              | xml-apis.jar  (version=1.4.01)                |
| jlibs-xmldog  | jlibs-xml    | jaxen.jar (version 1.1.1)                     |
| jlibs-swing   | jlibs-xml    | org-netbeans-swing-outline.jar (netbeans 6.5) |
| jlibs-examples| jlibs-jdbc   | saxon.jar (version 9.0.0.2)                   |
|               | jlibs-swing  | saxon-dom.jar (version 9.0.0.2)               |
|               |              | saxon-xpath.jar (version 9.0.0.2)             |
|               |              | commons-dbcp (version 1.4)                    |
|               |              | commons-pool (version 1.5.4)                  |
|               |              | mysql-connector-java (version 5.1.12)         |
+---------------+--------------+-----------------------------------------------+

Note: Dependencies are recursive.

If you have any doubts in using jlibs, contact me at [email protected]

jlibs's People

Contributors

santhosh-tekuri avatar

Watchers

James Cloos avatar

jlibs's Issues

RFE - Sax2binding - support for namespaceAware (ignoring namespaces) and/or org.xml.sax.helpers.XMLFilter

It would be nice to have this feature. I want to be able to parse these 2 XMLs 
with a same binding:

<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
                       xmlns:moz="http://www.mozilla.org/2006/browser/search/">

  <ShortName>isoHunt - BT search</ShortName>
   ...
</OpenSearchDescription>



<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription>
  <ShortName>isoHunt - BT search</ShortName>
   ...
</OpenSearchDescription>

It can be implemented using many ways - eg. using customized XMLFilter.

Original issue reported on code.google.com by wordrider.net on 29 Oct 2010 at 7:49

Support fot Maven 2

Your library are very interesting and usefull.

Do you have any plan to support maven. I mean publish classes, source and 
javadoc in some public maven repository.

Original issue reported on code.google.com by [email protected] on 26 Jan 2010 at 8:26

github repository?

Github source creates confusion.
https://github.com/santhosh-tekuri/maven-repository/tree/master
and I was looking for the corrected 1.1-SNAPSHOT there (as I had github URLs 
copy/pasted from some page).

All went well when I switch to using Dropbox repo, but I think you should just 
remove the sources from github.

Original issue reported on code.google.com by [email protected] on 8 Nov 2013 at 11:43

SAX2Binding - invalid parsing attributes when default namespace is used

What steps will reproduce the problem?
1. Use a default xmlns="http://a9.com/-/spec/opensearch/1.1/" attribute in 
input XML.
2. Use annotation in Binding
@NamespaceContext({
    @Entry(prefix="", uri="http://a9.com/-/spec/opensearch/1.1/")
})
2. Attributes for Url elements are not parsed (values are null).
That's because the generated code is following:
attributes.getValue("http://a9.com/-/spec/opensearch/1.1/", "width")

The working code for "" prefix should be 
attributes.getValue("width")

What is the expected output? What do you see instead?
Attributes are parsed properly.

What version of the product are you using? 
JLibs r935.

Please provide any additional information below.
Please see attached source code. Problem will be more obvious.

Original issue reported on code.google.com by wordrider.net on 29 Oct 2010 at 7:43

Attachments:

java.lang.IllegalArgumentException: no prefix found for uri

Hi,

when trying to generate sample XML file from XSD which imports multiple 
undelying XSD files, there appears response that the prefix was not found.

Piece of code:
XSInstance xsInstance = new XSInstance();
            xsInstance.minimumElementsGenerated = 2;
            xsInstance.maximumElementsGenerated = 4;
            xsInstance.generateOptionalElements = Boolean.TRUE; // null means random

            XSModel xsModel = new XSParser().parse(SOATF_HOME + "\\schema\\SOATestingFrameworkInterfaceConfiguration\\SOATestingFrameworkInterfaceConfiguration.xsd");


            QName rootElement = new QName("http://www.ibm.com/SOATF/Config/Interface", "soaTestingFrameworkInterfaceConfiguration", "stfconf");
            XMLDocument sampleXml = new XMLDocument(new StreamResult(System.out), true, 4, null);
            xsInstance.generate(xsModel, rootElement, sampleXml);


I attached whole XSD folder.

Original issue reported on code.google.com by [email protected] on 17 Nov 2013 at 5:54

Attachments:

Comparing "dateTime" to x.toLowerCase() will never be true

dateTimes are not correctly generated: they are treated as strings!
I found out why, using the trunk source code that I checked out today.

On line 452 of XSInstance.java is written:

            String name = builtInType.getName().toLowerCase();

On line 470 of XSInstance.java is written:

            if("dateTime".equals(name)){

This comparison will never result true since "T".toLowerCase() == "t".

Original issue reported on code.google.com by [email protected] on 20 Nov 2013 at 12:20

XSInstance maximumRecursionDepth not being obeyed. Infinite output loop results

What steps will reproduce the problem?
1. FileOutputStream fos = new FileOutputStream(file);
   XMLDocument sampleXml = 
           new XMLDocument(new StreamResult(fos), true, 4, null);
   xsInstance.generate(xsModel, rootElement, sampleXml);
2.
3.

What is the expected output? What do you see instead?
I expected the maxRecursion depth to limit output, but the output XML has an 
infinitely recursive depth (until memory ran out)

What version of the product are you using? On what operating system?
1.1-SNAPSHOT

Please provide any additional information below.
Attached is the XSD that causes this:

Original issue reported on code.google.com by [email protected] on 11 Feb 2014 at 7:47

Attachments:

Enhance SQL DAO with support for batch operations

For performance benefits, it would be nice for the DAO to support batch 
operations.

It would be convenient for batches to be handled using a similar approach as 
transactions, such that one could write:

BatchManager.run(datasource, new Batch<X>() {
  public X run (Connection conn) {
     .... Insert/Update/Delete calls here are implicitly batched and executed when this method returns ....
  }
});

Batch operations should work within a transaction, though it would not work to 
put a transaction within a batch.

Select operations should just be executed immediately.

Original issue reported on code.google.com by [email protected] on 7 Nov 2011 at 2:59

java.lang.NumberFormatException: For input string: "0.0"

java.lang.NumberFormatException: For input string: "0.0"
java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
java.lang.Long.parseLong(Long.java:441)
java.lang.Long.parseLong(Long.java:483)
jlibs.xml.xsd.XSInstance$XSSampleVisitor$Range.randomNumber(XSInstance.java:589)
jlibs.xml.xsd.XSInstance$XSSampleVisitor.generateSampleValue(XSInstance.java:464
)
jlibs.xml.xsd.XSInstance$XSSampleVisitor.access$400(XSInstance.java:168)
jlibs.xml.xsd.XSInstance$XSSampleVisitor$2.preProcess(XSInstance.java:280)
jlibs.xml.xsd.XSInstance$XSSampleVisitor$2.preProcess(XSInstance.java:262)
jlibs.core.graph.WalkerUtil.walk(WalkerUtil.java:40)
jlibs.xml.xsd.XSInstance.generate(XSInstance.java:100)

Original issue reported on code.google.com by [email protected] on 8 Nov 2013 at 12:00

variable values generated for fixed elements in XSD

What steps will reproduce the problem?
1. Select a XSD with a fixed element in it. See e.g. attached file.
2. Generate instance from XSD using XSInstance
3. Validate generated instance against XSD

What is the expected output? What do you see instead?
The validation fails. I would like the validation to pass.

What version of the product are you using? On what operating system?
The latest version from the svn archieve.
On windows.

Please provide any additional information below.

You can use the following code for JLIBS under the LGPL license when I am 
acknowledge as co-author either in the file or (as currently illustrated) above 
the function:

            /**
             * @author Santhosh Kumar T
             * @author Pierre van de Laar - TNO-ESI
             */
            public void postProcess(XSElementDeclaration elem, Path path){
                if(path.getRecursionDepth()>2)
                    return;
                try{
                    XSSimpleTypeDefinition simpleType = null;
                    if(elem.getTypeDefinition().getTypeCategory()==XSTypeDefinition.SIMPLE_TYPE)
                        simpleType = (XSSimpleTypeDefinition)elem.getTypeDefinition();
                    else{
                        XSComplexTypeDefinition complexType = (XSComplexTypeDefinition)elem.getTypeDefinition();
                        if(complexType.getContentType()==XSComplexTypeDefinition.CONTENTTYPE_SIMPLE)
                            simpleType = complexType.getSimpleType();
                    }
                    if(simpleType!=null){

                        String sampleValue = null;
                        switch(elem.getConstraintType()){
                            case XSConstants.VC_FIXED:
                                if(RandomUtil.randomBoolean(generateFixedAttributes))                   //TODO: introduce generateFixedElements?                                                                        sampleValue = elem.getValueConstraintValue().getNormalizedValue();
                                break;
                            case XSConstants.VC_DEFAULT:
                                if(RandomUtil.randomBoolean(generateDefaultAttributes))                 //TODO: introduce generateDefaultElements?
                                    sampleValue = elem.getValueConstraintValue().getNormalizedValue();
                                break;
                            default:
                               sampleValue = null;
                        }
                        if(sampleValueGenerator!=null)
                            sampleValue = sampleValueGenerator.generateSampleValue(elem, simpleType);
                        if(sampleValue==null)
                            sampleValue = generateSampleValue(simpleType, elem.getName());
                        doc.addText(sampleValue);
                    }
                    doc.endElement();
                }catch(SAXException ex){
                    throw new ImpossibleException(ex);
                }
            }


Original issue reported on code.google.com by [email protected] on 19 Dec 2013 at 12:54

Attachments:

XML element without closing tag is parsed successfully

What steps will reproduce the problem?
1. Try to parse XML without closing tag (like "<root>").
It is parsed successfully but shouldn't be.

What is the expected output? What do you see instead?
Expected:
  A new exception like XPathException or some other should be raised.
Actual:
  No exception is raised

What version of the product are you using? On what operating system?
Version: 1.0-SNAPSHOT
OS: Win XP




Original issue reported on code.google.com by [email protected] on 24 Jan 2012 at 9:12

XSInstance does not consider restrictions on xsd types

What steps will reproduce the problem?
  Create xsd simple type with restriction (for example only digits). Try to generate xml with XSInstance.

What is the expected output? What do you see instead?
  Restriction is ignored.

What version of the product are you using? On what operating system?
  r1753, Windows

Please provide any additional information below.
  <xs:simpleType name="TypeWithRestriction">
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]{11}"/>
      <xs:maxLength value="11"/>
    </xs:restriction>
  </xs:simpleType>

Original issue reported on code.google.com by [email protected] on 27 Nov 2013 at 8:37

Code duplication

The code of   class Range: 
constructor Range(XSSimpleTypeDefinition simpleType)
sets totalDigits twice!

540:                 facet = getFacet(simpleType, 
XSSimpleTypeDefinition.FACET_TOTALDIGITS);
                if(facet!=null)
                    totalDigits = Integer.parseInt(facet.getLexicalFacetValue());

                facet = getFacet(simpleType, XSSimpleTypeDefinition.FACET_TOTALDIGITS);
                if(facet!=null)
                    totalDigits = Integer.parseInt(facet.getLexicalFacetValue());

Original issue reported on code.google.com by [email protected] on 20 Nov 2013 at 1:44

Out of memory& reading XML file issues

What steps will reproduce the problem?
1.Download java file and xml files.
2.In java file update String file = 
"C:\\Sripati\\FileCompareson\\XmlFile\\file.xml"; for your xml file path 
updation.
3. Run java file post compilation.

What is the expected output? What do you see instead?
1. Out put should all xn:MeContext tag ID values. It returns nothing.

2. If I change Expression xpath1 = dog.addXPath("//*"); for all elements then 
it throws 
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Unknown Source)
    at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
    at java.lang.AbstractStringBuilder.append(Unknown Source)
    at java.lang.StringBuilder.append(Unknown Source)
    at java.lang.StringBuilder.append(Unknown Source)
    at java.util.AbstractCollection.toString(Unknown Source)
    at java.lang.String.valueOf(Unknown Source)
    at java.io.PrintStream.println(Unknown Source)
    at XMLDogSearching.main(XMLDogSearching.java:45)

What version of the product are you using? On what operating system?
Downloaded jlibs-r1627 from your download link. OS is Windows vista


Please provide any additional information below.
Please help me as we are planning to handle around 3GB XML file search but now 
it is through memory error for all elements display at 8MB file search.

Suggest me best way to do it. Or let me know your development API guide to use 
it in right way.

Original issue reported on code.google.com by [email protected] on 24 Aug 2012 at 12:47

Attachments:

add support for Relation start/finish accepting parent's temp data

add support for Relation start/finish accepting parent's temp data

for example:

public static void relateWithEdge(@Parent.Temp List<Node> nodes){
    List<Node> nodes = (List<Node>)parent.get("", "nodes");
}

i.e we can provide both @Parent.Temp and @Current.Temp in Relation start/finish 
methods
currently @Temp fetches from current context in both relation start/finish and 
binding.finish methods

workaround is accept parent context and fetch yourself:

public static void relateWithEdge(SAXContext parent, ...){
    List<Node> nodes = (List<Node>)parent.get("", "nodes");
}

Original issue reported on code.google.com by [email protected] on 10 Sep 2010 at 4:32

Issue #12

I looked at the diffs & applied them locally.  The fix was apparently applied 
to jlibs-xml, but not jlibs-jdbc (which is what I am presently using). (Though 
it seems like it was appropriate for both.)

Original issue reported on code.google.com by [email protected] on 20 Apr 2011 at 5:35

Maven repository timeouts

The maven repository listed on the project home page 
http://dl.dropbox.com/u/326301/repository is timing out.

Has the URL moved or are there any problems you are aware of?

Thanks


Original issue reported on code.google.com by [email protected] on 18 Nov 2010 at 6:50

Support for non-standard database types

What steps will reproduce the problem?

1. Use of database-specific types

What is the expected output? What do you see instead?

 The jlibs/jdbc API provides no way to pass type information down with parameters to its setObject calls (e.g. in JDBC.setParams). For some non-standard database types, it's necessary to pass the type as java.sql.Types.OTHER.

What version of the product are you using? On what operating system?

 Latest SVN version; Windows & Linux.

Please provide any additional information below.

 It's not possible to use the @TypeMapper "mapsTo" type value for this, because the type within Java for all other purposes may be something like String, but the mapping in the database isn't to varchar (or text or cblob or ...).  And the situation can happen without even needing a TypeMapper, as the data may otherwise be treated like it was just a String (or some other class which already has default mappings).

 Either @Column(overrideSqlType=[some java.sql.Types]) or @OverrideSQLType([some java.sql.Types]) would make sense.  At this point I don't know of a case where a value other than "OTHER" needs to be used, but it would be good to allow the user to pass any Types value they need.

Original issue reported on code.google.com by [email protected] on 2 Jun 2011 at 4:08

XmlCrawler does not support xml catalogs

hi guys, XmlCrawler is pretty cool. I noticed however that it does not allow to 
resolve imports and includes using a resource or entity catalog. It does take a 
bit of effort to introduce such support but you are using SAX and Xerces so it 
is not too painful.

There are 2 changes required, 1 is to the rules where one will not only need to 
extract the "location" but also the "target namespace" attribute to be able to 
resolve a resource in a catalog.

The patch would still be alpha and will need a bit more work to support 
catalogs properly across all types but I tested a few larger xsd libraries that 
are strung together with catalogs and it all seems to work well.

Could not find a structured test in your xml project so attached a zip with a 
very simple test case that uses a catalog resolver.

Please let me know if you need further info or like to discuss the patch.

Original issue reported on code.google.com by [email protected] on 21 Apr 2013 at 2:59

Attachments:

Exception running XSInstance.java

What steps will reproduce the problem?
  If I run XSInstance with the latest code (svn 1766) and the file trunk/xml/xsds/purchaseOrder.xsd I get the exception:
Exception in thread "main" java.lang.NullPointerException
    at jlibs.xml.sax.helpers.MyNamespaceSupport.declarePrefix(MyNamespaceSupport.java:104)
    at jlibs.xml.sax.XMLDocument.declarePrefix(XMLDocument.java:94)
    at jlibs.xml.sax.XMLDocument.toQName(XMLDocument.java:112)
    at jlibs.xml.sax.XMLDocument.addAttribute(XMLDocument.java:232)
    at jlibs.xml.xsd.XSInstance$XSSampleVisitor$2.preProcess(XSInstance.java:286)
    at jlibs.xml.xsd.XSInstance$XSSampleVisitor$2.preProcess(XSInstance.java:1)
    at jlibs.core.graph.WalkerUtil.walk(WalkerUtil.java:40)
    at jlibs.xml.xsd.XSInstance.generate(XSInstance.java:103)
    at jlibs.xml.xsd.XSInstance.main(XSInstance.java:704)


This does work with svn rev. 1753 so it is an error that was introduced with 
the changes between those builds. 


What is the expected output? What do you see instead?
Should generate the XML

What version of the product are you using? On what operating system?
Windows, but I ran the test just in Java with the XSIntance

Please provide any additional information below.
I appreciate your solution and it looks like it could be very helpful to us. 
Thanks for maintaining it.

Original issue reported on code.google.com by [email protected] on 4 Nov 2013 at 10:48

Temp.Add should support value optionally

Temp.Add should support value optionally

for example:

@Relation.Finish("*")
public static Temp.Add("matcher") Matcher relateWithMatcher(Matcher matcher){
    parent.add(new QName("matcher"), matcher);
}

here matcher is an abstract class. Different child elements create Matcher 
subclass instances with different
element name. We want to collect all matchers into to temp list. For this 
Temp.Add must support value argument
optionally.

workaround is:

@Relation.Finish("*")
public static void relateWithMatcher(SAXContext parent, Matcher matcher){
    parent.add(new QName("matcher"), matcher);
}

why dont we add Temp.Put also and support optional value argument for that 
also....

Original issue reported on code.google.com by [email protected] on 10 Sep 2010 at 4:39

Tracing output can't be turned off

What steps will reproduce the problem?
1. Simply use DAO system

What is the expected output? What do you see instead?

Expected output would be nothing at all, instead there are messages like:
newConnection
SQL[true]: SELECT ... FROM ...
closed

What version of the product are you using? On what operating system?

r935

Please provide any additional information below.

It looks like there are just some debugging calls left in JDBC.java & 
TransactionManager.java; If these can be removed, or turned off unless a debug 
property is set, that would be great.

Also, thanks for the quick fix to issue #12.

Original issue reported on code.google.com by [email protected] on 20 Apr 2011 at 4:22

bug in SSLUtil.java

http://code.google.com/p/jlibs/source/browse/trunk/core/src/main/java/jlibs/core
/net/SSLUtil.java#126

line 126:
sslContext.init(kmf.getKeyManagers(), tm , null);

should be
sslContext.init(km, tm , null);

It took me a few hours til I realized it. Please fix, thanks!

Original issue reported on code.google.com by [email protected] on 23 Jun 2011 at 5:52

If two methods use same binding/relation annotation for a child element, then throw error at compile time

If two methods use same binding/relation annotation for a child element, then 
throw error at compile time

for example:

    @Binding.Start("rule")
    public static Rule onRule(@Attr String name){
        ...
    }

    @Binding.Start("rule")
    public static Matcher onMatcher(@Attr String name){
        ...
    }

this should be caught at compile time. This type of mistakes quite often happen 
in copy paste.


Original issue reported on code.google.com by [email protected] on 10 Sep 2010 at 4:44

Update dependencies

Using "mvn versions:display-dependency-updates" I noticed that jlibs uses many 
old versions of its dependencies.
Jlibs thus doesn't benefit from bug fixes, while the effort to update to the 
latest version increases with every update.

For example, to move to the latest version of xerces (2.11.0) currently only 
needs two changes in the code:
1. change jlibs-read-only\xml\src\main\java\jlibs\xml\dom\DOMLSInputList.java :
public class DOMLSInputList extends ArrayList<LSInput> implements LSInputList{
to
public class DOMLSInputList extends ArrayList implements LSInputList{

and
2. change in 
jlibs-read-only\xml\src\main\java\jlibs\xml\sax\async\XMLFeeder.java :
    XMLEntityManager.setInstanceFollowRedirects(httpCon, true);
to 
    httpCon.setInstanceFollowRedirects(true);

Original issue reported on code.google.com by [email protected] on 3 Dec 2013 at 2:24

Values generated by XSInstance.generate() for xsd decimal type is not valid

What steps will reproduce the problem?
  Generate xml by XSInstance.generate() for xsd with decimal type

What is the expected output? What do you see instead?
  Generated values like "1234.456E123", but "E" is not allowed (http://books.xmlschemata.org/relaxng/ch19-77057.html)

What version of the product are you using? On what operating system?
  r1753, Windows

Please provide any additional information below.
  http://www.w3.org/TR/xmlschema-2/#decimal
  I believe only xsd float type allows exponent notation. IBM Websphere fails on validate decimal with exponent. 

Original issue reported on code.google.com by [email protected] on 26 Nov 2013 at 1:54

daily build breaks

What steps will reproduce the problem?
1. mvn clean install on jlibs

What is the expected output? What do you see instead?
I expect that the project (and its subproject all compile)
However, I have to explicitly ignore the test cases (using 
-Dmaven.test.skip=true) since some tests fail.
Furthermore, some files are missing the mandatory header (
jlibs-read-only\core\src\main\java\jlibs\core\io\EncodingDetector.java
jlibs-read-only\jdbc\src\main\java\jlibs\jdbc\JDBCTask.java
jlibs-read-only\xmldog\src\main\java\jlibs\xml\sax\dog\path\tests\LocalName.java
)
which also causes the build to fail.

What version of the product are you using? On what operating system?
I am using the latest version of the code archive.

Original issue reported on code.google.com by [email protected] on 3 Dec 2013 at 12:46

Support inner classes in DAO code generator

What steps will reproduce the problem?
1. Use @Table on an inner class

What is the expected output? What do you see instead?

The generated code does not import the inner class, so it's not visible.

What version of the product are you using? On what operating system?

935

Please provide any additional information below.

Just need to add an import statement to the generated code when needed; 
something like:

if ( !printer.clazz.class.getCanonicalName()
       .equals(printer.clazz.class.getPackage().getName() + "." +
               printer.clazz.class.getSimpleName()) )
  printer.importClass(printer.clazz);



Original issue reported on code.google.com by [email protected] on 19 Apr 2011 at 7:16

[Javac] cann't generate class cz.actum.koop.contact.binding.PobockyBindingImpl because it already exists

I use this in my code

BindingHandler handler = new BindingHandler(PobockyBinding.class);

and it raise exception:

Exception in thread "main" java.lang.RuntimeException: 
java.lang.ClassNotFoundException: 
cz.actum.koop.contact.binding.PobockyBindingImpl

Why handler looking for class PobockyBindingImpl when I entered 
PobockyBinding.class

This is not documented in wiki. And it not possible turn it off without 
modify your code.

Original issue reported on code.google.com by [email protected] on 27 Jan 2010 at 2:10

Using TransactionManager

What steps will reproduce the problem?
1. Mixing TransactionManager with DAO calls

Please provide any additional information below.

DAO calls are made starting from a DataSource or a JDBC, and the 
TransactionManager provides a Connection.  How can a DAO call be written inside 
a transaction?  Should there be a way to create a DAO/JDBC from a Connection?

This also seems relevant for Connection reuse.

Original issue reported on code.google.com by [email protected] on 9 Jun 2011 at 9:18

Generate friendly creator method for DAO base class

What steps will reproduce the problem?
1. Use an abstract base class for a JDBC DAO

Please provide any additional information below.

It's inconvenient to get an instance of the DAO class converted to the base 
class type when using @Table(extend=...)

  final X x = (X)DAO.create(Y.class, dataSource);

It would be nice for the generated DAO code to include its own create() method:

  public static X create (final DataSource dataSource) {
    return (X)jlibs.jdbc.DAO.create(Y.class, dataSource);
  }

Thus making it possible to write the cleaner:

  final X x = X.create(dataSource);

Right now, it's obviously possible to get this by simply putting that method 
into the base class manually, but it would be friendlier for the API to 
generate it.

Original issue reported on code.google.com by [email protected] on 3 Jun 2011 at 6:54

Email Contact Requested

Hi Santhosh,

none of the email addresses shown in this site seem to work for me, this is why 
I tried to get into contact with you via this issue tracker.

I am Alex Schulze, founder of the jWebSocket Framework (open source, 
http://jwebsocket.org). For a project we are searching for a java nio proxy 
which can be used to distinguish between WebSocket requests and http requests 
to route them to different hosts/interfaces. I roughly tested your proxy demo 
and it looks like your jlib collection could be an appropriate base for our 
project.

Since I noticed in Google Code that you are actively maintaining the jlibs 
project I was wondering if you are interested in a cooperation. The demand on 
WebSocket communication is amazingly growing and I could imagine that we could 
mutually benefit from each other.

Looking forward to your answer.

Best Regards
Alex 
[email protected]
http://jWebSocket.org

Original issue reported on code.google.com by [email protected] on 2 May 2011 at 10:36

Results Memory Leak when using Instant Evaluation

What steps will reproduce the problem?
1.Add 20+ xpaths that select nodesets from the test file
2.Use a large 100Mb+ test file
3.Use a profiler to monitor heap

What is the expected output? What do you see instead?

The LongTreeMap called 'results' in LocationEvaluation is not cleared after the 
results are delivered.
An Entry is added to the LongTreeMap for each xpath result.
I think results should be discarded once the instant evaluation callback has 
been notified.
If they are not then the processing slows down significantly when the 
LongTreeMap contains > 400000 Entries.

What version of the product are you using? On what operating system?
1.7.25 on OSX (JDK: (build 1.6.0_31-b04-415-11M3635))

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 11 Jun 2012 at 3:33

Upsert annotation generates bad SQL: insert stmt missing ) before VALUES

Using the @Upsert annotation generates SQL that has a missing ")" after the 
column names list for the insert() portion.  For example:

    @Override //@Upsert
    public void updateSession(java.lang.String where_sessionid, java.lang.String folderPath){
        int count = update("SET "+jdbc.quote("folder_path")+"=? WHERE "+jdbc.quote("sessionid")+"=?", folderPath, where_sessionid);
        if(count==0)
            insert("("+jdbc.quote("sessionid")+", "+jdbc.quote("folder_path")+" VALUES(?, ?, ?, ?)", where_sessionid, folderPath);
    }

Note the missing ) before VALUES in the insert() call.

Original issue reported on code.google.com by [email protected] on 13 Feb 2012 at 8:35

applyDigits in XSInstance fails on small numbers

String.valueOf( double ) has as format [0-9]+(.[0-9]+(E(-|+)[0-9]+)?)?
However, applyDigits in XSInstance assumes it is only number.fraction.
Consequently on small numbers like 0.000005678
which has a string representation 5.678E-6 the algorithm fails.

See the test below:
==============================================
package nl.esi.xsi;

import static org.junit.Assert.*;

import org.junit.Test;

public class ToDigit {

    @Test
    public void test() {
           double obj = 0.000005678;
           System.out.println("obj = "+ obj);

           String str = String.valueOf(obj);
           System.out.println("str = " +str);

           String number, fraction;
        int dot = str.indexOf(".");
        if(dot==-1){
            number = str;
            fraction = "";
        }else{
            number = str.substring(0, dot);
            fraction = str.substring(dot+1);
        }

        assertEquals("0", number);
        assertEquals("000005678", fraction);
    }   
}

Original issue reported on code.google.com by [email protected] on 20 Nov 2013 at 3:55

Confusing error message

The error message:

  "the column property must be specified for
   parameter "+param.getSimpleName()+" in query"

in DMLMethod.java is confusing/misleading.

I got this because I was using a java.util.Date type with a type mapper -- I 
think the loop over JavaType.values() with the comparison of 
javaType.clazz.getName() might have mis-matched on "Date" -- maybe that needs 
to be .getCanonicalName().  I wound up fixing it without tracing down the exact 
problem.

The error could be more informational though -- it seems to be saying that the 
@Column annotation is required, but that wasn't the actual problem -- the 
problem was definitely related to the type of the parameter.  Maybe there are 
two different error conditions there & each should have a separate message.

Original issue reported on code.google.com by [email protected] on 9 Jun 2011 at 9:33

Inconsistent Random interface

The functions defined in 
\jlibs-read-only\core\src\main\java\jlibs\core\util\RandomUtil.java
have an inconsistent interface.

max is excluded in
double random(double min, double max)     [and float]
but included in
int random(int min, int max)              [and short, long, byte]


This complicates the usage of these standard functions.

Possible solutions:
1. either include or exclude max in all cases.
2. add javadoc documentation, such that the user can read what the function 
does without the need to look at the actual implementation file.
 The additional documentation could look like:
    /** Random integer value
      * @param min minimum integer value (inclusive)
      * @param max maximum integer value (inclusive)
      * @return a random integer in the range [min, max]
      */
    public static int random(int min, int max)

Original issue reported on code.google.com by [email protected] on 3 Dec 2013 at 1:35

Quote database identifiers

When table/column names contain values that need to be quoted, it can be 
awkward to use the jlibs annotations.

For example, writing @table(name="\"foo\"") is inconvenient and hard-codes the 
use of double quotes.

It would be better to use DatabaseMetaData.getIdentifierQuoteString() to 
determine how to perform the quoting, but that's not generally going to be 
available at the time the annotations are being written or processed.  It would 
be best to apply the database-specific quoting for the JDBC connection at the 
time the identifiers are being used.

It would probably be appropriate to make this behavior optional and to allow 
the user to explicitly set a quoting string; but I think it would be reasonable 
to have it enabled by default -- it would only impact code that already 
contains explicit identifier escaping.

Original issue reported on code.google.com by [email protected] on 22 May 2011 at 10:08

Connection is closed exception in JDBC

This is my DAO class, basically same as on the Wiki page 
(http://code.google.com/p/jlibs/wiki/DAOPattern):

public class KeywordDAO {

   public static final DataSource DATA_SOURCE;
   public static final DAO<Keyword> KEYWORDS;

   static {
      System.setProperty("jlibs.jdbc.debug", Boolean.TRUE.toString());
      DataSource ds = null;
      try {
         Context initCtx = new InitialContext();
         Context envCtx = (Context) initCtx.lookup("java:comp/env");
         ds = (DataSource) envCtx.lookup("jdbc/tv"); //using datasource from tomcat, same problem with BasicDataSource
      } catch (NamingException ex) {
         Logger.getLogger(KeywordDAO.class.getName()).log(Level.SEVERE, null, ex);
      }
      DATA_SOURCE = ds;
      KEYWORDS = DAO.create(Keyword.class, new JDBC(DATA_SOURCE));
   }
}

This is how I invoke the DAO:
KeywordDAO.KEYWORDS.all();

The problem is that every other invoke results in a "java.sql.SQLException: 
Connection is closed". I've fixed this problem easily by modifying the 
jlibs.jdbc.JDBC class, specifically the method:

public <T> T run(int batchInterval, JDBCTask<T> task) throws DAOException

so that after every call to con.close() (there are 2 of those currently in the 
method) a CONNECTION.set(null) is called.

Original issue reported on code.google.com by [email protected] on 21 Apr 2013 at 8:53

SAX2Binding Compiler internal error if binding classes are placed in default package

What steps will reproduce the problem?
1. Move Employee example into default package.
2. Run compile - compilation will fail

- What is the expected output? 
  Compiled code

What do you see instead?
Information:Round 1:
Information:    input files: {Employee, EmployeeBinding, MainApp}
Information:    annotations: [jlibs.xml.sax.binding.Binding, 
jlibs.xml.sax.binding.Binding.Start, jlibs.xml.sax.binding.Binding.Text, 
jlibs.xml.sax.binding.Relation.Finish]
Information:    last round: false
Information:An annotation processor threw an uncaught exception.
Information:Consult the following stack trace for details.
Information:    at 
jlibs.xml.sax.binding.impl.processor.BindingAnnotationProcessor.process(BindingA
nnotationProcessor.java:82)
Information:    at 
com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacPro
cessingEnvironment.java:624)
Information:    at 
com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(Ja
vacProcessingEnvironment.java:553)
Information:    at 
com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProc
essingEnvironment.java:698)
Information:    at 
com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:981)
Information:    at 
com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
Information:    at com.sun.tools.javac.main.Main.compile(Main.java:353)
Information:    at com.sun.tools.javac.main.Main.compile(Main.java:279)
Information:    at com.sun.tools.javac.main.Main.compile(Main.java:270)
Information:    at com.sun.tools.javac.Main.compile(Main.java:69)
Information:    at com.sun.tools.javac.Main.main(Main.java:54)
Information:    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Information:    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Information:    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
Information:    at java.lang.reflect.Method.invoke(Method.java:597)
Information:    at com.intellij.rt.compiler.JavacRunner.main(JavacRunner.java:70)
Information:    at 
com.sun.tools.javac.processing.JavacFiler.checkName(JavacFiler.java:451)
Information:    at 
com.sun.tools.javac.processing.JavacFiler.checkNameAndExistence(JavacFiler.java:
473)
Information:    at 
com.sun.tools.javac.processing.JavacFiler.createSourceOrClassFile(JavacFiler.jav
a:372)
Information:    at 
com.sun.tools.javac.processing.JavacFiler.createSourceFile(JavacFiler.java:363)
Information:    at jlibs.core.annotation.processing.Printer.get(Printer.java:107)
Information:    at 
jlibs.xml.sax.binding.impl.processor.BindingAnnotationProcessor.process(BindingA
nnotationProcessor.java:79)
Information:    ... 15 more
Information:Compilation completed with 1 error and 0 warnings
Information:1 error
Information:0 warnings
Error:Compiler internal error. Process terminated with exit code 3

What version of the product are you using? On what operating system?
jlibs-r935.zip, WinXP, 1.6_18

We found a problem using debugging (calling javac from java). Classes cannot be 
placed in default package. 
RuntimeException is " Illegal name .MyBeanBindingImpl"


Original issue reported on code.google.com by [email protected] on 18 Aug 2010 at 11:13

Maven Repository Down

What steps will reproduce the problem?
1. Try to build or access repo.


What is the expected output? What do you see instead?
404 given.

Original issue reported on code.google.com by [email protected] on 9 Feb 2012 at 5:14

Supported Source Version

What steps will reproduce the problem?
1. Create test program to use the ANSI Coloring
2. Compile with javac -cp "lib/jlibs-core.jar" AnsiTest.java
3. Run with java -cp "lib/jlibs-core.jar" AnsiTest

What is the expected output? What do you see instead?
When Compiling I receive the following:
warning: Supported source version 'RELEASE_6' from annotation processor 
'jlibs.core.util.i18n.BundleAnnotationProcessor' less than -source '1.7'
warning: Supported source version 'RELEASE_6' from annotation processor 
'jlibs.core.graph.VisitorAnnotationProcessor' less than -source '1.7'
2 warnings

When I run I receive the following:
Error: Could not find or load main class AnsiTest

What version of the product are you using? On what operating system?
Unix

Please provide any additional information below.
I think this is because I have a newer version of Java, but I cannot get my 
program to run.

Original issue reported on code.google.com by [email protected] on 29 Jan 2013 at 5:39

[SAX2Java binding] Error handling of XML parsing

When this is used:
handler.setIgnoreUnresolved(false);

SAX2Java binding raise this exception:

Exception in thread "main" java.lang.NullPointerException
        at jlibs.xml.sax.binding.impl.Handler$BindingContext.xpath
(Handler.java:218)
        at jlibs.xml.sax.binding.SAXContext.toString(SAXContext.java:129)
        at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2794)

instead of

org.xml.sax.SAXException: can't find binding for /employee/email (line=5, 
col=12)

Tested in R664 with not bounded elements and with bounded elements that 
contain XML code with missing CDATA blok like this:

<aktualni-zmeny><span style="color:red;">28.1. do 13 h, 29.1. ZAVŘENO-
STĚHOVÁNÍ</span></aktualni-zmeny>

Original issue reported on code.google.com by [email protected] on 29 Jan 2010 at 11:34

Warnings in XSInstance

What steps will reproduce the problem?
1. Open XSInstance.java in development environment, like Eclipse
2. Look at the warnings.

What is the expected output? What do you see instead?
I don't want any warnings. Warnings in practice are errors in disguise.

What version of the product are you using? On what operating system?
Latest version from SVN archive. On Windows.

Please provide any additional information below.
1. Replace 
        sampleValue = attr.getConstraintValue();
BY
        sampleValue = attr.getValueConstraintValue().getNormalizedValue();
2. Add the type in references to generic types, i.e. use X<E> instead of X.
3. remove unused (local) variables


Original issue reported on code.google.com by [email protected] on 19 Dec 2013 at 1:05

NullPointerException

In some XSD cases, the parser throws NPE.

15:01:46,539 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) 
java.lang.NullPointerException
15:01:46,540 INFO  [stdout] (http-localhost/127.0.0.1:8080-5)   at 
jlibs.xml.sax.helpers.MyNamespaceSupport.declarePrefix(MyNamespaceSupport.java:1
04)
15:01:46,540 INFO  [stdout] (http-localhost/127.0.0.1:8080-5)   at 
jlibs.xml.sax.XMLDocument.declarePrefix(XMLDocument.java:94)
15:01:46,540 INFO  [stdout] (http-localhost/127.0.0.1:8080-5)   at 
jlibs.xml.sax.XMLDocument.toQName(XMLDocument.java:112)
15:01:46,540 INFO  [stdout] (http-localhost/127.0.0.1:8080-5)   at 
jlibs.xml.sax.XMLDocument.addAttribute(XMLDocument.java:232)

by a wild guess, seems that 
 if(prefix==null){
should be
 if(prefix==null || uri == null){ 

?

Original issue reported on code.google.com by [email protected] on 7 Nov 2013 at 2:04

overflow not handled in random functions

What steps will reproduce the problem?
For example, create random double number with min == -Double.MAX_VALUE and
max == Double.MAX_VALUE

or a random integer with min == -10 and max = Integer.MAX_VALUE - 3

What is the expected output? What do you see instead?
One expects a number in the specified range, but
the range calculation overflows (since the maximal values are used).

What version of the product are you using? On what operating system?
I am using the version currently in the source code archive.

Please provide any additional information below.

A possible solution for doubles is provided below, which you can use under the 
LGPL license of jlibs, when credentials are included.

 /** @author Pierre van de Laar - TNO-ESI
   */
   public static double random(double min, double max){
        final double factor = 4;
        if (min < Double.MAX_VALUE/-factor || max > Double.MAX_VALUE/factor)
        {
            //Prevent overflow with large ranges 
            final double mindivfactor = min/factor;
            final double retval = factor * ( mindivfactor + Math.random()*((max/factor)-mindivfactor) );
            return retval;
        } 
        else 
        {
      final double retval = min+Math.random()*(max-min);
      return retval;
    }                   
    }

Original issue reported on code.google.com by [email protected] on 3 Dec 2013 at 1:44

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.