maven-surefire-plugin:2.12.4:test failed Error occurred in starting fork

Trying to run the following maven command:

mvn test -X

Result:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-
plugin:2.12.4:test (default-test) on project unit4-api-message-hub: Error 
occurred in starting fork, check output in log -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project unit4-api-message-hub: Error occurred in starting fork, check output in log
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error occurred in starting fork, check output in log
        at org.apache.maven.plugin.surefire.SurefirePlugin.assertNoException(SurefirePlugin.java:159)
        at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:148)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:650)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:586)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 20 more
Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: Error occurred in starting fork, check output in log
        at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:284)
        at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:116)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:740)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAllProviders(AbstractSurefireMojo.java:682)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:648)
        ... 23 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The system cannot find the path specified.

When i change the pom.xml to explicitly use maven-surefire-plugin:2.20.1 it gives kind of error as with maven-surefire-
plugin:2.12.4
.
What makes it even more strange is that I use the same installation set as my colleague and his works out of the box. Same OS (Windows 10) , same JAVA and Maven version same Git Repo. We already tried delete .m2 repo to relieve the system of cache.

I have a feeling that there is something wrong with CMD like like the problem is with cmd /C exit /B 0
When trying to run a part of the command in windows CMD i get the following result: The system cannot find the path specified.

C:devworkspaceMessageHub.JavaSdklucas-api-hub>C:myPathJavajdk1.8.0_152jrebinjava -jar C:devworkspaceMessageHub.JavaSdklucas-api-hubtargetsurefiresurefirebooter4393690082191226141.jar C:devworkspaceMessageHub.JavaSdklucas-api-hubtargetsurefiresurefire2387848635455087535tmp C:devworkspaceMessageHub.JavaSdklucas-api-hubtargetsurefiresurefire_08471100731569808288tmp
I,1,java.runtime.name,Java(TM) SE Runtime Environment
I,1,sun.boot.library.path,C:\myPath\Java\jdk1.8.0_152\jre\bin
I,1,java.vm.version,25.152-b16
I,1,user.country.format,NL
I,1,java.vm.vendor,Oracle Corporation
I,1,java.vendor.url,http://java.oracle.com/
I,1,path.separator,;
I,1,java.vm.name,Java HotSpot(TM) 64-Bit Server VM
I,1,file.encoding.pkg,sun.io
I,1,user.script,
I,1,user.country,US
I,1,sun.java.launcher,SUN_STANDARD
I,1,sun.os.patch.level,
I,1,java.vm.specification.name,Java Virtual Machine Specification
I,1,user.dir,C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub
I,1,java.runtime.version,1.8.0_152-b16
I,1,java.awt.graphicsenv,sun.awt.Win32GraphicsEnvironment
I,1,basedir,C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub
I,1,java.endorsed.dirs,C:\myPath\Java\jdk1.8.0_152\jre\lib\endorsed
I,1,os.arch,amd64
I,1,surefire.real.class.path,C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub\target\surefire\surefirebooter4393690082191226141.jar
I,1,java.io.tmpdir,C:\Users\secretuser\AppData\Local\Temp\
I,1,line.separator,rn
I,1,java.vm.specification.vendor,Oracle Corporation
I,1,user.variant,
I,1,os.name,Windows 10
I,1,sun.jnu.encoding,Cp1252
I,1,java.library.path,C:\myPath\Java\jdk1.8.0_152\jre\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Program Files\Docker\Docker\Resources\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Windows\CCM;C:\Program Files\PuTTY\;C:\dev\bin;C:\dev\apache-maven-3.5.0\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\myPath\Java\jdk1.8.0_152\bin;C:\Users\secretuser\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\Microsoft VS Code\bin;.
I,1,surefire.test.class.path,C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub\target\test-classes;C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub\target\classes;C:\Users\secretuser\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.8.4\jackson-databind-2.8.4.jar;C:\Users\secretuser\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;C:\Users\secretuser\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.8.4\jackson-core-2.8.4.jar;C:\Users\secretuser\.m2\repository\com\google\inject\guice\4.1.0\guice-4.1.0-no_aop.jar;C:\Users\secretuser\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar;C:\Users\secretuser\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Users\secretuser\.m2\repository\com\google\guava\guava\19.0\guava-19.0.jar;C:\Users\secretuser\.m2\repository\com\google\code\gson\gson\2.8.0\gson-2.8.0.jar;C:\Users\secretuser\.m2\repository\com\google\oauth-client\google-oauth-client\1.22.0\google-oauth-client-1.22.0.jar;C:\Users\secretuser\.m2\repository\com\google\http-client\google-http-client\1.22.0\google-http-client-1.22.0.jar;C:\Users\secretuser\.m2\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;C:\Users\secretuser\.m2\repository\com\google\http-client\google-http-client-jackson\1.15.0-rc\google-http-client-jackson-1.15.0-rc.jar;C:\Users\secretuser\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.9.11\jackson-core-asl-1.9.11.jar;C:\Users\secretuser\.m2\repository\com\microsoft\azure\azure-servicebus\0.9.7\azure-servicebus-0.9.7.jar;C:\Users\secretuser\.m2\repository\com\microsoft\azure\azure-core\0.9.7\azure-core-0.9.7.jar;C:\Users\secretuser\.m2\repository\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;C:\Users\secretuser\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\secretuser\.m2\repository\org\apache\httpcomponents\httpclient\4.3.6\httpclient-4.3.6.jar;C:\Users\secretuser\.m2\repository\org\apache\httpcomponents\httpcore\4.3.3\httpcore-4.3.3.jar;C:\Users\secretuser\.m2\repository\javax\mail\mail\1.4.5\mail-1.4.5.jar;C:\Users\secretuser\.m2\repository\javax\activation\activation\1.1\activation-1.1.jar;C:\Users\secretuser\.m2\repository\com\sun\jersey\jersey-client\1.19\jersey-client-1.19.jar;C:\Users\secretuser\.m2\repository\com\sun\jersey\jersey-core\1.19\jersey-core-1.19.jar;C:\Users\secretuser\.m2\repository\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;C:\Users\secretuser\.m2\repository\com\sun\jersey\jersey-json\1.19\jersey-json-1.19.jar;C:\Users\secretuser\.m2\repository\org\codehaus\jettison\jettison\1.1\jettison-1.1.jar;C:\Users\secretuser\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.3-1\jaxb-impl-2.2.3-1.jar;C:\Users\secretuser\.m2\repository\javax\xml\bind\jaxb-api\2.2.2\jaxb-api-2.2.2.jar;C:\Users\secretuser\.m2\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;C:\Users\secretuser\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.2\jackson-mapper-asl-1.9.2.jar;C:\Users\secretuser\.m2\repository\org\codehaus\jackson\jackson-jaxrs\1.9.2\jackson-jaxrs-1.9.2.jar;C:\Users\secretuser\.m2\repository\org\codehaus\jackson\jackson-xc\1.9.2\jackson-xc-1.9.2.jar;C:\Users\secretuser\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar;C:\Users\secretuser\.m2\repository\com\microsoft\azure\azure-storage\4.4.0\azure-storage-4.4.0.jar;C:\Users\secretuser\.m2\repository\org\slf4j\slf4j-api\1.7.12\slf4j-api-1.7.12.jar;C:\Users\secretuser\.m2\repository\org\apache\commons\commons-lang3\3.4\commons-lang3-3.4.jar;C:\Users\secretuser\.m2\repository\com\microsoft\azure\azure-keyvault-core\0.8.0\azure-keyvault-core-0.8.0.jar;C:\Users\secretuser\.m2\repository\org\core4j\core4j\0.6\core4j-0.6.jar;C:\Users\secretuser\.m2\repository\org\bouncycastle\bcprov-jdk15on\1.55\bcprov-jdk15on-1.55.jar;C:\Users\secretuser\.m2\repository\org\apache\qpid\qpid-jms-client\0.11.1\qpid-jms-client-0.11.1.jar;C:\Users\secretuser\.m2\repository\org\apache\geronimo\specs\geronimo-jms_1.1_spec\1.1.1\geronimo-jms_1.1_spec-1.1.1.jar;C:\Users\secretuser\.m2\repository\org\apache\qpid\proton-j\0.14.0\proton-j-0.14.0.jar;C:\Users\secretuser\.m2\repository\io\netty\netty-buffer\4.0.41.Final\netty-buffer-4.0.41.Final.jar;C:\Users\secretuser\.m2\repository\io\netty\netty-common\4.0.41.Final\netty-common-4.0.41.Final.jar;C:\Users\secretuser\.m2\repository\io\netty\netty-handler\4.0.41.Final\netty-handler-4.0.41.Final.jar;C:\Users\secretuser\.m2\repository\io\netty\netty-codec\4.0.41.Final\netty-codec-4.0.41.Final.jar;C:\Users\secretuser\.m2\repository\io\netty\netty-transport\4.0.41.Final\netty-transport-4.0.41.Final.jar;C:\Users\secretuser\.m2\repository\io\netty\netty-codec-http\4.0.41.Final\netty-codec-http-4.0.41.Final.jar;C:\Users\secretuser\.m2\repository\junit\junit\4.11\junit-4.11.jar;C:\Users\secretuser\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;
I,1,java.specification.name,Java Platform API Specification
I,1,java.class.version,52.0
I,1,sun.management.compiler,HotSpot 64-Bit Tiered Compilers
I,1,os.version,10.0
I,1,user.home,C:\Users\secretuser
I,1,user.timezone,
I,1,java.awt.printerjob,sun.awt.windows.WPrinterJob
I,1,java.specification.version,1.8
I,1,file.encoding,Cp1252
I,1,user.name,secretuser
I,1,java.class.path,C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub\target\test-classes;C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub\target\classes;C:\Users\secretuser\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.8.4\jackson-databind-2.8.4.jar;C:\Users\secretuser\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;C:\Users\secretuser\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.8.4\jackson-core-2.8.4.jar;C:\Users\secretuser\.m2\repository\com\google\inject\guice\4.1.0\guice-4.1.0-no_aop.jar;C:\Users\secretuser\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar;C:\Users\secretuser\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Users\secretuser\.m2\repository\com\google\guava\guava\19.0\guava-19.0.jar;C:\Users\secretuser\.m2\repository\com\google\code\gson\gson\2.8.0\gson-2.8.0.jar;C:\Users\secretuser\.m2\repository\com\google\oauth-client\google-oauth-client\1.22.0\google-oauth-client-1.22.0.jar;C:\Users\secretuser\.m2\repository\com\google\http-client\google-http-client\1.22.0\google-http-client-1.22.0.jar;C:\Users\secretuser\.m2\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar;C:\Users\secretuser\.m2\repository\com\google\http-client\google-http-client-jackson\1.15.0-rc\google-http-client-jackson-1.15.0-rc.jar;C:\Users\secretuser\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.9.11\jackson-core-asl-1.9.11.jar;C:\Users\secretuser\.m2\repository\com\microsoft\azure\azure-servicebus\0.9.7\azure-servicebus-0.9.7.jar;C:\Users\secretuser\.m2\repository\com\microsoft\azure\azure-core\0.9.7\azure-core-0.9.7.jar;C:\Users\secretuser\.m2\repository\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;C:\Users\secretuser\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\secretuser\.m2\repository\org\apache\httpcomponents\httpclient\4.3.6\httpclient-4.3.6.jar;C:\Users\secretuser\.m2\repository\org\apache\httpcomponents\httpcore\4.3.3\httpcore-4.3.3.jar;C:\Users\secretuser\.m2\repository\javax\mail\mail\1.4.5\mail-1.4.5.jar;C:\Users\secretuser\.m2\repository\javax\activation\activation\1.1\activation-1.1.jar;C:\Users\secretuser\.m2\repository\com\sun\jersey\jersey-client\1.19\jersey-client-1.19.jar;C:\Users\secretuser\.m2\repository\com\sun\jersey\jersey-core\1.19\jersey-core-1.19.jar;C:\Users\secretuser\.m2\repository\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;C:\Users\secretuser\.m2\repository\com\sun\jersey\jersey-json\1.19\jersey-json-1.19.jar;C:\Users\secretuser\.m2\repository\org\codehaus\jettison\jettison\1.1\jettison-1.1.jar;C:\Users\secretuser\.m2\repository\com\sun\xml\bind\jaxb-impl\2.2.3-1\jaxb-impl-2.2.3-1.jar;C:\Users\secretuser\.m2\repository\javax\xml\bind\jaxb-api\2.2.2\jaxb-api-2.2.2.jar;C:\Users\secretuser\.m2\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;C:\Users\secretuser\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.2\jackson-mapper-asl-1.9.2.jar;C:\Users\secretuser\.m2\repository\org\codehaus\jackson\jackson-jaxrs\1.9.2\jackson-jaxrs-1.9.2.jar;C:\Users\secretuser\.m2\repository\org\codehaus\jackson\jackson-xc\1.9.2\jackson-xc-1.9.2.jar;C:\Users\secretuser\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar;C:\Users\secretuser\.m2\repository\com\microsoft\azure\azure-storage\4.4.0\azure-storage-4.4.0.jar;C:\Users\secretuser\.m2\repository\org\slf4j\slf4j-api\1.7.12\slf4j-api-1.7.12.jar;C:\Users\secretuser\.m2\repository\org\apache\commons\commons-lang3\3.4\commons-lang3-3.4.jar;C:\Users\secretuser\.m2\repository\com\microsoft\azure\azure-keyvault-core\0.8.0\azure-keyvault-core-0.8.0.jar;C:\Users\secretuser\.m2\repository\org\core4j\core4j\0.6\core4j-0.6.jar;C:\Users\secretuser\.m2\repository\org\bouncycastle\bcprov-jdk15on\1.55\bcprov-jdk15on-1.55.jar;C:\Users\secretuser\.m2\repository\org\apache\qpid\qpid-jms-client\0.11.1\qpid-jms-client-0.11.1.jar;C:\Users\secretuser\.m2\repository\org\apache\geronimo\specs\geronimo-jms_1.1_spec\1.1.1\geronimo-jms_1.1_spec-1.1.1.jar;C:\Users\secretuser\.m2\repository\org\apache\qpid\proton-j\0.14.0\proton-j-0.14.0.jar;C:\Users\secretuser\.m2\repository\io\netty\netty-buffer\4.0.41.Final\netty-buffer-4.0.41.Final.jar;C:\Users\secretuser\.m2\repository\io\netty\netty-common\4.0.41.Final\netty-common-4.0.41.Final.jar;C:\Users\secretuser\.m2\repository\io\netty\netty-handler\4.0.41.Final\netty-handler-4.0.41.Final.jar;C:\Users\secretuser\.m2\repository\io\netty\netty-codec\4.0.41.Final\netty-codec-4.0.41.Final.jar;C:\Users\secretuser\.m2\repository\io\netty\netty-transport\4.0.41.Final\netty-transport-4.0.41.Final.jar;C:\Users\secretuser\.m2\repository\io\netty\netty-codec-http\4.0.41.Final\netty-codec-http-4.0.41.Final.jar;C:\Users\secretuser\.m2\repository\junit\junit\4.11\junit-4.11.jar;C:\Users\secretuser\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;
I,1,java.vm.specification.version,1.8
I,1,sun.arch.data.model,64
I,1,java.home,C:\myPath\Java\jdk1.8.0_152\jre
I,1,sun.java.command,C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub\target\surefire\surefirebooter4393690082191226141.jar C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub\target\surefire\surefire2387848635455087535tmp C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub\target\surefire\surefire_08471100731569808288tmp
I,1,java.specification.vendor,Oracle Corporation
I,1,user.language,en
I,1,user.language.format,nl
I,1,awt.toolkit,sun.awt.windows.WToolkit
I,1,java.vm.info,mixed mode
I,1,java.version,1.8.0_152
I,1,java.ext.dirs,C:\myPath\Java\jdk1.8.0_152\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
I,1,sun.boot.class.path,C:\myPath\Java\jdk1.8.0_152\jre\lib\resources.jar;C:\myPath\Java\jdk1.8.0_152\jre\lib\rt.jar;C:\myPath\Java\jdk1.8.0_152\jre\lib\sunrsasign.jar;C:\myPath\Java\jdk1.8.0_152\jre\lib\jsse.jar;C:\myPath\Java\jdk1.8.0_152\jre\lib\jce.jar;C:\myPath\Java\jdk1.8.0_152\jre\lib\charsets.jar;C:\myPath\Java\jdk1.8.0_152\jre\lib\jfr.jar;C:\myPath\Java\jdk1.8.0_152\jre\classes
I,1,sun.stderr.encoding,cp437
I,1,java.vendor,Oracle Corporation
I,1,localRepository,C:\Users\secretuser\.m2\repository
I,1,file.separator,\
I,1,java.vendor.url.bug,http://bugreport.sun.com/bugreport/
I,1,sun.cpu.endian,little
I,1,sun.io.unicode.encoding,UnicodeLittle
I,1,sun.stdout.encoding,cp437
I,1,sun.desktop,windows
I,1,sun.cpu.isalist,amd64
1,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestHashMapExtensions,null,null,null
5,1,com.lucas.java.util.TestHashMapExtensions,testTryGet(com.lucas.java.util.TestHashMapExtensions),null,null,null
6,1,com.lucas.java.util.TestHashMapExtensions,testTryGet(com.lucas.java.util.TestHashMapExtensions),null,null,null
2,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestHashMapExtensions,null,null,null
1,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestIterableUtilities,null,null,null
5,1,com.lucas.java.util.TestIterableUtilities,testGetSize(com.lucas.java.util.TestIterableUtilities),null,null,null
6,1,com.lucas.java.util.TestIterableUtilities,testGetSize(com.lucas.java.util.TestIterableUtilities),null,null,null
2,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestIterableUtilities,null,null,null
1,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestU4String,null,null,null
5,1,com.lucas.java.util.TestU4String,testIsNullOrEmpty(com.lucas.java.util.TestU4String),null,null,null
6,1,com.lucas.java.util.TestU4String,testIsNullOrEmpty(com.lucas.java.util.TestU4String),null,null,null
5,1,com.lucas.java.util.TestU4String,testIsNullOrWhiteSpace(com.lucas.java.util.TestU4String),null,null,null
6,1,com.lucas.java.util.TestU4String,testIsNullOrWhiteSpace(com.lucas.java.util.TestU4String),null,null,null
2,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestU4String,null,null,null
1,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestU4URLDecoder,null,null,null
5,1,com.lucas.java.util.TestU4URLDecoder,testDecode(com.lucas.java.util.TestU4URLDecoder),null,null,null
6,1,com.lucas.java.util.TestU4URLDecoder,testDecode(com.lucas.java.util.TestU4URLDecoder),null,null,null
2,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestU4URLDecoder,null,null,null
1,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestU4URLEncoder,null,null,null
5,1,com.lucas.java.util.TestU4URLEncoder,testEncode(com.lucas.java.util.TestU4URLEncoder),null,null,null
6,1,com.lucas.java.util.TestU4URLEncoder,testEncode(com.lucas.java.util.TestU4URLEncoder),null,null,null
2,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestU4URLEncoder,null,null,null
Z,0,BYE! 

