What is the cause of my IndexOutOfBoundsException
What is the cause of my IndexOutOfBoundsException I am trying to upload a file using primefaces and hibernate. My managed bean has the following function: public void upload(){ if(file != null){ try { FacesContext context = FacesContext.getCurrentInstance(); ServletContext servletContext = (ServletContext) context.getExternalContext().getContext(); String dbPath = servletContext.getRealPath("/"); String webcut = dbPath.substring(0, dbPath.lastIndexOf("\")); String buildcut = webcut.substring(0, webcut.lastIndexOf("\")); String mainURLPath = buildcut.substring(0, buildcut.lastIndexOf("\")); InputStream inputStream = file.getInputstream(); String path = mainURLPath + "\web\resources\images" + file.getFileName(); File destFile = new File(path); if(!destFile.exists()){ FileUtils.copyInputStreamT...