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
ea22edc4
Commit
ea22edc4
authored
16 years ago
by
ribeaudc
Browse files
Options
Downloads
Patches
Plain Diff
change: - Extract 'InputStreamReaderGobbler' and put in the 'common' project.
SVN: 6242
parent
db9ed2b7
No related branches found
No related tags found
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
+7
-61
7 additions, 61 deletions
...va/ch/systemsx/cisd/ant/task/subversion/SVNUtilities.java
with
7 additions
and
61 deletions
ant_tasks/source/java/ch/systemsx/cisd/ant/task/subversion/SVNUtilities.java
+
7
−
61
View file @
ea22edc4
...
...
@@ -16,23 +16,19 @@
package
ch.systemsx.cisd.ant.task.subversion
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
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
;
import
ch.systemsx.cisd.ant.common.StringUtils
;
import
ch.systemsx.cisd.common.exceptions.EnvironmentFailureException
;
import
ch.systemsx.cisd.common.exceptions.UserFailureException
;
import
ch.systemsx.cisd.common.logging.ISimpleLogger
;
import
ch.systemsx.cisd.common.logging.LogLevel
;
import
ch.systemsx.cisd.common.process.InputStreamReaderGobbler
;
import
ch.systemsx.cisd.common.utilities.OSUtilities
;
/**
...
...
@@ -107,56 +103,6 @@ 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
)
throws
InterruptedException
{
waitForReadingFinishedSemaphore
.
acquire
();
final
Thread
t
=
new
Thread
()
{
@Override
public
void
run
()
{
try
{
final
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
stream
));
String
line
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
lines
.
add
(
line
);
}
}
catch
(
IOException
ex
)
{
throw
new
EnvironmentFailureException
(
"Couldn't gobble stream content"
,
ex
);
}
finally
{
waitForReadingFinishedSemaphore
.
release
();
}
}
};
t
.
start
();
}
List
<
String
>
getLines
()
throws
InterruptedException
{
waitForReadingFinishedSemaphore
.
acquire
();
try
{
return
lines
;
}
finally
{
waitForReadingFinishedSemaphore
.
release
();
}
}
}
/**
* @return The top-level directory (first level of the hierarchy) of <var>path</var>.
*/
...
...
@@ -284,10 +230,10 @@ class SVNUtilities
try
{
final
Process
process
=
builder
.
start
();
StreamReaderGobbler
inputStreamGobbler
=
new
StreamReaderGobbler
(
process
.
getInputStream
());
StreamReaderGobbler
errorStreamGobbler
=
new
StreamReaderGobbler
(
process
.
getErrorStream
());
Input
StreamReaderGobbler
inputStreamGobbler
=
new
Input
StreamReaderGobbler
(
process
.
getInputStream
());
Input
StreamReaderGobbler
errorStreamGobbler
=
new
Input
StreamReaderGobbler
(
process
.
getErrorStream
());
final
int
exitValue
=
process
.
waitFor
();
List
<
String
>
lines
=
inputStreamGobbler
.
getLines
();
if
(
0
!=
exitValue
)
...
...
@@ -336,8 +282,8 @@ class SVNUtilities
try
{
final
Process
process
=
builder
.
start
();
StreamReaderGobbler
inputStreamGobbler
=
new
StreamReaderGobbler
(
process
.
getInputStream
());
Input
StreamReaderGobbler
inputStreamGobbler
=
new
Input
StreamReaderGobbler
(
process
.
getInputStream
());
final
int
exitValue
=
process
.
waitFor
();
List
<
String
>
lines
=
inputStreamGobbler
.
getLines
();
if
(
0
!=
exitValue
)
...
...
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