|
1 |
| -/* |
2 |
| - * This file is a part of MDClasses. |
3 |
| - * |
4 |
| - * Copyright (c) 2019 - 2024 |
5 |
| - * Tymko Oleg <olegtymko@yandex.ru>, Maximov Valery <maximovvalery@gmail.com> and contributors |
6 |
| - * |
7 |
| - * SPDX-License-Identifier: LGPL-3.0-or-later |
8 |
| - * |
9 |
| - * MDClasses is free software; you can redistribute it and/or |
10 |
| - * modify it under the terms of the GNU Lesser General Public |
11 |
| - * License as published by the Free Software Foundation; either |
12 |
| - * version 3.0 of the License, or (at your option) any later version. |
13 |
| - * |
14 |
| - * MDClasses is distributed in the hope that it will be useful, |
15 |
| - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
| - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 |
| - * Lesser General Public License for more details. |
18 |
| - * |
19 |
| - * You should have received a copy of the GNU Lesser General Public |
20 |
| - * License along with MDClasses. |
21 |
| - */ |
22 |
| -package com.github._1c_syntax.bsl.reader.designer.converter; |
| 1 | +/* |
| 2 | + * This file is a part of MDClasses. |
| 3 | + * |
| 4 | + * Copyright (c) 2019 - 2024 |
| 5 | + * Tymko Oleg <olegtymko@yandex.ru>, Maximov Valery <maximovvalery@gmail.com> and contributors |
| 6 | + * |
| 7 | + * SPDX-License-Identifier: LGPL-3.0-or-later |
| 8 | + * |
| 9 | + * MDClasses is free software; you can redistribute it and/or |
| 10 | + * modify it under the terms of the GNU Lesser General Public |
| 11 | + * License as published by the Free Software Foundation; either |
| 12 | + * version 3.0 of the License, or (at your option) any later version. |
| 13 | + * |
| 14 | + * MDClasses is distributed in the hope that it will be useful, |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | + * Lesser General Public License for more details. |
| 18 | + * |
| 19 | + * You should have received a copy of the GNU Lesser General Public |
| 20 | + * License along with MDClasses. |
| 21 | + */ |
| 22 | +package com.github._1c_syntax.bsl.reader.designer.converter; |
23 | 23 |
|
24 | 24 | import com.github._1c_syntax.bsl.mdo.storage.form.FormAttribute;
|
25 | 25 | import com.github._1c_syntax.bsl.mdo.storage.form.FormItem;
|
26 | 26 | import com.github._1c_syntax.bsl.reader.common.context.FormElementReaderContext;
|
| 27 | +import com.github._1c_syntax.bsl.reader.common.xstream.ExtendXStream; |
27 | 28 | import com.github._1c_syntax.bsl.reader.common.xstream.ReadConverter;
|
28 | 29 | import com.thoughtworks.xstream.converters.UnmarshallingContext;
|
29 | 30 | import com.thoughtworks.xstream.io.HierarchicalStreamReader;
|
| 31 | +import lombok.extern.slf4j.Slf4j; |
30 | 32 |
|
31 | 33 | /**
|
32 | 34 | * Конвертор элемента формы в формате конфигуратора
|
33 | 35 | */
|
34 | 36 | @DesignerConverter
|
| 37 | +@Slf4j |
35 | 38 | public class FormElementConverter implements ReadConverter {
|
36 | 39 |
|
37 | 40 | @Override
|
38 | 41 | public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
|
39 | 42 | var readerContext = new FormElementReaderContext(reader.getNodeName(), reader);
|
| 43 | + try { |
| 44 | + readerContext.setValue("id", Integer.parseInt(reader.getAttribute("id"))); |
| 45 | + } catch (NumberFormatException e) { |
| 46 | + LOGGER.error("Unknown type {} in file {}", reader.getNodeName(), ExtendXStream.getCurrentPath(reader).toString()); |
| 47 | + return null; |
| 48 | + } |
40 | 49 | readerContext.setValue("type", reader.getNodeName());
|
41 |
| - readerContext.setValue("id", Integer.parseInt(reader.getAttribute("id"))); |
42 | 50 | readerContext.setValue("name", reader.getAttribute("name"));
|
43 | 51 | Unmarshaller.unmarshal(reader, context, readerContext);
|
44 | 52 | return readerContext.build();
|
|
0 commit comments