Example usage for java.lang Exception getLocalizedMessage

List of usage examples for java.lang Exception getLocalizedMessage

Introduction

In this page you can find the example usage for java.lang Exception getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.heatmap.HeatMapImgGenerator.java

public String generateHeatmap(String[] rows, String[] columns, String[][] data) {

    JPanel heatmapPanelLayout = new JPanel();
    heatmapPanelLayout.setLayout(null);//ww w  . j ava2s  . c o  m
    heatmapPanelLayout.setVisible(true);

    int width = (columns.length + 1) * 50;
    int height = (rows.length + 1) * 50;
    heatmapPanelLayout.setSize(width, height);
    JPanel cornerCell = initCell("#ffffff", 0, 0);
    int x = 50;
    int y = 0;
    heatmapPanelLayout.add(cornerCell);

    for (String headerCell : columns) {
        JPanel cell = initCell(headerCell, x, y);
        x += 50;
        heatmapPanelLayout.add(cell);

    }
    y = 50;
    for (String headerCell : rows) {
        JPanel cell = initCell(headerCell, 0, y);
        y += 50;
        heatmapPanelLayout.add(cell);

    }
    x = 50;
    y = 50;
    for (String[] row : data) {
        for (String color : row) {
            JPanel cell = initCell(color, x, y);
            heatmapPanelLayout.add(cell);
            x += 50;
        }
        x = 50;
        y += 50;
    }

    BufferedImage image = new BufferedImage(width + 10, height + 10, BufferedImage.TYPE_INT_ARGB);
    Graphics2D graphics = image.createGraphics();
    graphics.setPaint(Color.WHITE);
    graphics.setBackground(Color.WHITE);
    heatmapPanelLayout.paint(graphics);
    byte[] imageData = null;

    try {

        ImageEncoder in = ImageEncoderFactory.newInstance(ImageFormat.PNG, new Float(0.084666f));
        imageData = in.encode(image);
    } catch (Exception e) {
        System.out.println(e.getLocalizedMessage());
    }

    String base64 = Base64.encodeBytes(imageData);
    base64 = "data:image/png;base64," + base64;
    return base64;

}

From source file:com.jaxio.celerio.maven.plugin.celerio.CleanGeneratedMojo.java

public void execute() throws MojoExecutionException {
    try {//  w  w  w.  j  a  v  a  2 s  .  co  m
        process();
    } catch (Exception e) {
        getLog().error(e.getMessage());
        throw new MojoExecutionException(e.getLocalizedMessage(), e);
    }
}

From source file:fr.sanofi.fcl4transmart.controllers.listeners.clinicalData.SetTermsListener.java

@Override
public void handleEvent(Event event) {
    // TODO Auto-generated method stub
    File file = new File(this.dataType.getPath().toString() + File.separator
            + this.dataType.getStudy().toString() + ".words.tmp");
    try {/*w ww.ja  v a 2s. co  m*/
        FileWriter fw = new FileWriter(file);
        BufferedWriter out = new BufferedWriter(fw);
        out.write("Filename\tColumn Number\tOriginal Data Value\tNew Data Value\n");
        //  
        HashMap<String, Vector<String>> oldValues = this.setTermsUI.getOldValues();
        HashMap<String, Vector<String>> newValues = this.setTermsUI.getNewValues();

        for (String fullName : oldValues.keySet()) {
            File rawFile = new File(this.dataType.getPath() + File.separator + fullName.split(" - ", -1)[0]);
            String header = fullName.split(" - ", -1)[1];
            int columnNumber = FileHandler.getHeaderNumber(rawFile, header);
            for (int i = 0; i < oldValues.get(fullName).size(); i++) {
                if (newValues.get(fullName).elementAt(i).compareTo("") != 0) {
                    out.write(rawFile.getName() + "\t" + columnNumber + "\t"
                            + oldValues.get(fullName).elementAt(i) + "\t" + newValues.get(fullName).elementAt(i)
                            + "\n");
                }
            }
        }

        out.close();
        try {
            File fileDest;
            if (((ClinicalData) this.dataType).getWMF() != null) {
                String fileName = ((ClinicalData) this.dataType).getWMF().getName();
                ((ClinicalData) this.dataType).getWMF().delete();
                fileDest = new File(this.dataType.getPath() + File.separator + fileName);
            } else {
                fileDest = new File(this.dataType.getPath() + File.separator
                        + this.dataType.getStudy().toString() + ".words");
            }
            FileUtils.moveFile(file, fileDest);
            ((ClinicalData) this.dataType).setWMF(fileDest);
        } catch (IOException ioe) {
            this.setTermsUI.displayMessage("File error: " + ioe.getLocalizedMessage());
            return;
        }
    } catch (Exception e) {
        this.setTermsUI.displayMessage("Error: " + e.getLocalizedMessage());
        e.printStackTrace();
    }
    this.setTermsUI.displayMessage("Word mapping file updated");
    WorkPart.updateSteps();
    WorkPart.updateFiles();
    UsedFilesPart.sendFilesChanged(dataType);
}

