Solving OWASP security vulnerabilities in Liferay 6.0.x

By John Negoita on Thursday, July 14th, 2016 in Liferay. No Comments

I have worked with Liferay for over 5 years, delivering solutions on the Liferay platform to clients of all sizes. Medium to large clients, multinational companies especially, have to conform to lots of rules and regulations when it comes to their IT infrastructure. Therefore, when we were approached by this type of clients we were always asked about security vulnerabilities in Liferay. In this post I will explain how we went about identifying and fixing these security issues in Liferay. Liferay 6.0.6 security audit We employed a third party to conduct a security audit on our Liferay 6.0.6 platform …


ApacheDS LDAP authentication, stay away

By John Negoita on Monday, December 14th, 2015 in Java. No Comments

While developing a relatively large application, we required a single sign-on authentication. After a brief investigation about what open source solutions there are we decided that we go for the ApacheDS LDAP authentication. I don’t usually do this, I’m not hater, but take this warning from me: stay away from ApacheDS! ApacheDS LDAP What is ApacheDS? It is an open source directory server developed under the Apache Foundation. To be honest, being mainly a Java programmer I have to say that I’m very happy with all most of the solutions found under Apache. I started using ApacheDS around a year ago, …


Liferay portal instances explained

By John Negoita on Friday, June 19th, 2015 in Liferay. No Comments

Liferay portal instances are a way through which Liferay handles data separation. Each Liferay instance can be seen as a separate website within the same server. Each instance has its own domain name (setup via the Virtual Host attribute of the instance). Each portal instance is only accessible through this domain name and not otherwise. How to setup Liferay portal instances? To setup a new Liferay portal instance you have to be logged in as an admin. Then go to the Control Panel via Manage > Control Panel and then in the Server section click on Portal Instances > Add. You have to …


Hibernate HQL BETWEEN Expression

By John Negoita on Thursday, January 22nd, 2015 in Hibernate. No Comments

In this post I will show you how to use the Hibernate HQL between expression to write and execute some simple HQL queries. HQL is the Hibernate Query Language that allows you to query your Hibernate data layer using similar syntax to the relational database query language SQL. SQL offers a number of operators and expressions that are also found in HQL. Luckily, between is an operator that is found in both SQL and HQL. Let’s see some examples of when and how you can use HQL between and list a few considerations. Just like the SQL between expression the correct syntax …


Modal Progress Bar Dialog with Java Swing

By John Negoita on Thursday, October 16th, 2014 in Java. 4 Comments

In this post I will show you how you can make a modal progress bar dialog in a Java Swing application. Though I am a Java programmer I am mainly involved in web development so my experience with Swing is rather limited. The problem So you have an application made in Java with Swing and in it you have for example a button that the user can push to start processing something. Main challenge for me coming from web development was that with Swing you have to be aware of the UI thread. That means that if you start processing something …


Java Integer == Integer – WTF moment with Java

By John Negoita on Wednesday, October 15th, 2014 in Java. No Comments

Integer == Integer This post is about a curious situation I encountered while debugging a Java application (not written by me). It was quite an “ahhh” “ohhh” “wtf” moment regarding since I spent about an hour or so to figure out. I started investigating an ArrayIndexOutOfBoundsException and realized the the cause was that the index was searched in a piece of code comparing two integers (Integer objects that is) by using Integer == Integer. Consider the following piece of code: …
Integer index1 = 100;
Integer index2 = 100;

System.out.println(index1 == index2);

index1 = 200;
index2 = 200;

System.out.println(index1 == …


HQL Date and Datetime Quick Tip

By John Negoita on Tuesday, March 4th, 2014 in Hibernate, Java. 4 Comments

Working with Hibernate in one of my projects I stumbled upon a small problem that took a while to figure out, therefore I thought it would be nice to share it, maybe saves someone some time. The documentation for HQL was not really helpful for me in this situation. The problem: HQL date vs datetime queries When you need to do HQL date comparison you need to take into account if you want to compare dates at day level or at hour/second level. Let’s see an example: public class Event{

int id;

String name;

Date eventDate;

} Mapped …


Liferay Architecture – a Simplified View

By John Negoita on Wednesday, February 19th, 2014 in Liferay. No Comments

Liferay Architecture Diagram   Let’s do a very brief analysis of the Liferay portal architecture. The best way to do that get an overview of Liferay portal architecture is through a visual representation, so here is a diagram of the Liferay architecture. 3 Tier Liferay Architecture Diagram As you can see in the diagram the Liferay architecture has 3 tiers, which is a pretty standard architecture. [googleAd] Tier 1 of the Liferay architecture: the front-end Liferay front-end is based on the implementation of JSR-268, which is the specification for Java Portlets 2.0. As pointed out in the diagram Liferay’s UI …


Java Swing JXTable tutorial – fixing the ColumnControlButton menu

By John Negoita on Tuesday, January 28th, 2014 in Java, Swing. 1 Comment

In this post I will show you how you can keep open the menu of ColumnControlButton in a Java Swing application using JXTable. The reason for this JXTable tutorial Want to know what problems you may encounter when using the JXTable component amd how to tackle them? Read on. Through a weird and unwanted series of events (often referred to as a “daytime job”) a project landed on my plate which involves the development of a Java desktop application using Swing. Being mainly involved so far in web project it’s the first time I work on a real Swing project. …


Liferay Script for Setting Document Library Folder Permissions

By John Negoita on Monday, November 18th, 2013 in Java, Liferay. No Comments

Setting document library folder permissions in Liferay can be a tedious task, especially if you have a complicated structure of shards and organizations. Using a script can be the faster way than doing it manually. In this post I will show you how I manage this task in production servers and will provide you with the Beanshell script. If you are unsure about how to run Beanshell scripts in Liferay you can also check out my post about Liferay Beanshell Scripts for Sharded Environments. Document library folder permissions Liferay’s document library one of the core functionality that the Liferay portal offers. …