Bug 4212072 [Richard/GCL]
546222
private void expandAffix(String pattern, String pluralCount, StringBuffer buffer) {
        buffer.setLength(0);
        for (int i = 0; i < pattern.length();) {
            char c = pattern.charAt(i++);
            if (c == QUOTE) {
                for (;;) {
                    int j = pattern.indexOf(QUOTE, i);
                    if (j == i) {
                        buffer.append(QUOTE);
                        i = j + 1;
                        break;
                    } else if (j > i) {
                        buffer.append(pattern.substring(i, j));
                        i = j + 1;
                        if (i < pattern.length() && pattern.charAt(i) == QUOTE) {
                            buffer.append(QUOTE);
                            ++i;
                            // loop again
                        } else {
                            break;
                        }
                    } else {
                        // Unterminated quote; should be caught by apply
                        // pattern.
                        throw new RuntimeException();
                    }
                }
                continue;
            }

            switch (c) {
            case CURRENCY_SIGN:
                // As of ICU 2.2 we use the currency object, and ignore the currency
                // symbols in the DFS, unless we have a null currency object. This occurs
                // if resurrecting a pre-2.2 object or if the user sets a custom DFS.
                boolean intl = i < pattern.length() && pattern.charAt(i) == CURRENCY_SIGN;
                boolean plural = false;
                if (intl) {
                    ++i;
                    if (i < pattern.length() && pattern.charAt(i) == CURRENCY_SIGN) {
                        plural = true;
                        intl = false;
                        ++i;
                    }
                }
                String s = null;
                Currency currency = getCurrency();
                if (currency != null) {
                    // plural name is only needed when pluralCount != null, which means
                    // when formatting currency plural names.  For other cases,
                    // pluralCount == null, and plural names are not needed.
                    if (plural && pluralCount != null) {
                        s = currency.getName(symbols.getULocale(), Currency.PLURAL_LONG_NAME,
                                             pluralCount, null);
                    } else if (!intl) {
                        s = currency.getName(symbols.getULocale(), Currency.SYMBOL_NAME, null);
                    } else {
                        s = currency.getCurrencyCode();
                    }
                } else {
                    s = intl ? symbols.getInternationalCurrencySymbol() :
                        symbols.getCurrencySymbol();
                }
                // Here is where FieldPosition could be set for CURRENCY PLURAL.
                buffer.append(s);
                break;
            case PATTERN_PERCENT:
                buffer.append(symbols.getPercentString());
                break;
            case PATTERN_PER_MILLE:
                buffer.append(symbols.getPerMillString());
                break;
            case PATTERN_MINUS_SIGN:
                buffer.append(symbols.getMinusSignString());
                break;
            default:
                buffer.append(c);
                break;
            }
        }
    }
726424
@Override
    int command_inout_asynch_i(final String c, final boolean fgt, final boolean fwd, final int rid) throws DevFailed {
	try {
	    final int actual_rid = proxy.command_inout_asynch(c, fgt);
	    if (fgt == false) {
		arp.put(new Integer(rid), new AsynchRequest(actual_rid, c));
	    }
	} catch (final DevFailed df) {
	    if (fgt == false) {
		arp.put(new Integer(rid), new AsynchRequest(-1, c, df));
	    }
	} catch (final Exception e) {
	    if (fgt == false) {
		final DevError[] errors = new DevError[1];
		errors[0] = new DevError();
		errors[0].severity = ErrSeverity.ERR;
		errors[0].reason = "unknown exception caught";
		errors[0].desc = "unknown error";
		errors[0].origin = "GroupDeviceElemnt.command_inout";
		final DevFailed ex = new DevFailed(errors);
		arp.put(new Integer(rid), new AsynchRequest(-1, c, ex));
	    }
	}
	return rid;
    }
403515
private static void tryWaitingForGC() {
    // We could try to preallocate memory mx bean and count collections...
    // there is no guarantee it doesn't allocate stuff too though.
    final long timeout = System.currentTimeMillis() + 2000;
    while (System.currentTimeMillis() < timeout) {
      System.gc(); 
      try {
        Thread.sleep(250);
      } catch (InterruptedException e) {
        break;
      }
    }
  }
774103
public void poll_command(final DeviceProxy deviceProxy, final String cmdname, final int period)
		    throws DevFailed {
		poll_object(deviceProxy, cmdname, "command", period);
    }
382314
def gpg_error(exception, message):
    """"""
    LOGGER.debug("GPG Command %s", ' '.join([str(x) for x in exception.cmd]))
    LOGGER.debug("GPG Output %s", exception.output)
    raise CryptoritoError(message)
43322
public void errorCommon(String msgCode, Object[] objects) {
        if (!bInboundSupported) {
            Tr.error(tcCommon, msgCode, objects);
        }
    }
1283109
void one_more_poll() throws DevFailed {
	if (works.size() > 0) {
	    final WorkItem item = (WorkItem) works.elementAt(0);
	    works.remove(0);

	    if (polling_stop == false) {
		if (item.type == Tango_POLL_CMD) {
		    poll_cmd(item);
		} else {
		    poll_attr(item);
		}
	    }
	    item.wake_up_date = compute_new_date(item.wake_up_date, item.update);
	    insert_in_list(item);
	}
    }
954167
void waitForCommitMessage()
      throws TimeoutException, InterruptedException, IOException {
    LOG.debug("Waiting for commit message from {}", this.electedLeader);
    MessageTuple tuple = filter.getExpectedMessage(MessageType.COMMIT,
                                                   this.electedLeader,
                                                   config.getTimeoutMs());
    Zxid zxid = MessageBuilder.fromProtoZxid(tuple.getMessage()
                                                  .getCommit()
                                                  .getZxid());
    Zxid lastZxid = persistence.getLatestZxid();
    // If the followers are appropriately synchronized, the Zxid of ACK should
    // match the last Zxid in followers' log.
    if (zxid.compareTo(lastZxid) != 0) {
      LOG.error("The ACK zxid {} doesn't match last zxid {} in log!",
                zxid,
                lastZxid);
      throw new RuntimeException("The ACK zxid doesn't match last zxid");
    }
  }
276886
function fixBadRegex(grammar) {
	const scopeResolution = grammar.repository['scope-resolution'];
	if (scopeResolution) {
		const match = scopeResolution.patterns[0].match;
		if (match === '(?i)([a-z_\\x{7f}-\\x{7fffffff}\\\\][a-z0-9_\\x{7f}-\\x{7fffffff}\\\\]*)(?=\\s*::)') {
			scopeResolution.patterns[0].match = '([A-Za-z_\\x{7f}-\\x{7fffffff}\\\\][A-Za-z0-9_\\x{7f}-\\x{7fffffff}\\\\]*)(?=\\s*::)';
			return;
		}
	}

	throw new Error(`fixBadRegex callback couldn't patch the regex. It may be obsolete`);
}
222037
void one_more_trigg() throws DevFailed {
	Util.out5.println("Polling thread has received a trigger");

	WorkItem item = null;
	for (int i = 0; i < ext_trig_works.size(); i++) {
	    final WorkItem w = (WorkItem) ext_trig_works.elementAt(i);
	    if (w.dev == local_cmd.dev && w.type == local_cmd.type && w.name.equals(local_cmd.name)) {
		item = w;
	    }
	}

	// Check that the object to poll has been installed.
	// If not, simply returns. This case should never happens because it is
	// tested in the Util::trigger_polling() method before the trigger is
	// effectively sent to this thread.
	if (item == null) {
	    Util.out5.println("Object externally triggered not found !!!");
	    {
		shared_cmd.trigger = false;
		p_mon.signal();
	    }
	    return;
	}

	// Inform requesting thread that the work is done
	{
	    shared_cmd.trigger = false;
	    p_mon.signal();
	}

	// Do the job
	final WorkItem tmp = item;
	if (polling_stop == false) {
	    if (tmp.type == Tango_POLL_CMD) {
		poll_cmd(tmp);
	    } else {
		poll_attr(tmp);
	    }
	}
    }
434006
public static void main(String[] args) throws Exception {
    BinaryProblem problem = new OneMax(1024) ;

    MutationOperator<BinarySolution> mutationOperator =
        new BitFlipMutation(1.0 / problem.getNumberOfBits(0)) ;

    int improvementRounds = 10000 ;

    Comparator<BinarySolution> comparator = new DominanceComparator<>(0) ;

    LocalSearchOperator<BinarySolution> localSearch = new BasicLocalSearch<>(
            improvementRounds,
            mutationOperator,
            comparator,
            problem) ;

    BinarySolution solution = problem.createSolution() ;

    BinarySolution newSolution = localSearch.execute(solution) ;

    JMetalLogger.logger.info("Fitness: " + newSolution.getObjective(0)) ;
    JMetalLogger.logger.info("Solution: " + newSolution.getVariableValueString(0)) ;
  }
627489
private void impossibleOffsetFailed(T object, ObjectId objectId, Cleaners.Cleanable cleanable, ObjectLeakNotifier notifier)
  {
    poolSize.decrementAndGet();
    notifier.disable();
    // Effectively does nothing, because notifier is disabled above. The purpose of this call is to deregister the
    // cleaner from the internal global linked list of all cleaners in the JVM, and let it be reclaimed itself.
    cleanable.clean();
    log.error(
        new ISE("Queue offer failed"),
        "Could not offer object [%s] back into the queue, objectId [%s]",
        object,
        objectId
    );
  }
208409
public static void checkGlError(String op) {
        int error = GLES20.glGetError();
        if (error != GLES20.GL_NO_ERROR) {
            String msg = op + ": glError 0x" + Integer.toHexString(error);
            Log.e(TAG, msg);
            throw new RuntimeException(msg);
        }
    }
594509
function gnodeEval (code, context, file, fn) {
  var err, result;
  try {
    // compile JS via facebook/regenerator
    code = regenerator.compile(code, {
      includeRuntime: 'object' !== typeof regeneratorRuntime
    }).code;
  } catch (e) {
    // Treat regenerator errors as syntax errors in repl.
    // A hack to have repl interpret certain js structures correctly.
    e.name = 'SyntaxError'
    err = e;
  }
  try {
    if (this.useGlobal) {
      result = vm.runInThisContext(code, file);
    } else {
      result = vm.runInContext(code, context, file);
    }
  } catch (e) {
    err = e;
  }

  fn(err, result);
}
32171
private void gc() {
    if ((services != null && services.isConnected()) && debugger != null) {
      debugger.releaseObjects();
    }
    objectIds.clear();
  }
517379
private void compile2() {
        try {
            switch (compilePolicy) {
            case ATTR_ONLY:
                attribute(todo);
                break;

            case CHECK_ONLY:
                flow(attribute(todo));
                break;

            case SIMPLE:
                generate(desugar(flow(attribute(todo))));
                break;

            case BY_FILE: {
                    Queue<Queue<Env<AttrContext>>> q = todo.groupByFile();
                    while (!q.isEmpty() && !shouldStop(CompileState.ATTR)) {
                        generate(desugar(flow(attribute(q.remove()))));
                    }
                }
                break;

            case BY_TODO:
                while (!todo.isEmpty())
                    generate(desugar(flow(attribute(todo.remove()))));
                break;

            default:
                Assert.error("unknown compile policy");
            }
        } catch (Abort ex) {
            if (devVerbose)
                ex.printStackTrace(System.err);
        }

        if (verbose) {
            elapsed_msec = elapsed(start_msec);
            log.printVerbose("total", Long.toString(elapsed_msec));
        }

        reportDeferredDiagnostics();

        if (!log.hasDiagnosticListener()) {
            printCount("error", errorCount());
            printCount("warn", warningCount());
        }
    }
1352918
def check_error(when='periodic check'):
    

    errors = []
    while True:
        err = glGetError()
        if err == GL_NO_ERROR or (errors and err == errors[-1]):
            break
        errors.append(err)
    if errors:
        msg = ', '.join([repr(ENUM_MAP.get(e, e)) for e in errors])
        err = RuntimeError('OpenGL got errors (%s): %s' % (when, msg))
        err.errors = errors
        err.err = errors[-1]  # pyopengl compat
        raise err