Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
e-Knife for Erlang with Constrained Edges
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
Program Slicing
e-Knife for Erlang with Constrained Edges
Commits
c1ee66fa
Commit
c1ee66fa
authored
3 years ago
by
Carlos Galindo
Browse files
Options
Downloads
Patches
Plain Diff
Added helpful error messages for erroneous arguments
* Added clarifying comma to help message.
parent
2db6f88d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
e-Knife/src/main/java/eknife/EKnife.java
+24
-9
24 additions, 9 deletions
e-Knife/src/main/java/eknife/EKnife.java
with
24 additions
and
9 deletions
e-Knife/src/main/java/eknife/EKnife.java
+
24
−
9
View file @
c1ee66fa
...
...
@@ -27,9 +27,10 @@ import edg.graph.Node;
import
edg.slicing.ConstrainedAlgorithm
;
import
edg.slicing.SlicingAlgorithm
;
import
edg.slicing.SlicingCriterion
;
import
eknife.config.Config
;
import
java.io.File
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Set
;
public
class
EKnife
...
...
@@ -113,8 +114,8 @@ public class EKnife
help
+=
" -l,--line <num> The line of the slicing criterion\n"
;
help
+=
" -v,--var <name> The name of the slicing criterion (must be a variable)\n"
;
help
+=
" -n,--occurrence <num> The occurrence of the slicing criterion in that line\n"
;
help
+=
" -G
--print-graph <file.dot> Exports the graph as a dot file\n"
;
help
+=
" -G
--print-graph <file.pdf> Exports the graph as a PDF file\n"
;
help
+=
" -G
,
--print-graph <file.dot> Exports the graph as a dot file\n"
;
help
+=
" -G
,
--print-graph <file.pdf> Exports the graph as a PDF file\n"
;
help
+=
" --help Show this message.\n"
;
System
.
out
.
print
(
help
);
...
...
@@ -180,12 +181,26 @@ public class EKnife
}
boolean
isValid
()
{
return
inputPath
!=
null
&&
new
File
(
inputPath
).
exists
()
&&
outputFile
!=
null
&&
(
outputFile
.
exists
()
||
outputFile
.
getAbsoluteFile
().
getParentFile
().
isDirectory
())
&&
file
!=
null
&&
line
>
0
&&
name
!=
null
&&
!
name
.
isEmpty
()
&&
occurrence
>
0
;
List
<
String
>
errors
=
new
LinkedList
<>();
if
(
inputPath
==
null
)
errors
.
add
(
"You must specify a file to analyze with '-i'."
);
else
if
(!
new
File
(
inputPath
).
exists
())
errors
.
add
(
"The input file you've specified does not exist or isn't readable("
+
inputPath
+
")."
);
if
(
outputFile
==
null
)
errors
.
add
(
"You must specify a location for the output with '-o'."
);
else
if
(!
outputFile
.
exists
()
&&
!
outputFile
.
getAbsoluteFile
().
getParentFile
().
isDirectory
())
errors
.
add
(
"The output file's parent folder does not exist, or the output folder does not exist."
);
if
(
file
==
null
)
errors
.
add
(
"The input file is a folder, so you must specify a the file that contains the slicing criterion with '-f'."
);
if
(
line
<=
0
)
errors
.
add
(
"You must specify a line number greater than 0 with '-l'."
);
if
(
name
==
null
||
name
.
isEmpty
())
errors
.
add
(
"You must specify a valid variable name with '-v'."
);
if
(
occurrence
<=
0
)
errors
.
add
(
"You must specify an occurrence greater than 0 with '-n'."
);
for
(
String
error
:
errors
)
System
.
out
.
println
(
error
);
return
errors
.
isEmpty
();
}
}
}
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