Skip to content

Commit

Permalink
address null
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-du-car committed May 9, 2024
1 parent 6277c0b commit 57a2763
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/cc/ws/CtrlTiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ public void init(ServletConfig oConfig)
protected void doGet(HttpServletRequest oRequest, HttpServletResponse oResponse)
throws ServletException, IOException
{
TimeSource timeSrc = (TimeSource) this.getServletContext().getAttribute(TimeSource.class.getName());
Object timeObj = this.getServletContext().getAttribute(TimeSource.class.getName());
TimeSource timeSrc = timeObj != null? (TimeSource) timeObj: new TimeSource(false);
long lNow = timeSrc.currentTimeMillis();
String[] sUriParts = oRequest.getRequestURI().split("/");
int nZ = Integer.parseInt(sUriParts[sUriParts.length - 3]);
Expand Down Expand Up @@ -450,7 +451,8 @@ private void addControl(HttpServletRequest oReq, HttpServletResponse oRes)
{
try
{
TimeSource timeSrc = (TimeSource) this.getServletContext().getAttribute(TimeSource.class.getName());
Object timeObj = this.getServletContext().getAttribute(TimeSource.class.getName());
TimeSource timeSrc = timeObj != null? (TimeSource) timeObj: new TimeSource(false);
long lNow = timeSrc.currentTimeMillis();
int nType = Integer.parseInt(oReq.getParameter("type"));
String[] sVtypes = oReq.getParameterValues("vtypes[]");
Expand Down Expand Up @@ -563,7 +565,8 @@ private void saveEdit(HttpServletRequest oReq, HttpServletResponse oRes)
{
try
{
TimeSource timeSrc = (TimeSource) this.getServletContext().getAttribute(TimeSource.class.getName());
Object timeObj = this.getServletContext().getAttribute(TimeSource.class.getName());
TimeSource timeSrc = timeObj != null? (TimeSource) timeObj: new TimeSource(false);
long lNow = timeSrc.currentTimeMillis();
int nType = Integer.parseInt(oReq.getParameter("type"));
String[] sVtypes = oReq.getParameterValues("vtypes[]");
Expand Down
3 changes: 2 additions & 1 deletion src/cc/ws/TcmReqServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public void run()
{
try
{
TimeSource timeSrc = (TimeSource) this.getServletContext().getAttribute(TimeSource.class.getName());
Object timeObj = this.getServletContext().getAttribute(TimeSource.class.getName());
TimeSource timeSrc = timeObj != null? (TimeSource) timeObj: new TimeSource(false);
long lNow = timeSrc.currentTimeMillis();
String sReq = Thread.currentThread().getName();
int nPos = sReq.indexOf('<');
Expand Down

0 comments on commit 57a2763

Please sign in to comment.