This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Product Version = NetBeans IDE Dev (Build 201607210002) Operating System = Linux version 4.4.0-31-generic running on amd64 Java; VM; Vendor = 1.8.0_102 Runtime = Java HotSpot(TM) 64-Bit Server VM 25.102-b14 Reproducibility: Happens sometimes, but not always Pasting Java code that will also need some new imports sometimes corrupts the imports in the target file. For example, pasting the following code block: // create and send a new one Message l_msg = new MimeMessage(l_session_out); // from is a list Address[] l_from = l_old_msg.getFrom(); if (l_from != null && l_from.length > 0) { l_msg.setFrom(l_from[0]); } l_msg.setReplyTo(l_old_msg.getReplyTo()); l_msg.addRecipient(Message.RecipientType.TO, new InternetAddress(a_redirect_to)); l_msg.setSubject(l_old_msg.getSubject()); l_msg.setSentDate(l_old_msg.getSentDate()); // now the parts Object l_content = l_old_msg.getContent(); if (l_content == null) { l_return = "Message has no content??!!"; } else if (l_content instanceof Multipart) { Multipart l_mp_old = (Multipart) l_content; l_msg.setContent(l_mp_old); } else if (l_content instanceof String) { String l_old_type = l_old_msg.getContentType(); if (StringUtil.isEmpty(l_old_type)) { l_old_type = "text/plain"; } l_msg.setContent(l_content, l_old_type); } else { l_return = "Don't know how to deal with content type " + l_content.getClass().getName(); } if (l_return == null) { Transport.send(l_msg); } Resulted in this: import javax.mail.Multipart; import javax.mail.Message; import javax.mail.PasswordAuthenticatiimport javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; on; import javax.mail.Session; import javax.mail.Store; I can typically recover by deleting the corrupted import lines and doing "fix imports".
Created attachment 161406 [details] IDE log
I need to debug the issue with the exact file (perhaps some positioning screws up). When the issue happens again, please try the following: 1/ Undo to the point before code block paste. 2/ Save the file, close editor 3/ Open file again, do the paste 4/ Check imports; if they are screwed again, great ! Close the editor (do not save contents) and send me the exact file or attach the file here. Also export *all* your options (Tools | Options > Export button). 5/ if the file does not become corrupted, bad luck :-/ try again.