Ver Mensaje Individual
  #3 (permalink)  
Antiguo 17/11/2009, 04:20
rosemary22
 
Fecha de Ingreso: agosto-2005
Mensajes: 36
Antigüedad: 19 años, 4 meses
Puntos: 0
Respuesta: PROBLEMA CON arrayindexoutofboundsexception

Buenas Fuzzylog
Muchas Gracias por tu ayuda! , a funcionado correctamente ,tengo otro problemilla , te agradeceriaque me puedas orientar ,los datos que muestro con la query y las clases anteriores van pintar un grafico en Openflashchart
tengo este servlets que se encargar de realizar el grafico
Cita:
public class Retenciones extends HttpServlet
{
public void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException, IndexOutOfBoundsException
{ String SO = "Desconocido";
String browser = "Desconocido";
Datos dt = new Datos();
ServletOutputStream salida = res.getOutputStream();
res.setContentType("text/html");
String userAgent = req.getHeader("User-Agent");
if(userAgent.contains("Windows"))
SO = "Windows";
if(userAgent.contains("Linux"))
SO = "Linux";
if(userAgent.contains("Mac"))
SO = "Mac OS";
if(userAgent.contains("MSIE"))
browser = "IE";
if(userAgent.contains("Opera"))
browser = "Opera";
if(userAgent.contains("Firefox"))
browser = "Firefox";
if(userAgent.contains("Safari"))
browser = "Safari";
String parametros = req.getParameter("parametros");
try{
String campos[] = parametros.split("\\|");
String dias = campos[0];
String fecha = campos[1].replaceAll("-",":");
String provincia=campos[2];
provincia=provincia.replace(",", "','");
String nivel=campos[3];
nivel=nivel.replace(",", "','");
HashMap datos = dt.damedatos(fecha, dias, browser, provincia,nivel);
String camposFecha[] = fecha.split("\\ ");
fecha = (new StringBuilder()).append(camposFecha[0]).append(" ").append(camposFecha[1]).append(" ").append(camposFecha[2]).append(" ").append(camposFecha[3]).append(" ").append(camposFecha[4]).toString();
String x_labels = "";
String labels = "00:00,00:10,00:20,00:30,00:40,00:50," +
"01:00,01:10,01:20,01:30,01:40,01:50," +
"02:00,02:10,02:20,02:30,02:40,02:50," +
"03:00,03:10,03:20,03:30,03:40,03:50," +
"04:00,04:10,04:20,04:30,04:40,04:50," +
"05:00,05:10,05:20,05:30,05:40,05:50," +
"06:00,06:10,06:20,06:30,06:40,06:50," +
"07:00,07:10,07:20,07:30,07:40,07:50," +
"08:00,08:10,08:20,08:30,08:40,08:50," +
"09:00,09:10,09:20,09:30,09:40,09:50," +
"10:00,10:10,10:20,10:30,10:40,10:50," +
"11:00,11:10,11:20,11:30,11:40,11:50," +
"12:00,12:10,12:20,12:30,12:40,12:50," +
"13:00,13:10,13:20,13:30,13:40,13:50," +
"14:00,14:10,14:20,14:30,14:40,14:50," +
"15:00,15:10,15:20,15:30,15:40,15:50," +
"16:00,16:10,16:20,16:30,16:40,16:50," +
"17:00,17:10,17:20,17:30,17:40,17:50," +
"18:00,18:10,18:20,18:30,18:40,18:50," +
"19:00,19:10,19:20,19:30,19:40,19:50," +
"20:00,20:10,20:20,20:30,20:40,20:50," +
"21:00,21:10,21:20,21:30,21:40,21:50," +
"22:00,22:10,22:20,22:30,22:40,22:50," +
"23:00,23:10,23:20,23:30,23:40,23:50";
x_labels = labels;
for(int i = 1; i <Integer.parseInt(dias); i++)
x_labels = (new StringBuilder()).append(x_labels).append(",").appe nd(labels).toString();
salida.println((new StringBuilder())
.append("&tool_tip=#x_label#<br>CAUSA:#key#<br>#va l#km<br>Carreteras:<br>#tip#&")
.append("&x_label_style=10,#0101DF,2,")
.append(6 * Integer.parseInt(dias))//multiplica 6 elementos de x_labels x los dias
.append(",#FFFFFF& \n")
.append("&y_label_style=10,#0101DF,2,")
.append(6 * Integer.parseInt(dias))
.append(",#C1CFDD&\n")
.append("&y_ticks=2,5,10& \n")//2.- espacio de la linea al numero, 5.- tamaño del guion cerca d ela linea. 10.- q vaya la hora de 10 en 10
.append("&area_hollow=2,3,25,#000000,'Circulacion' ,12,#000000& \n")
.append("&line=2,#0174DF,CIRCULACION,10,4&\n")
.append("&line_2=3,#8A0808,ACCIDENTE,10,4&\n")
.append("&line_3=3,#088A85,TOTAL,10,4&\n")
.append("&y_legend=Km,13,#0101DF&\n")
.append("&x_legend=Tiempo (Horas),13,#0101DF&\n")
.append("&x_tick_size=20\"\n")
.append("&x_axis_steps=20\n")
.append("&y_min=0& \n")
.append("&y_max=").append(datos.get("max"))//los kilometros de y
.append("&\n")
.append("&x_labels=").append(x_labels).append(",00 :00& \n")
.append("&values=").append(datos.get("circulacion" )).append("&\n")
.append("&values_2=").append(datos.get("accidente" )).append("&\n")
.append("&values_3=").append(datos.get("total")).a ppend("&\n")
.append("&tool_tips_set=").append(datos.get("dcirc ulacion")).append("&\n")
.append("&tool_tips_set_2=").append(datos.get("dac cidente")).append("&\n")
.append("&tool_tips_set_3=").append(datos.get("dto tal")).append("&\n")
.append("&x_axis_steps=30&\n")
.append("&y_label_steps=20&\n")
.append("&x_offset=true&\n")
.append("&inner_background=#C1CFDD,#FFFFFF,70&")
.append("&x_axis_colour=#B0C4D9&\n")
.append("&x_grid_colour=#FFFFFF&")
.append("&y_grid_colour=#FFFFFF&")
.append("&y_axis_colour=#B0C4D9&\n")
.append("&bg_colour=#cadaef&").toString());
//System.out.print("x_labels"+x_labels);
this.crearJson(dias, datos, x_labels, provincia, fecha);
}catch(Exception e){
System.out.println("no pinta:(");
System.err.println(e.getLocalizedMessage());}
}
}
------------>>>>>>> lo demas sigue el sgte mensaje.... eran muchas lineas :)

Última edición por rosemary22; 17/11/2009 a las 07:23