Skip to content

Commit

Permalink
fix out of index #32
Browse files Browse the repository at this point in the history
  • Loading branch information
shalousun committed May 26, 2020
1 parent 70eb845 commit 2be66cb
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/main/java/com/power/doc/utils/DocClassUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private static String[] classNameFix(String[] arr) {
for (int i = 0; i < length; i++) {
if (classes.size() > 0) {
int index = classes.size() - 1;
if (!DocUtil.isClassName(classes.get(index))) {
if (!isClassName(classes.get(index))) {
globIndex = globIndex + 1;
if (globIndex < length) {
indexList.add(globIndex);
Expand All @@ -99,7 +99,7 @@ private static String[] classNameFix(String[] arr) {
} else {
globIndex = globIndex + 1;
if (globIndex < length) {
if (DocUtil.isClassName(arr[globIndex]) || arr[i].length() == 1) {
if (isClassName(arr[globIndex])) {
indexList.add(globIndex);
classes.add(arr[globIndex]);
} else {
Expand All @@ -113,7 +113,7 @@ private static String[] classNameFix(String[] arr) {
}
}
} else {
if (DocUtil.isClassName(arr[i]) || arr[i].length() == 1) {
if (isClassName(arr[i])) {
indexList.add(i);
classes.add(arr[i]);
} else {
Expand Down Expand Up @@ -254,4 +254,17 @@ public static String rewriteRequestParam(String typeName) {
return typeName;
}
}

private static boolean isClassName(String className) {
if (StringUtil.isEmpty(className)) {
return false;
}
if (className.contains("<") && !className.contains(">")) {
return false;
} else if (className.contains(">") && !className.contains("<")) {
return false;
} else {
return true;
}
}
}

0 comments on commit 2be66cb

Please sign in to comment.