Example usage for java.lang IllegalArgumentException getLocalizedMessage

List of usage examples for java.lang IllegalArgumentException getLocalizedMessage

Introduction

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

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:org.deegree.tools.rendering.manager.trees.TreeManager.java

/**
 * @param reader//  w  w  w .j  av  a2 s .co m
 * @param mappedColumns
 * @param maxLength
 * @return
 * @throws IOException
 */
private BackendResult readAndImportBillboards(CSVReader reader, Map<Column, Integer> mappedColumns,
        int maxLength) throws IOException {
    String[] values = reader.parseLine();
    List<DataObjectInfo<BillBoard>> inserts = new LinkedList<DataObjectInfo<BillBoard>>();
    while (values != null) {
        if (values.length >= maxLength) {
            String uuid = "" + Integer.parseInt(values[mappedColumns.get(Column.ID)]);
            BillBoard b = null;
            try {
                b = createBillBoard(mappedColumns, values);
            } catch (IllegalArgumentException e) {
                LOG.error("Line( " + reader.getLineNumber() + "):  " + e.getLocalizedMessage());
            }
            if (b != null) {
                inserts.add(createDataObjectInfo(uuid, values[mappedColumns.get(Column.TYPE)],
                        values[mappedColumns.get(Column.IMAGE)], b));
            }
        } else {
            LOG.warn("Line( " + reader.getLineNumber() + "): not enough elements parsed: "
                    + Arrays.toString(values));
        }
        values = reader.parseLine();
    }
    ModelBackend<?> backend = getDbBackend();
    BackendResult result = backend.insert(inserts, Type.TREE);
    flush();
    return result;
}

From source file:org.kitodo.production.helper.VariableReplacer.java

/**
 * Metadatum von FirstChild oder TopStruct ermitteln (vorzugsweise vom
 * FirstChild) und zurckgeben./*  ww w  .  j  a  v  a 2 s . c  o  m*/
 */
private String getMetadataFromDigitalDocument(MetadataLevel inLevel, String metadata) {
    if (Objects.nonNull(this.dd)) {
        /* TopStruct und FirstChild ermitteln */
        LegacyDocStructHelperInterface topstruct = this.dd.getLogicalDocStruct();
        LegacyDocStructHelperInterface firstchildstruct = null;
        if (Objects.nonNull(topstruct.getAllChildren()) && !topstruct.getAllChildren().isEmpty()) {
            firstchildstruct = topstruct.getAllChildren().get(0);
        }

        /* MetadataType ermitteln und ggf. Fehler melden */
        LegacyMetadataTypeHelper mdt;
        try {
            mdt = LegacyPrefsHelper.getMetadataType(this.prefs, metadata);
        } catch (IllegalArgumentException e) {
            Helper.setErrorMessage(e.getLocalizedMessage(), logger, e);
            return "";
        }

        String resultTop = getMetadataValue(topstruct, mdt);
        String resultFirst = null;
        if (Objects.nonNull(firstchildstruct)) {
            resultFirst = getMetadataValue(firstchildstruct, mdt);
        }
        return getResultAccordingToMetadataLevel(inLevel, metadata, resultFirst, resultTop);
    } else {
        return "";
    }
}

From source file:de.dfki.iui.mmds.dialogue.SiamEvaluator.java

@Override
public void onTransition(TransitionTarget from, TransitionTarget to, Transition transition) {
    // save variables of firing transition to context that were filled
    // during transition pattern matching process
    Context currentContext = siamStateMachine.getCurrentContext();
    Log log = (Log) transition.getActions().get(0);
    String transitionId = log.getLabel();
    if (variableCache.containsKey(transitionId)) {
        Map<String, Object> variables = variableCache.get(transitionId);
        // set context variables
        for (String key : variables.keySet()) {
            Variable variable = (Variable) currentContext.get("_variable$" + key);
            if (variable == null) {
                Logger.getLogger(this.getClass())
                        .warn(String.format(
                                "In transition \'%s': Variable \"%s\" is not defined for scope of state \"%s\"",
                                transitionId, key, currentContext.get("stateID")));
            } else {
                try {
                    currentContext.set(key, variables.get(key));
                } catch (IllegalArgumentException ex) {
                    Logger.getLogger(getClass()).warn(
                            String.format("In transition \'%s': %s", transitionId, ex.getLocalizedMessage()));
                }/*www  . j av a  2 s. c o m*/
            }

        }
    }
    variableCache.remove(transitionId);
}

