List of usage examples for java.io FileNotFoundException getMessage
public String getMessage()
From source file:com.phoenixnap.oss.ramlapisync.generation.RamlGenerator.java
/** * Emits the RAML model into its string representation and saves it as a file in the specified path * /* w w w . j a va2 s . c o m*/ * @param path The path to which the RAML document will be saved * @param createPathIfMissing Indicates if the path and/or file should be created if it doesn't exist * @param removeOldOutput Indicates if we will empty the output directory before generation occurs * @return A file handle to the created document file * @throws FileNotFoundException if the supplied path does not exist */ public File outputRamlToFile(String path, Boolean createPathIfMissing, Boolean removeOldOutput) throws FileNotFoundException { if (this.raml == null) { return null; } FileOutputStream fos = null; File file = getRamlOutputFile(path); try { prepareDirectories(file, createPathIfMissing, removeOldOutput); logger.info("Saving generated raml to " + file.getAbsolutePath()); fos = new FileOutputStream(file); fos.write(outputRamlToString().getBytes()); fos.flush(); } catch (FileNotFoundException e) { logger.error("Could not save raml - directory enclosing " + file.getAbsolutePath() + " does not exist", e); throw e; } catch (IOException e) { logger.error(e.getMessage(), e); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { logger.error(e.getMessage(), e); } } } return file; }
From source file:com.springsource.hq.plugin.tcserver.plugin.discovery.TcRuntimeDetector.java
private String getJMXPassword(String catalinaBase) { String password = ""; BufferedReader reader = null; String passwordFilePath = catalinaBase + "/conf/" + "jmxremote.password"; try {// ww w. j a va2 s . co m File passwordFile = new File(passwordFilePath); reader = new BufferedReader(new FileReader(passwordFile)); String line = reader.readLine(); while (line != null) { if (line.trim().startsWith("admin")) { password = line.substring(5, line.length()).trim(); } line = reader.readLine(); } } catch (FileNotFoundException e) { logger.error("Unable to locate file: " + passwordFilePath + ". Error message: " + e.getMessage()); if (logger.isDebugEnabled()) { logger.debug(e); } } catch (IOException e) { logger.error("Problem loading file: " + passwordFilePath + ". Error message: " + e.getMessage()); if (logger.isDebugEnabled()) { logger.debug(e); } } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { // ignore } } } return password; }
From source file:com.cws.esolutions.security.processors.impl.FileSecurityProcessorImpl.java
/** * @see com.cws.esolutions.security.processors.interfaces.IFileSecurityProcessor#verifyFile(com.cws.esolutions.security.processors.dto.FileSecurityRequest) *//*from ww w.j ava 2 s . c o m*/ public synchronized FileSecurityResponse verifyFile(final FileSecurityRequest request) throws FileSecurityException { final String methodName = IFileSecurityProcessor.CNAME + "#verifyFile(final FileSecurityRequest request) throws FileSecurityException"; if (DEBUG) { DEBUGGER.debug(methodName); DEBUGGER.debug("FileSecurityRequest: {}", request); } FileSecurityResponse response = new FileSecurityResponse(); final RequestHostInfo reqInfo = request.getHostInfo(); final UserAccount userAccount = request.getUserAccount(); final KeyManager keyManager = KeyManagementFactory.getKeyManager(keyConfig.getKeyManager()); if (DEBUG) { DEBUGGER.debug("RequestHostInfo: {}", reqInfo); DEBUGGER.debug("UserAccount", userAccount); DEBUGGER.debug("KeyManager: {}", keyManager); } try { KeyPair keyPair = keyManager.returnKeys(userAccount.getGuid()); if (keyPair != null) { // read in the file signature byte[] sigToVerify = IOUtils.toByteArray(new FileInputStream(request.getSignedFile())); if (DEBUG) { DEBUGGER.debug("sigToVerify: {}", sigToVerify); } Signature signature = Signature.getInstance(fileSecurityConfig.getSignatureAlgorithm()); signature.initVerify(keyPair.getPublic()); signature.update(IOUtils.toByteArray(new FileInputStream(request.getUnsignedFile()))); if (DEBUG) { DEBUGGER.debug("Signature: {}", signature); } response.setRequestStatus(SecurityRequestStatus.SUCCESS); response.setIsSignatureValid(signature.verify(sigToVerify)); } else { response.setRequestStatus(SecurityRequestStatus.FAILURE); } } catch (NoSuchAlgorithmException nsax) { ERROR_RECORDER.error(nsax.getMessage(), nsax); throw new FileSecurityException(nsax.getMessage(), nsax); } catch (FileNotFoundException fnfx) { ERROR_RECORDER.error(fnfx.getMessage(), fnfx); throw new FileSecurityException(fnfx.getMessage(), fnfx); } catch (InvalidKeyException ikx) { ERROR_RECORDER.error(ikx.getMessage(), ikx); throw new FileSecurityException(ikx.getMessage(), ikx); } catch (SignatureException sx) { ERROR_RECORDER.error(sx.getMessage(), sx); throw new FileSecurityException(sx.getMessage(), sx); } catch (IOException iox) { ERROR_RECORDER.error(iox.getMessage(), iox); throw new FileSecurityException(iox.getMessage(), iox); } catch (KeyManagementException kmx) { ERROR_RECORDER.error(kmx.getMessage(), kmx); throw new FileSecurityException(kmx.getMessage(), kmx); } finally { // audit try { AuditEntry auditEntry = new AuditEntry(); auditEntry.setHostInfo(reqInfo); auditEntry.setAuditType(AuditType.VERIFYFILE); auditEntry.setUserAccount(userAccount); auditEntry.setAuthorized(Boolean.TRUE); auditEntry.setApplicationId(request.getApplicationId()); auditEntry.setApplicationName(request.getAppName()); if (DEBUG) { DEBUGGER.debug("AuditEntry: {}", auditEntry); } AuditRequest auditRequest = new AuditRequest(); auditRequest.setAuditEntry(auditEntry); if (DEBUG) { DEBUGGER.debug("AuditRequest: {}", auditRequest); } auditor.auditRequest(auditRequest); } catch (AuditServiceException asx) { ERROR_RECORDER.error(asx.getMessage(), asx); } } return response; }
From source file:com.buildml.main.BMLAdminMain.java
/** * This is the main entry point for the bml command. This method parses the global * command line arguments, determines which sub-command is being invoked, parses that * command's options, then invokes the command. * //w w w .ja va 2 s . c o m * @param args Standard Java command line arguments - passed to us by the * "bml" shell script. */ private void invokeCommand(String[] args) { /* register all the sub-command classes */ registerCommands(); /* Process global command line options */ String cmdArgs[] = processGlobalOptions(args); /* * If the user types "bml -h" with no other arguments, show the general help page. * Also, if the user doesn't provide a sub-command name, show the same help page, * but also with an error message. */ if (cmdArgs.length == 0) { if (optionVersion) { System.out.println(Version.getVersion()); CliUtils.reportErrorAndExit(null); } if (optionHelp) { displayHelpAndExit(null); } else { displayHelpAndExit("Missing command - please specify an operation to perform."); } } /* what's the command's name? If it begins with '-', this means we have unparsed options! */ String cmdName = cmdArgs[0]; if (cmdName.startsWith("-")) { CliUtils.reportErrorAndExit("Unrecognized global option " + cmdName); } cmdArgs = StringArray.shiftLeft(cmdArgs); /* find the appropriate command object (if it exists) */ ICliCommand cmd = findCommand(cmdName); if (cmd == null) { CliUtils.reportErrorAndExit("Unrecognized command - \"" + cmdName + "\""); } /* Does the user want help with this command? */ if (optionHelp) { displayDetailedHelpAndExit(cmd); } /* * Open the build store file, or for the "create" command, we create it. For * "upgrade" we do neither. */ IBuildStore buildStore = null; try { if (cmd.getName().equals("create")) { buildStore = BuildStoreFactory.createBuildStore(buildStoreFileName); } else if (!cmd.getName().equals("upgrade")) { buildStore = BuildStoreFactory.openBuildStore(buildStoreFileName); } } catch (FileNotFoundException ex) { CliUtils.reportErrorAndExit(ex.getMessage()); } catch (IOException ex) { CliUtils.reportErrorAndExit(ex.getMessage()); } catch (BuildStoreVersionException ex) { CliUtils.reportErrorAndExit(ex.getMessage()); } /* * Fetch the command's command line options (Options object) which * is then used to parse the user-provided arguments. */ CommandLineParser parser = new PosixParser(); CommandLine cmdLine = null; Options cmdOpts = cmd.getOptions(); try { cmdLine = parser.parse(cmdOpts, cmdArgs, true); } catch (ParseException e) { CliUtils.reportErrorAndExit(e.getMessage()); } cmd.processOptions(buildStore, cmdLine); /* * Check for unprocessed command options. That is, if the first * non-option argument starts with '-', then it's actually an * unprocessed option. */ String remainingArgs[] = cmdLine.getArgs(); if (remainingArgs.length > 0) { String firstArg = remainingArgs[0]; if (firstArg.startsWith("-")) { CliUtils.reportErrorAndExit("Unrecognized option " + firstArg); } } /* * Now, invoke the command. If the invoke() method wants to, it may completely * exit from the program. This is the typical case when an error is reported * via the CliUtils.reportErrorAndExit() method. */ cmd.invoke(buildStore, buildStoreFileName, remainingArgs); /* release resources */ if (buildStore != null) { buildStore.close(); } }
From source file:io.openvidu.server.recording.service.SingleStreamRecordingService.java
private Recording sealMetadataFiles(Recording recording) { // Must update recording "status" (to stopped), "duration" (min startTime of all // individual recordings) and "size" (sum of all individual recordings size) String folderPath = this.openviduConfig.getOpenViduRecordingPath() + recording.getId() + "/"; String metadataFilePath = folderPath + RecordingManager.RECORDING_ENTITY_FILE + recording.getId(); String syncFilePath = folderPath + recording.getName() + ".json"; recording = this.recordingManager.getRecordingFromEntityFile(new File(metadataFilePath)); long minStartTime = Long.MAX_VALUE; long maxEndTime = 0; long accumulatedSize = 0; File folder = new File(folderPath); File[] files = folder.listFiles(); Reader reader = null;//from w w w. ja v a 2 s . com Gson gson = new Gson(); // Sync metadata json object to store in "RECORDING_NAME.json" JsonObject json = new JsonObject(); json.addProperty("createdAt", recording.getCreatedAt()); json.addProperty("id", recording.getId()); json.addProperty("name", recording.getName()); json.addProperty("sessionId", recording.getSessionId()); JsonArray jsonArrayFiles = new JsonArray(); for (int i = 0; i < files.length; i++) { if (files[i].isFile() && files[i].getName().startsWith(INDIVIDUAL_STREAM_METADATA_FILE)) { try { reader = new FileReader(files[i].getAbsolutePath()); } catch (FileNotFoundException e) { log.error("Error reading file {}. Error: {}", files[i].getAbsolutePath(), e.getMessage()); } RecorderEndpointWrapper wr = gson.fromJson(reader, RecorderEndpointWrapper.class); minStartTime = Math.min(minStartTime, wr.getStartTime()); maxEndTime = Math.max(maxEndTime, wr.getEndTime()); accumulatedSize += wr.getSize(); JsonObject jsonFile = new JsonObject(); jsonFile.addProperty("connectionId", wr.getConnectionId()); jsonFile.addProperty("streamId", wr.getStreamId()); jsonFile.addProperty("size", wr.getSize()); jsonFile.addProperty("clientData", wr.getClientData()); jsonFile.addProperty("serverData", wr.getServerData()); jsonFile.addProperty("hasAudio", wr.hasAudio() && recording.hasAudio()); jsonFile.addProperty("hasVideo", wr.hasVideo() && recording.hasVideo()); if (wr.hasVideo()) { jsonFile.addProperty("typeOfVideo", wr.getTypeOfVideo()); } jsonFile.addProperty("startTimeOffset", wr.getStartTime() - recording.getCreatedAt()); jsonFile.addProperty("endTimeOffset", wr.getEndTime() - recording.getCreatedAt()); jsonArrayFiles.add(jsonFile); } } json.add("files", jsonArrayFiles); this.fileWriter.createAndWriteFile(syncFilePath, new GsonBuilder().setPrettyPrinting().create().toJson(json)); this.generateZipFileAndCleanFolder(folderPath, recording.getName() + ".zip"); double duration = (double) (maxEndTime - minStartTime) / 1000; duration = duration > 0 ? duration : 0; recording = this.sealRecordingMetadataFile(recording, accumulatedSize, duration, metadataFilePath); return recording; }
From source file:com.cws.esolutions.security.processors.impl.FileSecurityProcessorImpl.java
/** * @see com.cws.esolutions.security.processors.interfaces.IFileSecurityProcessor#signFile(com.cws.esolutions.security.processors.dto.FileSecurityRequest) *///from w ww. j av a 2 s. co m public synchronized FileSecurityResponse signFile(final FileSecurityRequest request) throws FileSecurityException { final String methodName = IFileSecurityProcessor.CNAME + "#signFile(final FileSecurityRequest request) throws FileSecurityException"; if (DEBUG) { DEBUGGER.debug(methodName); DEBUGGER.debug("FileSecurityRequest: {}", request); } FileSecurityResponse response = new FileSecurityResponse(); final RequestHostInfo reqInfo = request.getHostInfo(); final UserAccount userAccount = request.getUserAccount(); final KeyManager keyManager = KeyManagementFactory.getKeyManager(keyConfig.getKeyManager()); if (DEBUG) { DEBUGGER.debug("RequestHostInfo: {}", reqInfo); DEBUGGER.debug("UserAccount", userAccount); DEBUGGER.debug("KeyManager: {}", keyManager); } try { KeyPair keyPair = keyManager.returnKeys(userAccount.getGuid()); if (keyPair != null) { Signature signature = Signature.getInstance(fileSecurityConfig.getSignatureAlgorithm()); signature.initSign(keyPair.getPrivate()); signature.update(IOUtils.toByteArray(new FileInputStream(request.getUnsignedFile()))); if (DEBUG) { DEBUGGER.debug("Signature: {}", signature); } byte[] sig = signature.sign(); if (DEBUG) { DEBUGGER.debug("Signature: {}", sig); } IOUtils.write(sig, new FileOutputStream(request.getSignedFile())); if ((request.getSignedFile().exists()) && (request.getSignedFile().length() != 0)) { response.setSignedFile(request.getSignedFile()); response.setRequestStatus(SecurityRequestStatus.SUCCESS); } else { response.setRequestStatus(SecurityRequestStatus.FAILURE); } } else { response.setRequestStatus(SecurityRequestStatus.FAILURE); } } catch (NoSuchAlgorithmException nsax) { ERROR_RECORDER.error(nsax.getMessage(), nsax); throw new FileSecurityException(nsax.getMessage(), nsax); } catch (FileNotFoundException fnfx) { ERROR_RECORDER.error(fnfx.getMessage(), fnfx); throw new FileSecurityException(fnfx.getMessage(), fnfx); } catch (InvalidKeyException ikx) { ERROR_RECORDER.error(ikx.getMessage(), ikx); throw new FileSecurityException(ikx.getMessage(), ikx); } catch (SignatureException sx) { ERROR_RECORDER.error(sx.getMessage(), sx); throw new FileSecurityException(sx.getMessage(), sx); } catch (IOException iox) { ERROR_RECORDER.error(iox.getMessage(), iox); throw new FileSecurityException(iox.getMessage(), iox); } catch (KeyManagementException kmx) { ERROR_RECORDER.error(kmx.getMessage(), kmx); throw new FileSecurityException(kmx.getMessage(), kmx); } finally { // audit try { AuditEntry auditEntry = new AuditEntry(); auditEntry.setHostInfo(reqInfo); auditEntry.setAuditType(AuditType.SIGNFILE); auditEntry.setUserAccount(userAccount); auditEntry.setAuthorized(Boolean.TRUE); auditEntry.setApplicationId(request.getApplicationId()); auditEntry.setApplicationName(request.getAppName()); if (DEBUG) { DEBUGGER.debug("AuditEntry: {}", auditEntry); } AuditRequest auditRequest = new AuditRequest(); if (DEBUG) { DEBUGGER.debug("AuditRequest: {}", auditRequest); } auditor.auditRequest(auditRequest); } catch (AuditServiceException asx) { ERROR_RECORDER.error(asx.getMessage(), asx); } } return response; }
From source file:acp.sdk.SDKConfig.java
/** * properties//w w w .j a va 2 s.com * * @param rootPath * ????. */ public void loadPropertiesFromPath(String rootPath) { if (StringUtils.isNotBlank(rootPath)) { File file = new File(rootPath + File.separator + FILE_NAME); InputStream in = null; if (file.exists()) { try { in = new FileInputStream(file); BufferedReader bf = new BufferedReader(new InputStreamReader(in, "utf-8")); properties = new Properties(); properties.load(bf); loadProperties(properties); } catch (FileNotFoundException e) { LogUtil.writeErrorLog(e.getMessage(), e); } catch (IOException e) { LogUtil.writeErrorLog(e.getMessage(), e); } finally { if (null != in) { try { in.close(); } catch (IOException e) { LogUtil.writeErrorLog(e.getMessage(), e); } } } } else { // ??LOG??? System.out.println(rootPath + FILE_NAME + "?,?"); } } else { loadPropertiesFromSrc(); } }
From source file:com.jaspersoft.studio.components.customvisualization.creation.wizard.CustomVisualizationComponentWizard.java
/** * Create the project inside the workspace and all it's content *///from www . j a v a2 s . c om @Override public boolean performFinish() { IProgressMonitor monitor = new NullProgressMonitor(); String projectName = page0.getProjectName(); ModuleDefinition selected = page0.getSelectedModule(); boolean result = createProject(projectName, monitor); if (result) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject project = root.getProject(projectName); File dest = new File(root.getRawLocation().toFile(), projectName); List<VelocityLibrary> libraries = new ArrayList<VelocityLibrary>(); List<VelocityShimLibrary> shimLibraries = new ArrayList<VelocityShimLibrary>(); try { String outputScriptName = projectName + ".min.js"; //Add the main module and all it's dependencies addModule(selected, shimLibraries, libraries, dest); for (ModuleDefinition requiredLibrary : selected.getRequiredLibraries()) { addModule(requiredLibrary, shimLibraries, libraries, dest); } String cssFileName = generateCSS(project, monitor, selected); String renderFileName = generateRender(project, monitor, selected); libraries.add(new VelocityLibrary(selected.getModuleName(), removeJsExtension(renderFileName))); String buildFile = generateBuildFile(libraries, shimLibraries, selected.getModuleName(), outputScriptName); createFile("build.js", project, buildFile, monitor); //$NON-NLS-1$ //Eventually create a sample for the current project createSample(selected, outputScriptName, cssFileName, project, monitor); try { project.refreshLocal(IProject.DEPTH_INFINITE, new NullProgressMonitor()); } catch (CoreException e) { e.printStackTrace(); } } catch (FileNotFoundException ex) { MessageDialog.openError(UIUtils.getShell(), Messages.CustomVisualizationComponentWizard_errorTitle, ex.getMessage()); return false; } } return result; }
From source file:forseti.JGestionArchivos.java
public void EliminarArchivo(HttpServletRequest request) throws ServletException { //System.out.println("GestionEliminarArchivo:" + m_Nombre + ":m_Nombre"); try {/*w ww . java 2 s. co m*/ //Ahora agrega el archivo al mensaje String charset = "UTF-8"; String requestURL = "https://" + m_URL + "/servlet/SAFAwsS3Conn"; MultipartUtility multipart = new MultipartUtility(requestURL, charset); multipart.addHeaderField("User-Agent", "CodeJava"); multipart.addHeaderField("Test-Header", "Header-Value"); multipart.addFormField("SERVER", m_HOST); multipart.addFormField("DATABASE", JUtil.getSesion(request).getBDCompania()); multipart.addFormField("USER", m_S3_USERNAME); multipart.addFormField("PASSWORD", m_S3_PASSWORD); multipart.addFormField("ACTION", "ELIMINAR"); multipart.addFormField("ID_MODULO", m_ID_MODULO); multipart.addFormField("OBJIDS", m_OBJIDS); multipart.addFormField("IDSEP", m_IDSEP); multipart.addFormField("NOMBRE", m_Nombre); JProcessSet setPer = new JProcessSet(null); String sql = "select coalesce(sum(tambites),0) as totbites from tbl_s3_registros_exitosos where servidor = '" + JUtil.p(m_HOST) + "' and bd = '" + JUtil.getSesion(request).getBDCompania() + "'"; //System.out.println(sql); setPer.ConCat(true); setPer.setSQL(sql); setPer.Open(); multipart.addFormField("TOTBITES", setPer.getAbsRow(0).getSTS("Col1")); //Este parametro LN se manda solo para que el NOMBRE no se mande con una linea (LN) extra del return multipart.addFormField("LN", "LN"); InputStream response = multipart.connect(); // Recibe la respuesta del servidor, esta debe estar en formato xml SAXBuilder builder = new SAXBuilder(); Document document = (Document) builder.build(response); Element S3 = document.getRootElement(); if (S3.getName().equals("S3")) { String SQL = "SELECT * FROM sp_s3_registros_exitosos_eliminar('" + JUtil.q(m_HOST) + "','" + JUtil.q(JUtil.getSesion(request).getBDCompania()) + "','" + JUtil.q(m_ID_MODULO) + "','" + JUtil.q(m_OBJIDS) + "','" + JUtil.q(m_IDSEP) + "','" + JUtil.q(m_Nombre) + "') as (RES integer);"; Connection con = JAccesoBD.getConexion(); Statement s = con.createStatement(); ResultSet rs = s.executeQuery(SQL); if (rs.next()) { int res = rs.getInt("RES"); System.out.println("Resultado de la eliminacin del archivo S3 en Cliente: " + res); } s.close(); JAccesoBD.liberarConexion(con); m_StatusS3 = OKYDOKY; } else if (S3.getName().equals("SIGN_ERROR"))// Significan errores { m_StatusS3 = ERROR; m_Error += "Codigo de Error JAwsS3Conn: " + S3.getAttribute("CodError") + "<br>" + S3.getAttribute("MsjError"); } else { m_StatusS3 = ERROR; m_Error += "ERROR: El archivo recibido es un archivo XML, pero no parece ser una respuesta de archivo ni una respuesta de ERROR del servidor JAwsS3Conn. Esto debe ser investigado de inmediato, Contacta con tu intermediario de archivos AWS S3 Forseti para que te explique el problema"; } multipart.disconnect(); } catch (FileNotFoundException e1) { e1.printStackTrace(); m_StatusS3 = ERROR; m_Error = "Error de archivos S3: " + e1.getMessage(); } catch (IOException e1) { e1.printStackTrace(); m_StatusS3 = ERROR; m_Error = "Error de Entrada/Salida S3: " + e1.getMessage(); } catch (JDOMException e1) { e1.printStackTrace(); m_StatusS3 = ERROR; m_Error = "Error de JDOMException S3: " + e1.getMessage(); } catch (SQLException e1) { e1.printStackTrace(); m_StatusS3 = ERROR; m_Error = "Error de SQLException S3: " + e1.getMessage(); } }
From source file:forseti.JGestionArchivos.java
public void SubirArchivo(HttpServletRequest request) throws ServletException { try {//from w w w . ja va 2 s.co m FileItem actual = (FileItem) m_Archivos.elementAt(0); //Ahora agrega el archivo al mensaje String charset = "UTF-8"; String requestURL = "https://" + m_URL + "/servlet/SAFAwsS3Conn"; MultipartUtility multipart = new MultipartUtility(requestURL, charset); multipart.addHeaderField("User-Agent", "CodeJava"); multipart.addHeaderField("Test-Header", "Header-Value"); multipart.addFormField("SERVER", m_HOST); multipart.addFormField("DATABASE", JUtil.getSesion(request).getBDCompania()); multipart.addFormField("USER", m_S3_USERNAME); multipart.addFormField("PASSWORD", m_S3_PASSWORD); multipart.addFormField("ACTION", "SUBIR"); multipart.addFormField("ID_MODULO", m_ID_MODULO); multipart.addFormField("OBJIDS", m_OBJIDS); multipart.addFormField("IDSEP", m_IDSEP); multipart.addFormField("NOMBRE", actual.getName()); multipart.addFormField("TAMBITES", Long.toString(actual.getSize())); JProcessSet setPer = new JProcessSet(null); String sql = "select coalesce(sum(tambites),0) as totbites from tbl_s3_registros_exitosos where servidor = '" + JUtil.p(m_HOST) + "' and bd = '" + JUtil.getSesion(request).getBDCompania() + "'"; //System.out.println(sql); setPer.ConCat(true); setPer.setSQL(sql); setPer.Open(); multipart.addFormField("TOTBITES", setPer.getAbsRow(0).getSTS("Col1")); multipart.addFilePart("fileUpload", actual); InputStream response = multipart.connect(); // Recibe la respuesta del servidor, esta debe estar en formato xml SAXBuilder builder = new SAXBuilder(); Document document = (Document) builder.build(response); Element S3 = document.getRootElement(); if (S3.getName().equals("S3")) { String SQL = "SELECT * FROM sp_s3_registros_exitosos('" + JUtil.q(m_HOST) + "','" + JUtil.q(JUtil.getSesion(request).getBDCompania()) + "','" + JUtil.q(m_ID_MODULO) + "','" + JUtil.q(m_OBJIDS) + "','" + JUtil.q(m_IDSEP) + "','" + JUtil.q(actual.getName()) + "'," + Long.toString(actual.getSize()) + ") as (RES integer);"; Connection con = JAccesoBD.getConexion(); Statement s = con.createStatement(); ResultSet rs = s.executeQuery(SQL); if (rs.next()) { int res = rs.getInt("RES"); System.out.println("Resultado del archivo S3 en Cliente: " + res); } s.close(); JAccesoBD.liberarConexion(con); m_StatusS3 = OKYDOKY; } else if (S3.getName().equals("SIGN_ERROR"))// Significan errores { m_StatusS3 = ERROR; m_Error += "Codigo de Error JAwsS3Conn: " + S3.getAttribute("CodError") + "<br>" + S3.getAttribute("MsjError"); } else { m_StatusS3 = ERROR; m_Error += "ERROR: El archivo recibido es un archivo XML, pero no parece ser una respuesta de archivo ni una respuesta de ERROR del servidor JAwsS3Conn. Esto debe ser investigado de inmediato, Contacta con tu intermediario de archivos AWS S3 Forseti para que te explique el problema"; } multipart.disconnect(); // Fin de archivo grabado /////////////////////////////////////////////////////////////////////////// } catch (FileNotFoundException e1) { e1.printStackTrace(); m_StatusS3 = ERROR; m_Error = "Error de archivos S3: " + e1.getMessage(); } catch (IOException e1) { e1.printStackTrace(); m_StatusS3 = ERROR; m_Error = "Error de Entrada/Salida S3: " + e1.getMessage(); } catch (JDOMException e1) { e1.printStackTrace(); m_StatusS3 = ERROR; m_Error = "Error de JDOMException S3: " + e1.getMessage(); } catch (SQLException e1) { e1.printStackTrace(); m_StatusS3 = ERROR; m_Error = "Error de SQLException S3: " + e1.getMessage(); } }