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
8a5628f1
Commit
8a5628f1
authored
17 years ago
by
ribeaudc
Browse files
Options
Downloads
Patches
Plain Diff
change:
- Ensure that given file is not a directory. SVN: 2880
parent
8b17f5fe
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
common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java
+22
-21
22 additions, 21 deletions
...java/ch/systemsx/cisd/common/utilities/FileUtilities.java
with
22 additions
and
21 deletions
common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java
+
22
−
21
View file @
8a5628f1
...
@@ -147,10 +147,11 @@ public final class FileUtilities
...
@@ -147,10 +147,11 @@ public final class FileUtilities
*
*
* @throws CheckedExceptionTunnel for wrapping an {@link IOException}.
* @throws CheckedExceptionTunnel for wrapping an {@link IOException}.
*/
*/
public
static
void
writeToFile
(
File
file
,
String
str
)
throws
CheckedExceptionTunnel
public
static
void
writeToFile
(
final
File
file
,
final
String
str
)
throws
CheckedExceptionTunnel
{
{
assert
file
!=
null
:
"Unspecified file."
;
assert
file
!=
null
:
"Unspecified file."
;
assert
str
!=
null
:
"Unspecified string."
;
assert
str
!=
null
:
"Unspecified string."
;
assert
file
.
isDirectory
()
==
false
:
String
.
format
(
"Given file '%s' already exists and is a directory."
,
file
);
FileWriter
fileWriter
=
null
;
FileWriter
fileWriter
=
null
;
try
try
...
@@ -868,7 +869,7 @@ public final class FileUtilities
...
@@ -868,7 +869,7 @@ public final class FileUtilities
return
file
.
getAbsolutePath
();
return
file
.
getAbsolutePath
();
}
}
}
}
/**
/**
* Returns <code>true</code>, if the (remote resource) <var>path</var> becomes available within
* Returns <code>true</code>, if the (remote resource) <var>path</var> becomes available within
* <var>timeOutMillis</var> milli-seconds.
* <var>timeOutMillis</var> milli-seconds.
...
@@ -878,28 +879,28 @@ public final class FileUtilities
...
@@ -878,28 +879,28 @@ public final class FileUtilities
final
Semaphore
sem
=
new
Semaphore
(
1
);
final
Semaphore
sem
=
new
Semaphore
(
1
);
sem
.
acquireUninterruptibly
();
sem
.
acquireUninterruptibly
();
final
Thread
t
=
new
Thread
(
new
Runnable
()
final
Thread
t
=
new
Thread
(
new
Runnable
()
{
public
void
run
()
{
{
boolean
pathExists
=
false
;
public
void
run
()
do
{
{
pathExists
=
path
.
exists
();
boolean
pathExists
=
false
;
if
(
pathExists
)
do
{
sem
.
release
();
return
;
}
try
{
{
Thread
.
sleep
(
timeOutMillis
/
10L
);
pathExists
=
path
.
exists
();
}
catch
(
InterruptedException
ex
)
if
(
pathExists
)
{
{
return
;
sem
.
release
();
}
return
;
}
while
(
true
);
}
}
try
},
"Path Availability Checker: "
+
path
.
getPath
());
{
Thread
.
sleep
(
timeOutMillis
/
10L
);
}
catch
(
InterruptedException
ex
)
{
return
;
}
}
while
(
true
);
}
},
"Path Availability Checker: "
+
path
.
getPath
());
t
.
start
();
t
.
start
();
try
try
{
{
...
...
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