From source file:cz.zcu.kiv.eeg.mobile.base.ws.asynctask.FetchArtifacts.java

/**
 * Method, where all artifacts are read from server.
 * All heavy lifting is made here.//from   w ww  . j a  va  2 s. c  o m
 *
 * @param params omitted here
 * @return list of fetched artifacts
 */
@Override
protected List<Artifact> doInBackground(Void... params) {
    SharedPreferences credentials = getCredentials();
    String username = credentials.getString("username", null);
    String password = credentials.getString("password", null);
    String url = credentials.getString("url", null) + Values.SERVICE_ARTIFACTS;

    setState(RUNNING, R.string.working_ws_artifacts);
    HttpAuthentication authHeader = new HttpBasicAuthentication(username, password);
    HttpHeaders requestHeaders = new HttpHeaders();
    requestHeaders.setAuthorization(authHeader);
    requestHeaders.setAccept(Collections.singletonList(MediaType.APPLICATION_XML));
    HttpEntity<Object> entity = new HttpEntity<Object>(requestHeaders);

    SSLSimpleClientHttpRequestFactory factory = new SSLSimpleClientHttpRequestFactory();
    // Create a new RestTemplate instance
    RestTemplate restTemplate = new RestTemplate(factory);
    restTemplate.getMessageConverters().add(new SimpleXmlHttpMessageConverter());

    try {
        // Make the network request
        Log.d(TAG, url);
        ResponseEntity<ArtifactList> response = restTemplate.exchange(url, HttpMethod.GET, entity,
                ArtifactList.class);
        ArtifactList body = response.getBody();

        if (body != null) {
            return body.getArtifacts();
        }

    } catch (Exception e) {
        Log.e(TAG, e.getLocalizedMessage(), e);
        setState(ERROR, e);
    } finally {
        setState(DONE);
    }
    return Collections.emptyList();
}

From source file:cz.zcu.kiv.eeg.mobile.base.ws.asynctask.FetchPeople.java

/**
 * Method, where all people are read from server.
 * All heavy lifting is made here.//from www  .j  a va2  s  . co  m
 *
 * @param params omitted here
 * @return list of fetched people
 */
@Override
protected List<Person> doInBackground(Void... params) {
    SharedPreferences credentials = getCredentials();
    String username = credentials.getString("username", null);
    String password = credentials.getString("password", null);
    String url = credentials.getString("url", null) + Values.SERVICE_USER + Values.SERVICE_QUALIFIER_ALL;

    setState(RUNNING, R.string.working_ws_people);
    HttpAuthentication authHeader = new HttpBasicAuthentication(username, password);
    HttpHeaders requestHeaders = new HttpHeaders();
    requestHeaders.setAuthorization(authHeader);
    requestHeaders.setAccept(Collections.singletonList(MediaType.APPLICATION_XML));
    HttpEntity<Object> entity = new HttpEntity<Object>(requestHeaders);

    SSLSimpleClientHttpRequestFactory factory = new SSLSimpleClientHttpRequestFactory();
    // Create a new RestTemplate instance
    RestTemplate restTemplate = new RestTemplate(factory);
    restTemplate.getMessageConverters().add(new SimpleXmlHttpMessageConverter());

    try {
        // Make the network request
        Log.d(TAG, url);
        ResponseEntity<PersonList> response = restTemplate.exchange(url, HttpMethod.GET, entity,
                PersonList.class);
        PersonList body = response.getBody();

        if (body != null) {
            return body.getPeople();
        }

    } catch (Exception e) {
        Log.e(TAG, e.getLocalizedMessage(), e);
        setState(ERROR, e);
    } finally {
        setState(DONE);
    }
    return Collections.emptyList();
}

From source file:com.nononsenseapps.notepad.sync.googleapi.GoogleTaskList.java

public GoogleTaskList(final JSONObject jsonList, final String accountName) throws JSONException {
    super();/*  ww w .  j  a  v a2s .  co m*/
    this.service = SERVICENAME;
    // this.api = ;

    remoteId = jsonList.getString("id");
    title = jsonList.getString("title");
    account = accountName;

    try {
        updated = RFC3339Date.parseRFC3339Date(jsonList.getString("updated")).getTime();
    } catch (Exception e) {
        Log.d(TAG, e.getLocalizedMessage());
        updated = 0L;
    }

    //json = jsonList;
}

From source file:com.amalto.core.save.generator.HazelcastAutoIncrementGenerator.java

