Commit f6267e6a authored by Kristof Szabados's avatar Kristof Szabados

updated to handle negative list index values.

Signed-off-by: Kristof Szabados's avatarKristof Szabados <Kristof.Szabados@ericsson.com>
parent 7f637d16
......@@ -371,7 +371,8 @@ public class TitanCharacter_String_identification extends Base_Type {
/**
* Returns the current selection.
* It will return TitanCharacter_String_identification.union_selection_type.UNBOUND_VALUE if the value is unbound,
* TitanCharacter_String_identification.union_selection_type.ALT_syntaxes if the first field was selected, and so on.\n *
* TitanCharacter_String_identification.union_selection_type.ALT_syntaxes if the first field was selected, and so on.
*
* @return the current selection.
* */
public TitanCharacter_String_identification.union_selection_type get_selection() {
......
......@@ -485,7 +485,9 @@ public class TitanCharacter_String_identification_context__negotiation_template
if (template_selection != template_sel.VALUE_LIST && template_selection != template_sel.COMPLEMENTED_LIST) {
throw new TtcnError("Accessing a list element of a non-list template of type CHARACTER STRING.identification.context-negotiation.");
}
if (list_index >= list_value.size()) {
if (list_index < 0) {
throw new TtcnError(MessageFormat.format("Internal error: Accessing a value list template of type CHARACTER STRING.identification.context-negotiation using a negative index ({0}).", list_index));
} else if (list_index >= list_value.size()) {
throw new TtcnError("Index overflow in a value list template of type CHARACTER STRING.identification.context-negotiation.");
}
return list_value.get(list_index);
......
......@@ -485,7 +485,9 @@ public class TitanCharacter_String_identification_syntaxes_template extends Base
if (template_selection != template_sel.VALUE_LIST && template_selection != template_sel.COMPLEMENTED_LIST) {
throw new TtcnError("Accessing a list element of a non-list template of type CHARACTER STRING.identification.syntaxes.");
}
if (list_index >= list_value.size()) {
if (list_index < 0) {
throw new TtcnError(MessageFormat.format("Internal error: Accessing a value list template of type CHARACTER STRING.identification.syntaxes using a negative index ({0}).", list_index));
} else if (list_index >= list_value.size()) {
throw new TtcnError("Index overflow in a value list template of type CHARACTER STRING.identification.syntaxes.");
}
return list_value.get(list_index);
......
......@@ -404,9 +404,8 @@ public class TitanCharacter_String_identification_template extends Base_Template
throw new TtcnError("Internal error: Accessing a list element of a non-list template of union type CHARACTER STRING.identification.");
}
if (list_index < 0) {
throw new TtcnError("Internal error: Index underflow in a value list template of union type CHARACTER STRING.identification.");
}
if(list_index >= value_list.size()) {
throw new TtcnError(MessageFormat.format("Internal error: Accessing a value list template of type CHARACTER STRING.identification using a negative index ({0}).", list_index));
} else if(list_index >= value_list.size()) {
throw new TtcnError("Internal error: Index overflow in a value list template of union type CHARACTER STRING.identification.");
}
return value_list.get(list_index);
......
......@@ -547,7 +547,9 @@ public class TitanCharacter_String_template extends Base_Template {
if (template_selection != template_sel.VALUE_LIST && template_selection != template_sel.COMPLEMENTED_LIST) {
throw new TtcnError("Accessing a list element of a non-list template of type CHARACTER STRING.");
}
if (list_index >= list_value.size()) {
if (list_index < 0) {
throw new TtcnError(MessageFormat.format("Internal error: Accessing a value list template of type CHARACTER STRING using a negative index ({0}).", list_index));
} else if (list_index >= list_value.size()) {
throw new TtcnError("Index overflow in a value list template of type CHARACTER STRING.");
}
return list_value.get(list_index);
......
......@@ -371,7 +371,8 @@ public class TitanEmbedded_PDV_identification extends Base_Type {
/**
* Returns the current selection.
* It will return TitanEmbedded_PDV_identification.union_selection_type.UNBOUND_VALUE if the value is unbound,
* TitanEmbedded_PDV_identification.union_selection_type.ALT_syntaxes if the first field was selected, and so on.\n *
* TitanEmbedded_PDV_identification.union_selection_type.ALT_syntaxes if the first field was selected, and so on.
*
* @return the current selection.
* */
public TitanEmbedded_PDV_identification.union_selection_type get_selection() {
......
......@@ -485,7 +485,9 @@ public class TitanEmbedded_PDV_identification_context__negotiation_template exte
if (template_selection != template_sel.VALUE_LIST && template_selection != template_sel.COMPLEMENTED_LIST) {
throw new TtcnError("Accessing a list element of a non-list template of type EMBEDDED PDV.identification.context-negotiation.");
}
if (list_index >= list_value.size()) {
if (list_index < 0) {
throw new TtcnError(MessageFormat.format("Internal error: Accessing a value list template of type EMBEDDED PDV.identification.context-negotiation using a negative index ({0}).", list_index));
} else if (list_index >= list_value.size()) {
throw new TtcnError("Index overflow in a value list template of type EMBEDDED PDV.identification.context-negotiation.");
}
return list_value.get(list_index);
......
......@@ -485,7 +485,9 @@ public class TitanEmbedded_PDV_identification_syntaxes_template extends Base_Tem
if (template_selection != template_sel.VALUE_LIST && template_selection != template_sel.COMPLEMENTED_LIST) {
throw new TtcnError("Accessing a list element of a non-list template of type EMBEDDED PDV.identification.syntaxes.");
}
if (list_index >= list_value.size()) {
if (list_index < 0) {
throw new TtcnError(MessageFormat.format("Internal error: Accessing a value list template of type EMBEDDED PDV.identification.syntaxes using a negative index ({0}).", list_index));
} else if (list_index >= list_value.size()) {
throw new TtcnError("Index overflow in a value list template of type EMBEDDED PDV.identification.syntaxes.");
}
return list_value.get(list_index);
......
......@@ -404,9 +404,8 @@ public class TitanEmbedded_PDV_identification_template extends Base_Template {
throw new TtcnError("Internal error: Accessing a list element of a non-list template of union type EMBEDDED PDV.identification.");
}
if (list_index < 0) {
throw new TtcnError("Internal error: Index underflow in a value list template of union type EMBEDDED PDV.identification.");
}
if(list_index >= value_list.size()) {
throw new TtcnError(MessageFormat.format("Internal error: Accessing a value list template of type EMBEDDED PDV.identification using a negative index ({0}).", list_index));
} else if(list_index >= value_list.size()) {
throw new TtcnError("Internal error: Index overflow in a value list template of union type EMBEDDED PDV.identification.");
}
return value_list.get(list_index);
......
......@@ -547,7 +547,9 @@ public class TitanEmbedded_PDV_template extends Base_Template {
if (template_selection != template_sel.VALUE_LIST && template_selection != template_sel.COMPLEMENTED_LIST) {
throw new TtcnError("Accessing a list element of a non-list template of type EMBEDDED PDV.");
}
if (list_index >= list_value.size()) {
if (list_index < 0) {
throw new TtcnError(MessageFormat.format("Internal error: Accessing a value list template of type EMBEDDED PDV using a negative index ({0}).", list_index));
} else if (list_index >= list_value.size()) {
throw new TtcnError("Index overflow in a value list template of type EMBEDDED PDV.");
}
return list_value.get(list_index);
......
......@@ -370,7 +370,8 @@ public class TitanExternal_identification extends Base_Type {
/**
* Returns the current selection.
* It will return TitanExternal_identification.union_selection_type.UNBOUND_VALUE if the value is unbound,
* TitanExternal_identification.union_selection_type.ALT_syntaxes if the first field was selected, and so on.\n *
* TitanExternal_identification.union_selection_type.ALT_syntaxes if the first field was selected, and so on.
*
* @return the current selection.
* */
public TitanExternal_identification.union_selection_type get_selection() {
......
......@@ -485,7 +485,9 @@ public class TitanExternal_identification_context__negotiation_template extends
if (template_selection != template_sel.VALUE_LIST && template_selection != template_sel.COMPLEMENTED_LIST) {
throw new TtcnError("Accessing a list element of a non-list template of type EXTERNAL.identification.context-negotiation.");
}
if (list_index >= list_value.size()) {
if (list_index < 0) {
throw new TtcnError(MessageFormat.format("Internal error: Accessing a value list template of type EXTERNAL.identification.context-negotiation using a negative index ({0}).", list_index));
} else if (list_index >= list_value.size()) {
throw new TtcnError("Index overflow in a value list template of type EXTERNAL.identification.context-negotiation.");
}
return list_value.get(list_index);
......
......@@ -485,7 +485,9 @@ public class TitanExternal_identification_syntaxes_template extends Base_Templat
if (template_selection != template_sel.VALUE_LIST && template_selection != template_sel.COMPLEMENTED_LIST) {
throw new TtcnError("Accessing a list element of a non-list template of type EXTERNAL.identification.syntaxes.");
}
if (list_index >= list_value.size()) {
if (list_index < 0) {
throw new TtcnError(MessageFormat.format("Internal error: Accessing a value list template of type EXTERNAL.identification.syntaxes using a negative index ({0}).", list_index));
} else if (list_index >= list_value.size()) {
throw new TtcnError("Index overflow in a value list template of type EXTERNAL.identification.syntaxes.");
}
return list_value.get(list_index);
......
......@@ -404,9 +404,8 @@ public class TitanExternal_identification_template extends Base_Template {
throw new TtcnError("Internal error: Accessing a list element of a non-list template of union type EXTERNAL.identification.");
}
if (list_index < 0) {
throw new TtcnError("Internal error: Index underflow in a value list template of union type EXTERNAL.identification.");
}
if(list_index >= value_list.size()) {
throw new TtcnError(MessageFormat.format("Internal error: Accessing a value list template of type EXTERNAL.identification using a negative index ({0}).", list_index));
} else if(list_index >= value_list.size()) {
throw new TtcnError("Internal error: Index overflow in a value list template of union type EXTERNAL.identification.");
}
return value_list.get(list_index);
......
......@@ -547,7 +547,9 @@ public class TitanExternal_template extends Base_Template {
if (template_selection != template_sel.VALUE_LIST && template_selection != template_sel.COMPLEMENTED_LIST) {
throw new TtcnError("Accessing a list element of a non-list template of type EXTERNAL.");
}
if (list_index >= list_value.size()) {
if (list_index < 0) {
throw new TtcnError(MessageFormat.format("Internal error: Accessing a value list template of type EXTERNAL using a negative index ({0}).", list_index));
} else if (list_index >= list_value.size()) {
throw new TtcnError("Index overflow in a value list template of type EXTERNAL.");
}
return list_value.get(list_index);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment