Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 261231 Details for
Bug 492395
Some dot models causes deadlock in DotExecutableUtils
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch
org.eclipse.gef4.patch (text/plain), 3.82 KB, created by
Darius Jockel
on 2016-04-25 16:03:11 EDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darius Jockel
Created:
2016-04-25 16:03:11 EDT
Size:
3.82 KB
patch
obsolete
>diff --git a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotExecutableUtilsTests.java b/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotExecutableUtilsTests.java >index a1e41a6..15719b5 100644 >--- a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotExecutableUtilsTests.java >+++ b/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotExecutableUtilsTests.java >@@ -13,16 +13,17 @@ > *******************************************************************************/ > package org.eclipse.gef4.dot.tests; > >+import static org.junit.Assert.assertNotNull; >+import static org.junit.Assert.assertTrue; >+ > import java.io.File; > import java.io.IOException; > import java.io.InputStream; > import java.util.Properties; > >+import org.eclipse.gef4.dot.internal.DotExecutableUtils; > import org.eclipse.gef4.dot.internal.DotExport; > import org.eclipse.gef4.dot.internal.DotFileUtils; >-import org.eclipse.gef4.dot.internal.DotExecutableUtils; >-import org.eclipse.gef4.dot.internal.ui.GraphvizPreferencePage; >-import org.eclipse.gef4.graph.Graph; > import org.junit.Assert; > import org.junit.BeforeClass; > import org.junit.Test; >@@ -54,7 +55,8 @@ > if (stream == null) { > System.err.println( > "Could not load the test.properties file in directory of " //$NON-NLS-1$ >- + DotExecutableUtilsTests.class.getSimpleName()); >+ + DotExecutableUtilsTests.class >+ .getSimpleName()); > } else > try { > props.load(stream); >@@ -80,7 +82,8 @@ > > @Test > public void simpleGraph() { >- testDotGeneration(DotTestUtils.getSimpleGraph(), "simple_graph.dot"); >+ testDotGeneration(DotTestUtils.getSimpleGraph(), >+ "arrowshapes_direction_both.dot"); > } > > @Test >@@ -114,4 +117,13 @@ > } > } > >+ @Test(timeout = 2000) >+ public void testComplexDot() throws Exception { >+ File dotFile = new File("./resources/arrowshapes_direction_both.dot"); >+ assertTrue(dotFile.exists()); >+ String[] dotResult = DotExecutableUtils >+ .executeDot(new File(dotExecutablePath), dotFile, null, null); >+ assertNotNull("Result should not be null", dotResult); >+ } >+ > } >diff --git a/org.eclipse.gef4.dot/src/org/eclipse/gef4/dot/internal/DotExecutableUtils.java b/org.eclipse.gef4.dot/src/org/eclipse/gef4/dot/internal/DotExecutableUtils.java >index 9994ab6..28b3c8d 100644 >--- a/org.eclipse.gef4.dot/src/org/eclipse/gef4/dot/internal/DotExecutableUtils.java >+++ b/org.eclipse.gef4.dot/src/org/eclipse/gef4/dot/internal/DotExecutableUtils.java >@@ -17,6 +17,7 @@ > package org.eclipse.gef4.dot.internal; > > import java.io.File; >+import java.io.FileInputStream; > import java.io.IOException; > import java.io.InputStream; > import java.util.ArrayList; >@@ -95,16 +96,41 @@ > public static String[] executeDot(final File dotExecutablePath, > final File dotInputFile, final File outputFile, > final String outputFormat) { >+ File buffer = null; >+ boolean hasBuffer = false; > List<String> commands = new ArrayList<>(); > commands.add(dotExecutablePath.getAbsolutePath()); > if (outputFormat != null) { > commands.add("-T" + outputFormat); > } > if (outputFile != null) { >- commands.add("-o" + outputFile.toPath().toString()); >+ buffer = outputFile; >+ } else { >+ try { >+ buffer = File.createTempFile("tmpResult", ".dot"); >+ hasBuffer = true; >+ } catch (IOException e) { >+ e.printStackTrace(); >+ } > } >+ commands.add("-o" + buffer.toPath().toString()); > commands.add(dotInputFile.toPath().toString()); >- return call(commands.toArray(new String[] {})); >+ String[] call = call(commands.toArray(new String[] {})); >+ if (hasBuffer) { >+ FileInputStream input; >+ try { >+ input = new FileInputStream(buffer); >+ call[0] = read(input); >+ input.close(); >+ } catch (Exception e) { >+ System.out.println("failed to read temp dot file"); >+ } finally { >+ buffer.delete(); >+ } >+ return call; >+ } else { >+ return call; >+ } > } > > /***
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
nyssen
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 492395
: 261231