Example usage for java.io IOException getLocalizedMessage

List of usage examples for java.io IOException getLocalizedMessage

Introduction

In this page you can find the example usage for java.io IOException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:com.kylinolap.rest.service.QueryService.java

public void removeQuery(final String creator, final String id) {
    List<Query> queries = getQueries(creator);
    Iterator<Query> queryIter = queries.iterator();

    boolean changed = false;
    while (queryIter.hasNext()) {
        Query temp = queryIter.next();
        if (temp.getId().equals(id)) {
            queryIter.remove();//w  w w  . j  a v a  2  s .c  o m
            changed = true;
            break;
        }
    }

    if (!changed) {
        return;
    }

    Query[] queryArray = new Query[queries.size()];
    byte[] bytes = querySerializer.serialize(queries.toArray(queryArray));
    HTableInterface htable = null;
    try {
        htable = HBaseConnection.get(hbaseUrl).getTable(userTableName);
        Put put = new Put(Bytes.toBytes(creator));
        put.add(Bytes.toBytes(USER_QUERY_FAMILY), Bytes.toBytes(USER_QUERY_COLUMN), bytes);

        htable.put(put);
        htable.flushCommits();
    } catch (IOException e) {
        logger.error(e.getLocalizedMessage(), e);
    } finally {
        IOUtils.closeQuietly(htable);
    }
}

From source file:com.kylinolap.cube.project.ProjectManager.java

private void afterProjectUpdated(ProjectInstance updatedProject) {
    try {//from   w ww.j a  va  2  s  .c o m
        this.loadProjectCache(updatedProject, true);
    } catch (IOException e) {
        logger.error(e.getLocalizedMessage(), e);
    }
}

From source file:com.google.cloud.hadoop.gcsio.GoogleCloudStorageIntegrationHelper.java

/**
 * Delete buckets that were temporarily created during tests.
 *//*w  w  w  . j a v  a 2 s .  co  m*/
public void deleteBuckets() {
    for (String bucket : bucketsToDelete) {
        try {
            clearBucket(bucket);
            delete(bucket);
        } catch (IOException e) {
            log.warn("deleteBuckets: " + e.getLocalizedMessage());
        }
    }
    bucketsToDelete.clear();
}

From source file:ru.codemine.ccms.router.TaskRouter.java

@Secured("ROLE_USER")
@RequestMapping(value = "/tasks/getfile/{urlfilename}", method = RequestMethod.GET)
public void getFileFromTask(@RequestParam("taskid") Integer taskid, @RequestParam("fileid") Long fileid,
        @PathVariable("urlfilename") String urlFileName, HttpServletResponse response) {
    Task task = taskService.getById(taskid);
    DataFile targetDataFile = dataFileService.getById(fileid);
    Employee currentUser = employeeService.getCurrentUser();

    if (targetDataFile == null || task == null || !task.isInTask(currentUser))
        return;//from  w  w  w.j a v a 2  s.c o  m

    File targetFile = new File(targetDataFile.getFilename());

    try {
        String encFilename = URLEncoder.encode(targetDataFile.getViewName().replace(" ", "_"), "UTF-8");
        String decFilename = URLDecoder.decode(encFilename, "ISO8859_1");
        response.setHeader("Content-Disposition", "attachment;filename=" + decFilename);

        BufferedInputStream bs = new BufferedInputStream(new FileInputStream(targetFile));
        IOUtils.copy(bs, response.getOutputStream());
        response.flushBuffer();
    } catch (IOException ex) {
        log.error("    " + targetDataFile.getViewName()
                + ", : " + ex.getLocalizedMessage());
    }

}

From source file:com.app.model.m3.M3UpgradModel.java

private void buildThreadTarg() {
    taskActionNumber = new Thread(new Runnable() {

        @Override//from   w ww . j av  a 2  s  .  c  o m
        public void run() {
            try {
                actionNumber.loadData();
            } catch (IOException ex) {
                Ressource.logger.error(ex.getLocalizedMessage(), ex);
            }
        }
    });
}

From source file:com.photon.phresco.service.impl.DependencyManagerImpl.java

