Example usage for java.lang String intern

List of usage examples for java.lang String intern

Introduction

In this page you can find the example usage for java.lang String intern.

Prototype

public native String intern();

Source Link

Document

Returns a canonical representation for the string object.

Usage

From source file:org.sipfoundry.openfire.vcard.provider.SipXVCardProvider.java

/**
 * Loads the vCard using the SipX vCard Provider first On failure, attempt to load it from
 * database./*w  w w . j av a  2 s.  c  o m*/
 *
 */
@Override
public Element loadVCard(String username) {
    synchronized (username.intern()) {
        if (username.compareToIgnoreCase(PA_USER) == 0) {
            return defaultProvider.loadVCard(username);
        }

        return getVCard(username);
    }
}

From source file:com.netxforge.oss2.xml.event.Correlation.java

/**
 * Sets the value of field 'path'./* w  w  w  .  ja  va  2  s . c o m*/
 * 
 * @param path the value of field 'path'.
 */
public void setPath(final java.lang.String path) {
    this._path = path.intern();
}

From source file:org.protempa.valueset.ValueSetElement.java

/**
 * Instantiates a value of a value set./*from  ww w  .j  a va  2 s. c  o m*/
 *
 * @param value the {@link Value}. Cannot be <code>null</code>.
 * @param displayName the value's display name {@link String}. If
 * <code>null</code> is specified, {@link #getDisplayName()} will
 * return the empty string.
 * @param abbrevDisplayName the value's abbreviated display name
 * {@link String}. If <code>null</code> is specified,
 * {@link #getAbbrevDisplayName()} will return the empty string.
 */
public ValueSetElement(Value value, String displayName, String abbrevDisplayName, Attribute[] attributes) {
    if (value == null) {
        throw new IllegalArgumentException("value cannot be null");
    }
    if (displayName == null) {
        displayName = "";
    } else {
        displayName = displayName.intern();
    }
    if (abbrevDisplayName == null) {
        abbrevDisplayName = "";
    } else {
        abbrevDisplayName = abbrevDisplayName.intern();
    }
    this.value = value;
    this.displayName = displayName;
    this.abbrevDisplayName = abbrevDisplayName;
    if (attributes != null) {
        ProtempaUtil.checkArrayForNullElement(attributes, "attributes");
        this.attributes = attributes.clone();
    } else {
        this.attributes = EMPTY_ATTRIBUTE_ARR;
    }

}

From source file:savant.data.types.VCFVariantRecord.java

/**
 * Constructor not be be called directly, but rather through TabixIntervalRecord.valueOf.
 *///from  ww  w . j av  a  2 s.co  m
protected VCFVariantRecord(String line, ColumnMapping mapping) {
    super(line, mapping);

    // Storing all the string information is grossly inefficient, so we just parse what we
    // need and set the values to null.
    reference = super.getReference().intern();
    name = values[NAME_COLUMN].equals(".") ? null : values[NAME_COLUMN]; // VCF uses "." for missing value
    refBases = values[REF_COLUMN].intern();

    String altValue = values[ALT_COLUMN];
    if (altValue.startsWith("<")) {
        altBases = new String[] { altValue.intern() };
    } else {
        altBases = altValue.split(",");
        for (int i = 0; i < altBases.length; i++) {
            altBases[i] = altBases[i].intern();
        }
    }

    if (values.length > FIRST_PARTICIPANT_COLUMN) {
        participants0 = new byte[values.length - FIRST_PARTICIPANT_COLUMN];
        participants1 = new byte[values.length - FIRST_PARTICIPANT_COLUMN];
        for (int i = 0; i < participants0.length; i++) {
            String info = values[FIRST_PARTICIPANT_COLUMN + i];
            participants0[i] = MISSING;
            participants1[i] = MISSING;
            if (!info.equals(".")) {
                int colonPos = info.indexOf(':');
                if (colonPos >= 0) {
                    info = info.substring(0, colonPos);
                }

                phased &= info.indexOf('/') < 0;
                String[] alleleIndices = info.split("[|/]");
                if (!alleleIndices[0].equals(".")) {
                    participants0[i] = Byte.parseByte(alleleIndices[0]);
                }
                if (alleleIndices.length > 1 && !alleleIndices[1].equals(".")) {
                    participants1[i] = Byte.parseByte(alleleIndices[1]);
                }
            }
        }
    } else {
        // A defective VCF with no participants.
        participants0 = new byte[0];
        participants1 = new byte[0];
    }

    values = null;
}

From source file:org.wso2.andes.kernel.slot.SlotManagerStandalone.java

/**
 * Re-assign the slot when there are no local subscribers in the node
 *
 * @param queueName Name of the queue/*from   w  w w .  ja  v a 2  s.co m*/
 */
public void reAssignSlotWhenNoSubscribers(String queueName) {
    TreeSet<Slot> slotsToBeReAssigned = slotAssignmentMap.remove(queueName);
    String lockKey = queueName + SlotManagerStandalone.class;
    if (null != slotsToBeReAssigned) {
        synchronized (lockKey.intern()) {
            TreeSet<Slot> unassignedSlots = unAssignedSlotMap.get(queueName);
            if (null == unassignedSlots) {
                unassignedSlots = new TreeSet<>();
            }
            for (Slot slotToBeReAssigned : slotsToBeReAssigned) {
                unassignedSlots.add(slotToBeReAssigned);
            }
            unAssignedSlotMap.put(queueName, unassignedSlots);
        }
    }
}

From source file:bboss.org.apache.velocity.runtime.directive.RuntimeMacro.java

/**
 * Create a RuntimeMacro instance. Macro name and source
 * template stored for later use.//from  w  ww .  j  a  va 2s.c o m
 *
 * @param macroName name of the macro
 */
public RuntimeMacro(String macroName) {
    if (macroName == null) {
        throw new IllegalArgumentException("Null arguments");
    }

    this.macroName = macroName.intern();
}

From source file:org.opennms.netmgt.config.datacollection.Rrd.java

/**
 * @param rra//from  w w w.j a  va 2s  .  c o  m
 * @throws IndexOutOfBoundsException if the index
 * given is outside the bounds of the collection
 */
public void addRra(final String rra) throws IndexOutOfBoundsException {
    m_rras.add(rra.intern());
}

From source file:org.opennms.netmgt.config.datacollection.Rrd.java

/**
 * /*from  ww w.  ja  v a 2  s  .  c  om*/
 * 
 * @param index
 * @param rra
 * @throws IndexOutOfBoundsException if the index
 * given is outside the bounds of the collection
 */
public void addRra(final int index, final String rra) throws IndexOutOfBoundsException {
    m_rras.add(index, rra.intern());
}

From source file:org.esupportail.pay.services.PayBoxService.java

public boolean payboxCallback(String montant, String reference, String auto, String erreur, String idtrans,
        String signature, String queryString) {
    synchronized (idtrans.intern()) {
        List<PayTransactionLog> txLogs = PayTransactionLog.findPayTransactionLogsByIdtransEquals(idtrans)
                .getResultList();/*from  w  w  w . j av a2s  .  c  o  m*/
        boolean newTxLog = txLogs.size() == 0;
        PayTransactionLog txLog = txLogs.size() > 0 ? txLogs.get(0) : null;
        if (txLog == null) {
            txLog = new PayTransactionLog();
        } else {
            if ("00000".equals(txLog.getErreur())) {
                log.info("This transaction + " + idtrans + " is already OK");
                return true;
            }
        }
        txLog.setMontant(montant);
        txLog.setReference(reference);
        txLog.setAuto(auto);
        txLog.setErreur(erreur);
        txLog.setIdtrans(idtrans);
        txLog.setSignature(signature);
        txLog.setTransactionDate(new Date());

        List<EmailFieldsMapReference> emailMapFirstLastNames = EmailFieldsMapReference
                .findEmailFieldsMapReferencesByReferenceEquals(reference).getResultList();
        if (!emailMapFirstLastNames.isEmpty()) {
            txLog.setField1(emailMapFirstLastNames.get(0).getField1());
            txLog.setField2(emailMapFirstLastNames.get(0).getField2());
            txLog.setMail(emailMapFirstLastNames.get(0).getMail());
            PayEvtMontant evtMontant = emailMapFirstLastNames.get(0).getPayEvtMontant();
            PayEvt evt = evtMontant.getEvt();
            txLog.setPayEvtMontant(emailMapFirstLastNames.get(0).getPayEvtMontant());
            if (this.checkPayboxSignature(queryString, signature)) {
                if ("00000".equals(erreur)) {
                    log.info("Transaction : " + reference + " pour un montant de " + montant + " OK !");

                    String subject = evt.getMailSubject() + txLog.getMail() + " - " + txLog.getMontantDevise()
                            + " Euros.";
                    String mailTo = evt.getManagersEmail();
                    String message = "Email : " + txLog.getMail() + "\n";
                    message += txLog.getPayEvtMontant().getField1Label().getTranslation(LOCALE_IDS.fr) + " : "
                            + txLog.getField1() + "\n";
                    message += txLog.getPayEvtMontant().getField2Label().getTranslation(LOCALE_IDS.fr) + " : "
                            + txLog.getField2() + "\n";
                    message += "Montant : " + txLog.getMontantDevise() + " Euros\n";
                    message += "Evt : " + txLog.getPayEvtMontant().getEvt().getTitle().getLabelLocales()
                            .get(LOCALE_IDS.fr.toString()).getTranslation() + " \n";
                    message += "Titre du Montant : " + txLog.getPayEvtMontant().getTitle().getLabelLocales()
                            .get(LOCALE_IDS.fr.toString()).getTranslation() + " \n";
                    message += "Transaction Paybox : " + idtrans + "\n";
                    message += "Reference : " + reference + "\n";

                    try {
                        this.sendMessage(mailFrom, subject, mailTo, message);
                        txLog.setMailSent(true);
                    } catch (Exception ex) {
                        log.error("Exception during sending email to : " + mailTo, ex);
                        txLog.setMailSent(false);
                    }

                    if (newTxLog) {
                        txLog.persist();
                    } else {
                        txLog.merge();
                    }
                } else {
                    log.info("'Erreur' " + erreur + "  (annulation) lors de la transaction paybox : "
                            + reference + " pour un montant de " + montant);
                }
            } else {
                log.error("signature checking of paybox failed, transaction " + txLog + " canceled.");
            }
            return true;
        }
        return false;
    }
}

From source file:net.sf.firemox.clickable.target.card.AbstractCardModel.java

public void setRulesCredits(String cardRulesCredits) {
    if (cardRulesCredits == null || cardRulesCredits.trim().length() == 0) {
        this.cardRulesCredits = null;
    } else {/*from   ww w  .  j  av  a2 s.c o  m*/
        this.cardRulesCredits = cardRulesCredits.intern();
    }
}