Results 1 to 12 of 12
- 10-10-2010, 03:02 PM #1
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
java.lang.UnsupportedOperationException: Not supported yet
Hello All,
I am facing with "java.lang.UnsupportedOperationException: Not supported yet."
on my code
private Map<String, Object> session;
public String execute() {
Object list = session.get("mylist"); // this line thrown "java.lang.UnsupportedOperationException: Not supported yet."
could any body please help?
thanks & regards
Luc
- 10-10-2010, 03:11 PM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
map is an interface, which declare a method get. which implementing class do you use? it looks like that this implementation, does not implement this method but throw an exception (UnsupportedOperationException)
Last edited by eRaaaa; 10-10-2010 at 03:19 PM.
- 10-10-2010, 03:19 PM #3
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
I am just trying the codes from Struts2 jQuery Plugin Showcase
any comment?
- 10-10-2010, 03:42 PM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,375
- Blog Entries
- 7
- Rep Power
- 17
- 10-10-2010, 04:20 PM #5
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
Hi All,
sorry, please ignore it .. but I am facing with this
why it still thrown java.lang.NullPointerExceptionJava Code:Object list = session.get("mylist"); if (list == null) { myHost = HostDAO.buildList(); } else { myHost = (List<Host>) list; }
please help
thanks & regards
-
Please answer Jos's question so we all know what the issue was and please ask new questions in a new thread. In your new thread, please indicate which line throws the NPE, and which object on that line is null (easily tested by using System.out.println(myObject == null);
Thank you for your cooperation.
- 10-10-2010, 04:54 PM #7
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
ok. sorry for this ..
FYI,
I am using NetBeans 6.9 and this is my 1st struts learning app.. and I don't know to get the value of System.out.println(session.getClass().getName());
I tried to use try.. catch .. but I still unable to get its value
try {
} catch (Exception ex) {
System.out.println(session.getClass().getName());
}
-
No, you simply place the line
on the line above the one that caused your error in your first post. Jos suspects (as I do) that the variable causing the error does not refer to a java.util.Map object.Java Code:System.out.println(session.getClass().getName());
- 10-10-2010, 05:16 PM #9
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
Sorry, again ..:(
I knew the problem will not occurs if I removed "implements SessionAware" .. but I don't understandy why ?..
so I thought the problem is not from: Object list = session.get("mylist"); line as I said before.
could you please advise what's going on there?
Java Code:/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package example; import java.util.ArrayList; import java.util.List; import java.util.Map; import com.opensymphony.xwork2.ActionSupport; import java.sql.SQLException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Actions; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.interceptor.SessionAware; /** * * @author luckay */ public class JQueryGrid extends ActionSupport implements SessionAware { private String message; private static final long serialVersionUID = 5078264277068533593L; private static final Log log = LogFactory.getLog(JQueryGrid.class); private List<Host> gridModel; private Integer rows = 0; private Integer page = 0; private Integer total = 0; private Integer record = 0; private String sord; private String sidx; private String searchField; private String searchString; private String searchOper; private boolean loadonce = false; private Map<String, Object> session; private List<Host> myHost; @Actions({ @Action(value = "/JQueryGrid", results = { @Result(name = "success", type = "json") }) }) @Override public String execute() { try { setMessage("Hello Every body in Struts 2"); System.out.println(session.getClass().getName()); Object list = session.get("mylist"); if (list != null) { myHost = (List<Host>) list; } else { myHost = HostDAO.buildList(); } setRecord(HostDAO.getHostCount(myHost)); int to = (getRows() * getPage()); int from = to - getRows(); if (to > getRecord()) { to = getRecord(); } if (loadonce) { // All Custumer setGridModel(myHost); } else { // Search Custumers if (searchString != null && searchOper != null) { int id = Integer.parseInt(searchString); if (searchOper.equalsIgnoreCase("eq")) { log.debug("search id equals " + id); List<Host> cList = new ArrayList<Host>(); Host host = HostDAO.findById(myHost, id); if (host != null) { cList.add(host); } setGridModel(cList); } else if (searchOper.equalsIgnoreCase("ne")) { log.debug("search id not " + id); setGridModel(HostDAO.findNotById(myHost, id, from, to)); } else if (searchOper.equalsIgnoreCase("lt")) { log.debug("search id lesser then " + id); setGridModel(HostDAO.findLesserAsId(myHost, id, from, to)); } else if (searchOper.equalsIgnoreCase("gt")) { log.debug("search id greater then " + id); setGridModel(HostDAO.findGreaterAsId(myHost, id, from, to)); } } else { setGridModel(HostDAO.getHosts(myHost, from, to)); } } setTotal((int) Math.ceil((double) getRecord() / (double) getRows())); //session.put("mylist", myHost); } catch (Exception ex) { System.out.println(session.getClass().getName()); } return SUCCESS; } public String getJSON() throws SQLException { return execute(); } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } /** * @return current page of the query */ public Integer getPage() { return page; } /** * @param page * current page of the query */ public void setPage(Integer page) { this.page = page; } /** * @return total pages for the query */ public Integer getTotal() { return total; } /** * @param total * total pages for the query */ public void setTotal(Integer total) { this.total = total; } /** * @return how many rows we want to have into the grid */ public Integer getRows() { return rows; } /** * @param rows * how many rows we want to have into the grid */ public void setRows(Integer rows) { this.rows = rows; } /** * @return total number of records for the query. e.g. select count(*) from * table */ public Integer getRecord() { return record; } /** * @param record * total number of records for the query. e.g. select count(*) from * table */ public void setRecord(Integer record) { this.record = record; if (this.record > 0 && this.rows > 0) { this.total = (int) Math.ceil((double) this.record / (double) this.rows); } else { this.total = 0; } } /** * @return an collection that contains the actual data */ public List<Host> getGridModel() { return gridModel; } /** * @param gridModel * an collection that contains the actual data */ public void setGridModel(List<Host> gridModel) { this.gridModel = gridModel; } @Override public void setSession(Map<String, Object> map) { throw new UnsupportedOperationException("Not supported yet."); } }
-
- 10-10-2010, 05:34 PM #11
Senior Member
- Join Date
- Jan 2010
- Posts
- 138
- Rep Power
- 0
:confused:
sorry, I am unable to explain to you, I am still learning and got the codes from:
Struts2 jQuery Plugin Showcase
-
Cross-post: java-lang-UnsupportedOperationException-Not-supported
Please see the link in your post at JavaRanch.
Similar Threads
-
java.lang.NoSuchMethodError: org.apache.log4j.Logger.log(Ljava/lang/String;Lorg/apach
By rameshraj in forum JDBCReplies: 5Last Post: 03-17-2011, 02:26 PM -
best java supported!!
By cpanel in forum Reviews / AdvertisingReplies: 4Last Post: 01-10-2011, 05:54 PM -
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/star/lang/XEventLi
By baktha.thalapathy in forum New To JavaReplies: 5Last Post: 06-02-2010, 01:05 PM -
Error: cannot resolve symbol' on Person (java.lang.String, java.lang.String)
By baltimore in forum New To JavaReplies: 2Last Post: 09-18-2008, 07:30 AM -
Java Loader error message "UNC paths not supported"
By Johnny562 in forum New To JavaReplies: 1Last Post: 07-01-2008, 10:24 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks