From 2d1d1ece4ab2d4100985ef4317535f4e054ba012 Mon Sep 17 00:00:00 2001 From: Andy Wu Date: Wed, 29 Jun 2016 17:14:18 +0800 Subject: [PATCH 1/2] consider the file in templates wihout extensions --- .../src/com/liferay/blade/cli/CreateCommand.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/com.liferay.blade.cli/src/com/liferay/blade/cli/CreateCommand.java b/com.liferay.blade.cli/src/com/liferay/blade/cli/CreateCommand.java index 6a576f793..bf54b4f4e 100644 --- a/com.liferay.blade.cli/src/com/liferay/blade/cli/CreateCommand.java +++ b/com.liferay.blade.cli/src/com/liferay/blade/cli/CreateCommand.java @@ -493,9 +493,15 @@ private boolean isExistingTemplate(String templateName) throws Exception private boolean isTextFile(File dest) { String name = dest.getName(); + int posi = name.lastIndexOf("."); - return textExtensions.contains( - name.substring(name.lastIndexOf("."), name.length())); + if ( posi > -1 ) { + + return textExtensions.contains( + name.substring(posi, name.length())); + } + + return false; } private void listTemplates() throws Exception { From a64df7a9f1337bffb11a4a7be3705c176e347667 Mon Sep 17 00:00:00 2001 From: Gregory Amerson Date: Wed, 29 Jun 2016 11:56:44 -0500 Subject: [PATCH 2/2] rename --- .../src/com/liferay/blade/cli/CreateCommand.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/com.liferay.blade.cli/src/com/liferay/blade/cli/CreateCommand.java b/com.liferay.blade.cli/src/com/liferay/blade/cli/CreateCommand.java index bf54b4f4e..82afb8617 100644 --- a/com.liferay.blade.cli/src/com/liferay/blade/cli/CreateCommand.java +++ b/com.liferay.blade.cli/src/com/liferay/blade/cli/CreateCommand.java @@ -493,12 +493,11 @@ private boolean isExistingTemplate(String templateName) throws Exception private boolean isTextFile(File dest) { String name = dest.getName(); - int posi = name.lastIndexOf("."); - - if ( posi > -1 ) { + int index = name.lastIndexOf("."); + if ( index > -1 ) { return textExtensions.contains( - name.substring(posi, name.length())); + name.substring(index, name.length())); } return false;