ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ptupit...@apache.org
Subject [5/8] ignite git commit: Fixed tests.
Date Tue, 23 Aug 2016 11:24:50 GMT
Fixed tests.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f9258736
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f9258736
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f9258736

Branch: refs/heads/master
Commit: f9258736c5cfa157e138d879aa0dbacc5a7cb4b2
Parents: eea4282
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Tue Aug 23 14:59:45 2016 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Tue Aug 23 14:59:45 2016 +0700

----------------------------------------------------------------------
 .../ignite/schema/generator/CodeGenerator.java      | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f9258736/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
index 59dfdc4..5cdc6c6 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
@@ -256,6 +256,17 @@ public class CodeGenerator {
     }
 
     /**
+     * Ensure that all folders for packages exist.
+     *
+     * @param pkg Packages.
+     * @throws IOException If failed to ensure.
+     */
+    private static void ensurePackages(File pkg) throws IOException {
+        if (!pkg.exists() && !pkg.mkdirs())
+            throw new IOException("Failed to create folders for package: " + pkg);
+    }
+
+    /**
      * Generate java class code.
      *
      * @param pojo POJO descriptor.
@@ -275,8 +286,7 @@ public class CodeGenerator {
 
         checkValidJavaIdentifier(type, false, "Type", type);
 
-        if (!pkgFolder.exists() && !pkgFolder.mkdirs())
-            throw new IOException("Failed to create folders for package: " + pkg);
+        ensurePackages(pkgFolder);
 
         File out = new File(pkgFolder, type + ".java");
 
@@ -567,6 +577,8 @@ public class CodeGenerator {
         boolean generateAliases, String outFolder, ConfirmCallable askOverwrite) throws IOException
{
         File pkgFolder = new File(outFolder, pkg.replace('.', File.separatorChar));
 
+        ensurePackages(pkgFolder);
+
         File cacheCfg = new File(pkgFolder, "CacheConfig.java");
 
         if (cacheCfg.exists()) {


Mime
View raw message