You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pa...@apache.org on 2020/02/09 14:46:36 UTC

[camel-spring-boot] 03/03: camel-example-spring-boot-rest-producer: Avoid possible ArrayIndexOutOfBoundsException in PetController

This is an automated email from the ASF dual-hosted git repository.

pascalschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git

commit f2735df722bd3d4a87494698a686ba657017b85d
Author: Pascal Schumacher <pa...@gmx.net>
AuthorDate: Sun Feb 9 15:40:41 2020 +0100

    camel-example-spring-boot-rest-producer: Avoid possible ArrayIndexOutOfBoundsException in PetController
---
 .../src/main/java/sample/camel/PetController.java                       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/camel-example-spring-boot-rest-producer/src/main/java/sample/camel/PetController.java b/examples/camel-example-spring-boot-rest-producer/src/main/java/sample/camel/PetController.java
index 7178b5f..90d0944 100644
--- a/examples/camel-example-spring-boot-rest-producer/src/main/java/sample/camel/PetController.java
+++ b/examples/camel-example-spring-boot-rest-producer/src/main/java/sample/camel/PetController.java
@@ -33,7 +33,7 @@ public class PetController {
 
     @GetMapping(value = "/pets/{id}")
     public Map<String, String> petById(@PathVariable("id") Integer id) {
-        if (id != null && id > 0 && id <= PETS.length + 1) {
+        if (id != null && id > 0 && id <= PETS.length) {
             int index = id - 1;
             String pet = PETS[index];
             return Collections.singletonMap("name", pet);