Skip to content

Commit 89a2f6f

Browse files
committed
Added error message logging to the command line to track down publication errors sporadically occurring on Windows machines.
1 parent 49636e0 commit 89a2f6f

File tree

1 file changed

+14
-28
lines changed

1 file changed

+14
-28
lines changed

Scalatron/src/scalatron/scalatron/impl/ScalatronUser.scala

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -278,28 +278,6 @@ case class ScalatronUser(name: String, scalatron: ScalatronImpl) extends Scalatr
278278
list
279279
}
280280

281-
/*
282-
def createBackupVersion(policy: VersionPolicy, label: String, updatedSourceFiles: SourceFileCollection) =
283-
policy match {
284-
case VersionPolicy.IfDifferent =>
285-
if (git.status().call().isClean) {
286-
if(scalatron.verbose) println("VersionPolicy.IfDifferent, files are unchanged => not creating backup version")
287-
None
288-
} else {
289-
if(scalatron.verbose) println("VersionPolicy.IfDifferent, files are different => creating backup version")
290-
Some(updateSourcesAndCreateVersion(label, sourceFiles)) // backup old files as a version
291-
}
292-
case VersionPolicy.Always =>
293-
if(scalatron.verbose) println("VersionPolicy.Always => creating backup version")
294-
Some(updateSourcesAndCreateVersion(label, sourceFiles)) // backup old files as a version
295-
296-
case VersionPolicy.Never =>
297-
if(scalatron.verbose) println("VersionPolicy.Never => not creating backup version")
298-
None // OK - nothing to back up
299-
}
300-
*/
301-
302-
303281

304282

305283

@@ -313,15 +291,20 @@ case class ScalatronUser(name: String, scalatron: ScalatronImpl) extends Scalatr
313291
val backupJarFile = new File(backupJarFilePath)
314292
if( backupJarFile.exists ) {
315293
if( scalatron.verbose ) println(" deleting backup .jar file: " + backupJarFilePath)
316-
if( !backupJarFile.delete() ) throw new IllegalStateException("failed to delete backup .jar file at: " + backupJarFilePath)
294+
if( !backupJarFile.delete() ) {
295+
System.err.println("failed to delete backup .jar file at: %s" format backupJarFilePath)
296+
throw new IllegalStateException("failed to delete backup .jar file at: %s" format backupJarFilePath)
297+
}
317298
}
318299

319300
// then move away the current .jar file
320301
val publishedJarFile = new File(publishedJarFilePath)
321302
if( publishedJarFile.exists ) {
322303
if( scalatron.verbose ) println(" backing up current .jar file: " + publishedJarFilePath + " => " + backupJarFilePath)
323-
if( !publishedJarFile.renameTo(backupJarFile) )
324-
throw new IllegalStateException("failed to rename .jar file to backup: " + backupJarFilePath)
304+
if( !publishedJarFile.renameTo(backupJarFile) ) {
305+
System.err.println("failed to rename .jar file to backup: %s" format backupJarFilePath)
306+
throw new IllegalStateException("failed to rename .jar file to backup: %s" format backupJarFilePath)
307+
}
325308
}
326309

327310

@@ -333,18 +316,21 @@ case class ScalatronUser(name: String, scalatron: ScalatronImpl) extends Scalatr
333316
val userPluginDirectory = new File(userPluginDirectoryPath)
334317
if( !userPluginDirectory.exists() ) {
335318
if( !userPluginDirectory.mkdirs() ) {
336-
throw new IllegalStateException("failed to create user plug-in directory: " + userPluginDirectoryPath)
319+
System.err.println("failed to create user plug-in directory: %s" format userPluginDirectoryPath)
320+
throw new IllegalStateException("failed to create user plug-in directory: %s" format userPluginDirectoryPath)
337321
}
338322
if( scalatron.verbose ) println("created user plug-in directory for '" + name + "' at: " + userPluginDirectoryPath)
339323
}
340324
try {
341325
copyFile(localJarFilePath, publishedJarFilePath)
342326
} catch {
343327
case t: Throwable =>
344-
throw new IllegalStateException("failed to copy .jar file '" + localJarFilePath + "' to '" + publishedJarFilePath + "': " + t)
328+
System.err.println("failed to copy .jar file '%s' to '%s': %s" format(localJarFilePath, publishedJarFilePath, t.toString))
329+
throw new IllegalStateException("failed to copy .jar file '%s' to '%s': %s" format(localJarFilePath, publishedJarFilePath, t.toString))
345330
}
346331
} else {
347-
throw new IllegalStateException(".jar file intended for publication does not exist: " + localJarFilePath)
332+
System.err.println(".jar file intended for publication does not exist: %s" format localJarFilePath)
333+
throw new IllegalStateException(".jar file intended for publication does not exist: %s" format localJarFilePath)
348334
}
349335
}
350336

0 commit comments

Comments
 (0)