jump to navigation

Application blocked by security settings August 18, 2014

Posted by ninadgawad in Uncategorized.
Tags: , , ,
add a comment

Problem: While trying to access a website running Java Applets you get a message “Application Blocked by Security Settings”.
This is a common error while accessing a which has below listed issues:

  • Certificate is revoked
  • Failed to validate certificate
  • Unable to connect to Certificate Authority

Error Popup:

applicationblock_popup

Cause:  The issue is caused because your default Java Control Panel’s Security Level is set to “High”.

Solution:

Step1: Copy on clipboard Website URL you are trying to access

Step2: Open “Java Control Panel”

On Windows:  Start > All programs > Java > Configure Java

Java_Control_Panel1

Step3: Click “Security” tab and reduce security level to “Medium”, also you can click “Edit Site List” and paste the URL which is getting blocked.

Step4: Click “Ok” button, Restart browser. (optional)

Java_Control_Panel2

This should resolve the issue related to “Application Blocked by Security Settings”

Convert date from one format to another date format Utility February 10, 2012

Posted by ninadgawad in Java.
Tags: , , ,
add a comment

If you want Need to convert a date from a one format to another date format, please find the code below to do the same using Java.
You can have it as a generic Utility in your application’s Utility function.


/**
* Return string with formatted date
* @param inputdate Date String which needs conversion
* @param inputDateFormat Format of the input date
* @param outputDateFormat Format which date should be converted
* @return the output formated String
*/
private String convertDateFormat(String inputdate, String inputDateFormat, String outputDateFormat){
String outputDate = null;
SimpleDateFormat sdfSource = new SimpleDateFormat(inputDateFormat);
try {
Date date = sdfSource.parse(inputdate);
sdfSource = new SimpleDateFormat(outputDateFormat);
outputDate = sdfSource.format(date);
} catch (Exception e) {
e.printStackTrace();
}
return outputDate;
}

Let me know if you find a better way to do this.
Hope this helps !

Thanks,
Ninad

Cannot read project model from interpolating filter of serialized version. January 23, 2012

Posted by ninadgawad in Uncategorized.
Tags: , , ,
4 comments

Problem:
Error building POM (may not be this project’s POM).
Project ID: com.dev.project
POM Location: C:\dev&test\

Reason: Cannot read project model from interpolating filter of serialized version. for project com.
main at C:\dev&test\

[INFO] ————————————————————————
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Cannot read project model from interpolating filter of serialized vers
ion. for project com.dev.project at
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:378)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:292)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
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:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.project.InvalidProjectModelException: Cannot read project model from interpolating filter of
serialized version. for project com.dev.project at
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:882)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.ja
va:506)
at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:198)
at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:583)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:461)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:534)
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:365)
… 11 more
Caused by: org.apache.maven.project.interpolation.ModelInterpolationException: Cannot read project model from interpolat
ing filter of serialized version.
at org.apache.maven.project.interpolation.RegexBasedModelInterpolator.interpolate(RegexBasedModelInterpolator.ja
va:114)
at org.apache.maven.project.DefaultMavenProjectBuilder.processProjectLogic(DefaultMavenProjectBuilder.java:1016)

at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:878)
… 17 more
Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: entity reference name can not contain character \’
(position: START_TAG seen …C:\dev&test\… @314:33)
at org.codehaus.plexus.util.xml.pull.MXParser.parseEntityRef(MXParser.java:2222)
at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl(MXParser.java:1275)
at org.codehaus.plexus.util.xml.pull.MXParser.next(MXParser.java:1093)
at hidden.org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java:187)
at hidden.org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java:94)
at org.apache.maven.model.io.xpp3.MavenXpp3Reader.parsePluginExecution(MavenXpp3Reader.java:3144)
at org.apache.maven.model.io.xpp3.MavenXpp3Reader.parsePlugin(MavenXpp3Reader.java:2901)
at org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseBuild(MavenXpp3Reader.java:753)
at org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseModel(MavenXpp3Reader.java:2224)
at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:4422)
at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:4433)
at org.apache.maven.project.interpolation.RegexBasedModelInterpolator.interpolate(RegexBasedModelInterpolator.ja
va:105)
… 19 more

Cause:
This is a standard error while making build in maven on Windows.
It occurs when your path contain’s special characters like ‘&’, ” etc.
Remove ampersand from the path and this should solve the problem. This is because mvn.bat cannot handle these characters in windows.

Solution: Remove ampersand “&” or special characters from path or username

Example:
Path: D:\workspace\dev&test\project1\mvn clean install (Error)
Rename the folder dev&test to devtest

Hope this Helps !

LinkedHashMap or HashMap ? January 1, 2008

Posted by ninadgawad in Java.
Tags: ,
5 comments

The Class LinkedHashMap  is an extension of HashMap with specific feature of retaining the insertion order. Hence useful when order  of key-value pairs are to be retained. Also if one inserts the key again into the LinkedHashMap the original orders is retained. Such Collection is useful when you want to covert a record fetched from the database into a Java Object. The main advantage with this is that now we can shift the sorting logic of retrieved data into database rather than writing custom code here; that help in boosting performance.

Java Docs available @  http://java.sun.com/javase/6/docs/api/java/util/LinkedHashMap.html

Example Code:

import java.util.Iterator;
import java.util.LinkedHashMap;

class LinkedHashMapEx1  {
public static void main(String[] args)      {
LinkedHashMap map = new LinkedHashMap();

// Add some elements
map.put(“A”, “dataElement-1”);
map.put(“B”, “dataElement-2”);
map.put(“C”, “dataElement-3”);
map.put(“B”, “dataElement-4”);

// List the entries
for (Iterator it=map.keySet().iterator(); it.hasNext(); ) {
Object key = it.next();
Object value = map.get(key);
System.out.println( “Key = “+ key.toString() + ” Value = ” + value.toString() );

}
}
}