@Override
public void saveState(XmlServer server) {
    if (NEED_TO_SAVE.getAndSet(0) == 1) {
        try {/*from  ww  w.ja v a2  s  . c  om*/
            Properties properties = new Properties();
            properties.putAll(CONFIGURATION);
            String xmlString = Util.convertAutoIncrement(properties);
            ItemPOJO pojo = new ItemPOJO(DC, // cluster
                    AUTO_INCREMENT, // concept name
                    IDS, System.currentTimeMillis(), // insertion time
                    xmlString // actual data
            );
            pojo.setDataModelName(XSystemObjects.DM_CONF.getName());
            pojo.store();
        } catch (Exception e) {
            LOGGER.error(e.getLocalizedMessage(), e);
        }
    }
}

From source file:probe.com.model.util.vaadintoimageutil.Convertor.java

public String toImage(int height, int width, JComponent component) {
    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
    Graphics2D graphics = image.createGraphics();
    graphics.setPaint(Color.WHITE);
    component.paint(graphics);/* w  w w .  j  a  v a 2s.  c o  m*/
    //        super.paint(graphics);
    byte[] imageData = null;

    try {

        imageData = in.encode(image);
    } catch (Exception e) {
        System.out.println(e.getLocalizedMessage());
    }

    String base64 = Base64.encodeBytes(imageData);
    base64 = "data:image/png;base64," + base64;
    return base64;

}

From source file:com.kylinolap.job.hadoop.invertedindex.IIDistinctColumnsJob.java

@Override
public int run(String[] args) throws Exception {
    Options options = new Options();

    try {//ww  w  .ja va  2 s .  co  m
        options.addOption(OPTION_JOB_NAME);
        options.addOption(OPTION_TABLE_NAME);
        options.addOption(OPTION_INPUT_PATH);
        options.addOption(OPTION_INPUT_FORMAT);
        options.addOption(OPTION_INPUT_DELIM);
        options.addOption(OPTION_OUTPUT_PATH);
        parseOptions(options, args);

        job = Job.getInstance(getConf(), getOptionValue(OPTION_JOB_NAME));
        String tableName = getOptionValue(OPTION_TABLE_NAME).toUpperCase();
        Path input = new Path(getOptionValue(OPTION_INPUT_PATH));
        String inputFormat = getOptionValue(OPTION_INPUT_FORMAT);
        String inputDelim = getOptionValue(OPTION_INPUT_DELIM);
        Path output = new Path(getOptionValue(OPTION_OUTPUT_PATH));

        // ----------------------------------------------------------------------------

        System.out.println("Starting: " + job.getJobName());

        setupMapInput(input, inputFormat, inputDelim);
        setupReduceOutput(output);

        // pass table and columns
        MetadataManager metaMgr = MetadataManager.getInstance(KylinConfig.getInstanceFromEnv());
        TableDesc table = metaMgr.getTableDesc(tableName);
        job.getConfiguration().set(BatchConstants.TABLE_NAME, tableName);
        job.getConfiguration().set(BatchConstants.TABLE_COLUMNS, getColumns(table));

        return waitForCompletion(job);

    } catch (Exception e) {
        printUsage(options);
        log.error(e.getLocalizedMessage(), e);
        return 2;
    }

}

From source file:cz.zcu.kiv.eeg.mobile.base.ws.asynctask.FetchDigitizations.java

/**
 * Method, where all digitizations are read from server.
 * All heavy lifting is made here./*from w w w.j  a v a 2 s  . c om*/
 *
 * @param params omitted here
 * @return list of fetched digitizations
 */
@Override
protected List<Digitization> doInBackground(Void... params) {
    SharedPreferences credentials = getCredentials();
    String username = credentials.getString("username", null);
    String password = credentials.getString("password", null);
    String url = credentials.getString("url", null) + Values.SERVICE_DIGITIZATIONS;

    setState(RUNNING, R.string.working_ws_digitization);
    HttpAuthentication authHeader = new HttpBasicAuthentication(username, password);
    HttpHeaders requestHeaders = new HttpHeaders();
    requestHeaders.setAuthorization(authHeader);
    requestHeaders.setAccept(Collections.singletonList(MediaType.APPLICATION_XML));
    HttpEntity<Object> entity = new HttpEntity<Object>(requestHeaders);

    SSLSimpleClientHttpRequestFactory factory = new SSLSimpleClientHttpRequestFactory();
    // Create a new RestTemplate instance
    RestTemplate restTemplate = new RestTemplate(factory);
    restTemplate.getMessageConverters().add(new SimpleXmlHttpMessageConverter());

    try {
        // Make the network request
        Log.d(TAG, url);
        ResponseEntity<DigitizationList> response = restTemplate.exchange(url, HttpMethod.GET, entity,
                DigitizationList.class);
        DigitizationList body = response.getBody();

        if (body != null) {
            return body.getDigitizations();
        }

    } catch (Exception e) {
        Log.e(TAG, e.getLocalizedMessage(), e);
        setState(ERROR, e);
    } finally {
        setState(DONE);
    }
    return Collections.emptyList();
}