From 7c734c7c35a2966934a8ab5b37e7a4aaf2c5bf96 Mon Sep 17 00:00:00 2001 From: nimirum Date: Mon, 14 Sep 2015 14:05:47 +0300 Subject: [PATCH 01/14] #115 All red String urls changed to URI urls --- maven-wrapper/pom.xml | 2 +- .../CheckForNewExercisesOrUpdates.java | 2 +- .../cs/tmc/actions/ReviewEventListener.java | 3 ++- .../fi/helsinki/cs/tmc/model/CourseDb.java | 7 +++--- .../cs/tmc/model/PushEventListener.java | 7 +++--- .../helsinki/cs/tmc/model/ServerAccess.java | 22 +++++++++---------- .../cs/tmc/spyware/EventSendBuffer.java | 9 ++++---- .../helsinki/cs/tmc/ui/CodeReviewDialog.form | 1 + .../helsinki/cs/tmc/ui/CodeReviewDialog.java | 2 +- 9 files changed, 30 insertions(+), 25 deletions(-) diff --git a/maven-wrapper/pom.xml b/maven-wrapper/pom.xml index 2cf2a5b0..d93d411c 100644 --- a/maven-wrapper/pom.xml +++ b/maven-wrapper/pom.xml @@ -286,7 +286,7 @@ ${project.groupId} tmc-checkstyle-runner - 2.1.2-SNAPSHOT + 2.1.1 com.puppycrawl.tools diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/CheckForNewExercisesOrUpdates.java b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/CheckForNewExercisesOrUpdates.java index 38935720..b15c45f0 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/CheckForNewExercisesOrUpdates.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/CheckForNewExercisesOrUpdates.java @@ -141,7 +141,7 @@ public void bgTaskFailed(Throwable ex) { public Course call() throws Exception { logger.info("Downloading course to refresh cache"); currentCourseFuture = - tmcCore.getCourse(currentCourseBeforeUpdate.getDetailsUrlAsUri()); + tmcCore.getCourse(currentCourseBeforeUpdate.getDetailsUrl()); return currentCourseFuture.get(); } diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/ReviewEventListener.java b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/ReviewEventListener.java index b93feada..ebdd2bf7 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/ReviewEventListener.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/ReviewEventListener.java @@ -24,6 +24,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; +import java.net.URI; import java.nio.charset.Charset; import java.util.logging.Level; import java.util.logging.Logger; @@ -175,7 +176,7 @@ private void sendLoggableEvent(Review review) { private static class ReviewOpened { public final int id; public final int submissionId; - public final String url; + public final URI url; public final boolean markedAsRead; public ReviewOpened(Review review) { diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/model/CourseDb.java b/tmc-plugin/src/fi/helsinki/cs/tmc/model/CourseDb.java index b5fce710..a5995090 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/model/CourseDb.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/model/CourseDb.java @@ -11,6 +11,7 @@ import java.io.IOException; import java.io.Reader; import java.io.Writer; +import java.net.URI; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -142,13 +143,13 @@ public List getCurrentCourseUnlockableExercises() { List result = new ArrayList(); Course course = getCurrentCourse(); if (course != null) { - List unlockables = course.getUnlockables(); + List unlockables = course.getUnlockables(); if (unlockables == null) { unlockables = Collections.emptyList(); } - for (String exerciseName : unlockables) { + for (URI exerciseName : unlockables) { for (Exercise ex : course.getExercises()) { - if (ex.getName().equals(exerciseName)) { + if (ex.getName().equals(exerciseName.toString())) { result.add(ex); } } diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/model/PushEventListener.java b/tmc-plugin/src/fi/helsinki/cs/tmc/model/PushEventListener.java index 08603c75..9f45f66f 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/model/PushEventListener.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/model/PushEventListener.java @@ -4,6 +4,7 @@ import fi.helsinki.cs.tmc.events.TmcEvent; import fi.helsinki.cs.tmc.events.TmcEventBus; import fi.helsinki.cs.tmc.events.TmcEventListener; +import java.net.URI; import java.util.HashMap; import java.util.Map; import java.util.TimerTask; @@ -120,12 +121,12 @@ private synchronized void initClientIfPossible() { return; } - String cometUrl = course.getCometUrl(); + URI cometUrl = course.getCometUrl(); if (cometUrl == null) { return; } - ClientTransport transport = createWebSocketTransport(cometUrl); - client = new BayeuxClient(cometUrl, transport); + ClientTransport transport = createWebSocketTransport(cometUrl.toString()); + client = new BayeuxClient(cometUrl.toString(), transport); client.getChannel(Channel.META_HANDSHAKE).addListener(handshakeListener); client.getChannel(Channel.META_DISCONNECT).addListener(disconnectListener); diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/model/ServerAccess.java b/tmc-plugin/src/fi/helsinki/cs/tmc/model/ServerAccess.java index 932ab7db..420c436a 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/model/ServerAccess.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/model/ServerAccess.java @@ -134,8 +134,8 @@ public boolean cancel() { @Deprecated public CancellableCallable getFullCourseInfoTask(Course courseStub) { - String url = addApiCallQueryParameters(courseStub.getDetailsUrl()); - final CancellableCallable download = createHttpTasks().getForText(url); + URI url = URI.create(addApiCallQueryParameters(courseStub.getDetailsUrl().toString())); + final CancellableCallable download = createHttpTasks().getForText(url.toString()); return new CancellableCallable() { @Override public Course call() throws Exception { @@ -177,22 +177,22 @@ public boolean cancel() { } private String getUnlockUrl(Course course) { - return addApiCallQueryParameters(course.getUnlockUrl()); + return addApiCallQueryParameters(course.getUnlockUrl().toString()); } public CancellableCallable getDownloadingExerciseZipTask(Exercise exercise) { - String zipUrl = exercise.getDownloadUrl(); - return createHttpTasks().getForBinary(zipUrl); + URI zipUrl = exercise.getDownloadUrl(); + return createHttpTasks().getForBinary(zipUrl.toString()); } public CancellableCallable getDownloadingExerciseSolutionZipTask(Exercise exercise) { - String zipUrl = exercise.getSolutionDownloadUrl(); - return createHttpTasks().getForBinary(zipUrl); + URI zipUrl = exercise.getSolutionDownloadUrl(); + return createHttpTasks().getForBinary(zipUrl.toString()); } public CancellableCallable getSubmittingExerciseTask( final Exercise exercise, final byte[] sourceZip, Map extraParams) { - final String submitUrl = addApiCallQueryParameters(exercise.getReturnUrl()); + final URI submitUrl = URI.create(addApiCallQueryParameters(exercise.getReturnUrl().toString())); Map params = new LinkedHashMap(); params.put("client_time", "" + (System.currentTimeMillis() / 1000L)); @@ -202,7 +202,7 @@ public CancellableCallable getSubmittingExerciseTask( final CancellableCallable upload = createHttpTasks() .uploadFileForTextDownload( - submitUrl, params, "submission[file]", sourceZip); + submitUrl.toString(), params, "submission[file]", sourceZip); return new CancellableCallable() { @Override @@ -254,8 +254,8 @@ public CancellableCallable getSubmissionFetchTask(String submissionUrl) } public CancellableCallable> getDownloadingReviewListTask(Course course) { - String url = addApiCallQueryParameters(course.getReviewsUrl()); - final CancellableCallable download = createHttpTasks().getForText(url); + URI url = URI.create(addApiCallQueryParameters(course.getReviewsUrl().toString())); + final CancellableCallable download = createHttpTasks().getForText(url.toString()); return new CancellableCallable>() { @Override public List call() throws Exception { diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/EventSendBuffer.java b/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/EventSendBuffer.java index 3501b9a3..ae1406b7 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/EventSendBuffer.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/EventSendBuffer.java @@ -23,6 +23,7 @@ import org.openide.util.Exceptions; import java.io.IOException; +import java.net.URI; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; @@ -248,7 +249,7 @@ private String pickDestinationUrl() { return null; } - List urls = course.getSpywareUrls(); + List urls = course.getSpywareUrls(); if (urls == null || urls.isEmpty()) { log.log( Level.INFO, @@ -256,7 +257,7 @@ private String pickDestinationUrl() { return null; } - String url = urls.get(random.nextInt(urls.size())); + String url = urls.get(random.nextInt(urls.size())).toString(); return url; } @@ -316,8 +317,8 @@ private void clearAfterSend(List success) { private void addCorrectSpywareUrl( final String url, Optional currentCourse) { - List spywareUrls = new ArrayList(); - String finalUrl = serverAccess.addApiCallQueryParameters(url); + List spywareUrls = new ArrayList(); + URI finalUrl = URI.create(serverAccess.addApiCallQueryParameters(url)); spywareUrls.add(finalUrl); currentCourse.get().setSpywareUrls(spywareUrls); } diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/ui/CodeReviewDialog.form b/tmc-plugin/src/fi/helsinki/cs/tmc/ui/CodeReviewDialog.form index c0f7bfc6..5e3e663e 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/ui/CodeReviewDialog.form +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/ui/CodeReviewDialog.form @@ -7,6 +7,7 @@ + diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/ui/CodeReviewDialog.java b/tmc-plugin/src/fi/helsinki/cs/tmc/ui/CodeReviewDialog.java index 79629d01..577127b3 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/ui/CodeReviewDialog.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/ui/CodeReviewDialog.java @@ -59,7 +59,7 @@ private String getPointsAwardedText(Review review) { private void openInBrowser() { try { - HtmlBrowser.URLDisplayer.getDefault().showURLExternal(new URL(review.getUrl())); + HtmlBrowser.URLDisplayer.getDefault().showURLExternal(new URL(review.getUrl().toString())); } catch (MalformedURLException ex) { log.log(Level.WARNING, "Malformed URL: " + ex.getMessage(), ex); } From a1f0aa8748d9f60270f3d144421a691dd10ae821 Mon Sep 17 00:00:00 2001 From: nimirum Date: Thu, 17 Sep 2015 15:53:08 +0300 Subject: [PATCH 02/14] Added a blank line to PushEventListener --- tmc-plugin/src/fi/helsinki/cs/tmc/model/PushEventListener.java | 1 + 1 file changed, 1 insertion(+) diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/model/PushEventListener.java b/tmc-plugin/src/fi/helsinki/cs/tmc/model/PushEventListener.java index 9f45f66f..17e7783d 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/model/PushEventListener.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/model/PushEventListener.java @@ -4,6 +4,7 @@ import fi.helsinki.cs.tmc.events.TmcEvent; import fi.helsinki.cs.tmc.events.TmcEventBus; import fi.helsinki.cs.tmc.events.TmcEventListener; + import java.net.URI; import java.util.HashMap; import java.util.Map; From d442642aa81432c4ec03d8d227d75323d2259bfc Mon Sep 17 00:00:00 2001 From: nimirum Date: Wed, 23 Sep 2015 12:59:22 +0300 Subject: [PATCH 03/14] Strings refactored to Paths --- .../helsinki/cs/tmc/layergen/UpdateCenterLayerGen.java | 3 ++- .../src/fi/helsinki/cs/tmc/model/NbTmcSettings.java | 9 ++++++--- .../src/fi/helsinki/cs/tmc/model/ProjectMediator.java | 9 ++++++--- .../src/fi/helsinki/cs/tmc/model/SourceFileLookup.java | 9 ++++++--- .../utilities/urlcallback/CallbackURLStreamHandler.java | 7 ++++--- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/layergen/UpdateCenterLayerGen.java b/tmc-plugin/src/fi/helsinki/cs/tmc/layergen/UpdateCenterLayerGen.java index 96dd7c9f..ad8dca97 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/layergen/UpdateCenterLayerGen.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/layergen/UpdateCenterLayerGen.java @@ -14,6 +14,7 @@ import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; +import java.nio.file.Paths; import java.util.Collection; /** @@ -44,7 +45,7 @@ public InputStream openInputStream() { public UpdateCenterLayerGen() { synchronized (UpdateCenterLayerGen.class) { if (!callbackRegistered) { - CallbackURLStreamHandler.registerCallback(CALLBACK_NAME, callback); + CallbackURLStreamHandler.registerCallback(Paths.get(CALLBACK_NAME), callback); } callbackRegistered = true; } diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java b/tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java index 41be88f3..0ecc8bcc 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java @@ -7,6 +7,9 @@ import fi.helsinki.cs.tmc.tailoring.Tailoring; import fi.helsinki.cs.tmc.core.configuration.TmcSettings; import fi.helsinki.cs.tmc.core.domain.Course; + +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Locale; /** @@ -143,7 +146,7 @@ public void setSavingPassword(boolean shouldSave) { if (shouldSave) { settings.put(PREF_PASSWORD, unsavedPassword); } else { - settings.remove(PREF_PASSWORD); + settings.remove(PREF_PASSWORD); } } @@ -153,9 +156,9 @@ public boolean isSavingPassword() { @Override public String getTmcMainDirectory() { - String path = settings.get(PREF_PROJECT_ROOT_DIR, null); + Path path = Paths.get(settings.get(PREF_PROJECT_ROOT_DIR, null)); if (path != null) { - return path; + return path.toString(); } else { // Can sometimes take a while. That's why we don't pass it as a default above. return ProjectMediator.getDefaultProjectRootDir(); diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/model/ProjectMediator.java b/tmc-plugin/src/fi/helsinki/cs/tmc/model/ProjectMediator.java index 54a69877..9a2caa15 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/model/ProjectMediator.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/model/ProjectMediator.java @@ -2,8 +2,11 @@ import fi.helsinki.cs.tmc.core.domain.Exercise; import fi.helsinki.cs.tmc.utilities.ExceptionUtils; + import java.io.File; import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -113,13 +116,13 @@ public File getCourseRootDir(String courseName) { * The exercise must have a course name set. */ public File getProjectDirForExercise(Exercise ex) { - String path = + Path path = Paths.get( getProjectRootDir() + File.separator + ex.getCourseName() + File.separator - + ex.getName().replaceAll("-", "/"); - File file = new File(path); + + ex.getName().replaceAll("-", "/")); + File file = path.toFile(); return FileUtil.normalizeFile(file); } diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/model/SourceFileLookup.java b/tmc-plugin/src/fi/helsinki/cs/tmc/model/SourceFileLookup.java index c04a71c6..00d0712d 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/model/SourceFileLookup.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/model/SourceFileLookup.java @@ -2,6 +2,9 @@ import fi.helsinki.cs.tmc.core.domain.Exercise; +import java.nio.file.Path; +import java.nio.file.Paths; + import org.netbeans.api.java.classpath.GlobalPathRegistry; import org.openide.filesystems.FileObject; @@ -24,13 +27,13 @@ private SourceFileLookup( public FileObject findSourceFileFor(Exercise exercise, String className) { String outerClassName = className.replaceAll("\\$.*$", ""); - String path = outerClassName.replace('.', '/') + ".java"; + Path path = Paths.get(outerClassName.replace('.', '/') + ".java"); TmcProjectInfo correctProject = projectMediator.tryGetProjectForExercise(exercise); for (FileObject sr : globalPathRegistry.getSourceRoots()) { TmcProjectInfo p = projectMediator.tryGetProjectOwningFile(sr); if (p != null && p.equals(correctProject)) { - FileObject result = sr.getFileObject(path); + FileObject result = sr.getFileObject(path.toString()); if (result != null) { return result; } @@ -38,6 +41,6 @@ public FileObject findSourceFileFor(Exercise exercise, String className) { } // Fall back to findResource picking a source root from any project. - return GlobalPathRegistry.getDefault().findResource(path); + return GlobalPathRegistry.getDefault().findResource(path.toString()); } } diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/urlcallback/CallbackURLStreamHandler.java b/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/urlcallback/CallbackURLStreamHandler.java index 9fa0574e..7700bbef 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/urlcallback/CallbackURLStreamHandler.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/urlcallback/CallbackURLStreamHandler.java @@ -9,6 +9,7 @@ import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; +import java.nio.file.Path; import java.util.Map; /** @@ -23,11 +24,11 @@ public class CallbackURLStreamHandler extends URLStreamHandler { private static final Map callbacks = Maps.newHashMap(); - public static void registerCallback(String path, URLCallback callback) { + public static void registerCallback(Path path, URLCallback callback) { if (callback == null) { - callbacks.remove(path); + callbacks.remove(path.toString()); } else { - callbacks.put(path, callback); + callbacks.put(path.toString(), callback); } } From 12ab8b8b2e14db67d8366ce607bc5b1216a0e2b7 Mon Sep 17 00:00:00 2001 From: nimirum Date: Wed, 23 Sep 2015 16:29:47 +0300 Subject: [PATCH 04/14] More Strings refactored to Paths --- .../cs/tmc/model/PushEventListener.java | 1 + .../SourceSnapshotEventSource.java | 10 +++-- .../eventsources/TextInsertEventSource.java | 6 ++- .../cs/tmc/utilities/TmcFileUtils.java | 12 +++--- .../tmc/utilities/zip/NbProjectUnzipper.java | 38 +++++++++--------- .../functionaltests/utils/FakeTmcServer.java | 39 +++++++++++-------- 6 files changed, 60 insertions(+), 46 deletions(-) diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/model/PushEventListener.java b/tmc-plugin/src/fi/helsinki/cs/tmc/model/PushEventListener.java index 17e7783d..6a553bc0 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/model/PushEventListener.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/model/PushEventListener.java @@ -11,6 +11,7 @@ import java.util.TimerTask; import java.util.logging.Level; import java.util.logging.Logger; + import org.cometd.bayeux.Channel; import org.cometd.bayeux.Message; import org.cometd.bayeux.client.ClientSession; diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/SourceSnapshotEventSource.java b/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/SourceSnapshotEventSource.java index 4395a50a..a4239035 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/SourceSnapshotEventSource.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/SourceSnapshotEventSource.java @@ -23,6 +23,8 @@ import java.io.Closeable; import java.io.File; import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.SwingUtilities; @@ -102,27 +104,27 @@ public void fileRenamed(FileRenameEvent fre) { public void fileAttributeChanged(FileAttributeEvent fae) {} private void reactToChange(final ChangeType changeType, final FileObject fileObject) { - String filePath = TmcFileUtils.tryGetPathRelativeToProject(fileObject); + Path filePath = Paths.get(TmcFileUtils.tryGetPathRelativeToProject(fileObject)); if (filePath == null) { return; } String metadata = JsonMaker.create() .add("cause", changeType.name().toLowerCase()) - .add("file", filePath) + .add("file", filePath.toString()) .toString(); invokeSnapshotThreadViaEdt(fileObject, metadata); } private void reactToRename(final ChangeType changeType, final FileRenameEvent renameEvent) { - String filePath = TmcFileUtils.tryGetPathRelativeToProject(renameEvent.getFile()); + Path filePath = Paths.get(TmcFileUtils.tryGetPathRelativeToProject(renameEvent.getFile())); if (filePath == null) { return; } String metadata = JsonMaker.create() .add("cause", changeType.name().toLowerCase()) - .add("file", filePath) + .add("file", filePath.toString()) .add("previous_name", renameEvent.getName() + "." + renameEvent.getExt()) .toString(); invokeSnapshotThreadViaEdt(renameEvent.getFile(), metadata); diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/TextInsertEventSource.java b/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/TextInsertEventSource.java index 0e9ff652..2a548a8c 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/TextInsertEventSource.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/TextInsertEventSource.java @@ -25,6 +25,8 @@ import java.beans.PropertyChangeListener; import java.io.Closeable; import java.nio.charset.Charset; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -168,10 +170,10 @@ private void sendEvent(Exercise ex, String eventType, String text) { private String generatePatchDescription( FileObject fo, List patches, boolean patchContainsFullDocument) { - String filePath = TmcFileUtils.tryGetPathRelativeToProject(fo); + Path filePath = Paths.get(TmcFileUtils.tryGetPathRelativeToProject(fo)); if (filePath != null) { return JsonMaker.create() - .add("file", filePath) + .add("file", filePath.toString()) .add("patches", PATCH_GENERATOR.patch_toText(patches)) .add("full_document", patchContainsFullDocument) .toString(); diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/TmcFileUtils.java b/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/TmcFileUtils.java index fae2dd9b..5efa896a 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/TmcFileUtils.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/TmcFileUtils.java @@ -1,5 +1,7 @@ package fi.helsinki.cs.tmc.utilities; +import java.nio.file.Path; +import java.nio.file.Paths; import org.netbeans.api.project.FileOwnerQuery; import org.netbeans.api.project.Project; @@ -13,20 +15,20 @@ public class TmcFileUtils { * Otherwise returns null. */ public static String tryGetPathRelativeToProject(FileObject fileObject) { - String filePath = fileObject.getPath(); + Path filePath = Paths.get(fileObject.getPath()); try { Project p = FileOwnerQuery.getOwner(fileObject); String projectDirectory = p.getProjectDirectory().getPath(); - if (filePath.contains(projectDirectory)) { + if (filePath.toString().contains(projectDirectory)) { filePath = - filePath.substring( - filePath.indexOf(projectDirectory) + projectDirectory.length()); + Paths.get(filePath.toString().substring( + filePath.toString().indexOf(projectDirectory) + projectDirectory.length())); } } catch (Exception e) { return null; } - return filePath; + return filePath.toString(); } } diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/zip/NbProjectUnzipper.java b/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/zip/NbProjectUnzipper.java index 6e554a65..2a97ea83 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/zip/NbProjectUnzipper.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/zip/NbProjectUnzipper.java @@ -12,6 +12,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -148,11 +150,11 @@ public Result unzipProject(byte[] data, File projectDir, boolean reallyWriteFile ZipEntry zent; while ((zent = zis.getNextEntry()) != null) { if (zent.getName().startsWith(projectDirInZip)) { - String restOfPath = zent.getName().substring(projectDirInZip.length()); - restOfPath = trimSlashes(restOfPath); + Path restOfPath = Paths.get(zent.getName().substring(projectDirInZip.length())); + restOfPath = trimSlashes(restOfPath.toString()); - String destFileRelativePath = trimSlashes(restOfPath.replace("/", File.separator)); - pathsInZip.add(destFileRelativePath); + Path destFileRelativePath = trimSlashes(restOfPath.toString().replace("/", File.separator)); + pathsInZip.add(destFileRelativePath.toString()); File destFile = new File(projectDir.toString() + File.separator + destFileRelativePath); @@ -167,17 +169,17 @@ public Result unzipProject(byte[] data, File projectDir, boolean reallyWriteFile if (destFile.exists()) { if (fileContentEquals(destFile, entryData)) { shouldWrite = false; - result.unchangedFiles.add(destFileRelativePath); - } else if (overwriting.mayOverwrite(destFileRelativePath)) { + result.unchangedFiles.add(destFileRelativePath.toString()); + } else if (overwriting.mayOverwrite(destFileRelativePath.toString())) { shouldWrite = true; - result.overwrittenFiles.add(destFileRelativePath); + result.overwrittenFiles.add(destFileRelativePath.toString()); } else { shouldWrite = false; - result.skippedFiles.add(destFileRelativePath); + result.skippedFiles.add(destFileRelativePath.toString()); } } else { shouldWrite = true; - result.newFiles.add(destFileRelativePath); + result.newFiles.add(destFileRelativePath.toString()); } if (shouldWrite && reallyWriteFiles) { FileUtils.forceMkdir(destFile.getParentFile()); @@ -204,40 +206,40 @@ private void deleteFilesNotInZip( boolean reallyWriteFiles) throws IOException { for (File file : curDir.listFiles()) { - String relPath = file.getPath().substring(projectDir.getPath().length()); - relPath = trimSlashes(relPath); + Path relPath = Paths.get(file.getPath().substring(projectDir.getPath().length())); + relPath = trimSlashes(relPath.toString()); if (file.isDirectory()) { deleteFilesNotInZip( projectDir, file, result, pathsInZip, overwriting, reallyWriteFiles); } - if (!pathsInZip.contains(relPath)) { - if (overwriting.mayDelete(relPath)) { + if (!pathsInZip.contains(relPath.toString())) { + if (overwriting.mayDelete(relPath.toString())) { if (file.isDirectory() && file.listFiles().length > 0) { // Won't delete directories if they still have contents - result.skippedDeletingFiles.add(relPath); + result.skippedDeletingFiles.add(relPath.toString()); } else { if (reallyWriteFiles) { file.delete(); } - result.deletedFiles.add(relPath); + result.deletedFiles.add(relPath.toString()); } } else { - result.skippedDeletingFiles.add(relPath); + result.skippedDeletingFiles.add(relPath.toString()); } } } } - private String trimSlashes(String s) { + private Path trimSlashes(String s) { while (s.startsWith("/") || s.startsWith(File.separator)) { s = s.substring(1); } while (s.endsWith("/") || s.startsWith(File.separator)) { s = s.substring(0, s.length() - 1); } - return s; + return Paths.get(s); } private String findProjectDirInZip(byte[] data) throws IOException { diff --git a/tmc-plugin/test/qa-functional/src/fi/helsinki/cs/tmc/functionaltests/utils/FakeTmcServer.java b/tmc-plugin/test/qa-functional/src/fi/helsinki/cs/tmc/functionaltests/utils/FakeTmcServer.java index 5c4540be..c8e51ff8 100644 --- a/tmc-plugin/test/qa-functional/src/fi/helsinki/cs/tmc/functionaltests/utils/FakeTmcServer.java +++ b/tmc-plugin/test/qa-functional/src/fi/helsinki/cs/tmc/functionaltests/utils/FakeTmcServer.java @@ -2,21 +2,25 @@ import fi.helsinki.cs.tmc.model.ServerAccess; import fi.helsinki.cs.tmc.testing.AdHocHttpServer; + import java.io.UnsupportedEncodingException; -import org.apache.http.entity.StringEntity; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; + import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.utils.URLEncodedUtils; +import org.apache.http.entity.StringEntity; import org.apache.http.entity.ByteArrayEntity; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpRequestHandler; @@ -29,19 +33,19 @@ public class FakeTmcServer extends AdHocHttpServer { private String expectedPassword; private String coursesJson = "{}"; private Map courseDetails = new HashMap(); - + private HashMap zipFiles = new HashMap(); public FakeTmcServer() { setHandler(new Handler()); } - + public synchronized FakeTmcServer expectUser(String username, String password) { this.expectedUsername = username; this.expectedPassword = password; return this; } - + public synchronized void respondWithCourses(String coursesJson) { this.coursesJson = coursesJson; } @@ -49,11 +53,11 @@ public synchronized void respondWithCourses(String coursesJson) { public synchronized void respondWithCourseDetails(String id, String courseDetailsJson) { this.courseDetails.put(id, courseDetailsJson); } - + public synchronized void putZipFile(String path, byte[] data) { zipFiles.put(path, data); } - + public synchronized void clearResponses() { coursesJson = "{}"; courseDetails.clear(); @@ -63,6 +67,7 @@ public synchronized void clearResponses() { private static final Pattern courseRegex = Pattern.compile("/courses/(.+)\\.json"); private class Handler implements HttpRequestHandler { + @Override public void handle(HttpRequest req, HttpResponse resp, HttpContext hc) throws HttpException, IOException { synchronized (FakeTmcServer.this) { @@ -75,34 +80,34 @@ public void handle(HttpRequest req, HttpResponse resp, HttpContext hc) throws Ht Map params = parseQueryParameters(uri); - String path = uri.getPath(); - debug("Path: " + path); + Path path = Paths.get(uri.getPath()); + debug("Path: " + path.toString()); if (path.startsWith("/courses.json")) { authenticate(params); debug("Responding with course list: " + coursesJson); respondWithJson(resp, coursesJson); - } else if (courseRegex.matcher(path).matches()) { - Matcher m = courseRegex.matcher(path); + } else if (courseRegex.matcher(path.toString()).matches()) { + Matcher m = courseRegex.matcher(path.toString()); m.matches(); String id = m.group(1); -System.out.println(courseDetails); -System.out.println(id); + System.out.println(courseDetails); + System.out.println(id); String response = courseDetails.get(id); if (response != null) { authenticate(params); debug("Responding with course details: " + response); respondWithJson(resp, response); } else { - debug("Unknown course path: " + path); + debug("Unknown course path: " + path.toString()); resp.setStatusCode(404); resp.setEntity(new StringEntity("Not Found")); } - } else if (zipFiles.containsKey(path)) { - respondWithBinary(resp, zipFiles.get(path), "application/zip"); + } else if (zipFiles.containsKey(path.toString())) { + respondWithBinary(resp, zipFiles.get(path.toString()), "application/zip"); } else { - debug("Unknown path: " + path); + debug("Unknown path: " + path.toString()); resp.setStatusCode(404); resp.setEntity(new StringEntity("Not Found")); } @@ -137,7 +142,7 @@ private void respondWithJson(HttpResponse resp, String json) { } private void respondWithBinary(HttpResponse resp, byte[] data, String mimeType) { - ByteArrayEntity entity = new ByteArrayEntity(data); + ByteArrayEntity entity = new ByteArrayEntity(data); entity.setContentType(mimeType); resp.setEntity(entity); } From 35395a6f8c0591665812563948f731da2599580c Mon Sep 17 00:00:00 2001 From: nimirum Date: Wed, 23 Sep 2015 16:36:07 +0300 Subject: [PATCH 05/14] Useless space removed --- tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java b/tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java index 0ecc8bcc..4ac2fadc 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java @@ -146,7 +146,7 @@ public void setSavingPassword(boolean shouldSave) { if (shouldSave) { settings.put(PREF_PASSWORD, unsavedPassword); } else { - settings.remove(PREF_PASSWORD); + settings.remove(PREF_PASSWORD); } } From 79ea2e0999c6da56e8f606bc5a10e5114f4f6bfa Mon Sep 17 00:00:00 2001 From: nimirum Date: Wed, 30 Sep 2015 12:23:50 +0300 Subject: [PATCH 06/14] Map String key changed to Path --- .../tmc/utilities/urlcallback/CallbackURLStreamHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/urlcallback/CallbackURLStreamHandler.java b/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/urlcallback/CallbackURLStreamHandler.java index 7700bbef..0609530a 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/urlcallback/CallbackURLStreamHandler.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/urlcallback/CallbackURLStreamHandler.java @@ -22,13 +22,13 @@ @URLStreamHandlerRegistration(protocol = "callback") public class CallbackURLStreamHandler extends URLStreamHandler { - private static final Map callbacks = Maps.newHashMap(); + private static final Map callbacks = Maps.newHashMap(); public static void registerCallback(Path path, URLCallback callback) { if (callback == null) { - callbacks.remove(path.toString()); + callbacks.remove(path); } else { - callbacks.put(path.toString(), callback); + callbacks.put(path, callback); } } From 64407504a0982ac9573e91cf44db3b636cbd9f39 Mon Sep 17 00:00:00 2001 From: nimirum Date: Thu, 1 Oct 2015 14:22:35 +0300 Subject: [PATCH 07/14] TmcFileUtils returns Path instead of String --- tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java | 7 ++++--- .../spyware/eventsources/SourceSnapshotEventSource.java | 5 ++--- .../cs/tmc/spyware/eventsources/TextInsertEventSource.java | 3 +-- .../src/fi/helsinki/cs/tmc/utilities/TmcFileUtils.java | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java b/tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java index 4ac2fadc..26ebd236 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/model/NbTmcSettings.java @@ -156,9 +156,10 @@ public boolean isSavingPassword() { @Override public String getTmcMainDirectory() { - Path path = Paths.get(settings.get(PREF_PROJECT_ROOT_DIR, null)); - if (path != null) { - return path.toString(); + String target = settings.get(PREF_PROJECT_ROOT_DIR, null); + //TODO: Change String to Path in TmcSettings + if (target != null) { + return target; } else { // Can sometimes take a while. That's why we don't pass it as a default above. return ProjectMediator.getDefaultProjectRootDir(); diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/SourceSnapshotEventSource.java b/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/SourceSnapshotEventSource.java index a4239035..10383ac2 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/SourceSnapshotEventSource.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/SourceSnapshotEventSource.java @@ -24,7 +24,6 @@ import java.io.File; import java.io.IOException; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.SwingUtilities; @@ -104,7 +103,7 @@ public void fileRenamed(FileRenameEvent fre) { public void fileAttributeChanged(FileAttributeEvent fae) {} private void reactToChange(final ChangeType changeType, final FileObject fileObject) { - Path filePath = Paths.get(TmcFileUtils.tryGetPathRelativeToProject(fileObject)); + Path filePath = TmcFileUtils.tryGetPathRelativeToProject(fileObject); if (filePath == null) { return; } @@ -117,7 +116,7 @@ private void reactToChange(final ChangeType changeType, final FileObject fileObj } private void reactToRename(final ChangeType changeType, final FileRenameEvent renameEvent) { - Path filePath = Paths.get(TmcFileUtils.tryGetPathRelativeToProject(renameEvent.getFile())); + Path filePath = TmcFileUtils.tryGetPathRelativeToProject(renameEvent.getFile()); if (filePath == null) { return; } diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/TextInsertEventSource.java b/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/TextInsertEventSource.java index 2a548a8c..45809ca5 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/TextInsertEventSource.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/TextInsertEventSource.java @@ -26,7 +26,6 @@ import java.io.Closeable; import java.nio.charset.Charset; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -170,7 +169,7 @@ private void sendEvent(Exercise ex, String eventType, String text) { private String generatePatchDescription( FileObject fo, List patches, boolean patchContainsFullDocument) { - Path filePath = Paths.get(TmcFileUtils.tryGetPathRelativeToProject(fo)); + Path filePath = TmcFileUtils.tryGetPathRelativeToProject(fo); if (filePath != null) { return JsonMaker.create() .add("file", filePath.toString()) diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/TmcFileUtils.java b/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/TmcFileUtils.java index 5efa896a..9004ec73 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/TmcFileUtils.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/utilities/TmcFileUtils.java @@ -14,7 +14,7 @@ public class TmcFileUtils { * * Otherwise returns null. */ - public static String tryGetPathRelativeToProject(FileObject fileObject) { + public static Path tryGetPathRelativeToProject(FileObject fileObject) { Path filePath = Paths.get(fileObject.getPath()); try { @@ -29,6 +29,6 @@ public static String tryGetPathRelativeToProject(FileObject fileObject) { return null; } - return filePath.toString(); + return filePath; } } From d6b95ed4e60aabdc087dc9b22dc150aada7cecee Mon Sep 17 00:00:00 2001 From: nimirum Date: Mon, 12 Oct 2015 19:40:12 +0300 Subject: [PATCH 08/14] Unnecessary System.out.printlns removed --- .../fi/helsinki/cs/tmc/functionaltests/utils/FakeTmcServer.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/tmc-plugin/test/qa-functional/src/fi/helsinki/cs/tmc/functionaltests/utils/FakeTmcServer.java b/tmc-plugin/test/qa-functional/src/fi/helsinki/cs/tmc/functionaltests/utils/FakeTmcServer.java index c8e51ff8..f14218eb 100644 --- a/tmc-plugin/test/qa-functional/src/fi/helsinki/cs/tmc/functionaltests/utils/FakeTmcServer.java +++ b/tmc-plugin/test/qa-functional/src/fi/helsinki/cs/tmc/functionaltests/utils/FakeTmcServer.java @@ -92,8 +92,6 @@ public void handle(HttpRequest req, HttpResponse resp, HttpContext hc) throws Ht m.matches(); String id = m.group(1); - System.out.println(courseDetails); - System.out.println(id); String response = courseDetails.get(id); if (response != null) { authenticate(params); From 9ffdc9a88e7457290e49f020dbc5b613eb0f0370 Mon Sep 17 00:00:00 2001 From: nimirum Date: Tue, 13 Oct 2015 10:46:18 +0300 Subject: [PATCH 09/14] Added ServerErrorHelper.getServerExeptionMsg in bgTaskFailed --- .../cs/tmc/runners/TestRunHandler.java | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java b/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java index 8c69cbc3..f1850f5d 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java @@ -3,6 +3,7 @@ import static fi.helsinki.cs.tmc.langs.domain.RunResult.Status.COMPILE_FAILED; import static java.util.logging.Level.INFO; +import fi.helsinki.cs.tmc.actions.ServerErrorHelper; import fi.helsinki.cs.tmc.core.domain.Exercise; import fi.helsinki.cs.tmc.data.ResultCollector; import fi.helsinki.cs.tmc.data.TestCaseResult; @@ -21,6 +22,7 @@ import fi.helsinki.cs.tmc.utilities.BgTaskListener; import fi.helsinki.cs.tmc.utilities.CancellableCallable; +import com.google.common.base.Strings; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.ListenableFuture; @@ -65,16 +67,16 @@ public void performAction(final ResultCollector resultCollector, Project... proj for (final Project project : projects) { final TmcProjectInfo projectInfo = projectMediator.wrapProject(project); eventBus.post(new InvokedEvent(projectInfo)); - BgTaskListener bgTaskListener = - new BgTaskListener() { + BgTaskListener bgTaskListener + = new BgTaskListener() { @Override public void bgTaskReady(RunResult result) { if (result.status == COMPILE_FAILED) { dialogDisplayer.displayError("The code did not compile."); return; } - Exercise ex = - projectMediator.tryGetExerciseForProject(projectInfo, courseDb); + Exercise ex + = projectMediator.tryGetExerciseForProject(projectInfo, courseDb); boolean canSubmit = ex.isReturnable(); resultDisplayer.showLocalRunResult( testResultsToTestCaseResults(result.testResults), @@ -94,15 +96,19 @@ public void bgTaskFailed(Throwable ex) { log.log( INFO, "performAction of TestRunHandler failed with message: {0}, \ntrace: {1}", - new Object[] { + new Object[]{ ex.getMessage(), Throwables.getStackTraceAsString(ex) }); - dialogDisplayer.displayError( - "Failed to run the tests: " + ex.getMessage()); + String msg = ServerErrorHelper.getServerExceptionMsg(ex); + if (!Strings.isNullOrEmpty(msg)) { + dialogDisplayer.displayError( + "Failed to run the tests: " + ex.getMessage()); + } } @Override - public void bgTaskCancelled() {} + public void bgTaskCancelled() { + } }; BgTask.start( "Running tests", @@ -112,9 +118,9 @@ public void bgTaskCancelled() {} @Override public RunResult call() throws Exception { - result = - TmcCoreSingleton.getInstance() - .test(projectInfo.getProjectDirAsPath()); + result + = TmcCoreSingleton.getInstance() + .test(projectInfo.getProjectDirAsPath()); return result.get(); } @@ -131,8 +137,8 @@ private List testResultsToTestCaseResults( ImmutableList testresults) { List testCaseResults = new ArrayList(); for (TestResult result : testresults) { - TestCaseResult testCase = - new TestCaseResult(result.name, result.passed, result.errorMessage); + TestCaseResult testCase + = new TestCaseResult(result.name, result.passed, result.errorMessage); testCaseResults.add(testCase); } return testCaseResults; From ba3e54c3f29a21f2a7a066ebafc1799572c26cc1 Mon Sep 17 00:00:00 2001 From: nimirum Date: Tue, 13 Oct 2015 14:34:43 +0300 Subject: [PATCH 10/14] Identation fixed --- tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java b/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java index f1850f5d..e42d8e8e 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java @@ -75,8 +75,7 @@ public void bgTaskReady(RunResult result) { dialogDisplayer.displayError("The code did not compile."); return; } - Exercise ex - = projectMediator.tryGetExerciseForProject(projectInfo, courseDb); + Exercise ex = projectMediator.tryGetExerciseForProject(projectInfo, courseDb); boolean canSubmit = ex.isReturnable(); resultDisplayer.showLocalRunResult( testResultsToTestCaseResults(result.testResults), From 671a11065bc6c941683b0a6a2dff2256250188cf Mon Sep 17 00:00:00 2001 From: nimirum Date: Tue, 13 Oct 2015 14:44:05 +0300 Subject: [PATCH 11/14] Formation fixed --- maven-wrapper/hs_err_pid12788.log | 319 ++++++++++++++++++ .../cs/tmc/runners/TestRunHandler.java | 89 +++-- 2 files changed, 362 insertions(+), 46 deletions(-) create mode 100644 maven-wrapper/hs_err_pid12788.log diff --git a/maven-wrapper/hs_err_pid12788.log b/maven-wrapper/hs_err_pid12788.log new file mode 100644 index 00000000..e28250ea --- /dev/null +++ b/maven-wrapper/hs_err_pid12788.log @@ -0,0 +1,319 @@ +# +# There is insufficient memory for the Java Runtime Environment to continue. +# Native memory allocation (malloc) failed to allocate 2538720 bytes for Chunk::new +# Possible reasons: +# The system is out of physical RAM or swap space +# In 32 bit mode, the process size limit was hit +# Possible solutions: +# Reduce memory load on the system +# Increase physical memory or swap space +# Check if swap backing store is full +# Use 64 bit Java on a 64 bit OS +# Decrease Java heap size (-Xmx/-Xms) +# Decrease number of Java threads +# Decrease Java thread stack sizes (-Xss) +# Set larger code cache with -XX:ReservedCodeCacheSize= +# This output file may be truncated or incomplete. +# +# Out of Memory Error (allocation.cpp:323), pid=12788, tid=4112 +# +# JRE version: Java(TM) SE Runtime Environment (7.0_67-b01) (build 1.7.0_67-b01) +# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode windows-amd64 compressed oops) +# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows +# + +--------------- T H R E A D --------------- + +Current thread (0x000000000b144800): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=4112, stack(0x000000000c6b0000,0x000000000c7b0000)] + +Stack: [0x000000000c6b0000,0x000000000c7b0000] + +Current CompileTask: +C2: 34410 884 org.objectweb.asm.ClassReader::accept (5641 bytes) + + +--------------- P R O C E S S --------------- + +Java Threads: ( => current thread ) + 0x000000000b158000 JavaThread "Service Thread" daemon [_thread_blocked, id=5324, stack(0x000000000c8b0000,0x000000000c9b0000)] + 0x000000000b146800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=14624, stack(0x000000000c7b0000,0x000000000c8b0000)] +=>0x000000000b144800 JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=4112, stack(0x000000000c6b0000,0x000000000c7b0000)] + 0x000000000b143800 JavaThread "Attach Listener" daemon [_thread_blocked, id=15124, stack(0x000000000c5b0000,0x000000000c6b0000)] + 0x000000000b140800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=10384, stack(0x000000000c4b0000,0x000000000c5b0000)] + 0x000000000b10f000 JavaThread "Finalizer" daemon [_thread_blocked, id=12752, stack(0x000000000c3b0000,0x000000000c4b0000)] + 0x000000000b105800 JavaThread "Reference Handler" daemon [_thread_blocked, id=14440, stack(0x000000000c2b0000,0x000000000c3b0000)] + 0x0000000002cae000 JavaThread "main" [_thread_in_Java, id=13660, stack(0x0000000002b70000,0x0000000002c70000)] + +Other Threads: + 0x000000000b101800 VMThread [stack: 0x000000000c1b0000,0x000000000c2b0000] [id=1752] + 0x000000000b172800 WatcherThread [stack: 0x000000000c9b0000,0x000000000cab0000] [id=15348] + +VM state:not at safepoint (normal execution) + +VM Mutex/Monitor currently owned by a thread: None + +Heap + PSYoungGen total 73728K, used 30396K [0x00000007d5e80000, 0x00000007db580000, 0x0000000800000000) + eden space 62464K, 48% used [0x00000007d5e80000,0x00000007d7bd5d20,0x00000007d9b80000) + from space 11264K, 3% used [0x00000007daa80000,0x00000007daad9570,0x00000007db580000) + to space 13312K, 0% used [0x00000007d9b80000,0x00000007d9b80000,0x00000007da880000) + ParOldGen total 86016K, used 29236K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) + object space 86016K, 33% used [0x0000000781c00000,0x000000078388d1b8,0x0000000787000000) + PSPermGen total 24576K, used 24317K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) + object space 24576K, 98% used [0x000000077ca00000,0x000000077e1bf4d0,0x000000077e200000) + +Card table byte_map: [0x0000000005f20000,0x0000000006340000] byte_map_base: 0x000000000233b000 + +Polling page: 0x0000000001140000 + +Code Cache [0x0000000002e60000, 0x0000000003190000, 0x0000000005e60000) + total_blobs=1216 nmethods=862 adapters=306 free_code_cache=46001Kb largest_free_block=47044288 + +Compilation events (10 events): +Event: 34.307 Thread 0x000000000b146800 920 org.apache.maven.shared.dependency.analyzer.asm.DependencyVisitor::visitLdcInsn (16 bytes) +Event: 34.308 Thread 0x000000000b146800 nmethod 920 0x000000000311b2d0 code [0x000000000311b420, 0x000000000311b4c8] +Event: 34.336 Thread 0x000000000b146800 921 org.apache.maven.shared.dependency.analyzer.asm.DependencyVisitor::visitMethod (27 bytes) +Event: 34.345 Thread 0x000000000b146800 nmethod 921 0x000000000317d750 code [0x000000000317d940, 0x000000000317de40] +Event: 34.348 Thread 0x000000000b146800 922 org.objectweb.asm.ClassReader::a (99 bytes) +Event: 34.368 Thread 0x000000000b146800 nmethod 922 0x0000000003180b50 code [0x0000000003180d80, 0x0000000003181ac8] +Event: 34.398 Thread 0x000000000b146800 924 org.apache.maven.shared.dependency.analyzer.asm.DependencyVisitor::visitCode (1 bytes) +Event: 34.398 Thread 0x000000000b146800 nmethod 924 0x00000000031194d0 code [0x0000000003119600, 0x0000000003119658] +Event: 34.398 Thread 0x000000000b146800 925 org.apache.maven.shared.dependency.analyzer.asm.DependencyVisitor::visitMaxs (1 bytes) +Event: 34.398 Thread 0x000000000b146800 nmethod 925 0x000000000317be10 code [0x000000000317bf40, 0x000000000317bf98] + +GC Heap History (10 events): +Event: 24.295 GC heap before +{Heap before GC invocations=12 (full 0): + PSYoungGen total 71680K, used 67232K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) + eden space 66560K, 100% used [0x00000007d5e80000,0x00000007d9f80000,0x00000007d9f80000) + from space 5120K, 13% used [0x00000007d9f80000,0x00000007da028000,0x00000007da480000) + to space 5120K, 0% used [0x00000007da480000,0x00000007da480000,0x00000007da980000) + ParOldGen total 86016K, used 27985K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) + object space 86016K, 32% used [0x0000000781c00000,0x0000000783754638,0x0000000787000000) + PSPermGen total 24064K, used 23920K [0x000000077ca00000, 0x000000077e180000, 0x0000000781c00000) + object space 24064K, 99% used [0x000000077ca00000,0x000000077e15c138,0x000000077e180000) +Event: 24.297 GC heap after +Heap after GC invocations=12 (full 0): + PSYoungGen total 71680K, used 544K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) + eden space 66560K, 0% used [0x00000007d5e80000,0x00000007d5e80000,0x00000007d9f80000) + from space 5120K, 10% used [0x00000007da480000,0x00000007da508000,0x00000007da980000) + to space 5120K, 0% used [0x00000007d9f80000,0x00000007d9f80000,0x00000007da480000) + ParOldGen total 86016K, used 28145K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) + object space 86016K, 32% used [0x0000000781c00000,0x000000078377c638,0x0000000787000000) + PSPermGen total 24064K, used 23920K [0x000000077ca00000, 0x000000077e180000, 0x0000000781c00000) + object space 24064K, 99% used [0x000000077ca00000,0x000000077e15c138,0x000000077e180000) +} +Event: 24.657 GC heap before +{Heap before GC invocations=13 (full 0): + PSYoungGen total 71680K, used 67104K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) + eden space 66560K, 100% used [0x00000007d5e80000,0x00000007d9f80000,0x00000007d9f80000) + from space 5120K, 10% used [0x00000007da480000,0x00000007da508000,0x00000007da980000) + to space 5120K, 0% used [0x00000007d9f80000,0x00000007d9f80000,0x00000007da480000) + ParOldGen total 86016K, used 28145K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) + object space 86016K, 32% used [0x0000000781c00000,0x000000078377c638,0x0000000787000000) + PSPermGen total 24064K, used 23946K [0x000000077ca00000, 0x000000077e180000, 0x0000000781c00000) + object space 24064K, 99% used [0x000000077ca00000,0x000000077e162900,0x000000077e180000) +Event: 24.661 GC heap after +Heap after GC invocations=13 (full 0): + PSYoungGen total 71680K, used 1792K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) + eden space 66560K, 0% used [0x00000007d5e80000,0x00000007d5e80000,0x00000007d9f80000) + from space 5120K, 35% used [0x00000007d9f80000,0x00000007da140020,0x00000007da480000) + to space 5120K, 0% used [0x00000007da480000,0x00000007da480000,0x00000007da980000) + ParOldGen total 86016K, used 28305K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) + object space 86016K, 32% used [0x0000000781c00000,0x00000007837a4638,0x0000000787000000) + PSPermGen total 24064K, used 23946K [0x000000077ca00000, 0x000000077e180000, 0x0000000781c00000) + object space 24064K, 99% used [0x000000077ca00000,0x000000077e162900,0x000000077e180000) +} +Event: 27.917 GC heap before +{Heap before GC invocations=14 (full 0): + PSYoungGen total 71680K, used 68352K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) + eden space 66560K, 100% used [0x00000007d5e80000,0x00000007d9f80000,0x00000007d9f80000) + from space 5120K, 35% used [0x00000007d9f80000,0x00000007da140020,0x00000007da480000) + to space 5120K, 0% used [0x00000007da480000,0x00000007da480000,0x00000007da980000) + ParOldGen total 86016K, used 28305K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) + object space 86016K, 32% used [0x0000000781c00000,0x00000007837a4638,0x0000000787000000) + PSPermGen total 24576K, used 24069K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) + object space 24576K, 97% used [0x000000077ca00000,0x000000077e1815a0,0x000000077e200000) +Event: 27.934 GC heap after +Heap after GC invocations=14 (full 0): + PSYoungGen total 71680K, used 1306K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) + eden space 66560K, 0% used [0x00000007d5e80000,0x00000007d5e80000,0x00000007d9f80000) + from space 5120K, 25% used [0x00000007da480000,0x00000007da5c6b10,0x00000007da980000) + to space 5120K, 0% used [0x00000007d9f80000,0x00000007d9f80000,0x00000007da480000) + ParOldGen total 86016K, used 28537K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) + object space 86016K, 33% used [0x0000000781c00000,0x00000007837de638,0x0000000787000000) + PSPermGen total 24576K, used 24069K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) + object space 24576K, 97% used [0x000000077ca00000,0x000000077e1815a0,0x000000077e200000) +} +Event: 33.786 GC heap before +{Heap before GC invocations=15 (full 0): + PSYoungGen total 71680K, used 67866K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) + eden space 66560K, 100% used [0x00000007d5e80000,0x00000007d9f80000,0x00000007d9f80000) + from space 5120K, 25% used [0x00000007da480000,0x00000007da5c6b10,0x00000007da980000) + to space 5120K, 0% used [0x00000007d9f80000,0x00000007d9f80000,0x00000007da480000) + ParOldGen total 86016K, used 28537K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) + object space 86016K, 33% used [0x0000000781c00000,0x00000007837de638,0x0000000787000000) + PSPermGen total 24576K, used 24303K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) + object space 24576K, 98% used [0x000000077ca00000,0x000000077e1bbc80,0x000000077e200000) +Event: 33.793 GC heap after +Heap after GC invocations=15 (full 0): + PSYoungGen total 69632K, used 1465K [0x00000007d5e80000, 0x00000007db780000, 0x0000000800000000) + eden space 64512K, 0% used [0x00000007d5e80000,0x00000007d5e80000,0x00000007d9d80000) + from space 5120K, 28% used [0x00000007d9f80000,0x00000007da0ee420,0x00000007da480000) + to space 13312K, 0% used [0x00000007daa80000,0x00000007daa80000,0x00000007db780000) + ParOldGen total 86016K, used 28977K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) + object space 86016K, 33% used [0x0000000781c00000,0x000000078384c638,0x0000000787000000) + PSPermGen total 24576K, used 24303K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) + object space 24576K, 98% used [0x000000077ca00000,0x000000077e1bbc80,0x000000077e200000) +} +Event: 34.224 GC heap before +{Heap before GC invocations=16 (full 0): + PSYoungGen total 69632K, used 65977K [0x00000007d5e80000, 0x00000007db780000, 0x0000000800000000) + eden space 64512K, 100% used [0x00000007d5e80000,0x00000007d9d80000,0x00000007d9d80000) + from space 5120K, 28% used [0x00000007d9f80000,0x00000007da0ee420,0x00000007da480000) + to space 13312K, 0% used [0x00000007daa80000,0x00000007daa80000,0x00000007db780000) + ParOldGen total 86016K, used 28977K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) + object space 86016K, 33% used [0x0000000781c00000,0x000000078384c638,0x0000000787000000) + PSPermGen total 24576K, used 24315K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) + object space 24576K, 98% used [0x000000077ca00000,0x000000077e1bec88,0x000000077e200000) +Event: 34.228 GC heap after +Heap after GC invocations=16 (full 0): + PSYoungGen total 73728K, used 357K [0x00000007d5e80000, 0x00000007db580000, 0x0000000800000000) + eden space 62464K, 0% used [0x00000007d5e80000,0x00000007d5e80000,0x00000007d9b80000) + from space 11264K, 3% used [0x00000007daa80000,0x00000007daad9570,0x00000007db580000) + to space 13312K, 0% used [0x00000007d9b80000,0x00000007d9b80000,0x00000007da880000) + ParOldGen total 86016K, used 29236K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) + object space 86016K, 33% used [0x0000000781c00000,0x000000078388d1b8,0x0000000787000000) + PSPermGen total 24576K, used 24315K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) + object space 24576K, 98% used [0x000000077ca00000,0x000000077e1bec88,0x000000077e200000) +} + +Deoptimization events (10 events): +Event: 21.997 Thread 0x0000000002cae000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x0000000003085af8 method=org.codehaus.plexus.util.xml.Xpp3Dom.mergeIntoXpp3Dom(Lorg/codehaus/plexus/util/xml/Xpp3Dom;Lorg/codehaus/plexus/util/xml/Xpp3Dom;Ljava/lang/Boolean;)V @ 146 +Event: 22.742 Thread 0x0000000002cae000 Uncommon trap: reason=unreached action=reinterpret pc=0x0000000002ff1d7c method=org.apache.maven.model.ConfigurationContainer.getLocation(Ljava/lang/Object;)Lorg/apache/maven/model/InputLocation; @ 4 +Event: 22.748 Thread 0x0000000002cae000 Uncommon trap: reason=unreached action=reinterpret pc=0x0000000002ff099c method=org.apache.maven.model.ConfigurationContainer.getLocation(Ljava/lang/Object;)Lorg/apache/maven/model/InputLocation; @ 4 +Event: 24.560 Thread 0x0000000002cae000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x000000000311be64 method=org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependency(Lorg/apache/maven/model/building/ModelProblemCollector;Lorg/apache/maven/model/Depende +Event: 24.925 Thread 0x0000000002cae000 Uncommon trap: reason=unreached action=reinterpret pc=0x0000000002fc76e4 method=org.apache.maven.model.BuildBase.clone()Lorg/apache/maven/model/BuildBase; @ 140 +Event: 24.992 Thread 0x0000000002cae000 Uncommon trap: reason=unreached action=reinterpret pc=0x000000000300a95c method=org.apache.maven.artifact.DefaultArtifact.selectVersionFromNewRangeIfAvailable()V @ 14 +Event: 24.992 Thread 0x0000000002cae000 Uncommon trap: reason=unreached action=reinterpret pc=0x000000000300a064 method=org.apache.maven.artifact.DefaultArtifact.validateIdentity()V @ 107 +Event: 24.992 Thread 0x0000000002cae000 Uncommon trap: reason=unreached action=reinterpret pc=0x0000000003009388 method=org.apache.maven.artifact.DefaultArtifact.selectVersionFromNewRangeIfAvailable()V @ 14 +Event: 26.679 Thread 0x0000000002cae000 Uncommon trap: reason=class_check action=maybe_recompile pc=0x0000000002f0cf10 method=java.util.concurrent.ConcurrentHashMap$Segment.put(Ljava/lang/Object;ILjava/lang/Object;Z)Ljava/lang/Object; @ 77 +Event: 28.132 Thread 0x0000000002cae000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x00000000031276e0 method=org.apache.maven.bridge.MavenRepositorySystem.XcreateArtifact(Ljava/lang/String;Ljava/lang/String;Lorg/apache/maven/artifact/versioning/VersionRange;Ljava/lang/String;Lja®3tEÿ5@ + +Internal exceptions (10 events): +Event: 33.718 Thread 0x0000000002cae000 Threw 0x00000007d9bf42c0 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 +Event: 33.718 Thread 0x0000000002cae000 Threw 0x00000007d9bf74b8 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 +Event: 33.719 Thread 0x0000000002cae000 Threw 0x00000007d9bfacd0 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 +Event: 33.719 Thread 0x0000000002cae000 Threw 0x00000007d9bfda20 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 +Event: 33.721 Thread 0x0000000002cae000 Threw 0x00000007d9c01628 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 +Event: 33.721 Thread 0x0000000002cae000 Threw 0x00000007d9c054b0 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 +Event: 33.722 Thread 0x0000000002cae000 Threw 0x00000007d9c0bbf8 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 +Event: 33.724 Thread 0x0000000002cae000 Threw 0x00000007d9c1dfb0 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 +Event: 33.724 Thread 0x0000000002cae000 Threw 0x00000007d9c21c78 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 +Event: 33.728 Thread 0x0000000002cae000 Threw 0x00000007d9c49068 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 + +Events (10 events): +Event: 33.728 loading class 0x000000000cf98290 +Event: 33.728 loading class 0x000000000cf98290 done +Event: 33.728 loading class 0x000000000cf98290 +Event: 33.728 loading class 0x000000000cf98290 done +Event: 33.786 Executing VM operation: ParallelGCFailedAllocation +Event: 33.793 Executing VM operation: ParallelGCFailedAllocation done +Event: 33.881 Thread 0x000000000b146800 flushing nmethod 0x00000000031194d0 +Event: 34.224 Executing VM operation: ParallelGCFailedAllocation +Event: 34.228 Executing VM operation: ParallelGCFailedAllocation done +Event: 34.398 Thread 0x000000000b146800 flushing nmethod 0x0000000002fc6d10 + + +Dynamic libraries: +0x00007ff6e7700000 - 0x00007ff6e7733000 c:\Program Files\Java\jdk1.7.0_67\bin\java.exe +0x00007ffc597c0000 - 0x00007ffc5996c000 C:\Windows\SYSTEM32\ntdll.dll +0x00007ffc57800000 - 0x00007ffc5793e000 C:\Windows\system32\KERNEL32.DLL +0x00007ffc56a50000 - 0x00007ffc56b65000 C:\Windows\system32\KERNELBASE.dll +0x00007ffc554c0000 - 0x00007ffc5554e000 C:\Windows\system32\apphelp.dll +0x00000000728d0000 - 0x00000000728fa000 C:\Windows\AppPatch\AppPatch64\EMET64.dll +0x00007ffc57300000 - 0x00007ffc573aa000 C:\Windows\system32\msvcrt.dll +0x00007ffc554a0000 - 0x00007ffc554b2000 C:\Windows\SYSTEM32\WTSAPI32.dll +0x00007ffc49110000 - 0x00007ffc49163000 C:\Windows\AppPatch\AppPatch64\AcGenral.DLL +0x00007ffc56750000 - 0x00007ffc5677e000 C:\Windows\SYSTEM32\SspiCli.dll +0x00007ffc57af0000 - 0x00007ffc57b44000 C:\Windows\system32\SHLWAPI.dll +0x00007ffc57b50000 - 0x00007ffc57cc7000 C:\Windows\system32\USER32.dll +0x00007ffc56f60000 - 0x00007ffc570f4000 C:\Windows\system32\ole32.dll +0x00007ffc58080000 - 0x00007ffc59599000 C:\Windows\system32\SHELL32.dll +0x00007ffc56180000 - 0x00007ffc561a1000 C:\Windows\SYSTEM32\USERENV.dll +0x00007ffc57f10000 - 0x00007ffc57fba000 C:\Windows\system32\ADVAPI32.dll +0x00007ffc51310000 - 0x00007ffc5132e000 C:\Windows\SYSTEM32\MPR.dll +0x00007ffc57100000 - 0x00007ffc57241000 C:\Windows\system32\RPCRT4.dll +0x00007ffc577a0000 - 0x00007ffc577f9000 C:\Windows\SYSTEM32\sechost.dll +0x00007ffc595a0000 - 0x00007ffc597b1000 C:\Windows\SYSTEM32\combase.dll +0x00007ffc579a0000 - 0x00007ffc57aef000 C:\Windows\system32\GDI32.dll +0x00007ffc56920000 - 0x00007ffc56935000 C:\Windows\SYSTEM32\profapi.dll +0x00007ffc55120000 - 0x00007ffc551d2000 C:\Windows\SYSTEM32\SHCORE.dll +0x00007ffc572c0000 - 0x00007ffc572f6000 C:\Windows\system32\IMM32.DLL +0x00007ffc57570000 - 0x00007ffc576c2000 C:\Windows\system32\MSCTF.dll +0x00007ffc54560000 - 0x00007ffc547da000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.9600.17810_none_6240b9c7ecbd0bda\COMCTL32.dll +0x00000000727f0000 - 0x00000000728c2000 c:\Program Files\Java\jdk1.7.0_67\jre\bin\msvcr100.dll +0x0000000072010000 - 0x00000000727e2000 c:\Program Files\Java\jdk1.7.0_67\jre\bin\server\jvm.dll +0x00007ffc517f0000 - 0x00007ffc517f9000 C:\Windows\SYSTEM32\WSOCK32.dll +0x00007ffc53450000 - 0x00007ffc53472000 C:\Windows\SYSTEM32\WINMM.dll +0x00007ffc56e50000 - 0x00007ffc56e57000 C:\Windows\system32\PSAPI.DLL +0x00007ffc57eb0000 - 0x00007ffc57f0a000 C:\Windows\system32\WS2_32.dll +0x00007ffc53410000 - 0x00007ffc5343a000 C:\Windows\SYSTEM32\WINMMBASE.dll +0x00007ffc576d0000 - 0x00007ffc576d9000 C:\Windows\system32\NSI.dll +0x00007ffc56e00000 - 0x00007ffc56e4f000 C:\Windows\SYSTEM32\cfgmgr32.dll +0x00007ffc55730000 - 0x00007ffc55758000 C:\Windows\SYSTEM32\DEVOBJ.dll +0x0000000071fc0000 - 0x0000000071fcf000 c:\Program Files\Java\jdk1.7.0_67\jre\bin\verify.dll +0x0000000071f90000 - 0x0000000071fb8000 c:\Program Files\Java\jdk1.7.0_67\jre\bin\java.dll +0x0000000071f70000 - 0x0000000071f85000 c:\Program Files\Java\jdk1.7.0_67\jre\bin\zip.dll +0x0000000071f50000 - 0x0000000071f69000 C:\Program Files\Java\jdk1.7.0_67\jre\bin\net.dll +0x00007ffc56100000 - 0x00007ffc56159000 C:\Windows\system32\mswsock.dll +0x0000000071f30000 - 0x0000000071f41000 C:\Program Files\Java\jdk1.7.0_67\jre\bin\nio.dll +0x0000000071cb0000 - 0x0000000071cd4000 C:\Program Files\Java\jdk1.7.0_67\jre\bin\sunec.dll +0x0000000071ca0000 - 0x0000000071cab000 C:\Program Files\Java\jdk1.7.0_67\jre\bin\sunmscapi.dll +0x00007ffc56c20000 - 0x00007ffc56dff000 C:\Windows\system32\CRYPT32.dll +0x00007ffc569d0000 - 0x00007ffc569e1000 C:\Windows\system32\MSASN1.dll +0x00007ffc56160000 - 0x00007ffc56180000 C:\Windows\SYSTEM32\CRYPTSP.dll +0x00007ffc55d90000 - 0x00007ffc55dc6000 C:\Windows\system32\rsaenh.dll +0x00007ffc563e0000 - 0x00007ffc56406000 C:\Windows\SYSTEM32\bcrypt.dll +0x00007ffc56780000 - 0x00007ffc567e3000 C:\Windows\system32\bcryptprimitives.dll +0x00007ffc567f0000 - 0x00007ffc567fb000 C:\Windows\SYSTEM32\CRYPTBASE.dll +0x00007ffc50250000 - 0x00007ffc5027a000 C:\Windows\SYSTEM32\IPHLPAPI.DLL +0x00007ffc50240000 - 0x00007ffc5024a000 C:\Windows\SYSTEM32\WINNSI.DLL +0x00007ffc4f770000 - 0x00007ffc4f786000 C:\Windows\SYSTEM32\dhcpcsvc6.DLL +0x00007ffc4f970000 - 0x00007ffc4f98a000 C:\Windows\SYSTEM32\dhcpcsvc.DLL +0x00007ffc55ef0000 - 0x00007ffc55f94000 C:\Windows\SYSTEM32\DNSAPI.dll +0x00007ffc4cff0000 - 0x00007ffc4cffa000 C:\Windows\System32\rasadhlp.dll +0x00007ffc4f890000 - 0x00007ffc4f8fb000 C:\Windows\System32\fwpuclnt.dll +0x00007ffc3c5b0000 - 0x00007ffc3c5c5000 C:\Windows\system32\napinsp.dll +0x00007ffc3c5d0000 - 0x00007ffc3c5ea000 C:\Windows\system32\pnrpnsp.dll +0x00007ffc52430000 - 0x00007ffc5244b000 C:\Windows\system32\NLAapi.dll +0x00007ffc4b5b0000 - 0x00007ffc4b5bd000 C:\Windows\System32\winrnr.dll +0x00007ffc3ca70000 - 0x00007ffc3ca84000 C:\Windows\system32\wshbth.dll + +VM Arguments: +jvm_args: -Dclassworlds.conf=c:/apache-maven-3.3.3-bin/apache-maven-3.3.3/bin/m2.conf -Dmaven.home=c:/apache-maven-3.3.3-bin/apache-maven-3.3.3 -Dmaven.multiModuleProjectDirectory=c:/Users/nexu770/Documents/GitHub/tmc-netbeans/maven-wrapper +java_command: org.codehaus.plexus.classworlds.launcher.Launcher install +Launcher Type: SUN_STANDARD + +Environment Variables: +JAVA_HOME=c:/Program Files/Java/jdk1.7.0_67 +PATH=c:\Users\nexu770\bin;.;C:\Program Files (x86)\Git\local\bin;C:\Program Files (x86)\Git\mingw\bin;C:\Program Files (x86)\Git\bin;c:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS Client\;c:\Windows\system32;c:\Windows;c:\Windows\System32\Wbem;c:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files\Intel\Intel(R) Management Engine Components\DAL;c:\Program Files\Intel\Intel(R) Management Engine Components\IPT;c:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;c:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;c:\Program Files\Java\jdk1.7.0_67\bin;c:\Users\nexu770\.lein\bin;c:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;c:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\Git\cmd;c:\Program Files (x86)\Skype\Phone\;c:\Users\nexu770\AppData\Roaming\npm;c:\apache-maven-3.3.3-bin\apache-maven-3.3.3\bin +USERNAME=nexu770 +OS=Windows_NT +PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 69 Stepping 1, GenuineIntel + + + +--------------- S Y S T E M --------------- + +OS: Windows 8.1 , 64 bit Build 9600 + +CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 69 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, erms, ht, tsc, tscinvbit + +Memory: 4k page, physical 8268908k(1562064k free), swap 9987040k(5728k free) + +vm_info: Java HotSpot(TM) 64-Bit Server VM (24.65-b04) for windows-amd64 JRE (1.7.0_67-b01), built on Jul 25 2014 08:55:00 by "java_re" with unknown MS VC++:1600 + +time: Tue Oct 13 14:40:58 2015 +elapsed time: 34 seconds + diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java b/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java index e42d8e8e..ebe86a17 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java @@ -67,48 +67,47 @@ public void performAction(final ResultCollector resultCollector, Project... proj for (final Project project : projects) { final TmcProjectInfo projectInfo = projectMediator.wrapProject(project); eventBus.post(new InvokedEvent(projectInfo)); - BgTaskListener bgTaskListener - = new BgTaskListener() { - @Override - public void bgTaskReady(RunResult result) { - if (result.status == COMPILE_FAILED) { - dialogDisplayer.displayError("The code did not compile."); - return; - } - Exercise ex = projectMediator.tryGetExerciseForProject(projectInfo, courseDb); - boolean canSubmit = ex.isReturnable(); - resultDisplayer.showLocalRunResult( - testResultsToTestCaseResults(result.testResults), - canSubmit, - new Runnable() { - @Override - public void run() { - exerciseSubmitter.performAction( - projectInfo.getProject()); - } - }, - resultCollector); - } - - @Override - public void bgTaskFailed(Throwable ex) { - log.log( - INFO, - "performAction of TestRunHandler failed with message: {0}, \ntrace: {1}", - new Object[]{ - ex.getMessage(), Throwables.getStackTraceAsString(ex) - }); - String msg = ServerErrorHelper.getServerExceptionMsg(ex); - if (!Strings.isNullOrEmpty(msg)) { - dialogDisplayer.displayError( - "Failed to run the tests: " + ex.getMessage()); - } - } - - @Override - public void bgTaskCancelled() { - } - }; + BgTaskListener bgTaskListener = new BgTaskListener() { + @Override + public void bgTaskReady(RunResult result) { + if (result.status == COMPILE_FAILED) { + dialogDisplayer.displayError("The code did not compile."); + return; + } + Exercise ex = projectMediator.tryGetExerciseForProject(projectInfo, courseDb); + boolean canSubmit = ex.isReturnable(); + resultDisplayer.showLocalRunResult( + testResultsToTestCaseResults(result.testResults), + canSubmit, + new Runnable() { + @Override + public void run() { + exerciseSubmitter.performAction( + projectInfo.getProject()); + } + }, + resultCollector); + } + + @Override + public void bgTaskFailed(Throwable ex) { + log.log( + INFO, + "performAction of TestRunHandler failed with message: {0}, \ntrace: {1}", + new Object[]{ + ex.getMessage(), Throwables.getStackTraceAsString(ex) + }); + String msg = ServerErrorHelper.getServerExceptionMsg(ex); + if (!Strings.isNullOrEmpty(msg)) { + dialogDisplayer.displayError( + "Failed to run the tests: " + ex.getMessage()); + } + } + + @Override + public void bgTaskCancelled() { + } + }; BgTask.start( "Running tests", new CancellableCallable() { @@ -117,8 +116,7 @@ public void bgTaskCancelled() { @Override public RunResult call() throws Exception { - result - = TmcCoreSingleton.getInstance() + result = TmcCoreSingleton.getInstance() .test(projectInfo.getProjectDirAsPath()); return result.get(); } @@ -136,8 +134,7 @@ private List testResultsToTestCaseResults( ImmutableList testresults) { List testCaseResults = new ArrayList(); for (TestResult result : testresults) { - TestCaseResult testCase - = new TestCaseResult(result.name, result.passed, result.errorMessage); + TestCaseResult testCase = new TestCaseResult(result.name, result.passed, result.errorMessage); testCaseResults.add(testCase); } return testCaseResults; From 5de5153dab530458bf811d12966c14cc9570e0bb Mon Sep 17 00:00:00 2001 From: nimirum Date: Tue, 13 Oct 2015 16:23:50 +0300 Subject: [PATCH 12/14] Revert "Formation fixed" This reverts commit 671a11065bc6c941683b0a6a2dff2256250188cf. --- maven-wrapper/hs_err_pid12788.log | 319 ------------------ .../cs/tmc/runners/TestRunHandler.java | 89 ++--- 2 files changed, 46 insertions(+), 362 deletions(-) delete mode 100644 maven-wrapper/hs_err_pid12788.log diff --git a/maven-wrapper/hs_err_pid12788.log b/maven-wrapper/hs_err_pid12788.log deleted file mode 100644 index e28250ea..00000000 --- a/maven-wrapper/hs_err_pid12788.log +++ /dev/null @@ -1,319 +0,0 @@ -# -# There is insufficient memory for the Java Runtime Environment to continue. -# Native memory allocation (malloc) failed to allocate 2538720 bytes for Chunk::new -# Possible reasons: -# The system is out of physical RAM or swap space -# In 32 bit mode, the process size limit was hit -# Possible solutions: -# Reduce memory load on the system -# Increase physical memory or swap space -# Check if swap backing store is full -# Use 64 bit Java on a 64 bit OS -# Decrease Java heap size (-Xmx/-Xms) -# Decrease number of Java threads -# Decrease Java thread stack sizes (-Xss) -# Set larger code cache with -XX:ReservedCodeCacheSize= -# This output file may be truncated or incomplete. -# -# Out of Memory Error (allocation.cpp:323), pid=12788, tid=4112 -# -# JRE version: Java(TM) SE Runtime Environment (7.0_67-b01) (build 1.7.0_67-b01) -# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode windows-amd64 compressed oops) -# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows -# - ---------------- T H R E A D --------------- - -Current thread (0x000000000b144800): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=4112, stack(0x000000000c6b0000,0x000000000c7b0000)] - -Stack: [0x000000000c6b0000,0x000000000c7b0000] - -Current CompileTask: -C2: 34410 884 org.objectweb.asm.ClassReader::accept (5641 bytes) - - ---------------- P R O C E S S --------------- - -Java Threads: ( => current thread ) - 0x000000000b158000 JavaThread "Service Thread" daemon [_thread_blocked, id=5324, stack(0x000000000c8b0000,0x000000000c9b0000)] - 0x000000000b146800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=14624, stack(0x000000000c7b0000,0x000000000c8b0000)] -=>0x000000000b144800 JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=4112, stack(0x000000000c6b0000,0x000000000c7b0000)] - 0x000000000b143800 JavaThread "Attach Listener" daemon [_thread_blocked, id=15124, stack(0x000000000c5b0000,0x000000000c6b0000)] - 0x000000000b140800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=10384, stack(0x000000000c4b0000,0x000000000c5b0000)] - 0x000000000b10f000 JavaThread "Finalizer" daemon [_thread_blocked, id=12752, stack(0x000000000c3b0000,0x000000000c4b0000)] - 0x000000000b105800 JavaThread "Reference Handler" daemon [_thread_blocked, id=14440, stack(0x000000000c2b0000,0x000000000c3b0000)] - 0x0000000002cae000 JavaThread "main" [_thread_in_Java, id=13660, stack(0x0000000002b70000,0x0000000002c70000)] - -Other Threads: - 0x000000000b101800 VMThread [stack: 0x000000000c1b0000,0x000000000c2b0000] [id=1752] - 0x000000000b172800 WatcherThread [stack: 0x000000000c9b0000,0x000000000cab0000] [id=15348] - -VM state:not at safepoint (normal execution) - -VM Mutex/Monitor currently owned by a thread: None - -Heap - PSYoungGen total 73728K, used 30396K [0x00000007d5e80000, 0x00000007db580000, 0x0000000800000000) - eden space 62464K, 48% used [0x00000007d5e80000,0x00000007d7bd5d20,0x00000007d9b80000) - from space 11264K, 3% used [0x00000007daa80000,0x00000007daad9570,0x00000007db580000) - to space 13312K, 0% used [0x00000007d9b80000,0x00000007d9b80000,0x00000007da880000) - ParOldGen total 86016K, used 29236K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) - object space 86016K, 33% used [0x0000000781c00000,0x000000078388d1b8,0x0000000787000000) - PSPermGen total 24576K, used 24317K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) - object space 24576K, 98% used [0x000000077ca00000,0x000000077e1bf4d0,0x000000077e200000) - -Card table byte_map: [0x0000000005f20000,0x0000000006340000] byte_map_base: 0x000000000233b000 - -Polling page: 0x0000000001140000 - -Code Cache [0x0000000002e60000, 0x0000000003190000, 0x0000000005e60000) - total_blobs=1216 nmethods=862 adapters=306 free_code_cache=46001Kb largest_free_block=47044288 - -Compilation events (10 events): -Event: 34.307 Thread 0x000000000b146800 920 org.apache.maven.shared.dependency.analyzer.asm.DependencyVisitor::visitLdcInsn (16 bytes) -Event: 34.308 Thread 0x000000000b146800 nmethod 920 0x000000000311b2d0 code [0x000000000311b420, 0x000000000311b4c8] -Event: 34.336 Thread 0x000000000b146800 921 org.apache.maven.shared.dependency.analyzer.asm.DependencyVisitor::visitMethod (27 bytes) -Event: 34.345 Thread 0x000000000b146800 nmethod 921 0x000000000317d750 code [0x000000000317d940, 0x000000000317de40] -Event: 34.348 Thread 0x000000000b146800 922 org.objectweb.asm.ClassReader::a (99 bytes) -Event: 34.368 Thread 0x000000000b146800 nmethod 922 0x0000000003180b50 code [0x0000000003180d80, 0x0000000003181ac8] -Event: 34.398 Thread 0x000000000b146800 924 org.apache.maven.shared.dependency.analyzer.asm.DependencyVisitor::visitCode (1 bytes) -Event: 34.398 Thread 0x000000000b146800 nmethod 924 0x00000000031194d0 code [0x0000000003119600, 0x0000000003119658] -Event: 34.398 Thread 0x000000000b146800 925 org.apache.maven.shared.dependency.analyzer.asm.DependencyVisitor::visitMaxs (1 bytes) -Event: 34.398 Thread 0x000000000b146800 nmethod 925 0x000000000317be10 code [0x000000000317bf40, 0x000000000317bf98] - -GC Heap History (10 events): -Event: 24.295 GC heap before -{Heap before GC invocations=12 (full 0): - PSYoungGen total 71680K, used 67232K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) - eden space 66560K, 100% used [0x00000007d5e80000,0x00000007d9f80000,0x00000007d9f80000) - from space 5120K, 13% used [0x00000007d9f80000,0x00000007da028000,0x00000007da480000) - to space 5120K, 0% used [0x00000007da480000,0x00000007da480000,0x00000007da980000) - ParOldGen total 86016K, used 27985K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) - object space 86016K, 32% used [0x0000000781c00000,0x0000000783754638,0x0000000787000000) - PSPermGen total 24064K, used 23920K [0x000000077ca00000, 0x000000077e180000, 0x0000000781c00000) - object space 24064K, 99% used [0x000000077ca00000,0x000000077e15c138,0x000000077e180000) -Event: 24.297 GC heap after -Heap after GC invocations=12 (full 0): - PSYoungGen total 71680K, used 544K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) - eden space 66560K, 0% used [0x00000007d5e80000,0x00000007d5e80000,0x00000007d9f80000) - from space 5120K, 10% used [0x00000007da480000,0x00000007da508000,0x00000007da980000) - to space 5120K, 0% used [0x00000007d9f80000,0x00000007d9f80000,0x00000007da480000) - ParOldGen total 86016K, used 28145K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) - object space 86016K, 32% used [0x0000000781c00000,0x000000078377c638,0x0000000787000000) - PSPermGen total 24064K, used 23920K [0x000000077ca00000, 0x000000077e180000, 0x0000000781c00000) - object space 24064K, 99% used [0x000000077ca00000,0x000000077e15c138,0x000000077e180000) -} -Event: 24.657 GC heap before -{Heap before GC invocations=13 (full 0): - PSYoungGen total 71680K, used 67104K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) - eden space 66560K, 100% used [0x00000007d5e80000,0x00000007d9f80000,0x00000007d9f80000) - from space 5120K, 10% used [0x00000007da480000,0x00000007da508000,0x00000007da980000) - to space 5120K, 0% used [0x00000007d9f80000,0x00000007d9f80000,0x00000007da480000) - ParOldGen total 86016K, used 28145K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) - object space 86016K, 32% used [0x0000000781c00000,0x000000078377c638,0x0000000787000000) - PSPermGen total 24064K, used 23946K [0x000000077ca00000, 0x000000077e180000, 0x0000000781c00000) - object space 24064K, 99% used [0x000000077ca00000,0x000000077e162900,0x000000077e180000) -Event: 24.661 GC heap after -Heap after GC invocations=13 (full 0): - PSYoungGen total 71680K, used 1792K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) - eden space 66560K, 0% used [0x00000007d5e80000,0x00000007d5e80000,0x00000007d9f80000) - from space 5120K, 35% used [0x00000007d9f80000,0x00000007da140020,0x00000007da480000) - to space 5120K, 0% used [0x00000007da480000,0x00000007da480000,0x00000007da980000) - ParOldGen total 86016K, used 28305K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) - object space 86016K, 32% used [0x0000000781c00000,0x00000007837a4638,0x0000000787000000) - PSPermGen total 24064K, used 23946K [0x000000077ca00000, 0x000000077e180000, 0x0000000781c00000) - object space 24064K, 99% used [0x000000077ca00000,0x000000077e162900,0x000000077e180000) -} -Event: 27.917 GC heap before -{Heap before GC invocations=14 (full 0): - PSYoungGen total 71680K, used 68352K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) - eden space 66560K, 100% used [0x00000007d5e80000,0x00000007d9f80000,0x00000007d9f80000) - from space 5120K, 35% used [0x00000007d9f80000,0x00000007da140020,0x00000007da480000) - to space 5120K, 0% used [0x00000007da480000,0x00000007da480000,0x00000007da980000) - ParOldGen total 86016K, used 28305K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) - object space 86016K, 32% used [0x0000000781c00000,0x00000007837a4638,0x0000000787000000) - PSPermGen total 24576K, used 24069K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) - object space 24576K, 97% used [0x000000077ca00000,0x000000077e1815a0,0x000000077e200000) -Event: 27.934 GC heap after -Heap after GC invocations=14 (full 0): - PSYoungGen total 71680K, used 1306K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) - eden space 66560K, 0% used [0x00000007d5e80000,0x00000007d5e80000,0x00000007d9f80000) - from space 5120K, 25% used [0x00000007da480000,0x00000007da5c6b10,0x00000007da980000) - to space 5120K, 0% used [0x00000007d9f80000,0x00000007d9f80000,0x00000007da480000) - ParOldGen total 86016K, used 28537K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) - object space 86016K, 33% used [0x0000000781c00000,0x00000007837de638,0x0000000787000000) - PSPermGen total 24576K, used 24069K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) - object space 24576K, 97% used [0x000000077ca00000,0x000000077e1815a0,0x000000077e200000) -} -Event: 33.786 GC heap before -{Heap before GC invocations=15 (full 0): - PSYoungGen total 71680K, used 67866K [0x00000007d5e80000, 0x00000007da980000, 0x0000000800000000) - eden space 66560K, 100% used [0x00000007d5e80000,0x00000007d9f80000,0x00000007d9f80000) - from space 5120K, 25% used [0x00000007da480000,0x00000007da5c6b10,0x00000007da980000) - to space 5120K, 0% used [0x00000007d9f80000,0x00000007d9f80000,0x00000007da480000) - ParOldGen total 86016K, used 28537K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) - object space 86016K, 33% used [0x0000000781c00000,0x00000007837de638,0x0000000787000000) - PSPermGen total 24576K, used 24303K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) - object space 24576K, 98% used [0x000000077ca00000,0x000000077e1bbc80,0x000000077e200000) -Event: 33.793 GC heap after -Heap after GC invocations=15 (full 0): - PSYoungGen total 69632K, used 1465K [0x00000007d5e80000, 0x00000007db780000, 0x0000000800000000) - eden space 64512K, 0% used [0x00000007d5e80000,0x00000007d5e80000,0x00000007d9d80000) - from space 5120K, 28% used [0x00000007d9f80000,0x00000007da0ee420,0x00000007da480000) - to space 13312K, 0% used [0x00000007daa80000,0x00000007daa80000,0x00000007db780000) - ParOldGen total 86016K, used 28977K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) - object space 86016K, 33% used [0x0000000781c00000,0x000000078384c638,0x0000000787000000) - PSPermGen total 24576K, used 24303K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) - object space 24576K, 98% used [0x000000077ca00000,0x000000077e1bbc80,0x000000077e200000) -} -Event: 34.224 GC heap before -{Heap before GC invocations=16 (full 0): - PSYoungGen total 69632K, used 65977K [0x00000007d5e80000, 0x00000007db780000, 0x0000000800000000) - eden space 64512K, 100% used [0x00000007d5e80000,0x00000007d9d80000,0x00000007d9d80000) - from space 5120K, 28% used [0x00000007d9f80000,0x00000007da0ee420,0x00000007da480000) - to space 13312K, 0% used [0x00000007daa80000,0x00000007daa80000,0x00000007db780000) - ParOldGen total 86016K, used 28977K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) - object space 86016K, 33% used [0x0000000781c00000,0x000000078384c638,0x0000000787000000) - PSPermGen total 24576K, used 24315K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) - object space 24576K, 98% used [0x000000077ca00000,0x000000077e1bec88,0x000000077e200000) -Event: 34.228 GC heap after -Heap after GC invocations=16 (full 0): - PSYoungGen total 73728K, used 357K [0x00000007d5e80000, 0x00000007db580000, 0x0000000800000000) - eden space 62464K, 0% used [0x00000007d5e80000,0x00000007d5e80000,0x00000007d9b80000) - from space 11264K, 3% used [0x00000007daa80000,0x00000007daad9570,0x00000007db580000) - to space 13312K, 0% used [0x00000007d9b80000,0x00000007d9b80000,0x00000007da880000) - ParOldGen total 86016K, used 29236K [0x0000000781c00000, 0x0000000787000000, 0x00000007d5e80000) - object space 86016K, 33% used [0x0000000781c00000,0x000000078388d1b8,0x0000000787000000) - PSPermGen total 24576K, used 24315K [0x000000077ca00000, 0x000000077e200000, 0x0000000781c00000) - object space 24576K, 98% used [0x000000077ca00000,0x000000077e1bec88,0x000000077e200000) -} - -Deoptimization events (10 events): -Event: 21.997 Thread 0x0000000002cae000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x0000000003085af8 method=org.codehaus.plexus.util.xml.Xpp3Dom.mergeIntoXpp3Dom(Lorg/codehaus/plexus/util/xml/Xpp3Dom;Lorg/codehaus/plexus/util/xml/Xpp3Dom;Ljava/lang/Boolean;)V @ 146 -Event: 22.742 Thread 0x0000000002cae000 Uncommon trap: reason=unreached action=reinterpret pc=0x0000000002ff1d7c method=org.apache.maven.model.ConfigurationContainer.getLocation(Ljava/lang/Object;)Lorg/apache/maven/model/InputLocation; @ 4 -Event: 22.748 Thread 0x0000000002cae000 Uncommon trap: reason=unreached action=reinterpret pc=0x0000000002ff099c method=org.apache.maven.model.ConfigurationContainer.getLocation(Ljava/lang/Object;)Lorg/apache/maven/model/InputLocation; @ 4 -Event: 24.560 Thread 0x0000000002cae000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x000000000311be64 method=org.apache.maven.model.validation.DefaultModelValidator.validateEffectiveDependency(Lorg/apache/maven/model/building/ModelProblemCollector;Lorg/apache/maven/model/Depende -Event: 24.925 Thread 0x0000000002cae000 Uncommon trap: reason=unreached action=reinterpret pc=0x0000000002fc76e4 method=org.apache.maven.model.BuildBase.clone()Lorg/apache/maven/model/BuildBase; @ 140 -Event: 24.992 Thread 0x0000000002cae000 Uncommon trap: reason=unreached action=reinterpret pc=0x000000000300a95c method=org.apache.maven.artifact.DefaultArtifact.selectVersionFromNewRangeIfAvailable()V @ 14 -Event: 24.992 Thread 0x0000000002cae000 Uncommon trap: reason=unreached action=reinterpret pc=0x000000000300a064 method=org.apache.maven.artifact.DefaultArtifact.validateIdentity()V @ 107 -Event: 24.992 Thread 0x0000000002cae000 Uncommon trap: reason=unreached action=reinterpret pc=0x0000000003009388 method=org.apache.maven.artifact.DefaultArtifact.selectVersionFromNewRangeIfAvailable()V @ 14 -Event: 26.679 Thread 0x0000000002cae000 Uncommon trap: reason=class_check action=maybe_recompile pc=0x0000000002f0cf10 method=java.util.concurrent.ConcurrentHashMap$Segment.put(Ljava/lang/Object;ILjava/lang/Object;Z)Ljava/lang/Object; @ 77 -Event: 28.132 Thread 0x0000000002cae000 Uncommon trap: reason=null_check action=make_not_entrant pc=0x00000000031276e0 method=org.apache.maven.bridge.MavenRepositorySystem.XcreateArtifact(Ljava/lang/String;Ljava/lang/String;Lorg/apache/maven/artifact/versioning/VersionRange;Ljava/lang/String;Lja®3tEÿ5@ - -Internal exceptions (10 events): -Event: 33.718 Thread 0x0000000002cae000 Threw 0x00000007d9bf42c0 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 -Event: 33.718 Thread 0x0000000002cae000 Threw 0x00000007d9bf74b8 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 -Event: 33.719 Thread 0x0000000002cae000 Threw 0x00000007d9bfacd0 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 -Event: 33.719 Thread 0x0000000002cae000 Threw 0x00000007d9bfda20 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 -Event: 33.721 Thread 0x0000000002cae000 Threw 0x00000007d9c01628 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 -Event: 33.721 Thread 0x0000000002cae000 Threw 0x00000007d9c054b0 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 -Event: 33.722 Thread 0x0000000002cae000 Threw 0x00000007d9c0bbf8 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 -Event: 33.724 Thread 0x0000000002cae000 Threw 0x00000007d9c1dfb0 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 -Event: 33.724 Thread 0x0000000002cae000 Threw 0x00000007d9c21c78 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 -Event: 33.728 Thread 0x0000000002cae000 Threw 0x00000007d9c49068 at C:\re\jdk7u67\1368\hotspot\src\share\vm\prims\jvm.cpp:1244 - -Events (10 events): -Event: 33.728 loading class 0x000000000cf98290 -Event: 33.728 loading class 0x000000000cf98290 done -Event: 33.728 loading class 0x000000000cf98290 -Event: 33.728 loading class 0x000000000cf98290 done -Event: 33.786 Executing VM operation: ParallelGCFailedAllocation -Event: 33.793 Executing VM operation: ParallelGCFailedAllocation done -Event: 33.881 Thread 0x000000000b146800 flushing nmethod 0x00000000031194d0 -Event: 34.224 Executing VM operation: ParallelGCFailedAllocation -Event: 34.228 Executing VM operation: ParallelGCFailedAllocation done -Event: 34.398 Thread 0x000000000b146800 flushing nmethod 0x0000000002fc6d10 - - -Dynamic libraries: -0x00007ff6e7700000 - 0x00007ff6e7733000 c:\Program Files\Java\jdk1.7.0_67\bin\java.exe -0x00007ffc597c0000 - 0x00007ffc5996c000 C:\Windows\SYSTEM32\ntdll.dll -0x00007ffc57800000 - 0x00007ffc5793e000 C:\Windows\system32\KERNEL32.DLL -0x00007ffc56a50000 - 0x00007ffc56b65000 C:\Windows\system32\KERNELBASE.dll -0x00007ffc554c0000 - 0x00007ffc5554e000 C:\Windows\system32\apphelp.dll -0x00000000728d0000 - 0x00000000728fa000 C:\Windows\AppPatch\AppPatch64\EMET64.dll -0x00007ffc57300000 - 0x00007ffc573aa000 C:\Windows\system32\msvcrt.dll -0x00007ffc554a0000 - 0x00007ffc554b2000 C:\Windows\SYSTEM32\WTSAPI32.dll -0x00007ffc49110000 - 0x00007ffc49163000 C:\Windows\AppPatch\AppPatch64\AcGenral.DLL -0x00007ffc56750000 - 0x00007ffc5677e000 C:\Windows\SYSTEM32\SspiCli.dll -0x00007ffc57af0000 - 0x00007ffc57b44000 C:\Windows\system32\SHLWAPI.dll -0x00007ffc57b50000 - 0x00007ffc57cc7000 C:\Windows\system32\USER32.dll -0x00007ffc56f60000 - 0x00007ffc570f4000 C:\Windows\system32\ole32.dll -0x00007ffc58080000 - 0x00007ffc59599000 C:\Windows\system32\SHELL32.dll -0x00007ffc56180000 - 0x00007ffc561a1000 C:\Windows\SYSTEM32\USERENV.dll -0x00007ffc57f10000 - 0x00007ffc57fba000 C:\Windows\system32\ADVAPI32.dll -0x00007ffc51310000 - 0x00007ffc5132e000 C:\Windows\SYSTEM32\MPR.dll -0x00007ffc57100000 - 0x00007ffc57241000 C:\Windows\system32\RPCRT4.dll -0x00007ffc577a0000 - 0x00007ffc577f9000 C:\Windows\SYSTEM32\sechost.dll -0x00007ffc595a0000 - 0x00007ffc597b1000 C:\Windows\SYSTEM32\combase.dll -0x00007ffc579a0000 - 0x00007ffc57aef000 C:\Windows\system32\GDI32.dll -0x00007ffc56920000 - 0x00007ffc56935000 C:\Windows\SYSTEM32\profapi.dll -0x00007ffc55120000 - 0x00007ffc551d2000 C:\Windows\SYSTEM32\SHCORE.dll -0x00007ffc572c0000 - 0x00007ffc572f6000 C:\Windows\system32\IMM32.DLL -0x00007ffc57570000 - 0x00007ffc576c2000 C:\Windows\system32\MSCTF.dll -0x00007ffc54560000 - 0x00007ffc547da000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.9600.17810_none_6240b9c7ecbd0bda\COMCTL32.dll -0x00000000727f0000 - 0x00000000728c2000 c:\Program Files\Java\jdk1.7.0_67\jre\bin\msvcr100.dll -0x0000000072010000 - 0x00000000727e2000 c:\Program Files\Java\jdk1.7.0_67\jre\bin\server\jvm.dll -0x00007ffc517f0000 - 0x00007ffc517f9000 C:\Windows\SYSTEM32\WSOCK32.dll -0x00007ffc53450000 - 0x00007ffc53472000 C:\Windows\SYSTEM32\WINMM.dll -0x00007ffc56e50000 - 0x00007ffc56e57000 C:\Windows\system32\PSAPI.DLL -0x00007ffc57eb0000 - 0x00007ffc57f0a000 C:\Windows\system32\WS2_32.dll -0x00007ffc53410000 - 0x00007ffc5343a000 C:\Windows\SYSTEM32\WINMMBASE.dll -0x00007ffc576d0000 - 0x00007ffc576d9000 C:\Windows\system32\NSI.dll -0x00007ffc56e00000 - 0x00007ffc56e4f000 C:\Windows\SYSTEM32\cfgmgr32.dll -0x00007ffc55730000 - 0x00007ffc55758000 C:\Windows\SYSTEM32\DEVOBJ.dll -0x0000000071fc0000 - 0x0000000071fcf000 c:\Program Files\Java\jdk1.7.0_67\jre\bin\verify.dll -0x0000000071f90000 - 0x0000000071fb8000 c:\Program Files\Java\jdk1.7.0_67\jre\bin\java.dll -0x0000000071f70000 - 0x0000000071f85000 c:\Program Files\Java\jdk1.7.0_67\jre\bin\zip.dll -0x0000000071f50000 - 0x0000000071f69000 C:\Program Files\Java\jdk1.7.0_67\jre\bin\net.dll -0x00007ffc56100000 - 0x00007ffc56159000 C:\Windows\system32\mswsock.dll -0x0000000071f30000 - 0x0000000071f41000 C:\Program Files\Java\jdk1.7.0_67\jre\bin\nio.dll -0x0000000071cb0000 - 0x0000000071cd4000 C:\Program Files\Java\jdk1.7.0_67\jre\bin\sunec.dll -0x0000000071ca0000 - 0x0000000071cab000 C:\Program Files\Java\jdk1.7.0_67\jre\bin\sunmscapi.dll -0x00007ffc56c20000 - 0x00007ffc56dff000 C:\Windows\system32\CRYPT32.dll -0x00007ffc569d0000 - 0x00007ffc569e1000 C:\Windows\system32\MSASN1.dll -0x00007ffc56160000 - 0x00007ffc56180000 C:\Windows\SYSTEM32\CRYPTSP.dll -0x00007ffc55d90000 - 0x00007ffc55dc6000 C:\Windows\system32\rsaenh.dll -0x00007ffc563e0000 - 0x00007ffc56406000 C:\Windows\SYSTEM32\bcrypt.dll -0x00007ffc56780000 - 0x00007ffc567e3000 C:\Windows\system32\bcryptprimitives.dll -0x00007ffc567f0000 - 0x00007ffc567fb000 C:\Windows\SYSTEM32\CRYPTBASE.dll -0x00007ffc50250000 - 0x00007ffc5027a000 C:\Windows\SYSTEM32\IPHLPAPI.DLL -0x00007ffc50240000 - 0x00007ffc5024a000 C:\Windows\SYSTEM32\WINNSI.DLL -0x00007ffc4f770000 - 0x00007ffc4f786000 C:\Windows\SYSTEM32\dhcpcsvc6.DLL -0x00007ffc4f970000 - 0x00007ffc4f98a000 C:\Windows\SYSTEM32\dhcpcsvc.DLL -0x00007ffc55ef0000 - 0x00007ffc55f94000 C:\Windows\SYSTEM32\DNSAPI.dll -0x00007ffc4cff0000 - 0x00007ffc4cffa000 C:\Windows\System32\rasadhlp.dll -0x00007ffc4f890000 - 0x00007ffc4f8fb000 C:\Windows\System32\fwpuclnt.dll -0x00007ffc3c5b0000 - 0x00007ffc3c5c5000 C:\Windows\system32\napinsp.dll -0x00007ffc3c5d0000 - 0x00007ffc3c5ea000 C:\Windows\system32\pnrpnsp.dll -0x00007ffc52430000 - 0x00007ffc5244b000 C:\Windows\system32\NLAapi.dll -0x00007ffc4b5b0000 - 0x00007ffc4b5bd000 C:\Windows\System32\winrnr.dll -0x00007ffc3ca70000 - 0x00007ffc3ca84000 C:\Windows\system32\wshbth.dll - -VM Arguments: -jvm_args: -Dclassworlds.conf=c:/apache-maven-3.3.3-bin/apache-maven-3.3.3/bin/m2.conf -Dmaven.home=c:/apache-maven-3.3.3-bin/apache-maven-3.3.3 -Dmaven.multiModuleProjectDirectory=c:/Users/nexu770/Documents/GitHub/tmc-netbeans/maven-wrapper -java_command: org.codehaus.plexus.classworlds.launcher.Launcher install -Launcher Type: SUN_STANDARD - -Environment Variables: -JAVA_HOME=c:/Program Files/Java/jdk1.7.0_67 -PATH=c:\Users\nexu770\bin;.;C:\Program Files (x86)\Git\local\bin;C:\Program Files (x86)\Git\mingw\bin;C:\Program Files (x86)\Git\bin;c:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS Client\;c:\Windows\system32;c:\Windows;c:\Windows\System32\Wbem;c:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files\Intel\Intel(R) Management Engine Components\DAL;c:\Program Files\Intel\Intel(R) Management Engine Components\IPT;c:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;c:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;c:\Program Files\Java\jdk1.7.0_67\bin;c:\Users\nexu770\.lein\bin;c:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;c:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\Git\cmd;c:\Program Files (x86)\Skype\Phone\;c:\Users\nexu770\AppData\Roaming\npm;c:\apache-maven-3.3.3-bin\apache-maven-3.3.3\bin -USERNAME=nexu770 -OS=Windows_NT -PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 69 Stepping 1, GenuineIntel - - - ---------------- S Y S T E M --------------- - -OS: Windows 8.1 , 64 bit Build 9600 - -CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 69 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, erms, ht, tsc, tscinvbit - -Memory: 4k page, physical 8268908k(1562064k free), swap 9987040k(5728k free) - -vm_info: Java HotSpot(TM) 64-Bit Server VM (24.65-b04) for windows-amd64 JRE (1.7.0_67-b01), built on Jul 25 2014 08:55:00 by "java_re" with unknown MS VC++:1600 - -time: Tue Oct 13 14:40:58 2015 -elapsed time: 34 seconds - diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java b/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java index ebe86a17..e42d8e8e 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java @@ -67,47 +67,48 @@ public void performAction(final ResultCollector resultCollector, Project... proj for (final Project project : projects) { final TmcProjectInfo projectInfo = projectMediator.wrapProject(project); eventBus.post(new InvokedEvent(projectInfo)); - BgTaskListener bgTaskListener = new BgTaskListener() { - @Override - public void bgTaskReady(RunResult result) { - if (result.status == COMPILE_FAILED) { - dialogDisplayer.displayError("The code did not compile."); - return; - } - Exercise ex = projectMediator.tryGetExerciseForProject(projectInfo, courseDb); - boolean canSubmit = ex.isReturnable(); - resultDisplayer.showLocalRunResult( - testResultsToTestCaseResults(result.testResults), - canSubmit, - new Runnable() { - @Override - public void run() { - exerciseSubmitter.performAction( - projectInfo.getProject()); - } - }, - resultCollector); - } - - @Override - public void bgTaskFailed(Throwable ex) { - log.log( - INFO, - "performAction of TestRunHandler failed with message: {0}, \ntrace: {1}", - new Object[]{ - ex.getMessage(), Throwables.getStackTraceAsString(ex) - }); - String msg = ServerErrorHelper.getServerExceptionMsg(ex); - if (!Strings.isNullOrEmpty(msg)) { - dialogDisplayer.displayError( - "Failed to run the tests: " + ex.getMessage()); - } - } - - @Override - public void bgTaskCancelled() { - } - }; + BgTaskListener bgTaskListener + = new BgTaskListener() { + @Override + public void bgTaskReady(RunResult result) { + if (result.status == COMPILE_FAILED) { + dialogDisplayer.displayError("The code did not compile."); + return; + } + Exercise ex = projectMediator.tryGetExerciseForProject(projectInfo, courseDb); + boolean canSubmit = ex.isReturnable(); + resultDisplayer.showLocalRunResult( + testResultsToTestCaseResults(result.testResults), + canSubmit, + new Runnable() { + @Override + public void run() { + exerciseSubmitter.performAction( + projectInfo.getProject()); + } + }, + resultCollector); + } + + @Override + public void bgTaskFailed(Throwable ex) { + log.log( + INFO, + "performAction of TestRunHandler failed with message: {0}, \ntrace: {1}", + new Object[]{ + ex.getMessage(), Throwables.getStackTraceAsString(ex) + }); + String msg = ServerErrorHelper.getServerExceptionMsg(ex); + if (!Strings.isNullOrEmpty(msg)) { + dialogDisplayer.displayError( + "Failed to run the tests: " + ex.getMessage()); + } + } + + @Override + public void bgTaskCancelled() { + } + }; BgTask.start( "Running tests", new CancellableCallable() { @@ -116,7 +117,8 @@ public void bgTaskCancelled() { @Override public RunResult call() throws Exception { - result = TmcCoreSingleton.getInstance() + result + = TmcCoreSingleton.getInstance() .test(projectInfo.getProjectDirAsPath()); return result.get(); } @@ -134,7 +136,8 @@ private List testResultsToTestCaseResults( ImmutableList testresults) { List testCaseResults = new ArrayList(); for (TestResult result : testresults) { - TestCaseResult testCase = new TestCaseResult(result.name, result.passed, result.errorMessage); + TestCaseResult testCase + = new TestCaseResult(result.name, result.passed, result.errorMessage); testCaseResults.add(testCase); } return testCaseResults; From 8d63e5e194b6b24ac89cdf66d6fbea06e7687d8c Mon Sep 17 00:00:00 2001 From: nimirum Date: Tue, 13 Oct 2015 16:28:13 +0300 Subject: [PATCH 13/14] Formation fixed again --- .../cs/tmc/runners/TestRunHandler.java | 90 +++++++++---------- 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java b/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java index e42d8e8e..9686ec8b 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java @@ -67,48 +67,47 @@ public void performAction(final ResultCollector resultCollector, Project... proj for (final Project project : projects) { final TmcProjectInfo projectInfo = projectMediator.wrapProject(project); eventBus.post(new InvokedEvent(projectInfo)); - BgTaskListener bgTaskListener - = new BgTaskListener() { - @Override - public void bgTaskReady(RunResult result) { - if (result.status == COMPILE_FAILED) { - dialogDisplayer.displayError("The code did not compile."); - return; - } - Exercise ex = projectMediator.tryGetExerciseForProject(projectInfo, courseDb); - boolean canSubmit = ex.isReturnable(); - resultDisplayer.showLocalRunResult( - testResultsToTestCaseResults(result.testResults), - canSubmit, - new Runnable() { - @Override - public void run() { - exerciseSubmitter.performAction( - projectInfo.getProject()); - } - }, - resultCollector); - } - - @Override - public void bgTaskFailed(Throwable ex) { - log.log( - INFO, - "performAction of TestRunHandler failed with message: {0}, \ntrace: {1}", - new Object[]{ - ex.getMessage(), Throwables.getStackTraceAsString(ex) - }); - String msg = ServerErrorHelper.getServerExceptionMsg(ex); - if (!Strings.isNullOrEmpty(msg)) { - dialogDisplayer.displayError( - "Failed to run the tests: " + ex.getMessage()); - } - } - - @Override - public void bgTaskCancelled() { - } - }; + BgTaskListener bgTaskListener = new BgTaskListener() { + @Override + public void bgTaskReady(RunResult result) { + if (result.status == COMPILE_FAILED) { + dialogDisplayer.displayError("The code did not compile."); + return; + } + Exercise ex = projectMediator.tryGetExerciseForProject(projectInfo, courseDb); + boolean canSubmit = ex.isReturnable(); + resultDisplayer.showLocalRunResult( + testResultsToTestCaseResults(result.testResults), + canSubmit, + new Runnable() { + @Override + public void run() { + exerciseSubmitter.performAction( + projectInfo.getProject()); + } + }, + resultCollector); + } + + @Override + public void bgTaskFailed(Throwable ex) { + log.log( + INFO, + "performAction of TestRunHandler failed with message: {0}, \ntrace: {1}", + new Object[]{ + ex.getMessage(), Throwables.getStackTraceAsString(ex) + }); + String msg = ServerErrorHelper.getServerExceptionMsg(ex); + if (!Strings.isNullOrEmpty(msg)) { + dialogDisplayer.displayError( + "Failed to run the tests: " + ex.getMessage()); + } + } + + @Override + public void bgTaskCancelled() { + } + }; BgTask.start( "Running tests", new CancellableCallable() { @@ -117,9 +116,7 @@ public void bgTaskCancelled() { @Override public RunResult call() throws Exception { - result - = TmcCoreSingleton.getInstance() - .test(projectInfo.getProjectDirAsPath()); + result = TmcCoreSingleton.getInstance().test(projectInfo.getProjectDirAsPath()); return result.get(); } @@ -136,8 +133,7 @@ private List testResultsToTestCaseResults( ImmutableList testresults) { List testCaseResults = new ArrayList(); for (TestResult result : testresults) { - TestCaseResult testCase - = new TestCaseResult(result.name, result.passed, result.errorMessage); + TestCaseResult testCase = new TestCaseResult(result.name, result.passed, result.errorMessage); testCaseResults.add(testCase); } return testCaseResults; From 2c02802c3012f0965b735a82b706d39358df6eb4 Mon Sep 17 00:00:00 2001 From: nimirum Date: Thu, 15 Oct 2015 14:48:27 +0300 Subject: [PATCH 14/14] Changed ex.getMessage() to ServerErrorHelper.getServerExceptionMsg(ex) --- tmc-plugin/src/fi/helsinki/cs/tmc/actions/PastebinAction.java | 3 ++- .../src/fi/helsinki/cs/tmc/actions/RequestReviewAction.java | 3 ++- .../src/fi/helsinki/cs/tmc/actions/SendFeedbackAction.java | 2 +- .../helsinki/cs/tmc/exerciseSubmitter/ExerciseSubmitter.java | 2 +- tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/PastebinAction.java b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/PastebinAction.java index 12e9dacd..df197aef 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/PastebinAction.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/PastebinAction.java @@ -154,7 +154,8 @@ public void bgTaskCancelled() {} @Override public void bgTaskFailed(Throwable ex) { - dialogs.displayError("Failed to send exercise to pastebin", ex); + dialogs.displayError("Failed to send exercise to pastebin. \n" + + ServerErrorHelper.getServerExceptionMsg(ex)); } } diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/RequestReviewAction.java b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/RequestReviewAction.java index 9a08fb9c..cfcd5ed4 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/RequestReviewAction.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/RequestReviewAction.java @@ -172,7 +172,8 @@ public void bgTaskCancelled() {} @Override public void bgTaskFailed(Throwable ex) { dialogs.displayError( - "Failed to submit exercise for code review", ex); + "Failed to submit exercise for code review \n" + + ServerErrorHelper.getServerExceptionMsg(ex)); } }); } diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/SendFeedbackAction.java b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/SendFeedbackAction.java index 1462eae1..12a03e25 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/actions/SendFeedbackAction.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/actions/SendFeedbackAction.java @@ -72,7 +72,7 @@ public void onSuccess(HttpResult v) { @Override public void onFailure(Throwable ex) { - String msg = "Failed to send feedback :-(\n" + ex.getMessage(); + String msg = "Failed to send feedback :-(\n" + ServerErrorHelper.getServerExceptionMsg(ex); String msgWithBacktrace = msg + "\n" + ExceptionUtils.backtraceToString(ex); log.log(Level.INFO, msgWithBacktrace); dialogs.displayError(msg); diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/exerciseSubmitter/ExerciseSubmitter.java b/tmc-plugin/src/fi/helsinki/cs/tmc/exerciseSubmitter/ExerciseSubmitter.java index 5f8040ee..bd14828f 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/exerciseSubmitter/ExerciseSubmitter.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/exerciseSubmitter/ExerciseSubmitter.java @@ -135,7 +135,7 @@ public void bgTaskFailed(Throwable ex) { log.log(Level.INFO, "Error waiting for results from server.", ex); String msg = ServerErrorHelper.getServerExceptionMsg(ex); if (!Strings.isNullOrEmpty(msg)) { - dialogDisplayer.displayError("Error trying to get test results.", ex); + dialogDisplayer.displayError("Error trying to get test results. \n" + msg); } dialog.close(); } diff --git a/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java b/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java index 9686ec8b..4ff4073b 100644 --- a/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java +++ b/tmc-plugin/src/fi/helsinki/cs/tmc/runners/TestRunHandler.java @@ -100,7 +100,7 @@ public void bgTaskFailed(Throwable ex) { String msg = ServerErrorHelper.getServerExceptionMsg(ex); if (!Strings.isNullOrEmpty(msg)) { dialogDisplayer.displayError( - "Failed to run the tests: " + ex.getMessage()); + "Failed to run the tests: \n" + msg); } }