Is there a known problem with CMD? or am i looking in the wrong direction?

Java : Throwable not caught

I got this code in java :

    public static void main(String[] args) {
        try{
            Class tryLoadingClass = Class.forName("com.sun.deploy.uitoolkit.impl.fx.ui.MixedCodeInSwing");
    }
    catch (Throwable t){
        System.out.println("we caught a throwable");
    }  
}

I would expect the catch Throwable to catch any exception – error. However, the output is as follows:

 java.lang.ClassNotFoundException: com/sun/deploy/ui/DialogTemplate
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:348)
 at com.sun.deploy.uitoolkit.impl.fx.ui.MixedCodeInSwing.<clinit> (MixedCodeInSwing.java:55)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:264)
 at testrandomjavacode.TestRandomjavaCode.main(TestRandomjavaCode.java:19)

Why isn’t the exception caught and how can I catch it ?

Purpose of passing factory object in Simple Factory Design Pattern (Head-First)?

I am from C++ background, recently started learning Design Patterns.

I am facing problems with this code from Head First Design Patterns:

Link: PizzaStore.java

public class PizzaStore {
SimplePizzaFactory factory;

public PizzaStore(SimplePizzaFactory factory) { 
    this.factory = factory;
}

public Pizza orderPizza(String type) {
    Pizza pizza;

    pizza = factory.createPizza(type);

    pizza.prepare();
    pizza.bake();
    pizza.cut();
    pizza.box();

    return pizza;
} 
}

Please help me with the following doubt:

What is the relevance of passing a factory object in the Constructor of PizzaStore class ?

  • PizzaStore class already contains a SimplePizzaFactory object
  • The passed-on object is not initialized with any data (which needs to be copied by PizzaStore Constructor):

    public PizzaStore(SimplePizzaFactory factory) { 
    this.factory = factory;
    

    }

Thanks

Retroactively Broken Method

I won’t lie, I am at an utter loss. I do not even know what to put here, really. I have an application that can create backups of its information and recover them. I have 6 stable versions, complete with saved apks, of the program. These all worked 100% in the past, and I saved them exactly as they were.

I was working on a seventh version, and found that the recovery method would not work. It acted as if it did, but would do nothing. I could not figure out what was causing this, so I decided to simply start over from my sixth version.

None of my versions’ recovery methods work now. Theoretically, this should be impossible in my mind – if an apk ran correctly a week ago, how can the same apk fail now? I tried two different android phones and an emulator, same results on all.

It does not throw an error or anything else. It tells the user “The backup has been restored.” with a toast. If ext storage isn’t allowed, it throws an error. If the file path doesn’t exist, throws an error. Nothing abnormal on logcat. But when everything’s right, it just simply doesn’t work. So…here’s the recovery method from a stable version. Let me know if there’s anything else you’d like to examine.

