Bug fix in FileIssue.

* Property changes that changed the filename of the underlying file were
  neglecting to update the internal file pointer to the new file.
This commit is contained in:
Jonathan Bernard 2011-12-12 15:56:10 -06:00
parent 952064d903
commit ec7c07f81f
4 changed files with 29 additions and 27 deletions

View File

@ -1,11 +1,11 @@
#Thu, 08 Dec 2011 15:46:01 -0600 #Sun, 11 Dec 2011 21:03:38 -0600
#Sat Apr 24 17:08:00 CDT 2010 #Sat Apr 24 17:08:00 CDT 2010
build.dir=build build.dir=build
src.dir=src src.dir=src
lib.shared.dir=../shared-libs lib.shared.dir=../shared-libs
test.dir=test test.dir=test
build.number=2 build.number=3
version=3.2.2 version=3.2.3
name=libpit name=libpit
lib.dir=lib lib.dir=lib
lib.local=true lib.local=true

View File

@ -61,43 +61,45 @@ public class FileIssue extends Issue {
} }
public void setCategory(Category c) throws IOException { public void setCategory(Category c) throws IOException {
boolean renamed
renamed = source.renameTo(new File(source.canonicalFile.parentFile,
makeFilename(id, c, status, priority)))
if (!renamed) File newSource = new File(source.canonicalFile.parentFile,
throw new IOException("I was unable to set the category. " makeFilename(id, c, status, priority))
if (source.renameTo(newSource)) {
source = newSource
super.setCategory(c) }
else { throw new IOException("I was unable to set the category. "
+ "I need to rename the file for this issue, but something is " + "I need to rename the file for this issue, but something is "
+ "preventing me from doing so (maybe the path to the file is " + "preventing me from doing so (maybe the path to the file is "
+ "no longer valid, or maybe the file is currently open in " + "no longer valid, or maybe the file is currently open in "
+ "some other program).") + "some other program).") }}
else super.setCategory(c) }
public void setStatus(Status s) throws IOException { public void setStatus(Status s) throws IOException {
boolean renamed File newSource = new File(source.canonicalFile.parentFile,
renamed = source.renameTo(new File(source.canonicalFile.parentFile, makeFilename(id, category, s, priority))
makeFilename(id, category, s, priority)))
if (!renamed) if (source.renameTo(newSource)) {
throw new IOException("I was unable to set the status. " source = newSource
super.setStatus(s) }
else { throw new IOException("I was unable to set the status. "
+ "I need to rename the file for this issue, but something is " + "I need to rename the file for this issue, but something is "
+ "preventing me from doing so (maybe the path to the file is " + "preventing me from doing so (maybe the path to the file is "
+ "no longer valid, or maybe the file is currently open in " + "no longer valid, or maybe the file is currently open in "
+ "some other program).") + "some other program).") }}
else super.setStatus(s) }
public void setPriority(int p) throws IOException { public void setPriority(int p) throws IOException {
boolean renamed
renamed = source.renameTo(new File(source.canonicalFile.parentFile,
makeFilename(id, category, status, p)))
if (!renamed) File newSource = new File(source.canonicalFile.parentFile,
throw new IOException("I was unable to set the priority. " makeFilename(id, category, status, p))
if (source.renameTo(newSource)) {
source = newSource
super.setPriority(p) }
else { throw new IOException("I was unable to set the priority. "
+ "I need to rename the file for this issue, but something is " + "I need to rename the file for this issue, but something is "
+ "preventing me from doing so (maybe the path to the file is " + "preventing me from doing so (maybe the path to the file is "
+ "no longer valid, or maybe the file is currently open in " + "no longer valid, or maybe the file is currently open in "
+ "some other program).") + "some other program).") }}
else super.setPriority(p) }
public String getFilename() { public String getFilename() {
return makeFilename(id, category, status, priority) } return makeFilename(id, category, status, priority) }

View File

@ -1,9 +1,9 @@
#Thu, 08 Dec 2011 15:46:09 -0600 #Sun, 11 Dec 2011 21:04:03 -0600
build.dir=build build.dir=build
src.dir=src src.dir=src
build.jar=pit-cli-${application.version}.${build.number}.jar build.jar=pit-cli-${application.version}.${build.number}.jar
build.number=2 build.number=2
version=3.2.2 version=3.2.3
name=pit-cli name=pit-cli
lib.dir=lib lib.dir=lib
lib.local=true lib.local=true

View File

@ -83,7 +83,7 @@ cli._(longOpt: 'version', 'Display PIT version information.')
// ======== Parse CLI Options ======== // // ======== Parse CLI Options ======== //
// =================================== // // =================================== //
def VERSION = "3.2.2" def VERSION = "3.2.3"
def opts = cli.parse(args) def opts = cli.parse(args)
def issuedb = [:] def issuedb = [:]
def workingDir = new File('.') def workingDir = new File('.')