Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TeeTime-Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nelson Tavares de Sousa
TeeTime-Framework
Commits
55c79ff4
Commit
55c79ff4
authored
9 years ago
by
Nelson Tavares de Sousa
Browse files
Options
Downloads
Patches
Plain Diff
adapted old error throwing logic
parent
3c77564c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/teetime/framework/AbstractStage.java
+9
-4
9 additions, 4 deletions
src/main/java/teetime/framework/AbstractStage.java
src/main/java/teetime/framework/validation/AnalysisNotValidException.java
+1
-0
1 addition, 0 deletions
...etime/framework/validation/AnalysisNotValidException.java
with
10 additions
and
4 deletions
src/main/java/teetime/framework/AbstractStage.java
+
9
−
4
View file @
55c79ff4
...
@@ -278,7 +278,7 @@ public abstract class AbstractStage {
...
@@ -278,7 +278,7 @@ public abstract class AbstractStage {
}
}
public
void
onValidating
(
final
List
<
InvalidPortConnection
>
invalidPortConnections
)
{
public
void
onValidating
(
final
List
<
InvalidPortConnection
>
invalidPortConnections
)
{
this
.
checkTypeCompliance
();
this
.
checkTypeCompliance
(
invalidPortConnections
);
changeState
(
StageState
.
VALIDATED
);
changeState
(
StageState
.
VALIDATED
);
}
}
...
@@ -300,15 +300,20 @@ public abstract class AbstractStage {
...
@@ -300,15 +300,20 @@ public abstract class AbstractStage {
/**
/**
* Checks if connections to this pipe are correct in regards to type compliance.
* Checks if connections to this pipe are correct in regards to type compliance.
* Incoming elements must be instanceof input port type
* Incoming elements must be instanceof input port type.
*
* @param invalidPortConnections
* List of invalid connections. Adding invalid connections to this list is a performance advantage in comparison to returning a list by each stage.
*/
*/
private
void
checkTypeCompliance
()
{
private
void
checkTypeCompliance
(
final
List
<
InvalidPortConnection
>
invalidPortConnections
)
{
for
(
InputPort
<?>
port
:
getInputPorts
())
{
for
(
InputPort
<?>
port
:
getInputPorts
())
{
Class
<?>
targetType
=
port
.
getType
();
Class
<?>
targetType
=
port
.
getType
();
Class
<?>
sourceType
=
port
.
pipe
.
getSourcePort
().
getType
();
Class
<?>
sourceType
=
port
.
pipe
.
getSourcePort
().
getType
();
if
(
targetType
!=
null
&&
sourceType
!=
null
)
{
if
(
targetType
!=
null
&&
sourceType
!=
null
)
{
if
(
targetType
.
isAssignableFrom
(
sourceType
))
{
// kinda instanceof, but for Class class
if
(
targetType
.
isAssignableFrom
(
sourceType
))
{
// kinda instanceof, but for Class class
throw
new
IllegalStateException
(
"2002 - Invalid pipe at "
+
port
.
toString
()
+
": "
+
targetType
+
" is not a superclass/type of "
+
sourceType
);
invalidPortConnections
.
add
(
new
InvalidPortConnection
(
port
.
pipe
.
getSourcePort
(),
port
));
// throw new IllegalStateException("2002 - Invalid pipe at " + port.toString() + ": " + targetType + " is not a superclass/type of " +
// sourceType);
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/teetime/framework/validation/AnalysisNotValidException.java
+
1
−
0
View file @
55c79ff4
...
@@ -34,6 +34,7 @@ public class AnalysisNotValidException extends RuntimeException {
...
@@ -34,6 +34,7 @@ public class AnalysisNotValidException extends RuntimeException {
@Override
@Override
public
String
getMessage
()
{
public
String
getMessage
()
{
final
StringBuilder
builder
=
new
StringBuilder
(
this
.
invalidPortConnections
.
size
()
*
40
);
final
StringBuilder
builder
=
new
StringBuilder
(
this
.
invalidPortConnections
.
size
()
*
40
);
builder
.
append
(
"2002 - "
);
builder
.
append
(
this
.
invalidPortConnections
.
size
());
builder
.
append
(
this
.
invalidPortConnections
.
size
());
builder
.
append
(
" invalid port connections were detected.\n"
);
builder
.
append
(
" invalid port connections were detected.\n"
);
Joiner
.
on
(
"\n"
).
appendTo
(
builder
,
this
.
invalidPortConnections
);
Joiner
.
on
(
"\n"
).
appendTo
(
builder
,
this
.
invalidPortConnections
);
...
...
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