Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Verlässliche Systemsoftware
projects
osv
Commits
424e1245
Commit
424e1245
authored
11 years ago
by
Tomasz Grabiec
Browse files
Options
Downloads
Patches
Plain Diff
java: cleanups
parent
868ac399
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
java/runjava/src/main/java/io/osv/ContextIsolator.java
+10
-10
10 additions, 10 deletions
java/runjava/src/main/java/io/osv/ContextIsolator.java
with
10 additions
and
10 deletions
java/runjava/src/main/java/io/osv/ContextIsolator.java
+
10
−
10
View file @
424e1245
...
...
@@ -98,7 +98,7 @@ public class ContextIsolator {
}
public
Context
run
(
String
[]
args
)
throws
Throwable
{
ArrayList
<
String
>
classpath
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
classpath
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
if
(
args
[
i
].
equals
(
"-jar"
))
{
if
(
i
+
1
>=
args
.
length
)
{
...
...
@@ -130,22 +130,22 @@ public class ContextIsolator {
throw
new
IllegalArgumentException
(
"No jar or class specified to run."
);
}
private
Context
runJar
(
String
jar
n
ame
,
String
[]
args
,
ArrayList
<
String
>
classpath
)
throws
Throwable
{
File
jar
f
ile
=
new
File
(
jar
n
ame
);
private
Context
runJar
(
String
jar
N
ame
,
String
[]
args
,
ArrayList
<
String
>
classpath
)
throws
Throwable
{
File
jar
F
ile
=
new
File
(
jar
N
ame
);
try
{
JarFile
jar
=
new
JarFile
(
jar
f
ile
);
JarFile
jar
=
new
JarFile
(
jar
F
ile
);
Manifest
mf
=
jar
.
getManifest
();
jar
.
close
();
String
mainClass
=
mf
.
getMainAttributes
().
getValue
(
"Main-Class"
);
if
(
mainClass
==
null
)
{
throw
new
IllegalArgumentException
(
"No 'Main-Class' attribute in manifest of "
+
jar
n
ame
);
throw
new
IllegalArgumentException
(
"No 'Main-Class' attribute in manifest of "
+
jar
N
ame
);
}
classpath
.
add
(
jar
n
ame
);
classpath
.
add
(
jar
N
ame
);
return
runClass
(
mainClass
,
args
,
classpath
);
}
catch
(
FileNotFoundException
e
)
{
throw
new
IllegalArgumentException
(
"File not found: "
+
jar
n
ame
);
throw
new
IllegalArgumentException
(
"File not found: "
+
jar
N
ame
);
}
catch
(
ZipException
e
)
{
throw
new
IllegalArgumentException
(
"File is not a jar: "
+
jar
n
ame
);
throw
new
IllegalArgumentException
(
"File is not a jar: "
+
jar
N
ame
);
}
}
...
...
@@ -176,7 +176,7 @@ public class ContextIsolator {
}
private
static
List
<
URL
>
toUrls
(
Iterable
<
String
>
classpath
)
throws
MalformedURLException
{
ArrayList
<
URL
>
urls
=
new
ArrayList
<
URL
>();
ArrayList
<
URL
>
urls
=
new
ArrayList
<>();
for
(
String
path
:
classpath
)
{
urls
.
add
(
toUrl
(
path
));
}
...
...
@@ -235,7 +235,7 @@ public class ContextIsolator {
// where "dir/*" adds to the classpath all jar files in the given
// directory.
static
Iterable
<
String
>
expandClassPath
(
String
classpath
)
{
ArrayList
<
String
>
ret
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
ret
=
new
ArrayList
<>();
for
(
String
component
:
classpath
.
split
(
":"
))
{
if
(
component
.
endsWith
(
"/*"
))
{
File
dir
=
new
File
(
...
...
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