Skip to content

Commit 4926c88

Browse files
authored
Merge pull request #7 from chrisspelberg/master
Fixes for ArrayIndexOutOfBoundsException when a @CommandHandler annotated method has no parameters
2 parents a838bff + 243318f commit 4926c88

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
<properties>
180180
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
181181
<maven.javadoc.skip>true</maven.javadoc.skip>
182-
<idea.version>14.1.3</idea.version>
182+
<idea.version>LOCAL</idea.version>
183183
<ij.plugin>true</ij.plugin>
184184
</properties>
185185
</project>

setup.sh

100644100755
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,22 @@ if [ ! -e "$IDEA" ]
44
then
55
export IDEA="/Applications/IntelliJ IDEA 14.app/Contents"
66
fi
7+
if [ ! -e "$IDEA" ]
8+
then
9+
export IDEA="/Applications/IntelliJ IDEA CE.app/Contents"
10+
fi
11+
if [ ! -e "$IDEA" ]
12+
then
13+
echo "IDEA libraries not found!"
14+
echo "Checked: /C/Program Files (x86)/JetBrains/IntelliJ IDEA 14.1"
15+
echo "Checked: /Applications/IntelliJ IDEA 14.app/Contents"
16+
echo "Checked: /Applications/IntelliJ IDEA CE.app/Contents"
17+
echo ""
18+
echo "Try installing the IDEA Community Edition"
19+
exit 1
20+
fi
721

8-
export IDEA_VERSION=14.1.3
22+
export IDEA_VERSION=LOCAL
923
mvn install:install-file -Dfile="$IDEA/lib/annotations.jar" -DgroupId=com.intellij.idea -DartifactId=annotations -Dversion=$IDEA_VERSION -Dpackaging=jar
1024
mvn install:install-file -Dfile="$IDEA/lib/idea.jar" -DgroupId=com.intellij.idea -DartifactId=idea -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true -Dversion=$IDEA_VERSION
1125
mvn install:install-file -Dfile="$IDEA/lib/openapi.jar" -DgroupId=com.intellij.idea -DartifactId=openapi -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true -Dversion=$IDEA_VERSION

src/main/java/org/axonframework/intellij/ide/plugin/handler/CommandEventHandler.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,14 @@ public boolean isSagaEvent() {
4444

4545
public static Handler createEventHandler(PsiMethod method) {
4646
PsiType[] methodArguments = getMethodArguments(method);
47-
return new CommandEventHandler(methodArguments[0], method);
47+
return methodArguments.length > 0 ? new CommandEventHandler(methodArguments[0], method) : null;
4848
}
4949

5050
private static PsiType[] getMethodArguments(PsiMethod method) {
51-
PsiParameterList list = method.getParameterList();
52-
PsiType[] argument = new PsiType[list.getParametersCount()];
53-
for (int i = 0; i < list.getParameters().length; i++) {
54-
PsiParameter psiParameter = list.getParameters()[i];
55-
argument[i] = psiParameter.getType();
51+
PsiParameter[] listParameters = method.getParameterList().getParameters();
52+
PsiType[] argument = new PsiType[listParameters.length];
53+
for (int i = 0; i < listParameters.length; i++) {
54+
argument[i] = listParameters[i].getType();
5655
}
5756
return argument;
5857
}

0 commit comments

Comments
 (0)