From source file:org.mythtv.client.ui.dvr.RecordingRuleEditFragment.java

@Override
public void onStop() {
    Log.v(TAG, "onStop : enter");
    super.onStop();

    // Unregister for broadcast
    if (null != recordingRuleReceiver) {
        try {/*from  w  ww. ja v  a 2  s  .  c om*/
            getActivity().unregisterReceiver(recordingRuleReceiver);
        } catch (IllegalArgumentException e) {
            Log.e(TAG, e.getLocalizedMessage(), e);
        }
    }

    Log.v(TAG, "onStop : exit");
}

From source file:org.deegree.tools.rendering.manager.stage.StageManager.java

/**
 * @param reader//from w w w . j a  v  a  2  s  . c  o  m
 * @param mappedColumns
 * @param maxLength
 * @return
 * @throws IOException
 */
private BackendResult readAndImportStages(CSVReader reader, Map<Column, Integer> mappedColumns, int maxLength)
        throws IOException {
    String[] values = reader.parseLine();
    FileWriter fw = null;
    if (LOG.isTraceEnabled()) {
        fw = new FileWriter(File.createTempFile("missing_values", ".txt"));
    }

    List<DataObjectInfo<WorldRenderableObject>> inserts = new LinkedList<DataObjectInfo<WorldRenderableObject>>();
    while (values != null) {
        if (values.length >= maxLength) {
            String uuid = values[mappedColumns.get(Column.ID)];
            WorldRenderableObject wro = null;
            try {
                wro = createWRO(mappedColumns, values);
            } catch (IllegalArgumentException e) {
                LOG.error("Line( " + reader.getLineNumber() + "):  " + e.getLocalizedMessage());
            }
            if (wro != null) {
                inserts.add(createDataObjectInfo(uuid, values[mappedColumns.get(Column.TYPE)],
                        values[mappedColumns.get(Column.IMAGE)], wro));
            }
        } else {
            LOG.warn("Line( " + reader.getLineNumber() + "): not enough elements parsed: "
                    + Arrays.toString(values));
            if (fw != null) {
                fw.write("Line( " + reader.getLineNumber() + "): not enough elements parsed: "
                        + Arrays.toString(values) + "\n");
            }
        }
        values = reader.parseLine();
    }
    if (fw != null) {
        fw.flush();
        fw.close();
    }
    ModelBackend<?> backend = getDbBackend();
    BackendResult result = backend.insert(inserts, Type.STAGE);
    flush();
    return result;
}

From source file:se.trixon.jota.server.Server.java

private void startServer() {
    mRmiNameServer = JotaHelper.getRmiName(SystemHelper.getHostname(), mPort, JotaServer.class);

    try {/* ww  w.  j a v a 2  s.com*/
        LocateRegistry.createRegistry(mPort);
        mServerVmid = new VMID();
        //mServerOptions = new ServerOptions();
        Naming.rebind(mRmiNameServer, this);
        String message = String.format("started: %s (%s)", mRmiNameServer, mServerVmid.toString());
        Xlog.timedOut(message);
        listJobs();
        listTasks();
        getStatus();
        if (mOptions.isCronActive()) {
            cronOn();
        }
    } catch (IllegalArgumentException e) {
        Xlog.timedErr(e.getLocalizedMessage());
        Jota.exit();
    } catch (RemoteException e) {
        //nvm - server was running
        Xlog.timedErr(e.getLocalizedMessage());
        Jota.exit();
    } catch (MalformedURLException ex) {
        Xlog.timedErr(ex.getLocalizedMessage());
        Jota.exit();
    }
}

From source file:com.consol.citrus.admin.service.ProjectService.java

/**
 * Checks if home directory is valid Citrus project.
 *
 * @param project/*from   www.  j a  v  a 2s .  c o  m*/
 */
public boolean validateProject(Project project) {
    File homeDir = new File(project.getProjectHome());

    try {
        Assert.isTrue(homeDir.exists(), "Invalid project home directory");
        Assert.isTrue(new File(homeDir, project.getSettings().getJavaSrcDirectory()).exists(),
                "Missing Java source directory");
        Assert.isTrue(new File(homeDir, project.getSettings().getXmlSrcDirectory()).exists(),
                "Missing resources directory");
        Assert.isTrue(new File(homeDir, project.getSettings().getSpringApplicationContext()).exists(),
                "Missing Spring application context file");
    } catch (IllegalArgumentException e) {
        log.warn("Project home validation failed: " + e.getLocalizedMessage());
        return false;
    }

    return true;
}

From source file:org.mythtv.client.ui.dvr.RecordingsFragment.java

@Override
public void onStop() {
    Log.v(TAG, "onStop : enter");
    super.onStop();

    // Unregister for broadcast
    if (null != recordedDownloadReceiver) {
        try {/*from   w w  w .  j  av  a 2 s  . co m*/
            getActivity().unregisterReceiver(recordedDownloadReceiver);
        } catch (IllegalArgumentException e) {
            Log.e(TAG, e.getLocalizedMessage(), e);
        }
    }

    Log.v(TAG, "onStop : exit");
}

From source file:se.trixon.toolbox.relocator.RelocatorTopComponent.java

private void start() {
    mLogBuilder = new StringBuilder();

    if (mInputOutput != null) {
        mInputOutput.closeInputOutput();
    }//from w w  w .  j  ava2s  . c  o  m

    mInputOutput = IOProvider.getDefault().getIO(mToolName, false);
    mInputOutput.select();

    appendLog(Toolbox.getDefaultDateFormat().format(Calendar.getInstance().getTime()) + "\n");

    File file = new File(mOptions.getDestPath());

    try {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(mOptions.getDatePattern());
        if (file.isDirectory() && file.canWrite()) {
            Operation operation = new Operation(this);
            operation.start();
        } else {
            Message.error(Dict.IO_ERROR_TITLE.getString(), Dict.INVALID_DESTINATION.getString());
        }
    } catch (IllegalArgumentException ex) {
        Message.error(Dict.ERROR.getString(), ex.getLocalizedMessage());
    }
}

From source file:broadwick.phylo.NewickTreeParser.java

/**
 * Given a string that represents a node in the tree, split in into its constituent name and distance components and
 * add it to the tree. If the string is empty then a dummy node is added, this is useful fro creating (unnamed)
 * branches.//from  w ww .  j av a2s . c  o m
 * @param node             the string representing the node.
 * @param tree             the tree object on which the node will be placed.
 * @param parent           the parent node to which this node is attached.
 * @param createUniqueName if the name of the node is not unique then add create a unique one if this is true.
 * @return the node added to the tree.
 */
private PhyloNode addNodeToTree(final String node, final Tree<PhyloNode, Edge<PhyloNode>> tree,
        final PhyloNode parent, final boolean createUniqueName) {
    log.trace("Adding {} to tree at {}.", node, parent);
    PhyloNode phyloNode;

    final int lcolon = node.indexOf(':');
    String nodeName;
    double distance = 0.0;

    if (node.isEmpty()) {
        // no details so use default values.
        nodeName = String.format("branch-%d", branchLabel++);
        distance = 0.0;
    } else if (lcolon == -1) {
        // we just have a node name and no distance.
        distance = 0.0;
        nodeName = node;
    } else {
        // we have a node name and a distance.
        distance = Double.parseDouble(node.substring(lcolon + 1));
        nodeName = node.substring(0, lcolon);
    }

    phyloNode = new PhyloNode(nodeName, distance);

    try {
        tree.addEdge(new Edge<>(parent, phyloNode, distance), parent, phyloNode);
    } catch (IllegalArgumentException e) {
        // we may have non-unique branch names in the data file, if we encounter one here and we want to rename
        // it we do it now. This is not very good as we are searching for an error message but it's the best as can
        // be done.
        if (e.getLocalizedMessage().contains("already exists in this graph") && createUniqueName) {
            nodeName = String.format("branch-%d", branchLabel++);
            phyloNode = new PhyloNode(nodeName, distance);
            tree.addEdge(new Edge<>(parent, phyloNode), parent, phyloNode);
        }
    }

    return phyloNode;
}