- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
try {
	// Store settings in the database as a JSON string
	machine.setSettings(CustomJacksonRepresentation.createCanonicalObjectMapper().writeValueAsString(
			request.getSettings()));
} catch (final JsonMappingException e) {
	// We obtained request by parsing JSON in the first place,
	// no way it can fail to be serialized back o_O
	throw new AssertionError(e);
} catch (final JsonGenerationException e) {
	// See above
	throw new AssertionError(e);
} catch (final IOException e) {
	// Why does writeValueAsString throw IOException anyway? How CAN you fail to write to a String?
	// Seriously, what were the writers of Jackson smoking that they exposed IOException in the API
	// in a method specifically designed to serialize to String, just because the underlying implementation
	// uses StringWriter (which doesn't really throw IOException anyway)?
	// I mean, I understand if the string is too long to fit in memory, but that's an OutOfMemoryError
	throw new AssertionError(e);
}
                                 
        
наверное по той же самой причине по которой какие-то пидарасы из ISO когда-то настояли на том что бы в С snprintf() возвращал бесполезную -1 если вывод не влазит в выходной буффер. блягодаря им теперь есть куча реализаций где и возвращается эта самая -1. не смотря на то что это было исправлено в одной из первый эррат для с99. но она и дальше будет возвращать -1 потому "обратная совместимость, мля."