Migrate DOMBuilder setEntityResolver method in xerces 2.7 to xerces 3.x - xerces

How can we migrate setEntityResolver(DOMEntityResolver* const handler) method in DOMBuilder of xerces 2.7 to xerces 3.x.
Thanks in advance

After some research I am able to find the replacement for setEntityResolver(DOMEntityResolver* const handler) method in DOMBuilder in xerces c 2.7.
The equalent for it in xerces 3.x is :
Replace DOMBuilder with DOMLSParser.
then replace "setEntityResolver" by setting parameter as below.
void DOMLSParserImpl::setParameter(const XMLCh* name, const void* value)
Here "name" should be "XMLUni::fgDOMResourceResolver" and "value" is your handler.

Related

STS unable to resolve target type with java 8

I have the below code that errors out in STS(3.8.4) saying,
Type mismatch: cannot convert from Map<String,Object> to Map<? extends
K,? extends V>
this.attributeMappings = new HashMap<>(attributeMappings!=null?attributeMappings:Collections.EMPTY_MAP);
Where both the instances of attributeMappings are of type Map<String, Object>.
Ideally, this shouldn't be a problem with Java 8. Could someone help me to resolve it without making any changes to the source?
PS: The same happens with Eclipse Neon 3
You should upgrade, this is an eclipse compiler issue (I've tried searching for it, but no luck) to Eclipse Oxygen let's say.
Map<String, Object> attributeMappings;
#SuppressWarnings("unchecked")
public void test(Map<String, Object> attributeMappings) {
this.attributeMappings = new HashMap<>(attributeMappings != null
? attributeMappings : Collections.EMPTY_MAP);
}
This compiles just fine for me with javac-8 and in eclipse oxygen latest.
Also notice that you can replace Collections.EMPTY_MAP with Collections.emptyMap() and it will work also.

Tess4J: "Invalid calling convention 63" despite correct versions

I try to do OCR and output as PDF using Tess4J and the following code on Linux (Ubuntu 16 Xenial).
public void testOcr() throws Exception {
File imageFile = new File("/projects/de.conradt.core/tessdata/urkunde.jpg");
ITesseract instance = new Tesseract1(); // tried both Tesseract() and Tesseract1()
// File tessDataFolder = LoadLibs.extractTessResources("tessdata"); // Maven build bundles English data
// instance.setDatapath(tessDataFolder.getParent());
instance.setDatapath("/projects/de.conradt.core/tessdata");
instance.setLanguage("deu");
try {
String result = instance.doOCR(imageFile);
System.out.println(result);
} catch (TesseractException e) {
System.err.println(e.getMessage());
}
List<ITesseract.RenderedFormat> list = new ArrayList<ITesseract.RenderedFormat>();
list.add(ITesseract.RenderedFormat.PDF);
File pdfFile = new File("/projects/de.conradt.core/tessdata/urkunde.pdf");
instance.createDocuments(pdfFile.getAbsolutePath(), "/projects/de.conradt.core/tessdata/urkunde", list);
}
The last line
instance.createDocuments(pdfFile.getAbsolutePath(), "/projects/de.conradt.core/tessdata/urkunde", list);
throws an Exception:
11:03:12.651 [http-nio-8080-exec-1] ERROR net.sourceforge.tess4j.Tesseract - Invalid calling convention 63
java.lang.IllegalArgumentException: Invalid calling convention 63
at com.sun.jna.Native.createNativeCallback(Native Method)
at com.sun.jna.CallbackReference.<init>(CallbackReference.java:239)
at com.sun.jna.CallbackReference.getFunctionPointer(CallbackReference.java:413)
at com.sun.jna.CallbackReference.getFunctionPointer(CallbackReference.java:395)
at com.sun.jna.Function.convertArgument(Function.java:541)
at com.sun.jna.Function.invoke(Function.java:305)
at com.sun.jna.Library$Handler.invoke(Library.java:236)
at com.sun.proxy.$Proxy89.gsapi_set_stdio(Unknown Source)
at org.ghost4j.Ghostscript.initialize(Ghostscript.java:323)
at net.sourceforge.tess4j.util.PdfUtilities.convertPdf2Png(PdfUtilities.java:103)
at net.sourceforge.tess4j.util.PdfUtilities.convertPdf2Tiff(PdfUtilities.java:48)
at net.sourceforge.tess4j.Tesseract.createDocuments(Tesseract.java:535)
at net.sourceforge.tess4j.Tesseract.createDocuments(Tesseract.java:507)
at de.conradt.core.Example.testOcr(Example.java:62)
at de.conradt.core.Example.ocr(Example.java:35)
I found this to be a known (but supposedly closed) issue with Tess4J:
https://github.com/nguyenq/tess4j/issues/35
https://sourceforge.net/p/tess4j/discussion/1202294/thread/2a25344c/
https://github.com/zippy1978/ghost4j/issues/44
but I checked my versions as well as the TESSDATA_PREFIX env variable. It's all set correctly as far as I can see.
Tesseract and Leptonica version:
$ /usr/bin/tesseract --version
tesseract 3.04.01
leptonica-1.73
libgif 5.1.2 : libjpeg 8d (libjpeg-turbo 1.4.2) : libpng 1.2.54 : libtiff 4.0.6 : zlib 1.2.8 : libwebp 0.4.4 : libopenjp2 2.1.0
Ghostscript version: (this is the latest version I get via apt-get)
$ ghostscript -v
GPL Ghostscript 9.18 (2015-10-05)
Copyright (C) 2015 Artifex Software, Inc. All rights reserved.
Tess4j version:
3.2.1
and the TESSDATA_PREFIX (the config files etc. are under /projects/de.conradt.core/tessdata):
$ echo $TESSDATA_PREFIX
/projects/de.conradt.core
Looking at the Release log of Tess4j: http://tess4j.sourceforge.net/changelog.html, I should be using the correct version stack.
Especially version 3.2 in the change log says:
Version 3.2 - 15 May 2016: Revert JNA to 4.1.0 due to "Invalid calling
convention 63" errors invoking GhostScript via Ghost4J on Linux
so I thought I should be safe with 3.2.1.
Do I need to manually set anything about JNA? From my understanding, this had been fixed in 3.2.0 for Linux explicitly.
Ok, I didn't explicitly reference JNA anywhere in my project pom, I thought this is all done in Tess4J 3.2.1 and its pom.xml. I added JNA 4.1.0 as a dependency in my own pom.xml now as well and this seems to solve the problem.
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.1.0</version>
</dependency>

ZF2 - Deprecated: ServiceManagerAwareInterface is deprecated and will be removed in version 3.0, along with the ServiceManagerAwareInitializer

I'm developing a project on ZF2 + Doctrine2. Also I'm using ZfcUser. My composer.json looks like:
"php" : ">=5.5",
"zendframework/zendframework" : "~2.5",
"zendframework/zendservice-recaptcha" : "2.*",
"doctrine/doctrine-orm-module" : "0.*",
"zf-commons/zfc-base" : "0.*",
"zf-commons/zfc-user" : "1.*",
"zf-commons/zfc-user-doctrine-orm" : "^1.0",
"zf-commons/zfc-admin" : "0.1.0",
"bjyoungblood/bjy-authorize" : "1.*",
All works fine until I has updated project through composer...
Deprecated: ServiceManagerAwareInterface is deprecated and will be removed in version 3.0, along with the ServiceManagerAwareInitializer. Please update your class ZfcUser\Authentication\Storage\Db to remove the implementation, and start injecting your dependencies via factory instead. in /vagrant/personal/vendor/zendframework/zend-mvc/src/Service/ServiceManagerConfig.php on line 127
Deprecated: ServiceManagerAwareInterface is deprecated and will be removed in version 3.0, along with the ServiceManagerAwareInitializer. Please update your class ZfcUser\Authentication\Adapter\Db to remove the implementation, and start injecting your dependencies via factory instead. in /vagrant/personal/vendor/zendframework/zend-mvc/src/Service/ServiceManagerConfig.php on line 127
Deprecated: ServiceManagerAwareInterface is deprecated and will be removed in version 3.0, along with the ServiceManagerAwareInitializer. Please update your class ZfcUser\Service\User to remove the implementation, and start injecting your dependencies via factory instead. in /vagrant/personal/vendor/zendframework/zend-mvc/src/Service/ServiceManagerConfig.php on line 127
I don't understand how It can correctly fix. I have no time, so I will be very grateful if someone will show in detail how this to change.
This issue needs some refactoring to the ZfcUser library. A Github issue was already reported, also there is a possible, not yet merged, fix as pull request.
But you don't have to start crying, cause this is just an info. While you are using ZF2 ZfcUser will work as expected thanks to SemVer and not breaking backwards compatibility.

EclipseEnvironmentInfo class is unavailable in osgi bundle 3.10 onwards

I'm using the EclipseEnvironmentInfo.getDefault().getCommandLineArgs() to get the command line arguements passed.
In the latest osgi from version 3.10 onwards this class and method is unavailable.
Can someone tell me what is the equivalent to this in the latest osgi jar?
It's EquinoxConfiguration, however that is an internal class so I wouldn't recommend using it.
Platform.getCommandLineArgs() is a public method.
Alternatively you can get the EnvironmentInfo implementation from the OSGi service (code taken from org.eclipse.equinox.internal.app.Activator):
BundleContext bc = ...;
ServiceReference infoRef = bc.getServiceReference(EnvironmentInfo.class.getName());
EnvironmentInfo envInfo = (EnvironmentInfo) bc.getService(infoRef);
bc.ungetService(infoRef);

Restlet proxy generation fails with latest GWT 2.5.0-RC1

Upgraded to GWT 2.5.0-RC1 and the proxy generation for Restlet breaks - I have the latest release 2.1-RC6 in my project. This is the stack trace :
java.lang.NoSuchMethodException: com.google.gwt.user.rebind.rpc.SerializableTypeOracleBuilder.<init>(com.google.gwt.core.ext.TreeLogger, com.google.gwt.core.ext.PropertyOracle, com.google.gwt.core.ext.typeinfo.TypeOracle)
at java.lang.Class.getConstructor0(Class.java:2706)
at java.lang.Class.getDeclaredConstructor(Class.java:1985)
at org.restlet.rebind.ClientProxyGenerator.getSerializableTypeOracleBuilder2_2(ClientProxyGenerator.java:767)
at org.restlet.rebind.ClientProxyGenerator.generateSerializers(ClientProxyGenerator.java:569)
at org.restlet.rebind.ClientProxyGenerator.generateProxy(ClientProxyGenerator.java:500)
at org.restlet.rebind.ClientProxyGenerator.generate(ClientProxyGenerator.java:242)
The actual exception gets thrown here :
private SerializableTypeOracleBuilder getSerializableTypeOracleBuilder2_2()
throws Exception {
SerializableTypeOracleBuilder result = null;
Constructor<SerializableTypeOracleBuilder> c = null;
c = SerializableTypeOracleBuilder.class.getDeclaredConstructor(
TreeLogger.class, PropertyOracle.class, TypeOracle.class);
result = c.newInstance(getLogger(), getContext().getPropertyOracle(),
getTypeOracle());
return result;
}
This following call seems problematic, though I do not see why :
c = SerializableTypeOracleBuilder.class.getDeclaredConstructor(
TreeLogger.class, PropertyOracle.class, TypeOracle.class);
Somebody got Restlet GWT working with the latest GWT 2.5.0-rc1 ??
UPDATE: issue opened #647
I just checked the POMs for the following GWT versions of Restlet:
http://maven.restlet.org/org/restlet/gwt/org.restlet/2.2-SNAPSHOT/
http://maven.restlet.org/org/restlet/gwt/org.restlet/2.1.1/
and they all have dependencies on version 2.2 of GWT.
That's the problem when using internal classes: SerializableTypeOracleBuilder's constructor no longer takes a TypeOracle argument, but a GeneratorContext.
http://code.google.com/p/google-web-toolkit/source/browse/releases/2.5/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilder.java#782
That was already the case in GWT 2.4 though (with the experimental GeneratorContextExt instead): http://code.google.com/p/google-web-toolkit/source/browse/releases/2.4/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilder.java#747
and even GWT 2.3: http://code.google.com/p/google-web-toolkit/source/browse/releases/2.3/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilder.java#763
In other words, Restlet still depends on a 18 months old version, namely GWT 2.2: http://code.google.com/p/google-web-toolkit/source/browse/releases/2.2/user/src/com/google/gwt/user/rebind/rpc/SerializableTypeOracleBuilder.java#757
Thanks for reporting this issue. The 2.1 and master branches have been updated.