private void createSqlFolder(List<DownloadInfo> selectedDbs, File path) throws PhrescoException {
    if (isDebugEnabled) {
        LOGGER.debug("DependencyManagerImpl.createSqlFolder:Entry");
        LOGGER.info("DependencyManagerImpl.createSqlFolder",
                ServiceConstants.PATH_EQUALS_SLASH + path.getPath() + "\"");
    }//w w w.  j  a v  a2s .com
    String databaseType = "";
    try {
        File mysqlFolder = new File(path, artifactTypeMap.get("database") + Constants.DB_MYSQL);
        File mysqlVersionFolder = getMysqlVersionFolder(mysqlFolder);

        for (DownloadInfo db : selectedDbs) {
            databaseType = db.getName().toLowerCase();
            List<ArtifactInfo> versions = db.getArtifactGroup().getVersions();
            for (ArtifactInfo version : versions) {
                String sqlPath = databaseType + File.separator + version.getVersion();
                File sqlFolder = new File(path, artifactTypeMap.get("database") + sqlPath);
                sqlFolder.mkdirs();
                if (databaseType.equals(Constants.DB_MYSQL) && mysqlVersionFolder != null
                        && !(mysqlVersionFolder.getPath().equals(sqlFolder.getPath()))) {
                    FileUtils.copyDirectory(mysqlVersionFolder, sqlFolder);
                } else {
                    File sqlFile = new File(sqlFolder, Constants.SITE_SQL);
                    sqlFile.createNewFile();
                }
            }
        }
        if (isDebugEnabled) {
            LOGGER.debug("DependencyManagerImpl.createSqlFolder:Exit");
        }
    } catch (IOException e) {
        LOGGER.error("DependencyManagerImpl.createSqlFolder", ServiceConstants.STATUS_FAILURE,
                ServiceConstants.MESSAGE_EQUALS + "\"" + e.getLocalizedMessage() + "\"");
        throw new PhrescoException(e);
    }
}

From source file:com.qumasoft.qvcslib.CompareFilesWithApacheDiff.java

protected void writeEditScript(Revision apacheRevision, CompareLineInfo[] fileA, CompareLineInfo[] fileB)
        throws QVCSOperationException {
    DataOutputStream outStream = null;
    try {//from w  ww  . j a  v a  2 s  .  c o m
        outStream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(outFile)));

        // Write the header
        CompareFilesEditHeader editHeader = new CompareFilesEditHeader();
        editHeader.setBaseFileSize(new Common32Long((int) inFileA.length()));
        editHeader.setTimeOfTarget(new CommonTime());
        editHeader.write(outStream);

        int count = apacheRevision.size();
        for (int index = 0; index < count; index++) {
            Delta delta = apacheRevision.getDelta(index);
            formatEditScript(delta, outStream, fileA);
        }
    } catch (IOException e) {
        throw new QVCSOperationException("IO Exception in writeEditScript() " + e.getLocalizedMessage());
    } finally {
        if (outStream != null) {
            try {
                outStream.close();
            } catch (IOException ex) {
                Logger.getLogger(CompareFilesWithApacheDiff.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
}

From source file:com.nextgis.mobile.map.MapBase.java

/**
 * Save map properties and layers to map.json file
 *///w  w w. jav  a2s. c  o  m
public synchronized void saveMap() {
    Log.d(TAG, "save map");
    try {
        JSONObject rootObject = new JSONObject();
        rootObject.put(JSON_NAME_KEY, mName);
        JSONArray jsonArray = new JSONArray();
        rootObject.put(JSON_LAYERS_KEY, jsonArray);
        for (Layer layer : mLayers) {
            JSONObject layerObject = new JSONObject();
            layerObject.put(JSON_PATH_KEY, layer.getRelativePath());
            jsonArray.put(layerObject);
            layer.save();
        }

        File config_file = new File(mMapPath, MAP_CONFIG);
        FileUtil.writeToFile(config_file, rootObject.toString());
    } catch (IOException e) {
        reportError(e.getLocalizedMessage());
    } catch (JSONException e) {
        reportError(e.getLocalizedMessage());
    }
}

From source file:fr.sanofi.fcl4transmart.controllers.listeners.geneanalysis.LoadAnnotationListener.java

/**
 *Write a given string corresponding to Kettle log in a log file
 *//*from w w w  . j  ava2  s  . c  om*/
public void writeLog(String text) {
    File log = new File(dataType.getPath() + File.separator + "annotation.kettle.log");
    try {
        FileWriter fw = new FileWriter(log);
        BufferedWriter output = new BufferedWriter(fw);
        output.write(text);
        output.close();
        ((GeneExpressionAnalysis) dataType).setKettleLog(log);
    } catch (IOException ioe) {
        loadAnnotationUI.setMessage("File error: " + ioe.getLocalizedMessage());
        ioe.printStackTrace();
    }
}

From source file:com.app.model.m3.M3UpgradModel.java

private void buildThreadSrc() {
    taskM3Config = new Thread(new Runnable() {

        @Override/*from w  w  w  .j av a2  s .c  om*/
        public void run() {
            try {
                configm3.loadData();
            } catch (IOException ex) {
                Ressource.logger.error(ex.getLocalizedMessage(), ex);
            }
        }
    });

    taskM3User = new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                m3user.loadData();
            } catch (IOException ex) {
                Ressource.logger.error(ex.getLocalizedMessage(), ex);
            }
        }
    });
}