Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
053987c7
"eu_basysbio/git@sissource.ethz.ch:sispub/openbis.git" did not exist on "03ad1696aec8958ce4b4e06a5141627bb48cd971"
Commit
053987c7
authored
17 years ago
by
brinn
Browse files
Options
Downloads
Patches
Plain Diff
fix: race condition in StreamReaderGobbler
SVN: 647
parent
55a78861
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ant_tasks/source/java/ch/systemsx/cisd/ant/task/subversion/SVNUtilities.java
+20
-10
20 additions, 10 deletions
...va/ch/systemsx/cisd/ant/task/subversion/SVNUtilities.java
with
20 additions
and
10 deletions
ant_tasks/source/java/ch/systemsx/cisd/ant/task/subversion/SVNUtilities.java
+
20
−
10
View file @
053987c7
...
...
@@ -24,6 +24,7 @@ import java.io.InputStreamReader;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.concurrent.Semaphore
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
...
...
@@ -105,10 +106,12 @@ class SVNUtilities
private
static
final
class
StreamReaderGobbler
{
private
final
Semaphore
waitForReadingFinishedSemaphore
=
new
Semaphore
(
1
);
private
final
List
<
String
>
lines
=
new
ArrayList
<
String
>();
StreamReaderGobbler
(
final
InputStream
stream
)
StreamReaderGobbler
(
final
InputStream
stream
)
throws
InterruptedException
{
waitForReadingFinishedSemaphore
.
acquire
();
new
Thread
()
{
@Override
...
...
@@ -116,26 +119,33 @@ class SVNUtilities
{
try
{
synchronized
(
this
)
final
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
stream
));
String
line
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
final
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
stream
));
String
line
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
lines
.
add
(
line
);
}
lines
.
add
(
line
);
}
}
catch
(
IOException
ex
)
{
throw
new
EnvironmentFailureException
(
"Couldn't gobble stream content"
,
ex
);
}
finally
{
waitForReadingFinishedSemaphore
.
release
();
}
}
}.
start
();
}
synchronized
List
<
String
>
getLines
()
List
<
String
>
getLines
()
throws
InterruptedException
{
return
lines
;
waitForReadingFinishedSemaphore
.
acquire
();
try
{
return
lines
;
}
finally
{
waitForReadingFinishedSemaphore
.
release
();
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment