Skip to content

Commit

Permalink
-Update ChangeSetList to always return a list from getList
Browse files Browse the repository at this point in the history
-Add additional loggin
  • Loading branch information
echrist committed Oct 24, 2013
1 parent 67cfc0a commit ea7e75e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/main/java/org/mongeez/commands/ChangeSetList.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class ChangeSetList {
List<ChangeSet> list = null;

public List<ChangeSet> getList() {
if (list == null) {
list = new ArrayList<ChangeSet>();
}
return list;
}

Expand All @@ -27,9 +30,6 @@ public void setList(List<ChangeSet> list) {
}

public void add(ChangeSet changeSet) {
if (list == null) {
list = new ArrayList<ChangeSet>();
}
this.list.add(changeSet);
getList().add(changeSet);
}
}
3 changes: 2 additions & 1 deletion src/main/java/org/mongeez/reader/FilesetXMLReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ public List<Resource> getFiles(Resource file) {
digester.addSetProperties("changeFiles/file");
digester.addSetNext("changeFiles/file", "add");

logger.info("Parsing XML Fileset file {}", file.getFilename());
ChangeFileSet changeFileSet = (ChangeFileSet) digester.parse(file.getInputStream());
if (changeFileSet != null) {
logger.info("Num of changefiles " + changeFileSet.getChangeFiles().size());
logger.info("Num of changefiles found " + changeFileSet.getChangeFiles().size());
for (ChangeFile changeFile : changeFileSet.getChangeFiles()) {
files.add(file.createRelative(changeFile.getPath()));
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/mongeez/reader/XmlChangeSetReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ public List<ChangeSet> getChangeSets(Resource file) {
List<ChangeSet> changeSets = new ArrayList<ChangeSet>();

try {
logger.info("Parsing XML Change Set File {}", file.getFilename());
ChangeSetList changeFileSet = (ChangeSetList) digester.parse(file.getInputStream());
if (changeFileSet.getList() == null) {
logger.warn("Ignoring change file {}, it does not contain any changeSets", file.getFilename());
if (changeFileSet == null) {
logger.warn("Ignoring change file {}, the parser returned null. Please check your formatting.", file.getFilename());
}
else {
for (ChangeSet changeSet : changeFileSet.getList()) {
Expand Down

0 comments on commit ea7e75e

Please sign in to comment.