//Method025: Imports user acc settings from a file on a specified path.
public void importFile() {
    //The file variable to be imported.
    File file;

    try {
        //Used to access settings.
        TinyDB database = new TinyDB(getApplicationContext());

        //Sets the file equal to the file found at the specified path.
        String strfilePath = database.getString("FilePath");
        file = new File(strfilePath);

        //To be used to arrange the imported information.
        ArrayList<String> strAcc = new ArrayList<>();
        ArrayList<String> strUser = new ArrayList<>();
        ArrayList<String> strPass = new ArrayList<>();
        ArrayList<String> strAdditionalInfo = new ArrayList<>();

        //To be used to store all the information for additional info variables. This is
        //due to its multi-line nature requiring a slightly different method of
        //importation, the other variables are expected to be one line.
        String strExtraInfo = "";

        //Goes through the file and adds info to arrays for each corresponding variable.
        //If the line does not have an identifier, it assumes it to be an additional
        //info line, and will be processed later.
        try (BufferedReader br = new BufferedReader(new FileReader(file))) {
            String line;

            String strLine = br.readLine();
            //Decodes the line from Base64 and converts it to a string.
            byte[] decodedContent = Base64.decode(strLine.getBytes(), Base64.DEFAULT);
            strLine = decodedContent.toString();

            while ((line = br.readLine()) != null) {
                if (strLine.contains("[Acc]")) {
                    strLine = strLine.replace("[Acc]","");
                    strAcc.add(strLine);
                } else if (strLine.contains("[User]")) {
                    strLine = strLine.replace("[User]", "");
                    strUser.add(strLine);
                } else if (strLine.contains("[Pass]")) {
                    strLine = strLine.replace("[Pass]", "");
                    strPass.add(strLine);
                } else  {
                    strExtraInfo += strLine;
                }
            }
        }

        //Gets the list of accounts.
        ArrayList<String> savedInfo = new ArrayList<>(database.getListString("allSaved"));

        //To be used to get the AdditionalInfo variables one line at a time.
        String strSubInfo;

        //Gets rid of any erroneous spaces.
        while (strExtraInfo.contains("  ")) {
            strExtraInfo = strExtraInfo.replace("  ", " ");
        }

        //Uses the number of account names as the number of additional info vars to be
        //expected. For each iteration, it uses the identifiers to get the substring
        //that corresponds to one variable. Stores it, then runs again.
        for (String strName : strAcc) {

            //Used to store positions.
            Integer endPos;
            Integer startPos;

            //Finds the start and end of the first var in the overall string, then
            //puts it into a substring.
            endPos = strExtraInfo.indexOf("[ExtraStart]");
            startPos = strExtraInfo.indexOf("[ExtraEnd]");
            strSubInfo = strExtraInfo.substring(endPos, startPos);

            //Removes the substring, so that it wont be added twice. This will only
            //remove the specific occurrence, as no two can have the same acc name.
            //Thus, no two vars will be exactly the same.
            strExtraInfo = strExtraInfo.replace(strSubInfo, "");

            //Gets rid of the identifiers, then adds the variable to the array of
            //additional info variables.
            strSubInfo = strSubInfo.replace("[ExtraStart]", "");
            strSubInfo = strSubInfo.replace("[ExtraEnd]", "");
            strAdditionalInfo.add(strSubInfo);

        }

        //Arranges the information.
        for (String name : strAcc) {
            savedInfo.add(name);

            ArrayList<String> allInfo = new ArrayList<>();

            //Gets the info then adds it to database.
            allInfo.add(strUser.get(0));
            allInfo.add(strPass.get(0));
            allInfo.add(strAdditionalInfo.get(0));
            database.putListString(name,allInfo);

            //Deletes the old information.
            strUser.remove(0);
            strPass.remove(0);
            strAdditionalInfo.remove(0);
        }

        //Adds all the new account names to the database.
        database.putListString("allSaved", savedInfo);

        //Lets the user know the process is finished.
        Toast.makeText(MainActivity.this, "The backup has been restored.", Toast.LENGTH_SHORT).show();

    } catch (IOException e) {
        Toast.makeText(MainActivity.this, "Sorry, there's been an error.", Toast.LENGTH_SHORT).show();
        e.printStackTrace();
    }
}

