Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InvalidObjectException;
import java.io.NotSerializableException;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
Expand Down Expand Up @@ -395,6 +393,7 @@ public FileObject getModesLocalFolder () throws IOException {

/** Listens to property changes in InstanceDataObject. Used to clean top component
* cache when module owning given top component is disabled. */
@Override
public void propertyChange (PropertyChangeEvent evt) {
if (DataObject.PROP_COOKIE.equals(evt.getPropertyName())) {
Object obj = evt.getSource();
Expand Down Expand Up @@ -521,7 +520,6 @@ private TopComponent getTopComponentPersistentForID(String stringId, boolean des
return null;
}
// search on disk
IOException resultExc = null;
try {
DataObject dob = findTopComponentDataObject(getComponentsLocalFolder(), stringId);
if (dob == null) {
Expand Down Expand Up @@ -574,7 +572,6 @@ private TopComponent getTopComponentPersistentForID(String stringId, boolean des
// not found
String excAnnotation = NbBundle.getMessage(PersistenceManager.class,
"EXC_FailedLocateTC", stringId);
resultExc = new FileNotFoundException(excAnnotation);
LOG.log(warningLevelForDeserTC(stringId),
"[PersistenceManager.getTopComponentForID]" // NOI18N
+ " Problem when deserializing TopComponent for tcID:'" + stringId + "'. Reason: " // NOI18N
Expand All @@ -584,48 +581,24 @@ private TopComponent getTopComponentPersistentForID(String stringId, boolean des
// with new projects should not happen, since projects are not switched in winsys anymore.
// ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, resultExc);
}
} catch (NoClassDefFoundError ndfe) { // TEMP>>
} catch (DataObjectNotFoundException ex) {
LOG.log(warningLevelForDeserTC(stringId),
"[PersistenceManager.getTopComponentForID]" // NOI18N
+ " Problem when deserializing TopComponent for tcID:'" + stringId + "'. Reason: " // NOI18N
+ ndfe.getMessage(), ndfe);
} catch (InvalidObjectException ioe) {
+ ex.getMessage());
LOG.log(Level.FINE, "", ex);
} catch (NoClassDefFoundError | ClassNotFoundException | ClassCastException | IOException ex) {
LOG.log(warningLevelForDeserTC(stringId),
"[PersistenceManager.getTopComponentForID]" // NOI18N
+ " Problem when deserializing TopComponent for tcID:'" + stringId + "'. Reason: " // NOI18N
+ ioe.getMessage(), ioe);
} catch (DataObjectNotFoundException dnfe) {
LOG.log(warningLevelForDeserTC(stringId),
"[PersistenceManager.getTopComponentForID]" // NOI18N
+ " Problem when deserializing TopComponent for tcID:'" + stringId + "'. Reason: " // NOI18N
+ " Object not found: " + dnfe.getMessage() // NOI18N
+ ". It was probably deleted.", dnfe); // NOI18N
} catch (ClassNotFoundException exc) {
// ignore, will result in IOException fail below, annotate
// and turn into IOExc
LOG.log(warningLevelForDeserTC(stringId),
"[PersistenceManager.getTopComponentForID]" // NOI18N
+ " Problem when deserializing TopComponent for tcID:'" + stringId + "'. Reason: " // NOI18N
+ exc.getMessage(), exc);
} catch (ClassCastException exc) {
// instance is not top component (is broken), annotate and
// turn into IOExc
LOG.log(warningLevelForDeserTC(stringId),
"[PersistenceManager.getTopComponentForID]" // NOI18N
+ " Problem when deserializing TopComponent for tcID:'" + stringId + "'. Reason: " // NOI18N
+ exc.getMessage(), exc);
} catch (IOException ioe) {
LOG.log(warningLevelForDeserTC(stringId),
"[PersistenceManager.getTopComponentForID]" // NOI18N
+ " Problem when deserializing TopComponent for tcID:'" + stringId + "'. Reason: " // NOI18N
+ ioe.getMessage(), ioe);
+ ex.getMessage(), ex);
}
return null;
}
private final Set<String> warnedIDs = Collections.synchronizedSet(new HashSet<String>());
private final Set<String> warnedIDs = Collections.synchronizedSet(new HashSet<>());
/** Avoid printing dozens of warnings about the same ID in one IDE session. */
private Level warningLevelForDeserTC(String id) {
return warnedIDs.add(id) ? Level.INFO : Level.FINE;
return warnedIDs.add(id) ? Level.WARNING : Level.FINE;
}

/** @return Searches for TopComponent with given string id and returns
Expand Down Expand Up @@ -1039,6 +1012,7 @@ public XMLReader getXMLParser (DefaultHandler h) throws SAXException {
parser.setEntityResolver(new EntityResolver () {
/** Implementation of entity resolver. Points to the local DTD
* for our public ID */
@Override
public InputSource resolveEntity (String publicId, String systemId)
throws SAXException {
if (ModeParser.INSTANCE_DTD_ID_1_0.equals(publicId)
Expand Down Expand Up @@ -1389,6 +1363,7 @@ public TopComponentReference (TopComponent ref, String tcID) {
this.tcID = tcID;
}

@Override
public void run() {
removeGlobalTopComponentID(tcID);
}
Expand Down
Loading