Skip to content

Commit

Permalink
Avoid NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Dec 9, 2024
1 parent 84d6bf3 commit 4afb031
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/main/java/gr/uom/java/xmi/UMLModelASTReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,7 @@ private void processRecordDeclaration(CompilationUnit cu, RecordDeclaration reco
umlClass.setPackageDeclaration(umlPackage);
umlClass.setPackageDeclarationJavadoc(packageDoc);
for(UMLComment comment : comments) {
if(comment.getLocationInfo().before(umlPackage.getLocationInfo())) {
umlClass.getPackageDeclarationComments().add(comment);
}
else if(comment.getLocationInfo().before(locationInfo) && !locationInfo.nextLine(comment.getLocationInfo())) {
if(comment.getLocationInfo().before(locationInfo) && !locationInfo.nextLine(comment.getLocationInfo())) {
umlClass.getPackageDeclarationComments().add(comment);
}
}
Expand Down Expand Up @@ -476,10 +473,7 @@ private void processAnnotationTypeDeclaration(CompilationUnit cu, AnnotationType
umlClass.setPackageDeclaration(umlPackage);
umlClass.setPackageDeclarationJavadoc(packageDoc);
for(UMLComment comment : comments) {
if(comment.getLocationInfo().before(umlPackage.getLocationInfo())) {
umlClass.getPackageDeclarationComments().add(comment);
}
else if(comment.getLocationInfo().before(locationInfo) && !locationInfo.nextLine(comment.getLocationInfo())) {
if(comment.getLocationInfo().before(locationInfo) && !locationInfo.nextLine(comment.getLocationInfo())) {
umlClass.getPackageDeclarationComments().add(comment);
}
}
Expand Down Expand Up @@ -536,10 +530,7 @@ private void processEnumDeclaration(CompilationUnit cu, EnumDeclaration enumDecl
umlClass.setPackageDeclaration(umlPackage);
umlClass.setPackageDeclarationJavadoc(packageDoc);
for(UMLComment comment : comments) {
if(comment.getLocationInfo().before(umlPackage.getLocationInfo())) {
umlClass.getPackageDeclarationComments().add(comment);
}
else if(comment.getLocationInfo().before(locationInfo) && !locationInfo.nextLine(comment.getLocationInfo())) {
if(comment.getLocationInfo().before(locationInfo) && !locationInfo.nextLine(comment.getLocationInfo())) {
umlClass.getPackageDeclarationComments().add(comment);
}
}
Expand Down Expand Up @@ -667,10 +658,7 @@ private void processTypeDeclaration(CompilationUnit cu, TypeDeclaration typeDecl
umlClass.setPackageDeclaration(umlPackage);
umlClass.setPackageDeclarationJavadoc(packageDoc);
for(UMLComment comment : comments) {
if(comment.getLocationInfo().before(umlPackage.getLocationInfo())) {
umlClass.getPackageDeclarationComments().add(comment);
}
else if(comment.getLocationInfo().before(locationInfo) && !locationInfo.nextLine(comment.getLocationInfo())) {
if(comment.getLocationInfo().before(locationInfo) && !locationInfo.nextLine(comment.getLocationInfo())) {
umlClass.getPackageDeclarationComments().add(comment);
}
}
Expand Down

0 comments on commit 4afb031

Please sign in to comment.