Hibernate – Translating “Legacy” Criteria to JPA Critera to implement a Generic DAO

I am attempting to use a generic DAO pattern using Hibernate by referencing this article.

However, the GenericHibernateDAO class utilizes the Hibernate queries which have subsequently been deprecated. I am attempting to use the pattern, but update it with the currently supported JPA Criteria API. However, I am struggling with how to “build” queries in the “findByCriteria” method.

This is the code form the article using the legacy Criteria classes.

    /** 
 * Use this inside subclasses as a convenience method. 
 */  
@SuppressWarnings("unchecked")  
protected List<T> findByCriteria(Criterion... criterion) {  
    Criteria crit = getSession().createCriteria(getPersistentClass());  
    for (Criterion c : criterion) {  
        crit.add(c);  
    }  
    return crit.list();  

}

Presently, this is my present attempt at reworking it to use the JPA Criteria API.

protected List<T> findByCriteria(Criterion... criterion) {
            CriteriaBuilder builder = getSession().getCriteriaBuilder();
            CriteriaQuery<T> criteria = builder.createQuery(getPersistentClass());
            Root<T> root = criteria.from(getPersistentClass());
            criteria.select(root);

// Not sure what to do here
            for(Criterion c: criterion) {
                criteria.where()
            }

            return session.createQuery(criteria).getResultList();
        }

Specifically, the original code uses Criterion to build a query within a for loop. To my understanding, this would make the method very flexible. However, I am struggling to achieve this same effect with JPA Criteria. For example, to my understanding, usage of the JPA Criteria API requires that one already know something about the query, for example whether or not the WHERE clause involves an EQUAL TO, GREATER THAN, or similar, restriction. I understand that the findByCriteria method signature will likely need to be altered to accept something aside from Criterion, but I am not sure what yet.

I have looked over the Hibernate docs and other online resources, but have not found anything quite like I am looking for.

Any advice would be appreciated.

Enablin CORS on apache cxf embedded jetty server

I have problem setting up CORS on jetty . I am using embedded jetty server in java: apache.cxf.jaxws.JaxWsServerFactoryBean .
This is how I am creating the server:

JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean();
serverFactory.setAddress(ConfigurationFile.getProperty(“jetty.bindaddress”)+ “/ls”);
Map props = new HashMap();
props.put(“mtom-enabled”, Boolean.TRUE);
serverFactory.setProperties(props);
serverFactory.setServiceBean(new ServicesImpl());

Any idea how can I enable CORS ?

for loop with Image and margin

I got a problem with my for loop / with its content.
I want to have this loop in which an image is repeated n times.
In addition these images should have margins at the top so they have some space between each other.

For now these images are laying on top of each other or won’t be generated as they should (Result: Drawable “bg_circle” is only displayed once).

The “userinput” will be filled from an EditText in an Alert Dialog.
Here is my code:

int n = Integer.parseInt(userInput.getText().toString());
RelativeLayout layout = findViewById(R.id.TableView);
        for(int i = 0; i <= n; i++){
           ImageView image = new ImageView(mContext);
           image.setImageResource(R.drawable.bg_circle);
           RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
           lp.setMargins(100,100,0,0);
           lp.height = 100;
           lp.width = 100;
           image.setLayoutParams(lp);
           layout.addView(image);
        }

Where is the mistake?

Get the name of a null field in Android [duplicate]

This question already has an answer here:

I have a huge class with members, and i want to check on each member if its null. I don’t want to add it manually, just run a for loop (or something similar) which will go over all the fields without ‘human’ addition every time a field is added.

So far, i can go over the fields, and receive the name of the fields (which is what i need). However, there’s nothing on Field that checks if the value of it is null.

Here’s what i have so far :

private class Test {
    String name1 = null;
    String name2 = "test";
    String name3 = null;
}

Test mainTest = new Test();
   for (Field field : mainTest.getClass().getDeclaredFields()) {
        if (field.isValueNull())
            Log.i("test", field.getName() + " is missing ");
   }

field.isValueNull() -> this is the method i’m looking for.

In this example, the print will be :

name1 is missing

name3 is missing