Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lesson9 task1 #8

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

lesson9 task1 #8

wants to merge 9 commits into from

Conversation

ilyalychkou
Copy link
Owner

lesson 9

@ilyalychkou ilyalychkou requested a review from alka1ra November 12, 2020 09:10
.idea/libraries/hamcrest_2_1.xml Show resolved Hide resolved
src/com/javafordev/lesson9/task1/log/log.txt Outdated Show resolved Hide resolved
src/com/javafordev/lesson9/task1/parser/dom/DomUtil.java Outdated Show resolved Hide resolved
src/com/javafordev/lesson9/task1/parser/stax/StAXUtil.java Outdated Show resolved Hide resolved
Comment on lines +48 to +67
public void saveParticipantsToXMLFile() {

System.out.print("Сохранить список участников в файл?");
Scanner scan = new Scanner(System.in);
scan.useDelimiter(" ");
String answer = scan.nextLine().trim();
if (answer.equalsIgnoreCase("да")) {
String pathToXML = "/Users/Admin/Documents/javafordev/src/com/javafordev/lesson9/task2/data/participants.xml";
try {
JAXBContext context = JAXBContext.newInstance(Participants.class);
Marshaller m = context.createMarshaller();
m.marshal(this.participants, new FileOutputStream(pathToXML));
} catch (JAXBException | FileNotFoundException exception) {
logger.error("error occurred " + exception.getMessage());
}
logger.info("Список участников успешно сохранен в файл " + pathToXML);
} else {
logger.info("Список участников не был сохранен в файл");
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

логику не разделяешь - у тебя и ввод-вывлд с консоли и запись в файл все в одном месте как ты на это тест напишешь? - видно поэтому их и нет ко второму заданию

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants