How do we invoke the numeric keyboard instead of qwerty when the user sets focus on a Textfield control? - gluon

After looking at this advice, I tried the same.
myTextField.getProperties().put("vkType", "numeric");
But when I apply focus on the control at runtime, I get the error below and, also still, only the standard qwerty keyboard is shown to enter text into the textfield.
I found a more recent post here of someone else failing too. I also applied the same runtime config he mentions as below. That does show a "virtual" keyboard on my laptop at runtime but still not the numeric keyboard when testing directly on the phone.
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>${javafx.plugin.version}</version>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<options>
<option>-Dcom.sun.javafx.isEmbedded=true</option>
<option>-Dcom.sun.javafx.virtualKeyboard=javafx</option>
</options>
<mainClass>${main.class}</mainClass>
</configuration>
</execution>
Exception in thread "JavaFX Application Thread"
java.lang.ClassCastException: class java.lang.String cannot be cast to
class java.lang.Integer (java.lang.String and java.lang.Integer are in
module java.base of loader 'bootstrap')

Related

How do I overcome "object literals cannot contain duplicate keys in ES5 strict mode" error with Maven minify plugin?

I'm using the Maven minify plugin with Maven 3.5. I have the below configuration ...
<plugin>
<groupId>com.samaxes.maven</groupId>
<artifactId>minify-maven-plugin</artifactId>
<version>1.7.6</version>
<executions>
<execution>
<id>default-minify</id>
<phase>verify</phase>
<configuration>
<cssSourceIncludes>
<cssSourceInclude>**/*.css</cssSourceInclude>
</cssSourceIncludes>
<cssTargetDir>../${project.artifactId}/css</cssTargetDir>
<jsSourceExcludes>
<jsSourceExclude>lib/pdf.js</jsSourceExclude>
<jsSourceExclude>lib/pdf.worker.js</jsSourceExclude>
<jsSourceExclude>ckeditor_4.2/**</jsSourceExclude>
<jsSourceExclude>geogebra/**</jsSourceExclude>
<jsSourceExclude>contextMenu/**</jsSourceExclude>
<jsSourceExclude>wPaint/**</jsSourceExclude>
</jsSourceExcludes>
<jsSourceIncludes>
<jsSourceInclude>**/*.js</jsSourceInclude>
</jsSourceIncludes>
<jsTargetDir>../${project.artifactId}/js</jsTargetDir>
<jsEngine>CLOSURE</jsEngine>
<webappTargetDir>${project.build.outputDirectory}</webappTargetDir>
<skipMerge>true</skipMerge>
<nosuffix>true</nosuffix>
</configuration>
<goals>
<goal>minify</goal>
</goals>
</execution>
</executions>
</plugin>
However, I'm getting this error on the below file ...
SEVERE: panel.js:845: ERROR - with
SIDE_PANEL_BEGIN_CLOSE_EVENT:SIDE_PANEL_BEGIN_CLOSE_EVENT,
^
Nov 27, 2018 2:57:06 PM com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 1 error(s), 0 warning(s)
Everything works in my application fine with my uncompressed file so I'm thinking I just made a mistake with my configuration but I can't see what. How can I correct the configuration so that the optimization occurs without the error without affecting the underlying functionality of the code?
While Google's Closure Compiler (which is used under the hood by the minify plugin to optimize the source code) by default expects ECMAScript 6 as input language it seems to run additional diagnostic checks which do not take the language level into account.
These diagnostic checks include one for ECMAScript 5 strict mode compliance which forbids duplicate keys in objects.
As described in this answer by Sebstian Häger you can turn this diagnostic check of in the minify configuration by adding
<closureWarningLevels>
<es5Strict>OFF</es5Script>
</closureWarningLevels>

Kotlin JSR-223 ScriptEngineFactory within the fat jar - Cannot find kotlin compiler jar

I have a fat jar where I'm trying to get the instance of Kotlin's ScriptEngine.
For the debugging purposes I'm iterating through available Script Engine Factories and getting the engines.
val scriptEngineManager = ScriptEngineManager()
for (factory in scriptEngineManager.engineFactories) {
val scriptEngine = factory.scriptEngine
}
When it hits the Kotlin's engine, it fails with following exception:
Exception in thread "main" java.io.FileNotFoundException: Cannot find kotlin compiler jar, set kotlin.compiler.jar property to proper location
at org.jetbrains.kotlin.script.jsr223.KotlinJsr223ScriptEngineFactoryExamplesKt$kotlinCompilerJar$2.invoke(KotlinJsr223ScriptEngineFactoryExamples.kt:100)
at org.jetbrains.kotlin.script.jsr223.KotlinJsr223ScriptEngineFactoryExamplesKt$kotlinCompilerJar$2.invoke(KotlinJsr223ScriptEngineFactoryExamples.kt)
at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130)
at org.jetbrains.kotlin.script.jsr223.KotlinJsr223ScriptEngineFactoryExamplesKt.getKotlinCompilerJar(KotlinJsr223ScriptEngineFactoryExamples.kt)
at org.jetbrains.kotlin.script.jsr223.KotlinJsr223ScriptEngineFactoryExamplesKt.access$getKotlinCompilerJar$p(KotlinJsr223ScriptEngineFactoryExamples.kt:1)
at org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmDaemonLocalEvalScriptEngineFactory.getScriptEngine(KotlinJsr223ScriptEngineFactoryExamples.kt:56)
at davidsiro.invoices.InvoiceGeneratorKt.generateInvoice(invoiceGenerator.kt:16)
at davidsiro.invoices.MainKt.main(main.kt:11)
My fat jar contains all of the dependencies (though unpacked), including Kotlin Compiler. I'm using Maven Assembly Plugin to build it, which configured like these:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>${main.class}</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
Any ideas?
Update
For the record, I tried to both KotlinJsr223JvmLocalScriptEngineFactory and KotlinJsr223JvmDaemonLocalEvalScriptEngineFactory with the same result.
The JSR223 factories in the kotlin-script-util are trying to find the compiler jar in order to setup the compilation. In your case, you'll need to write your own factory to supply the script compilation classpath explicitly, e.g.
class MyScriptEngineFactory : KotlinJsr223JvmScriptEngineFactoryBase() {
override fun getScriptEngine(): ScriptEngine =
KotlinJsr223JvmLocalScriptEngine(
Disposer.newDisposable(),
this,
classpath, // !!! supply the script classpath here
KotlinStandardJsr223ScriptTemplate::class.qualifiedName!!,
{ ctx, types -> ScriptArgsWithTypes(arrayOf(ctx.getBindings(ScriptContext.ENGINE_SCOPE)), types ?: emptyArray()) },
arrayOf(Bindings::class)
)
}
You need to put the following jars into classpath:
kotlin-script-util.jar - it contains the template class used as a superclass for the script
kotlin-script-runtime.jar - for base classes used in scripting
any other jars you'll need to use in your scripts, quite likely - kotlin-stdlib.jar
You may put your fat jar there instead, but that would mean that everything from it will be accessible from your scripts. Not talking about the overheads for the compiler.

ERROR [WsdlTestCase] Failed to create test step for [X]

I get this error ERROR [WsdlTestCase] Failed to create test step for [X] when executing my soapui project from Maven.
Tests work fine from the SOAPUI client software. My Soap-ui.error log is empty.
There doesn't seem to be enough information to let me debug this - I'm guessing there's some dependency I'm missing, but my tests are fairly simple (REST requests with a few assertions on the HTTP response). I assumed the core maven plugin would suffice.
My maven config is as below (I've also included the eviware repository -http://www.eviware.com/repository/maven2/)
<plugin>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>2.0.2</version>
<executions>
<execution>
<phase>integration-test</phase>
<id>soapui-tests</id>
<configuration>
<projectFile>${basedir}/src/test/resources/MyTestSuite.xml</projectFile>
<outputFolder>${basedir}/target/soapui</outputFolder>
<junitReport>true</junitReport>
<exportwAll>true</exportwAll>
<printReport>true</printReport>
</configuration>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
the preceeding messages are :
[DefaultSoapUICore] Missing folder [/var/lib/jenkins/jobs/Build-Mule-Configuration/workspace/ext] for external libraries 2015-07-01 15:10:48,961 INFO
[DefaultSoapUICore] Creating new settings at [/var/lib/jenkins/jobs/Build-Mule-Configuration/workspace/soapui-settings.xml]
I've moved up to the 4.6.1 version of the soapui plugin as detailed here
(http://www.soapui.org/test-automation/maven/maven-2-x.html), the tests are now at least attempting to execute. As I understand it the version I've outlined above should work but perhaps it doesn't recognise the current SOAP UI project syntax.
As an aside the 4.6.1 version of the plugin seems to have a much larger number of dependancies and for me is causing memory issues.

Spring Security - Global Method Security using point-cut is not working

I want to apply method level security in my web app so that only authorized users can access those service layer methods.
There are two ways to implement this.
1) To annotate my service layer methods with #Secured annotation and in the dispatcher-servlet.xml file with configuration (<security:global-method-security secured-annotations="enabled" />).
But this would take a lot of time in my case as there are so many service class and methods already created so finding the methods and annotate them will not be a good way.
2) To define a point cut expression for methods level security that will automatically detect the methods having my custom annotation #SecuredAdmin in my services and secure them with the role ROLE_ADMIN.
In my case the option 1) is working very fine when I tried to test. And there is no issue. But when I tried the option 2) with following configuration I am not able to start my application.
<security:global-method-security>
<security:protect-pointcut access="ROLE_ADMIN" expression="execution(#com.xxx.yyy.zzz.services.SecuredAdmin * *.*(..))"/>
</security:global-method-security>
I am getting following exception when I tried to start my server.
java.lang.IllegalArgumentException: error annotation type patterns are only supported at Java 5 compliance level or above
org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:302)
org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:279)
org.springframework.security.config.method.ProtectPointcutPostProcessor.postProcessBeforeInitialization(ProtectPointcutPostProcessor.java:94)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1448)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
org.springframework.context.support.AbstractApplicationContext.initMessageSource(AbstractApplicationContext.java:773)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:452)
org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
javax.servlet.GenericServlet.init(GenericServlet.java:160)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:333)
org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:219)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
I have tried every possible way to change the code compliance level to 1.6 in both pom files and eclipse project properties.
I am using Spring-Security 3.0 and aspectj related libraries are as following.
spring-aop-3.1.0.RELEASE.jar
spring-aspects-3.1.0.RELEASE.jar
aspectjrt-1.6.5.jar
aspectjweaver-1.6.5.jar
Please help me in this regards. Ask me if you require any further information.
Thanks in advance.
You have to configure aspect weaver to use java 1.6 compliance level. Add something like that to your pom.xml in build plugins section.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
</plugin>
I came across this problem with an older project - when I switched from jdk6 to jdk7, when the application started I encountered:
'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource'
while setting bean property 'transactionAttributeSource';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0':
Initialization of bean failed; nested exception is java.lang.IllegalArgumentException:
error annotation type patterns are only supported at Java 5 compliance level or above
I didn't want a purely maven solution because during development I run the app in Tomcat via the IDE (Intellij IDEA).
In the end I just upgraded my aspectjweaver dependency to 1.7.2 (it was 1.5.4)
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.7.2</version>
</dependency>
Everything seems okay now.

