Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
90c8b61d
Unverified
Commit
90c8b61d
authored
Dec 21, 2023
by
gaoyan
Committed by
GitHub
Dec 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some npe (#2705)
* fix log error * Fix some Npe, and optimize some code logic * add some null check * add some null check
parent
95c544b5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
13 deletions
+23
-13
ConsoleContextHolder.java
...src/main/java/org/dinky/context/ConsoleContextHolder.java
+14
-5
SseSessionContextHolder.java
.../main/java/org/dinky/context/SseSessionContextHolder.java
+1
-1
JobInstanceServiceImpl.java
...n/java/org/dinky/service/impl/JobInstanceServiceImpl.java
+2
-1
Asserts.java
dinky-common/src/main/java/org/dinky/assertion/Asserts.java
+6
-6
No files found.
dinky-admin/src/main/java/org/dinky/context/ConsoleContextHolder.java
View file @
90c8b61d
...
@@ -26,7 +26,6 @@ import org.dinky.data.enums.ProcessType;
...
@@ -26,7 +26,6 @@ import org.dinky.data.enums.ProcessType;
import
org.dinky.data.enums.SseTopic
;
import
org.dinky.data.enums.SseTopic
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.enums.Status
;
import
org.dinky.data.exception.BusException
;
import
org.dinky.data.exception.BusException
;
import
org.dinky.data.exception.DinkyException
;
import
org.dinky.data.model.ProcessEntity
;
import
org.dinky.data.model.ProcessEntity
;
import
org.dinky.data.model.ProcessStepEntity
;
import
org.dinky.data.model.ProcessStepEntity
;
import
org.dinky.utils.LogUtil
;
import
org.dinky.utils.LogUtil
;
...
@@ -94,7 +93,7 @@ public class ConsoleContextHolder {
...
@@ -94,7 +93,7 @@ public class ConsoleContextHolder {
*
*
* @param processName process name
* @param processName process name
* @param stepPid process step type
* @param stepPid process step type
* @param logLine
messages
* @param logLine messages
* @throws BusException Throws an exception if the process does not exist
* @throws BusException Throws an exception if the process does not exist
*/
*/
public
void
appendLog
(
String
processName
,
String
stepPid
,
String
logLine
,
boolean
recordGlobal
)
{
public
void
appendLog
(
String
processName
,
String
stepPid
,
String
logLine
,
boolean
recordGlobal
)
{
...
@@ -108,7 +107,12 @@ public class ConsoleContextHolder {
...
@@ -108,7 +107,12 @@ public class ConsoleContextHolder {
}
}
if
(
stepPid
!=
null
)
{
if
(
stepPid
!=
null
)
{
ProcessStepEntity
stepNode
=
getStepNode
(
stepPid
,
getStepsMap
(
processName
));
ProcessStepEntity
stepNode
=
getStepNode
(
stepPid
,
getStepsMap
(
processName
));
stepNode
.
appendLog
(
logLine
);
if
(
stepNode
!=
null
)
{
stepNode
.
appendLog
(
logLine
);
process
.
setLastUpdateStep
(
stepNode
);
}
else
{
log
.
error
(
"process step not found {},{}"
,
processName
,
stepPid
);
}
process
.
setLastUpdateStep
(
stepNode
);
process
.
setLastUpdateStep
(
stepNode
);
}
}
// /TOPIC/PROCESS_CONSOLE/FlinkSubmit/12
// /TOPIC/PROCESS_CONSOLE/FlinkSubmit/12
...
@@ -172,7 +176,11 @@ public class ConsoleContextHolder {
...
@@ -172,7 +176,11 @@ public class ConsoleContextHolder {
process
.
getChildren
().
add
(
processStepEntity
);
process
.
getChildren
().
add
(
processStepEntity
);
}
else
{
}
else
{
ProcessStepEntity
stepNode
=
getStepNode
(
parentStepPid
,
process
.
getChildren
());
ProcessStepEntity
stepNode
=
getStepNode
(
parentStepPid
,
process
.
getChildren
());
stepNode
.
getChildren
().
add
(
processStepEntity
);
if
(
stepNode
==
null
)
{
log
.
error
(
"registerProcessStep {} failed in {}"
,
type
.
getDesc
(),
processName
);
}
else
{
stepNode
.
getChildren
().
add
(
processStepEntity
);
}
}
}
return
processStepEntity
;
return
processStepEntity
;
}
}
...
@@ -241,7 +249,8 @@ public class ConsoleContextHolder {
...
@@ -241,7 +249,8 @@ public class ConsoleContextHolder {
JSONObject
.
toJSONString
(
logPross
),
JSONObject
.
toJSONString
(
logPross
),
stepPid
,
stepPid
,
MDC
.
get
(
ProcessAspect
.
PROCESS_NAME
));
MDC
.
get
(
ProcessAspect
.
PROCESS_NAME
));
throw
new
DinkyException
(
errorStr
);
log
.
debug
(
errorStr
);
return
null
;
}
}
/**
/**
...
...
dinky-admin/src/main/java/org/dinky/context/SseSessionContextHolder.java
View file @
90c8b61d
...
@@ -159,7 +159,7 @@ public class SseSessionContextHolder {
...
@@ -159,7 +159,7 @@ public class SseSessionContextHolder {
SseDataVo
data
=
new
SseDataVo
(
sessionKey
,
topic
,
content
);
SseDataVo
data
=
new
SseDataVo
(
sessionKey
,
topic
,
content
);
sendSse
(
sessionKey
,
data
);
sendSse
(
sessionKey
,
data
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"Error sending sse data
"
,
e
);
log
.
error
(
"Error sending sse data
:{}"
,
e
.
getMessage
()
);
onError
(
sessionKey
,
e
);
onError
(
sessionKey
,
e
);
}
}
}
}
...
...
dinky-admin/src/main/java/org/dinky/service/impl/JobInstanceServiceImpl.java
View file @
90c8b61d
...
@@ -151,9 +151,10 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper,
...
@@ -151,9 +151,10 @@ public class JobInstanceServiceImpl extends SuperServiceImpl<JobInstanceMapper,
@Override
@Override
public
JobInfoDetail
getJobInfoDetailInfo
(
JobInstance
jobInstance
)
{
public
JobInfoDetail
getJobInfoDetailInfo
(
JobInstance
jobInstance
)
{
Asserts
.
checkNull
(
jobInstance
,
Status
.
JOB_INSTANCE_NOT_EXIST
.
getMessage
());
JobInfoDetail
jobInfoDetail
=
new
JobInfoDetail
(
jobInstance
.
getId
());
JobInfoDetail
jobInfoDetail
=
new
JobInfoDetail
(
jobInstance
.
getId
());
Asserts
.
checkNull
(
jobInstance
,
Status
.
JOB_INSTANCE_NOT_EXIST
.
getMessage
());
jobInfoDetail
.
setInstance
(
jobInstance
);
jobInfoDetail
.
setInstance
(
jobInstance
);
ClusterInstance
clusterInstance
=
clusterInstanceService
.
getById
(
jobInstance
.
getClusterId
());
ClusterInstance
clusterInstance
=
clusterInstanceService
.
getById
(
jobInstance
.
getClusterId
());
...
...
dinky-common/src/main/java/org/dinky/assertion/Asserts.java
View file @
90c8b61d
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
package
org
.
dinky
.
assertion
;
package
org
.
dinky
.
assertion
;
import
org.dinky.data.exception.
RunTime
Exception
;
import
org.dinky.data.exception.
Bus
Exception
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collection
;
...
@@ -89,31 +89,31 @@ public class Asserts {
...
@@ -89,31 +89,31 @@ public class Asserts {
public
static
void
checkNull
(
Object
key
,
String
msg
)
{
public
static
void
checkNull
(
Object
key
,
String
msg
)
{
if
(
key
==
null
)
{
if
(
key
==
null
)
{
throw
new
RunTime
Exception
(
msg
);
throw
new
Bus
Exception
(
msg
);
}
}
}
}
public
static
void
checkNotNull
(
Object
object
,
String
msg
)
{
public
static
void
checkNotNull
(
Object
object
,
String
msg
)
{
if
(
isNull
(
object
))
{
if
(
isNull
(
object
))
{
throw
new
RunTime
Exception
(
msg
);
throw
new
Bus
Exception
(
msg
);
}
}
}
}
public
static
void
checkNullString
(
String
key
,
String
msg
)
{
public
static
void
checkNullString
(
String
key
,
String
msg
)
{
if
(
isNull
(
key
)
||
isEquals
(
""
,
key
))
{
if
(
isNull
(
key
)
||
isEquals
(
""
,
key
))
{
throw
new
RunTime
Exception
(
msg
);
throw
new
Bus
Exception
(
msg
);
}
}
}
}
public
static
void
checkNullCollection
(
Collection
<?>
collection
,
String
msg
)
{
public
static
void
checkNullCollection
(
Collection
<?>
collection
,
String
msg
)
{
if
(
isNullCollection
(
collection
))
{
if
(
isNullCollection
(
collection
))
{
throw
new
RunTime
Exception
(
msg
);
throw
new
Bus
Exception
(
msg
);
}
}
}
}
public
static
void
checkNullMap
(
Map
<?,
?>
map
,
String
msg
)
{
public
static
void
checkNullMap
(
Map
<?,
?>
map
,
String
msg
)
{
if
(
isNullMap
(
map
))
{
if
(
isNullMap
(
map
))
{
throw
new
RunTime
Exception
(
msg
);
throw
new
Bus
Exception
(
msg
);
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment