EDU-376 NPE while creating course from local file
authorLiana Bakradze <liana.bakradze@jetbrains.com>
Wed, 15 Jul 2015 14:08:06 +0000 (17:08 +0300)
committerLiana Bakradze <liana.bakradze@jetbrains.com>
Wed, 15 Jul 2015 14:08:06 +0000 (17:08 +0300)
python/educational/interactive-learning/src/com/jetbrains/edu/learning/courseGeneration/StudyProjectGenerator.java

index 9ac371f60fa0b5c78dae9ab4065125896638e8bc..c3ac659ccab22031064fb9b2bdbe3716c1feb362 100644 (file)
@@ -352,6 +352,10 @@ public class StudyProjectGenerator {
       ZipUtil.unzip(null, courseDir, file, null, null, true);
       CourseInfo courseName = addCourse(myCourses, courseDir);
       flushCache();
+      if (courseName != null && !courseName.getName().equals(unzippedName)) {
+        courseDir.renameTo(new File(myCoursesDir, courseName.getName()));
+        courseDir.delete();
+      }
       return courseName;
     }
     catch (IOException e) {