Sonar and Jacoco : How to ? (Compatibility with Cobertura)

I know there are lot of questions about Sonar and Jacoco not generating the report correctly on SO but none of them helped me solve my problem:
Here is the deal :
I have a project using Cobertura to calculate code coverage and I can't change that. Sonar must use Cobertura for the server-side. But on the other hand I have this client (we're talking about a webapplication using smartGWT in java) which is tested with Selenium RC (because that's the only way to test smartGWT).
Cobertura can't calculate Selenium tests' coverage because those tests are done on the deployed application. Jacoco can calculate that because it is launched as a java agent. So everything is working fine on my computer. The jacoco.exec is generated successfully. But it seems that Sonar can't find how to read that file or maybe it's just cobertura and jacoco that are conflicted...
Here is the error that Jenkins generate :
[INFO] Surefire report directory: D:\JENKINS-SONAR\jobs\agepro PROTO\workspace\target\surefire-reports
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 sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Caused by: java.io.FileNotFoundException: D:\JENKINS-SONAR\jobs\agepro (Accès refusé)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:177)
at org.jacoco.agent.rt_9w37ty.controller.LocalController.startup(LocalController.java:46)
at org.jacoco.agent.rt_9w37ty.JacocoAgent.init(JacocoAgent.java:83)
at org.jacoco.agent.rt_9w37ty.JacocoAgent.premain(JacocoAgent.java:165)
... 6 more
FATAL ERROR in native method: processing of -javaagent failed
Exception in thread "main"
And here is my configuration of the surefire plugin :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-javaagent:${sonar.jacoco.jar}=destfile=${sonar.jacoco.reportPath}</argLine>
<excludes>
<exclude>**/Selenium*.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>surefire-integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<!-- <argLine>-javaagent:${sonar.jacoco.jar}=destfile=${sonar.jacoco.reportPath}</argLine> -->
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/Selenium*.java</include>
</includes>
<goal>selenium-test</goal>
</configuration>
</execution>
</executions>
</plugin>
Do you see any mistake I could have made ? Or maybe I have to set another path for the jacoco jar or something else ? Thanks for your help anyway.
The name reportPath is a bit misleading.
The setting sonar.jacoco.reportPath needs to point to a file and not to a directory.
You seem to have set it to: D:\JENKINS-SONAR\jobs\agepro: But I think you mean D:\JENKINS-SONAR\jobs\agepro\jacoco.exec
On further inspection I noticed that the problem might be that you working directory "agepro PROTO" has a space in it.
This breaks the syntax for the java agent configuration. Can you get rid of the space(I don't know if destfile='${sonar.jacoco.reportPath}' would work)

Resources