You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Simon Helsen <sh...@ca.ibm.com> on 2011/11/01 14:56:55 UTC

XMLInputFactory#newFactory not available in OpenJDK 1.6

Hi guys,

when I load the latest Jena2 project in an environment with an IBM JDK 6, 
I run into a compile error in line 67 of StAX2SAX

It seems that the method XMLInputFactory#newFactory() does not exist. I 
cross-checked with OpenJDK 1.6 and it has the same problem.  Now, the 
method does exist in the Oracle JRE, but if you use 
XMLInputFactory#newInstance(), it works in all environments (where I 
double checked that the implementation for newInstance() is identical to 
newFactory() in the Oracle JRE)

Is this something that could be addressed? Do you want me to open an issue 
to track this?

thanks

Simon

Re: XMLInputFactory#newFactory not available in OpenJDK 1.6

Posted by Damian Steer <d....@bristol.ac.uk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/11/11 15:42, Dave Reynolds wrote:

> Going entirely by the JavaDoc page you pointed at then the
> newInstance/2 method has been deprecated in favour of newFactory/2
> with the comment:
> 
> "Deprecated. This method has been deprecated to maintain API 
> consistency. All newInstance methods have been replaced with 
> corresponding newFactory methods. The replacement 
> newFactory(java.lang.String, java.lang.ClassLoader) method defines
> no changes in behavior."
> 
> That bit about *all* newInstance methods have been been replaced 
> suggests to me that newFactory/0 is the intended replacement for 
> newInstance/0, has the same semantics, but for some reason
> newInstance/0 hasn't been deprecated yet, maybe an oversight.
> 
> If so that would suggest the current code is correct.

Concur that current code is correct, and IBM jdk 6 is broken. However
I've changed it to newInstance for the moment, on the grounds that
they've merely threatened deprecation ;-) [1]

Damian

[1] Not deprecated in SE 7 either, so it may never be touched.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6wH7AACgkQAyLCB+mTtylangCdFthOp4FDXc9Unt3AEcHdIyNp
/3YAoNP0i112Equ++rcpZ5U9vHvxFsin
=myeX
-----END PGP SIGNATURE-----

Re: XMLInputFactory#newFactory not available in OpenJDK 1.6

Posted by Dave Reynolds <da...@gmail.com>.
On Tue, 2011-11-01 at 15:26 +0000, Damian Steer wrote: 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 01/11/11 15:07, Simon Helsen wrote:
> > I created https://issues.apache.org/jira/browse/JENA-152
> > 
> > thanks
> > 
> > Simon
> 
> Thanks Simon,
> 
> Actually, it does seem to exist:
> 
> <http://download.oracle.com/javase/6/docs/api/javax/xml/stream/XMLInputFactory.html#newFactory()>
> 
> And works for me in openjdk-1.6:
> 
> java version "1.6.0_23"
> OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre10-0ubuntu5)
> OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
> 
> However no obvious harm changing it. Not at all clear what the
> difference is to me (anyone?).

Going entirely by the JavaDoc page you pointed at then the newInstance/2
method has been deprecated in favour of newFactory/2 with the comment:

"Deprecated. This method has been deprecated to maintain API
consistency. All newInstance methods have been replaced with
corresponding newFactory methods. The replacement
newFactory(java.lang.String, java.lang.ClassLoader) method defines no
changes in behavior."

That bit about *all* newInstance methods have been been replaced
suggests to me that newFactory/0 is the intended replacement for
newInstance/0, has the same semantics, but for some reason newInstance/0
hasn't been deprecated yet, maybe an oversight. 

If so that would suggest the current code is correct.

Dave



Re: XMLInputFactory#newFactory not available in OpenJDK 1.6

Posted by Damian Steer <d....@bristol.ac.uk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/11/11 15:07, Simon Helsen wrote:
> I created https://issues.apache.org/jira/browse/JENA-152
> 
> thanks
> 
> Simon

Thanks Simon,

Actually, it does seem to exist:

<http://download.oracle.com/javase/6/docs/api/javax/xml/stream/XMLInputFactory.html#newFactory()>

And works for me in openjdk-1.6:

java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre10-0ubuntu5)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

