private void onSettingsUpdated(final boolean autoDetectEncoding) { if (!validateForm()) { return; } final byte[] sampleBuffer = getSampleBuffer(); if (sampleBuffer == null || sampleBuffer.length == 0) { logger.debug("No bytes read to autodetect settings"); return; } final String charSet; if (autoDetectEncoding) { charSet = _encodingComboBox.autoDetectEncoding(sampleBuffer); } else { charSet = _encodingComboBox.getSelectedItem(); } final char[] sampleChars = readSampleBuffer(sampleBuffer, charSet); final int lineLength = StringUtils.indexOf('\n', sampleChars); if (_eolPresentCheckBox.isSelected() && lineLength == -1) { setStatusWarning("No newline in first " + sampleChars.length + " chars"); // don't show the preview if no newlines were found (it may try to treat the whole file as a single row) showPreview = false; } else { showPreview = true; validateAndUpdate(); } }