Skip to content

Blog

Bugs love logging to hide

A lot of projects run integration and unit tests, but often miss a little something – logging. When you use logging you often check if the log level is enabled or not before you log. But this means that you introduce a control flow statement that enables or disables some code. So if you miss to enable logging for your tests you let code untested and bugs love untested code, because they can hide there. But it is easy to remove this hiding places for bugs. Avoid log level checks if possible If you can avoid log level enabled checks, you avoid control flow statements and this  means that you remove hiding… Read More »Bugs love logging to hide

GitDirStat – a git maintenance gui

Some time ago I wrote the blog “Remove directories and files permanently from git“. Removing files from a git history is not an unusual task and I thought that it would be nice if there is an easier and faster way to do it. I thought that there should be a gui that help you to find big files in the history and that let you select the files you want to remove with just a click of a button. Therefore I started the GitDirStat project on github and developed a java swing application based on the JGIT library provided by the eclipse community. The name was derived from the popular WinDirStat application or… Read More »GitDirStat – a git maintenance gui

A git checkstyle pre-receive hook

When multiple developers work on one project it is also essential that they all commit source code that matches some formatting rules. Otherwise reviewing changes and merging source code can be a great challenge. When using git repositories you can install hooks. Hooks are any kind of executables that can be run before something happens in a git repository like creating a commit or updating the refs during a push command. I developed a small bash script that can be used to execute checkstyle on every push and that rejects changes that have checkstyle errors. The script is simple and easy to configure so I want to share it here. Just… Read More »A git checkstyle pre-receive hook

How to create an independent branch in git

In a git repository everything normally starts with an initial commit and all other commits are ancestors of this first commit. But is it possible to create a second initial commit or even a third? Another initial commit with a complete different working directory? Yes it is.

Clean Code with underscores in literals

As of java 1.7 the java language specification allows integer literals to contain underscores in order to make them more readable. If it is applied in a good way it can enormously increase the readability of your code. In java 1.6 one had to define integer literals like this: int iterations = 10000000; long bytes = 0b11010010011010011001010010010010; With java 1.7 such integer literals can be written more readably by using the underscore as a  thousands separators. int iterations = 10_000_000; or when using binary literals one can use the underscores to group bytes long bytes = 0b11010010_01101001_10010100_10010010;   Further information can be found at http://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.10.1 Recommended Reading  

How to fix java.lang.ClassNotFoundException: com.ibm.websphere.ssl.protocol.SSLSocketFactory in eclipse

If you use IBM’s WebSphere plugin for eclipse you might have the problem that other plugins can’t establish an SSL connection anymore. The result is most times a ClassNotFoundException: com.ibm.websphere.ssl.protocol.SSLSocketFactory. This blog explains the reason behind the problem and gives a workaround to prevent that exception. Problem description When a component within eclipse (e.g. atlassian jira connector) tries to connect to an SSL socket a ClassNotFoundException: com.ibm.websphere.ssl.protocol.SSLSocketFactory is thrown. This exception is often the root cause of other exceptions. Caused by: java.net.SocketException: java.lang.ClassNotFoundException: com.ibm.websphere.ssl.protocol.SSLSocketFactory at javax.net.ssl.DefaultSSLSocketFactory.throwException(SSLSocketFactory.java:198) at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:205) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:116) at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:130) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at com.sun.jersey.client.apache.DefaultApacheHttpMethodExecutor.executeMethod(DefaultApacheHttpMethodExecutor.java:210) … 18 more… Read More »How to fix java.lang.ClassNotFoundException: com.ibm.websphere.ssl.protocol.SSLSocketFactory in eclipse

Remove directories and files permanently from git

Some day you might want to remove files or directories from git permanently, because someone committed sensitive data or large binary files that should not reside in the repository to keep clone times short.  In this blog I want to show you how to delete directories and files permanently from a git repository. The first chapter is a short answer and is intended for those of you who only want to quickly remove files and don’t want to undestand it in-depth. The section chapter dives into the depth of git and gives you links to other resources to understand how files are managed in git and thus can be removed. The short answer… Read More »Remove directories and files permanently from git

How to fix IBM Websphere ant task error: Unable to parse setupCmdLine: null\bin\setupCmdLine.bat

When trying to execute a wsadmin command using ant you might get the error Unable to parse setupCmdLine: null\bin\setupCmdLine.bat  (The system cannot find the path specified) This error is caused when you don’t provide the user.install.root system property or no wsadmin task profileName property. In order to fix you can either add a user.install.root property and point it to your websphere profile directory (in default installations e.g. AppSrv01) or you can just add a profileName attribute to the wsadmin task. In this case the wsadmin task resolves the profile directory for you, because of the wasHome attribute that you must provide. The analyse of the error Reproduce the error Before we dive into the analyse we need an example project to… Read More »How to fix IBM Websphere ant task error: Unable to parse setupCmdLine: null\bin\setupCmdLine.bat

How to fix IBM Websphere JNDI exception “cannot find the factory for this scheme: java”

Some time ago I stumbled on a weird exception when deploying an EAR on IBM WebSphere Application Server 8.5. The EAR got successfully installed, but when the application server tried to start the WAR archive of my EAR I got this exception: javax.naming.ConfigurationException: NamingManager.getURLContext cannot find the factory for this scheme: java at com.ibm.ws.naming.util.Helpers.checkForUrlContext(Helpers.java:1631) at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:160) at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179) at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161) at javax.naming.InitialContext.lookup(InitialContext.java:436) After searching the web for this exception I came to the conclusion that I have to debug it on my own. Some days of debugging later I found out that there was a configuration problem that was not obvious. So I decided to write this blog and I hope that it can safe… Read More »How to fix IBM Websphere JNDI exception “cannot find the factory for this scheme: java”

GDPR Cookie Consent with Real Cookie Banner