However no obvious harm changing it. Not at all clear what the
difference is to me (anyone?).

Damian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6wD48ACgkQAyLCB+mTtyk4BgCfRza0hM8LMvAX/rOji5wzQyHM
sFYAmwRHznRHgzA4KerIv9Av+1v5ktSl
=vxLY
-----END PGP SIGNATURE-----

Re: XMLInputFactory#newFactory not available in OpenJDK 1.6

Posted by Simon Helsen <sh...@ca.ibm.com>.
I created https://issues.apache.org/jira/browse/JENA-152

thanks

Simon



From:
Damian Steer <d....@bristol.ac.uk>
To:
jena-dev@incubator.apache.org
Date:
11/01/2011 11:03 AM
Subject:
Re: XMLInputFactory#newFactory not available in OpenJDK 1.6



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/11/11 13:56, Simon Helsen wrote:
> Hi guys,
> 
> when I load the latest Jena2 project in an environment with an IBM
> JDK 6, I run into a compile error in line 67 of StAX2SAX
> 
> It seems that the method XMLInputFactory#newFactory() does not
> exist. I cross-checked with OpenJDK 1.6 and it has the same
> problem.  Now, the method does exist in the Oracle JRE, but if you
> use XMLInputFactory#newInstance(), it works in all environments
> (where I double checked that the implementation for newInstance()
> is identical to newFactory() in the Oracle JRE)

Doh!

> Is this something that could be addressed? Do you want me to open
> an issue to track this?

Yes please, although it won't be hard to fix.

(Where did I get newFactory from?)

Damian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6wCGwACgkQAyLCB+mTtymAAQCfQgq/9duDKekoJGR3bclGuAsO
lEYAoIWpjvS9ezJzIXG4Cu/rCqmHk30x
=5rD4
-----END PGP SIGNATURE-----




Re: XMLInputFactory#newFactory not available in OpenJDK 1.6

Posted by Damian Steer <d....@bristol.ac.uk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/11/11 13:56, Simon Helsen wrote:
> Hi guys,
> 
> when I load the latest Jena2 project in an environment with an IBM
> JDK 6, I run into a compile error in line 67 of StAX2SAX
> 
> It seems that the method XMLInputFactory#newFactory() does not
> exist. I cross-checked with OpenJDK 1.6 and it has the same
> problem.  Now, the method does exist in the Oracle JRE, but if you
> use XMLInputFactory#newInstance(), it works in all environments
> (where I double checked that the implementation for newInstance()
> is identical to newFactory() in the Oracle JRE)

Doh!

> Is this something that could be addressed? Do you want me to open
> an issue to track this?

Yes please, although it won't be hard to fix.

(Where did I get newFactory from?)

Damian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6wCGwACgkQAyLCB+mTtymAAQCfQgq/9duDKekoJGR3bclGuAsO
lEYAoIWpjvS9ezJzIXG4Cu/rCqmHk30x
=5rD4
-----END PGP SIGNATURE-----

Re: XMLInputFactory#newFactory not available in OpenJDK 1.6

Posted by Andy Seaborne <an...@apache.org>.
On 01/11/11 13:56, Simon Helsen wrote:
> Hi guys,
>
> when I load the latest Jena2 project in an environment with an IBM JDK 6,
> I run into a compile error in line 67 of StAX2SAX
>
> It seems that the method XMLInputFactory#newFactory() does not exist. I
> cross-checked with OpenJDK 1.6 and it has the same problem.  Now, the
> method does exist in the Oracle JRE, but if you use
> XMLInputFactory#newInstance(), it works in all environments (where I
> double checked that the implementation for newInstance() is identical to
> newFactory() in the Oracle JRE)
>
> Is this something that could be addressed? Do you want me to open an issue
> to track this?
>
> thanks
>
> Simon
>

Simon,

I am using:

java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.2) (6b22-1.10.2-0ubuntu1~11.04.1)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

and it compiles for me (Eclipse, maven)

There has been a change to Java6 recently - the Eclipse projects were 
updated but if you are using your own Eclipse setup, you'll have to do 
the same.  It is set to the Eclipse generic name for Java6 so if there 
is a JDK of the right type installed for Eclipse it should work.

   <classpathentry kind="con" 
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>

	Andy