Recibo un error en las siguientes líneas.¿Cómo resolver este tipos incompatibles en Java?
error: incompatible types
required : java.util.Map.entry<java.lang.String,java.lang.String[]>
found :java.lang.Object
código completo está por debajo
package com.auth.actions;
public class SocialAuthSuccessAction extends Action {
final Log LOG = LogFactory.getLog(SocialAuthSuccessAction.class);
@Override
public ActionForward execute(final ActionMapping mapping,
final ActionForm form, final HttpServletRequest request,
final HttpServletResponse response) throws Exception {
AuthForm authForm = (AuthForm) form;
SocialAuthManager manager = null;
if (authForm.getSocialAuthManager() != null) {
manager = authForm.getSocialAuthManager();
}
if (manager != null) {
List<Contact> contactsList = new ArrayList<Contact>();
Profile profile = null;
try {
Map<String, String> paramsMap = new HashMap<String, String>();
for (Map.Entry<String, String[]> entry :request.getParameterMap().entrySet()) { // error in this line!
String key = entry.getKey();
String values[] = entry.getValue();
paramsMap.put(key, values[0].toString()); // Only 1 value is
}
AuthProvider provider = manager.connect(paramsMap);
profile = provider.getUserProfile();
contactsList = provider.getContactList();
if (contactsList != null && contactsList.size() > 0) {
for (Contact p : contactsList) {
if (StringUtils.isEmpty(p.getFirstName())
&& StringUtils.isEmpty(p.getLastName())) {
p.setFirstName(p.getDisplayName());
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
request.setAttribute("profile", profile);
request.setAttribute("contacts", contactsList);
return mapping.findForward("success");
}
// if provider null
return mapping.findForward("failure");
}
}
Por favor, ayuda
lo request.getParameterMap() devuelve? – mini
Esa línea se ve bien, ¿puedes publicar el seguimiento de la pila real? – DNA
'getParameterMap()' se define [aquí] (http://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getParameterMap%28%29) – DNA