Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Antti Väyrynen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 03de891d
authored
Oct 25, 2012
by
Riku Silvola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
catch null usercart
1 parent
313c4c6d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
26 deletions
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserCartView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserCartView.java
View file @
03de891
...
...
@@ -26,12 +26,12 @@ public class UserCartView extends GenericCDIView {
private
List
<
EventUser
>
usercart
;
public
void
initView
()
{
public
void
initView
()
{
}
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserCartView
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserCartView
.
class
);
public
String
next
()
{
++
current
;
...
...
@@ -45,37 +45,34 @@ public class UserCartView extends GenericCDIView {
return
null
;
}
public
String
getUserCartSize
()
{
public
String
getUserCartSize
()
{
String
ret
=
"0"
;
if
(
usercart
!=
null
)
{
if
(
usercart
!=
null
)
{
ret
=
Integer
.
toString
(
usercart
.
size
());
}
return
ret
;
}
public
String
removeCurrent
()
{
public
String
removeCurrent
()
{
EventUser
removed
=
usercart
.
remove
(
current
.
intValue
());
logger
.
debug
(
"Removed idx {} from usercart {}"
,
current
,
removed
);
if
(!
usercart
.
isEmpty
())
{
if
(!
usercart
.
isEmpty
())
{
updateCurrent
();
}
return
null
;
}
public
String
traverse
()
{
current
=
0
;
updateCurrent
();
return
"/useradmin/userCartShow"
;
public
String
traverse
()
{
if
(
usercart
!=
null
)
{
current
=
0
;
updateCurrent
();
return
"/useradmin/userCartShow"
;
}
else
return
"/useradmin/list"
;
}
public
String
saveUser
()
{
public
String
saveUser
()
{
userview
.
saveUser
();
return
null
;
}
...
...
@@ -84,14 +81,12 @@ public class UserCartView extends GenericCDIView {
logger
.
debug
(
"Updating current user to {}"
,
current
);
if
(
current
>=
usercart
.
size
())
{
current
=
usercart
.
size
()
-
1
;
}
else
if
(
current
<
0
)
{
}
else
if
(
current
<
0
)
{
current
=
0
;
}
EventUser
u
=
usercart
.
get
(
current
);
logger
.
debug
(
"usercart current {}, got {}"
,
current
,
u
);
if
(
u
!=
null
)
{
if
(
u
!=
null
)
{
userview
.
setUserid
(
u
.
getUser
().
getId
());
userview
.
setUser
(
null
);
userview
.
initView
();
...
...
@@ -99,8 +94,7 @@ public class UserCartView extends GenericCDIView {
}
public
void
addUsers
(
List
<
EventUser
>
results
)
{
if
(
usercart
==
null
)
{
if
(
usercart
==
null
)
{
usercart
=
new
ArrayList
<
EventUser
>();
}
usercart
.
removeAll
(
results
);
...
...
@@ -108,8 +102,7 @@ public class UserCartView extends GenericCDIView {
}
public
boolean
isEmpty
()
{
public
boolean
isEmpty
()
{
return
usercart
==
null
||
usercart
.
isEmpty
();
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment