Author: kono
Date: 2012-09-25 18:47:17 -0700 (Tue, 25 Sep 2012)
New Revision: 30485
Modified:
core3/impl/trunk/graphml-impl/src/main/java/org/cytoscape/io/internal/read/graphml/GraphMLFileFilter.java
Log:
fixes #1482 File filter for GraphML is working again.
Modified:
core3/impl/trunk/graphml-impl/src/main/java/org/cytoscape/io/internal/read/graphml/GraphMLFileFilter.java
===================================================================
---
core3/impl/trunk/graphml-impl/src/main/java/org/cytoscape/io/internal/read/graphml/GraphMLFileFilter.java
2012-09-26 01:34:26 UTC (rev 30484)
+++
core3/impl/trunk/graphml-impl/src/main/java/org/cytoscape/io/internal/read/graphml/GraphMLFileFilter.java
2012-09-26 01:47:17 UTC (rev 30485)
@@ -15,6 +15,7 @@
private static final Logger logger =
LoggerFactory.getLogger(GraphMLFileFilter.class);
private static final String GRAPHML_NAMESPACE_STRING =
"http://graphml.graphdrawing.org/xmlns";
+ private static final String GRAPHML_TAG = "<graphml>";
public GraphMLFileFilter(final String[] extensions, String[]
contentTypes, String description,
DataCategory category, StreamUtil streamUtil) {
@@ -25,12 +26,15 @@
public boolean accepts(InputStream stream, DataCategory category) {
// Check data category
- if (category != this.category)
+ if(category != this.category)
return false;
final String header = this.getHeader(stream, 20);
if (header.contains(GRAPHML_NAMESPACE_STRING))
return true;
+
+ if(header.contains(GRAPHML_TAG))
+ return true;
return false;
}
@@ -38,7 +42,10 @@
@Override
public boolean accepts(URI uri, DataCategory category) {
try {
- return accepts(uri.toURL().openStream(), category);
+ if(super.accepts(uri, category))
+ return accepts(uri.toURL().openStream(),
category);
+ else
+ return false;
} catch (IOException e) {
logger.error("Error while opening stream: " + uri, e);
return false;
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.