auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static OAuth2Error invalidIdToken(Map<String, Object> invalidClaims) { StringBuilder claimsDetail = new StringBuilder(); int i = 0; for (Map.Entry<String, Object> entry : invalidClaims.entrySet()) { claimsDetail.append(entry.getKey()).append(" (").append(entry.getValue()).append(")"); if (i != invalidClaims.size() - 1) { claimsDetail.append(", "); } i++; } return new OAuth2Error("invalid_id_token", "The ID Token contains invalid claims: " + claimsDetail, "<LINK_0>"); }

Target:
private static OAuth2Error invalidIdToken(Map<String, Object> invalidClaims) { return new OAuth2Error("invalid_id_token", "The ID Token contains invalid claims: " + invalidClaims, "<LINK_0>"); }
Source:
public void deserializeNBT(NBTTagCompound nbt) throws InvalidInputDataException { super.deserializeNBT(nbt); palette.clear(); for (NBTTagCompound schematicBlockTag : NBTUtilBC.readCompoundList(nbt.getTagList("palette", Constants.NBT.TAG_COMPOUND)).collect(Collectors.toList())) { palette.add(SchematicBlockManager.readFromNBT(schematicBlockTag)); } data = new int[size.getX()][size.getY()][size.getZ()]; NBTTagList list = nbt.hasKey("data", Constants.NBT.TAG_LIST) ? nbt.getTagList("data", Constants.NBT.TAG_INT) : null; int[] serializedData = nbt.hasKey("data", Constants.NBT.TAG_INT_ARRAY) ? nbt.getIntArray("data") : new int[0]; int len = list == null ? serializedData.length : list.tagCount(); if (len != size.getX() * size.getY() * size.getZ()) { throw new InvalidInputDataException("Pallette has length of " + len + ", but we expected " + size.getX() * size.getY() * size.getZ() + size.toString()); } int i = 0; for (int z = 0; z < size.getZ(); z++) { for (int y = 0; y < size.getY(); y++) { for (int x = 0; x < size.getX(); x++) { data[x][y][z] = list == null ? serializedData[i] : list.getIntAt(i); i++; } } } for (NBTTagCompound schematicEntityTag : NBTUtilBC.readCompoundList(nbt.getTagList("entities", Constants.NBT.TAG_COMPOUND)).collect(Collectors.toList())) { entities.add(SchematicEntityManager.readFromNBT(schematicEntityTag)); } }

Target:
public void deserializeNBT(NBTTagCompound nbt) throws InvalidInputDataException { super.deserializeNBT(nbt); palette.clear(); for (NBTTagCompound schematicBlockTag : NBTUtilBC.readCompoundList(nbt.getTagList("palette", Constants.NBT.TAG_COMPOUND)).collect(Collectors.toList())) { palette.add(SchematicBlockManager.readFromNBT(schematicBlockTag)); } data = new int[size.getX()][size.getY()][size.getZ()]; NBTTagList list = nbt.hasKey("data", Constants.NBT.TAG_LIST) ? nbt.getTagList("data", Constants.NBT.TAG_INT) : null; int[] serializedData = nbt.hasKey("data", Constants.NBT.TAG_INT_ARRAY) ? nbt.getIntArray("data") : new int[0]; if (serializedData.length == 0) { throw new InvalidInputDataException("Can't read a blueprint with no data!"); } int len = list == null ? serializedData.length : list.tagCount(); if (len != size.getX() * size.getY() * size.getZ()) { throw new InvalidInputDataException("Pallette has length of " + len + ", but we expected " + size.getX() * size.getY() * size.getZ() + size.toString()); } int i = 0; for (int z = 0; z < size.getZ(); z++) { for (int y = 0; y < size.getY(); y++) { for (int x = 0; x < size.getX(); x++) { data[x][y][z] = list == null ? serializedData[i] : list.getIntAt(i); i++; } } } for (NBTTagCompound schematicEntityTag : NBTUtilBC.readCompoundList(nbt.getTagList("entities", Constants.NBT.TAG_COMPOUND)).collect(Collectors.toList())) { entities.add(SchematicEntityManager.readFromNBT(schematicEntityTag)); } }
Source:
public FtSecure(final Back bck, final ServerSocket skt) { this.front = new FtBasic(bck, skt); }

Target:
FtSecure(final Back bck, final ServerSocket skt) { this.front = new FtBasic(bck, skt); }
Source:
public int compareTableRows(ITableRow r1, ITableRow r2) { VALUE o1 = getValue(r1); VALUE o2 = getValue(r2); if (o1 == null && o2 == null) { return 0; } if (o1 == null) { return -1; } if (o2 == null) { return 1; } if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) { return ((Comparable) o1).compareTo(o2); } String plainText1 = getPlainText(r1); String plainText2 = getPlainText(r2); if (!StringUtility.isNullOrEmpty(plainText1) && !StringUtility.isNullOrEmpty(plainText2)) { return StringUtility.compareIgnoreCase(plainText1, plainText2); } if (StringUtility.isNullOrEmpty(plainText1)) { return -1; } if (StringUtility.isNullOrEmpty(plainText2)) { return 1; } return super.compareTableRows(r1, r2); }

Target:
public int compareTableRows(ITableRow r1, ITableRow r2) { VALUE o1 = getValue(r1); VALUE o2 = getValue(r2); if (o1 == null && o2 == null) { return 0; } if (o1 == null) { return -1; } if (o2 == null) { return 1; } if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) { return ((Comparable) o1).compareTo(o2); } String plainText1 = getPlainText(r1); String plainText2 = getPlainText(r2); int c = StringUtility.compareIgnoreCase(plainText1, plainText2); if (c != 0) { return c; } return super.compareTableRows(r1, r2); }
Source:
public void singleQueue() throws IOException, InterruptedException { final Queue queue = this.client.getQueues().get(SerialWorkerTest.DEFAULT_QUEUE_NAME); queue.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); final SerialWorker worker = new SerialWorker( Arrays.asList(new String[] {SerialWorkerTest.DEFAULT_QUEUE_NAME}), this.client, null, 10); IntegrationTestJob.runningHistory.clear(); final Thread signal = new Thread() { @Override public void run() { try { Thread.sleep(2000); worker.shutDown(); } catch (final InterruptedException v) { System.out.println(v); } } }; signal.start(); worker.run(); assertThat(IntegrationTestJob.runningHistory.get(0), equalTo(SerialWorkerTest.DEFAULT_JOB_NAME + ".test")); }

Target:
public void singleQueue() throws IOException, InterruptedException { final Queue queue = this.client.getQueue(SerialWorkerTest.DEFAULT_QUEUE_NAME); queue.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); final SerialWorker worker = new SerialWorker( Arrays.asList(SerialWorkerTest.DEFAULT_QUEUE_NAME), this.client, null, 10); IntegrationTestJob.runningHistory.clear(); final Thread signal = this.getWorkerThread(worker, 2); signal.start(); worker.run(); assertThat(IntegrationTestJob.runningHistory.get(0), equalTo(SerialWorkerTest.DEFAULT_JOB_NAME + ".test")); }
Source:
public void testListProjects() throws Exception { setConfigSettings(); data.add(new NameValuePair("text", "jenkins list projects")); WebResponse response = makeRequest(data); assertThat(getSlackMessage(response).getText(), is("*Projects:*\n>_No projects found_")); FreeStyleProject project = jenkinsRule.createFreeStyleProject(LONG_PROJECT_NAME); Thread.sleep(30); response = makeRequest(data); assertThat(getSlackMessage(response).getText(), is("*Projects:*\n>*"+LONG_PROJECT_NAME+"*\n>*Last Build:* #TBD\n>*Status:* TBD\n\n\n")); project.scheduleBuild2(0); Thread.sleep(200); response = makeRequest(data); assertThat(getSlackMessage(response).getText(), is("*Projects:*\n>*"+LONG_PROJECT_NAME+"*\n>*Last Build:* #1\n>*Status:* SUCCESS\n\n\n")); }

Target:
public void testListProjects() throws Exception { setConfigSettings(); data.add(new NameValuePair("text", "jenkins list projects")); WebResponse response = makeRequest(data); assertThat(getSlackMessage(response).getText(), is("*Projects:*\n>_No projects found_")); FreeStyleProject project = jenkinsRule.createFreeStyleProject(LONG_PROJECT_NAME); response = makeRequest(data); assertThat(getSlackMessage(response).getText(), is("*Projects:*\n>*"+LONG_PROJECT_NAME+"*\n>*Last Build:* #TBD\n>*Status:* TBD\n\n\n")); project.scheduleBuild2(0).get(); response = makeRequest(data); assertThat(getSlackMessage(response).getText(), is("*Projects:*\n>*"+LONG_PROJECT_NAME+"*\n>*Last Build:* #1\n>*Status:* SUCCESS\n\n\n")); }
Source:
public void start(RuleContext ctx) { closeTargets.clear(); simpleTypes.clear(); types.clear(); if (getProperty(CLOSE_TARGETS_DESCRIPTOR) != null) { closeTargets.addAll(getProperty(CLOSE_TARGETS_DESCRIPTOR)); } if (getProperty(USE_CLOSE_AS_DEFAULT_TARGET) && !closeTargets.contains("close")) { closeTargets.add("close"); } if (getProperty(TYPES_DESCRIPTOR) != null) { types.addAll(getProperty(TYPES_DESCRIPTOR)); } if (getProperty(TYPES_DESCRIPTOR) != null) { for (String type : getProperty(TYPES_DESCRIPTOR)) { simpleTypes.add(toSimpleType(type)); } } }

Target:
public void start(RuleContext ctx) { closeTargets.clear(); simpleTypes.clear(); types.clear(); if (getProperty(CLOSE_TARGETS_DESCRIPTOR) != null) { closeTargets.addAll(getProperty(CLOSE_TARGETS_DESCRIPTOR)); } if (getProperty(USE_CLOSE_AS_DEFAULT_TARGET) && !closeTargets.contains("close")) { closeTargets.add("close"); } if (getProperty(TYPES_DESCRIPTOR) != null) { types.addAll(getProperty(TYPES_DESCRIPTOR)); for (String type : getProperty(TYPES_DESCRIPTOR)) { simpleTypes.add(toSimpleType(type)); } } }
Source:
private void updatePackageAccessProperty() { String packAccess = Security.getProperty("package.access"); if (packAccess != null && !packAccess.isEmpty()) { if (!packAccess.contains(IGNITE_INTERNAL_PACKAGE)) Security.setProperty("package.access", packAccess + ',' + IGNITE_INTERNAL_PACKAGE); } else Security.setProperty("package.access", IGNITE_INTERNAL_PACKAGE); }

Target:
private void updatePackageAccessProperty() { synchronized (SANDBOXED_NODES_COUNTER) { if (SANDBOXED_NODES_COUNTER.getAndIncrement() == 0) { String packAccess = Security.getProperty("package.access"); if (!F.isEmpty(packAccess)) { if (!packAccess.contains(IGNITE_INTERNAL_PACKAGE)) Security.setProperty("package.access", packAccess + ',' + IGNITE_INTERNAL_PACKAGE); } else Security.setProperty("package.access", IGNITE_INTERNAL_PACKAGE); } } }
Source:
public Session findSession(String id) throws IOException { log.debug("Datastore manager is loading session: " + id); Tracer tracer = Trace.getTracer(); Session session = null; try { TraceContext context = tracer.startSpan("Loading session"); session = this.getStore().load(id); tracer.endSpan(context); } catch (ClassNotFoundException ex) { log.warn("An error occurred during session deserialization", ex); } return session; }

Target:
public Session findSession(String id) throws IOException { log.debug("Datastore manager is loading session: " + id); Session session = null; try { session = this.getStore().load(id); } catch (ClassNotFoundException ex) { log.warn("An error occurred during session deserialization", ex); } return session; }
Source:
public Optional<T> getPreviousItem(T item) { int index = getItemIndex(item); if (index <= 0) return Optional.empty(); return getItems().skip(index - 1).findFirst(); }

Target:
public Optional<T> getPreviousItem(T item) { int index = getItemIndex(item); if (index <= 0) { return Optional.empty(); } return getItems().skip(index - 1).findFirst(); }
Source:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isCall() && !NodeUtil.isExpressionResultUsed(n) && (n.getFirstChild().isName() || n.getFirstChild().isString())) { JSType targetType = n.getFirstChild().getJSType(); if (targetType != null && targetType.isFunctionType()) { targetType = targetType.restrictByNotNullOrUndefined(); FunctionType functionType = targetType.toMaybeFunctionType(); JSDocInfo functionJSDocInfo = functionType.getJSDocInfo(); if (functionJSDocInfo != null && functionJSDocInfo.isNoSideEffects() && functionJSDocInfo.getAssociatedNode() != null && functionJSDocInfo.getAssociatedNode().isFromExterns()) { t.getCompiler().report(t.makeError(n, level, USELESS_CODE_ERROR, n.getFirstChild().getString())); problemNodes.add(n); } } } }

Target:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isCall() && !NodeUtil.isExpressionResultUsed(n) && (n.getFirstChild().isName() || n.getFirstChild().isString() || n.getFirstChild().isGetProp())) { JSType targetType = n.getFirstChild().getJSType(); if (targetType != null && targetType.isFunctionType()) { targetType = targetType.restrictByNotNullOrUndefined(); FunctionType functionType = targetType.toMaybeFunctionType(); JSDocInfo functionJSDocInfo = functionType.getJSDocInfo(); if (functionJSDocInfo != null && functionJSDocInfo.isNoSideEffects() && functionJSDocInfo.getAssociatedNode() != null && functionJSDocInfo.getAssociatedNode().isFromExterns()) { t.getCompiler().report(t.makeError(n, level, USELESS_CODE_ERROR, n.getFirstChild().getQualifiedName())); problemNodes.add(n); } } } }
Source:
public void setStateBackend(StateBackend backend) { if (backend != null) { try { InstantiationUtil.writeObjectToConfig(backend, this.config, STATE_BACKEND); this.config.setBoolean(STATE_BACKEND_USE_MANAGED_MEMORY, backend.useManagedMemory()); } catch (Exception e) { throw new StreamTaskException("Could not serialize stateHandle provider.", e); } } }

Target:
public void setStateBackend(StateBackend backend) { if (backend != null) { try { InstantiationUtil.writeObjectToConfig(backend, this.config, STATE_BACKEND); setStateBackendUsesManagedMemory(backend.useManagedMemory()); } catch (Exception e) { throw new StreamTaskException("Could not serialize stateHandle provider.", e); } } }
Source:
public static boolean equal(KeyPair k1, KeyPair k2) { return Objects.equal(k2.getPrivate(), k1.getPrivate()) && Objects.equal(k2.getPrivate(), k1.getPrivate()); }

Target:
public static boolean equal(KeyPair k1, KeyPair k2) { return Objects.equal(k2.getPrivate(), k1.getPrivate()) && Objects.equal(k2.getPublic(), k1.getPublic()); }
Source:
private String getVarcharValue(Type type, Object value) { if (type instanceof VarcharType) { return ((Slice) value).toStringUtf8(); } if (type instanceof TinyintType || type instanceof SmallintType || type instanceof IntegerType || type instanceof BigintType) { return ((Long) value).toString(); } if (type instanceof BooleanType) { return ((Boolean) value).toString(); } return null; }

Target:
private String getVarcharValue(Type type, Object value) { if (type instanceof VarcharType) { return ((Slice) value).toStringUtf8(); } if (type instanceof TinyintType || type instanceof SmallintType || type instanceof IntegerType || type instanceof BigintType) { return ((Long) value).toString(); } if (type instanceof BooleanType) { return ((Boolean) value).toString(); } throw new PrestoException(NOT_SUPPORTED, format("Unsupported data type in EXPLAIN (TYPE IO): %s", type.getDisplayName())); }
Source:
public void testFuzzyWithIntKeys() throws Exception { Table table = getDefaultTable(); List<byte[]> keys = Collections.unmodifiableList( Arrays.asList( createKey(5, 10, 126, 5), createKey(5, 10, 127, 5), createKey(5, 10, 128, 5), createKey(5, 10, 129, 5), createKey(5, 11, 126, 7), createKey(5, 11, 127, 7), createKey(5, 11, 128, 7), createKey(5, 11, 129, 7))); List<Put> puts = new ArrayList<>(); for(byte[] key : keys) { puts.add(new Put(key).addColumn(SharedTestEnvRule.COLUMN_FAMILY, Bytes.toBytes(0), Bytes.toBytes(0))); } table.put(puts); FuzzyRowFilter filter = new FuzzyRowFilter(ImmutableList.of( Pair.newPair(createKey(5, 0, 126, 0), createFuzzyMask(0, 1, 0, 1)), Pair.newPair(createKey(5, 0, 127, 0), createFuzzyMask(0, 1, 0, 1)), Pair.newPair(createKey(5, 0, 128, 0), createFuzzyMask(0, 1, 0, 1)), Pair.newPair(createKey(5, 0, 129, 0), createFuzzyMask(0, 1, 0, 1)))); Scan scan = new Scan().setFilter(filter); Set<String> expectedKeys = keys.stream().map(k ->toFuzzyKeyString(k)).collect(Collectors.toSet()); Set<String> actualKeys = new HashSet(); try (ResultScanner scanner = table.getScanner(scan)) { scanner.forEach(r -> { actualKeys.add(toFuzzyKeyString(CellUtil.cloneRow(r.rawCells()[0]))); }); } assertEquals(expectedKeys,actualKeys); }

Target:
public void testFuzzyWithIntKeys() throws Exception { Table table = getDefaultTable(); List<byte[]> keys = Collections.unmodifiableList( Arrays.asList( createKey(5, 10, 126, 5), createKey(5, 10, 127, 5), createKey(5, 10, 128, 5), createKey(5, 10, 129, 5), createKey(5, 11, 126, 7), createKey(5, 11, 127, 7), createKey(5, 11, 128, 7), createKey(5, 11, 129, 7))); List<Put> puts = new ArrayList<>(); for(byte[] key : keys) { puts.add(new Put(key).addColumn(SharedTestEnvRule.COLUMN_FAMILY, Bytes.toBytes(0), Bytes.toBytes(0))); } table.put(puts); FuzzyRowFilter filter = new FuzzyRowFilter(ImmutableList.of( Pair.newPair(createKey(5, 0, 126, 0), createFuzzyMask(0, 1, 0, 1)), Pair.newPair(createKey(5, 0, 127, 0), createFuzzyMask(0, 1, 0, 1)), Pair.newPair(createKey(5, 0, 128, 0), createFuzzyMask(0, 1, 0, 1)), Pair.newPair(createKey(5, 0, 129, 0), createFuzzyMask(0, 1, 0, 1)))); Scan scan = new Scan().setFilter(filter); Set<String> expectedKeys = new HashSet<>(keys.size()); for(byte[] key : keys) { expectedKeys.add(toFuzzyKeyString(key)); } Set<String> actualKeys = new HashSet(keys.size()); try (ResultScanner scanner = table.getScanner(scan)) { for(Result result : scanner) { actualKeys.add(toFuzzyKeyString(CellUtil.cloneRow(result.rawCells()[0]))); } } assertEquals(expectedKeys, actualKeys); }
Source:
public List<CorfuQueueRecord<E>> entryList(int maxEntries) { if (maxEntries == -1) { maxEntries = Integer.MAX_VALUE; } List<CorfuQueueRecord<E>> copy = new ArrayList<>(Math.min(mainMap.size(), maxEntries)); for (Map.Entry<UUID, E> entry : mainMap.entrySet()) { copy.add(new CorfuQueueRecord<>(entry.getKey(), entry.getValue())); if (--maxEntries == 0) { break; } } return copy; }

Target:
public List<CorfuQueueRecord<E>> entryList(int maxEntries) { if (maxEntries <= 0) { throw new IllegalArgumentException("entryList given negative maxEntries"); } if (maxEntries > MAX_INDEX_ENTRIES) { throw new IllegalArgumentException( "entryList can't return more than "+MAX_INDEX_ENTRIES+" entries" ); } long snapshotVersion; boolean startedNewTransaction = false; if (TransactionalContext.isInTransaction()) { snapshotVersion = TransactionalContext.getCurrentContext() .getSnapshotTimestamp().getSequence(); } else { runtime.getObjectsView().TXBuild().type(TransactionType.WRITE_AFTER_WRITE) .build() .begin(); snapshotVersion = TransactionalContext.getCurrentContext() .getSnapshotTimestamp().getSequence(); startedNewTransaction = true; } List<CorfuQueueRecord<E>> copy = new ArrayList<>( Math.min(corfuTable.size(), maxEntries) ); int index = 0; for (Map.Entry<Long, E> entry : corfuTable.entrySet()) { if (++index >= maxEntries) { break; } long ordering = (snapshotVersion << MAX_BITS_FOR_INDEX) | index; long entryId = entry.getKey(); CorfuQueueRecord<E> record = new CorfuQueueRecord<>( ordering, entryId, entry.getValue() ); copy.add(record); } if (startedNewTransaction) { runtime.getObjectsView().TXEnd(); } return copy; }
Source:
public static void recursivelyDelete(Path path, boolean deleteRoot, boolean retry) throws IOException { if (Files.isDirectory(path)) { for (Path child : Files.newDirectoryStream(path)) { recursivelyDelete(child, true, true); } } else if (deleteRoot) { try { Files.deleteIfExists(path); } catch (DirectoryNotEmptyException e) { if (!retry) { throw new IOException( "Directory not empty " + path + ": " + Files.list(path).collect(Collectors.toList())); } recursivelyDelete(path, true, false); } } }

Target:
public static void recursivelyDelete(Path path, boolean deleteRoot, boolean retry) throws IOException { if (Files.isDirectory(path)) { for (Path child : Files.newDirectoryStream(path)) { recursivelyDelete(child, true, true); } } if (deleteRoot) { try { Files.deleteIfExists(path); } catch (DirectoryNotEmptyException e) { if (!retry) { throw new IOException( "Directory not empty " + path + ": " + Files.list(path).collect(Collectors.toList())); } recursivelyDelete(path, true, false); } } }
Source:
protected boolean updateCinderDisksConnections() { if (getVm().getDiskMap().isEmpty()) { VmHandler.updateDisksFromDb(getVm()); } List<CinderDisk> cinderDisks = ImagesHandler.filterDisksBasedOnCinder(getVm().getDiskMap().values(), true); for (CinderDisk cinderDisk : cinderDisks) { try { CinderBroker cinderBroker = new CinderBroker(cinderDisk.getStorageIds().get(0), getReturnValue().getExecuteFailedMessages()); CinderConnectionInfo connectionInfo = cinderBroker.initializeConnectionForDisk(cinderDisk); CinderVolumeDriver cinderVolumeDriver = CinderVolumeDriver.forValue(connectionInfo.getDriverVolumeType()); if (cinderVolumeDriver == null) { addCustomValue("DiskAlias", cinderDisk.getDiskAlias()); auditLogDirector.log(this, AuditLogType.CINDER_DISK_CONNECTION_VOLUME_DRIVER_UNSUPPORTED); return false; } cinderDisk.setCinderConnectionInfo(connectionInfo); } catch (OpenStackResponseException ex) { addCustomValue("DiskAlias", cinderDisk.getDiskAlias()); auditLogDirector.log(this, AuditLogType.CINDER_DISK_CONNECTION_FAILURE); return false; } } return true; }

Target:
protected boolean updateCinderDisksConnections() { if (getVm().getDiskMap().isEmpty()) { VmHandler.updateDisksFromDb(getVm()); } List<CinderDisk> cinderDisks = ImagesHandler.filterDisksBasedOnCinder(getVm().getDiskMap().values(), true); for (CinderDisk cinderDisk : cinderDisks) { try { CinderBroker cinderBroker = new CinderBroker(cinderDisk.getStorageIds().get(0), getReturnValue().getExecuteFailedMessages()); CinderConnectionInfo connectionInfo = cinderBroker.initializeConnectionForDisk(cinderDisk); if (CinderVolumeDriver.forValue(connectionInfo.getDriverVolumeType()) == null) { addCustomValue("DiskAlias", cinderDisk.getDiskAlias()); auditLogDirector.log(this, AuditLogType.CINDER_DISK_CONNECTION_VOLUME_DRIVER_UNSUPPORTED); return false; } cinderDisk.setCinderConnectionInfo(connectionInfo); } catch (OpenStackResponseException ex) { addCustomValue("DiskAlias", cinderDisk.getDiskAlias()); auditLogDirector.log(this, AuditLogType.CINDER_DISK_CONNECTION_FAILURE); return false; } } return true; }
Source:
public OmemoBundleElement(int signedPreKeyId, byte[] signedPreKey, byte[] signedPreKeySig, byte[] identityKey, HashMap<Integer, byte[]> preKeys) { if (signedPreKeyId <= 0) { throw new IllegalArgumentException("signedPreKeyId MUST be greater than 0."); } this.signedPreKeyId = signedPreKeyId; this.signedPreKeyB64 = Base64.encodeToString(signedPreKey); if (StringUtils.isNullOrEmpty(this.signedPreKeyB64)) { throw new IllegalArgumentException("signedPreKeyB64 MUST NOT be null nor empty."); } this.signedPreKey = signedPreKey; this.signedPreKeySignatureB64 = Base64.encodeToString(signedPreKeySig); if (StringUtils.isNullOrEmpty(this.signedPreKeySignatureB64)) { throw new IllegalArgumentException("signedPreKeySigB64 MUST NOT be null nor empty."); } this.signedPreKeySignature = signedPreKeySig; this.identityKeyB64 = Base64.encodeToString(identityKey); if (StringUtils.isNullOrEmpty(identityKeyB64)) { throw new IllegalArgumentException("identityKeyB64 MUST NOT be null nor empty."); } this.identityKey = identityKey; this.preKeys = preKeys; if (preKeys.isEmpty()) { throw new IllegalArgumentException("PreKeys MUST NOT be empty."); } this.preKeysB64 = new HashMap<>(); for (int id : preKeys.keySet()) { preKeysB64.put(id, Base64.encodeToString(preKeys.get(id))); } }

Target:
public OmemoBundleElement(int signedPreKeyId, byte[] signedPreKey, byte[] signedPreKeySig, byte[] identityKey, HashMap<Integer, byte[]> preKeys) { this(signedPreKeyId, signedPreKey != null ? Base64.encodeToString(signedPreKey) : null, signedPreKeySig != null ? Base64.encodeToString(signedPreKeySig) : null, identityKey != null ? Base64.encodeToString(identityKey) : null, base64EncodePreKeys(preKeys)); this.signedPreKey = signedPreKey; this.signedPreKeySignature = signedPreKeySig; this.identityKey = identityKey; this.preKeys = preKeys; }
Source:
public void visitMethodInvocation(MethodInvocationTree mit) { if (KEY_GEN_INIT.matches(mit) || KEY_PAIR_GEN_INITIALIZE.matches(mit)) { Integer minKeySize = algorithmKeySizeMap.get(algorithm); if (minKeySize != null) { checkAlgorithmParameterToReport(mit.arguments().get(0), minKeySize) .ifPresent(argValue -> reportString = argValue); this.treeToReport = mit; } } }

Target:
public void visitMethodInvocation(MethodInvocationTree mit) { if (keyGenInit.matches(mit) || keyPairGenInitialize.matches(mit)) { Integer minKeySize = algorithmKeySizeMap.get(this.algorithm); if (minKeySize != null) { Integer keySize = LiteralUtils.intLiteralValue(mit.arguments().get(0)); if (keySize != null && keySize < minKeySize) { reportIssue(mit, "Use a key length of at least " + minKeySize + " bits."); } } } }
Source:
private Value resolveDynamicAttribute(String attributeValue, OMElement elem) { try { String valueExpression = attributeValue.substring(1, attributeValue.length() - 1); if (valueExpression.startsWith("json-eval(")) { new SynapseJsonPath(valueExpression.substring(10, valueExpression.length() - 1)); } else { new SynapseXPath(valueExpression); } } catch (JaxenException e) { handleException("Invalid expression for attribute 'name' : " + attributeValue); } ValueFactory nameValueFactory = new ValueFactory(); return nameValueFactory.createValue("iterations", elem); }

Target:
private Value resolveDynamicAttribute(String attributeValue, OMElement elem) { try { String valueExpression = attributeValue.substring(1, attributeValue.length() - 1); if (valueExpression.startsWith("json-eval(")) { new SynapseJsonPath(valueExpression.substring(10, valueExpression.length() - 1)); } else { new SynapseXPath(valueExpression); } } catch (JaxenException e) { handleException("Invalid expression for attribute 'name' : " + attributeValue); } ValueFactory nameValueFactory = new ValueFactory(); return nameValueFactory.createValue(ITERATIONS, elem); }
Source:
protected List<String> getPropertiesToFetch() { Set<String> fetched = ctx.getFetched(ENTITY_TYPE); List<String> propertiesToFetch = DEFAULT_PROPERTIES.stream() .filter(fetched::contains) .collect(Collectors.toList()); propertiesToFetch = propertiesToFetch.isEmpty() ? DEFAULT_PROPERTIES : propertiesToFetch; return propertiesToFetch; }

Target:
protected List<String> getPropertiesToFetch() { Set<String> fetched = ctx.getFetched(ENTITY_TYPE); List<String> propertiesToFetch = DEFAULT_PROPERTIES.stream() .filter(fetched::contains) .collect(Collectors.toList()); return propertiesToFetch.isEmpty() ? DEFAULT_PROPERTIES : propertiesToFetch; }
Source:
private void shiftBaseTemplateToSuccessor() { try { getVmTemplateDao().shiftBaseTemplate(getVmTemplateId()); } finally { freeSubTemplatesLock(); } }

Target:
private void shiftBaseTemplateToSuccessor() { try { getVmTemplateDao().shiftBaseTemplate(getVmTemplateId()); } finally { freeSubTemplateLock(); } }
Source:
public void testNumericDimensionTopNWithNullPreviousStop() { TopNQuery query = new TopNQueryBuilder() .dataSource(QueryRunnerTestHelper.dataSource) .granularity(QueryGranularities.ALL) .dimension(QueryRunnerTestHelper.marketDimension) .metric(new DimensionTopNMetricSpec(null, StringComparators.NUMERIC)) .threshold(2) .intervals(QueryRunnerTestHelper.secondOnly) .aggregators(duplicateAggregators( QueryRunnerTestHelper.rowsCount, new CountAggregatorFactory("rows1", "rows") )) .build(); List<Result<TopNResultValue>> expectedResults = Arrays.asList( new Result<>( new DateTime("2011-04-02T00:00:00.000Z"), new TopNResultValue( withDuplicateResults( Arrays.asList( ImmutableMap.<String, Object>of( "market", "spot", "rows", 9L ), ImmutableMap.<String, Object>of( "market", "total_market", "rows", 2L ) ), "rows", "rows1" ) ) ) ); TestHelper.assertExpectedResults(expectedResults, runner.run(query, new HashMap<String, Object>())); }

Target:
public void testNumericDimensionTopNWithNullPreviousStop() { TopNQuery query = new TopNQueryBuilder() .dataSource(QueryRunnerTestHelper.dataSource) .granularity(Granularities.ALL) .dimension(QueryRunnerTestHelper.marketDimension) .metric(new DimensionTopNMetricSpec(null, StringComparators.NUMERIC)) .threshold(2) .intervals(QueryRunnerTestHelper.secondOnly) .aggregators(duplicateAggregators( QueryRunnerTestHelper.rowsCount, new CountAggregatorFactory("rows1") )) .build(); List<Result<TopNResultValue>> expectedResults = Arrays.asList( new Result<>( new DateTime("2011-04-02T00:00:00.000Z"), new TopNResultValue( withDuplicateResults( Arrays.asList( ImmutableMap.<String, Object>of( "market", "spot", "rows", 9L ), ImmutableMap.<String, Object>of( "market", "total_market", "rows", 2L ) ), "rows", "rows1" ) ) ) ); TestHelper.assertExpectedResults(expectedResults, runner.run(query, new HashMap<String, Object>())); }
Source:
public ArrayLiteralTreeImpl(List<Tree> elementsAndCommas) { this.elementsAndCommas = elementsAndCommas; this.elements = getExpressionTrees(elementsAndCommas); }

Target:
public ArrayLiteralTreeImpl(List<Tree> elementsAndCommas) { this.elementsAndCommas = elementsAndCommas; this.elements = ImmutableList.copyOf(Iterables.filter(elementsAndCommas, ExpressionTree.class)); }
Source:
private void reportInstanceCapacityMetrics(ClusterStatusMonitor clusterStatusMonitor, ResourceControllerDataProvider dataProvider, Map<String, Resource> resourceMap, CurrentStateOutput currentStateOutput) { asyncExecute(dataProvider.getAsyncTasksThreadPool(), () -> { try { Map<String, IdealState> idealStateMap = dataProvider.getIdealStates(); Map<String, Resource> metricResourceMap = resourceMap.entrySet().stream() .filter(resourceName -> idealStateMap.containsKey(resourceName)) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); Map<String, ResourceAssignment> currentStateAssignment = currentStateOutput.getAssignment(metricResourceMap.keySet()); ClusterModel clusterModel = ClusterModelProvider.generateClusterModelFromCurrentState( dataProvider, metricResourceMap, currentStateAssignment); Map<String, Double> maxUsageMap = new HashMap<>(); for (AssignableNode node : clusterModel.getAssignableNodes().values()) { String instanceName = node.getInstanceName(); double usage = node.getProjectedHighestUtilization(Collections.emptyMap()); maxUsageMap.put(instanceName, usage); } clusterStatusMonitor.updateInstanceMaxUsage(maxUsageMap); } catch (Exception ex) { LOG.error("Failed to report instance capacity metrics.", ex); } return null; }); }

Target:
private void reportInstanceCapacityMetrics(ClusterStatusMonitor clusterStatusMonitor, ResourceControllerDataProvider dataProvider, Map<String, Resource> resourceMap, CurrentStateOutput currentStateOutput) { asyncExecute(dataProvider.getAsyncTasksThreadPool(), () -> { try { Map<String, IdealState> idealStateMap = dataProvider.getIdealStates(); Map<String, Resource> resourceToMonitorMap = resourceMap.entrySet().stream() .filter(resourceName -> idealStateMap.containsKey(resourceName)) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); Map<String, ResourceAssignment> currentStateAssignment = currentStateOutput.getAssignment(resourceToMonitorMap.keySet()); ClusterModel clusterModel = ClusterModelProvider.generateClusterModelFromCurrentState( dataProvider, resourceToMonitorMap, currentStateAssignment); Map<String, Double> maxUsageMap = new HashMap<>(); for (AssignableNode node : clusterModel.getAssignableNodes().values()) { String instanceName = node.getInstanceName(); double usage = node.getProjectedHighestUtilization(Collections.emptyMap()); maxUsageMap.put(instanceName, usage); } clusterStatusMonitor.updateInstanceMaxUsage(maxUsageMap); } catch (Exception ex) { LOG.error("Failed to report instance capacity metrics.", ex); } return null; }); }
Source:
public void test() { connect(); JQuery jqTrack = jq(".z-multislider-track"); getActions().moveToElement(toElement(jqTrack)) .moveByOffset(jqTrack.width() / 2 - 2, 0) .click() .perform(); waitResponse(); assertEquals(jqTrack.width() + "px", jq("@multislider .z-sliderbuttons-button").eq(1).css("left")); jqTrack = jq(".z-rangeslider-track"); getActions().moveToElement(toElement(jqTrack)) .moveByOffset(jqTrack.width() / 2 - 2, 0) .click() .perform(); waitResponse(); assertEquals(jqTrack.width() + "px", jq("@rangeslider .z-sliderbuttons-button").eq(1).css("left")); }

Target:
public void test() { connect(); JQuery jqTrack = jq(".z-multislider-track"); getActions().moveToElement(toElement(jqTrack)) .moveByOffset(jqTrack.width() / 2 - 1, 0) .click() .perform(); waitResponse(); assertEquals(jqTrack.width(), jq("@multislider .z-sliderbuttons-button").eq(1).positionLeft()); jqTrack = jq(".z-rangeslider-track"); getActions().moveToElement(toElement(jqTrack)) .moveByOffset(jqTrack.width() / 2 - 1, 0) .click() .perform(); waitResponse(); assertEquals(jqTrack.width(), jq("@rangeslider .z-sliderbuttons-button").eq(1).positionLeft()); }
Source:
public Mono<DataLakeFileAsyncClient> createFile(String fileName) { try { return createFile(fileName, false); } catch (RuntimeException ex) { return monoError(logger, ex); } }

Target:
public Mono<DataLakeFileAsyncClient> createFile(String fileName) { return createFile(fileName, false); }
Source:
private void startFolderMonitor() { if (serverConfiguration.getAppFolderToMonitor() != null) { try { folderMonitor = new FolderMonitor(this); folderMonitor.start(); } catch (Exception e) { log.warning("Couldn't monitor the given folder: " + serverConfiguration.getAppFolderToMonitor()); } } }

Target:
private void startFolderMonitor() { if (serverConfiguration.getAppFolderToMonitor() != null) { try { folderMonitor = new FolderMonitor(this, serverConfiguration); folderMonitor.start(); } catch (IOException e) { log.warning("Could not monitor the given folder: " + serverConfiguration.getAppFolderToMonitor()); } } }
Source:
public static double[][] parseShifts(String filename, double scaling) throws IOException { ArrayList<double[]> list = new ArrayList<>(); double[][] shift; try (CSVReader reader = getCSVReader(filename)) { String[] line; while ((line = reader.readNext()) != null) { double[] lineDouble = new double[line.length]; for (int loopc = 0; loopc < line.length; loopc++) { lineDouble[loopc] = Double.parseDouble(line[loopc]) * scaling; } list.add(lineDouble); } shift = list.toArray(new double[0][0]); } return shift; }

Target:
public static double[][] parseShifts(String filename, double scaling) throws IOException { ArgumentChecker.notNull(filename, "fine name"); ArrayList<double[]> list = new ArrayList<>(); double[][] shift; try (CSVReader reader = getCSVReader(filename)) { String[] line; while ((line = reader.readNext()) != null) { double[] lineDouble = new double[line.length]; for (int loopc = 0; loopc < line.length; loopc++) { lineDouble[loopc] = Double.parseDouble(line[loopc]) * scaling; } list.add(lineDouble); } shift = list.toArray(new double[0][0]); } return shift; }
Source:
public Indexed<Long> getSortedIndexedValues() { return null; }

Target:
public Indexed<Long> getSortedIndexedValues() { throw new UnsupportedOperationException("Numeric columns do not support value dictionaries."); }
Source:
public RunGnuplot(final HttpQuery query, final int max_age, final Plot plot, final String basepath, final HashSet<String>[] aggregated_tags, final int npoints) { this.query = query; this.max_age = max_age; this.plot = plot; if (System.getProperty("os.name").contains("Windows")) this.basepath = basepath.replace("\\", "\\\\").replace("/", "\\\\"); else this.basepath = basepath; this.aggregated_tags = aggregated_tags; this.npoints = npoints; }

Target:
public RunGnuplot(final HttpQuery query, final int max_age, final Plot plot, final String basepath, final HashSet<String>[] aggregated_tags, final int npoints) { this.query = query; this.max_age = max_age; this.plot = plot; if (IS_WINDOWS) this.basepath = basepath.replace("\\", "\\\\").replace("/", "\\\\"); else this.basepath = basepath; this.aggregated_tags = aggregated_tags; this.npoints = npoints; }
Source:
public XpathFilter(String files, String checks, String moduleId, String query) { filePattern = files; fileRegexp = Pattern.compile(files); checkPattern = checks; if (checks == null) { checkRegexp = null; } else { checkRegexp = CommonUtils.createPattern(checks); } this.moduleId = moduleId; xpathQuery = query; if (xpathQuery == null) { xpathExpression = null; } else { final XPathEvaluator xpathEvaluator = new XPathEvaluator(); try { xpathExpression = xpathEvaluator.createExpression(xpathQuery); } catch (XPathException ex) { throw new IllegalStateException("Unexpected xpath query", ex); } } }

Target:
public XpathFilter(String files, String checks, String moduleId, String query) { filePattern = files; fileRegexp = Pattern.compile(files); checkPattern = checks; if (checks == null) { checkRegexp = null; } else { checkRegexp = CommonUtils.createPattern(checks); } this.moduleId = moduleId; xpathQuery = query; if (xpathQuery == null) { xpathExpression = null; } else { final XPathEvaluator xpathEvaluator = new XPathEvaluator(); try { xpathExpression = xpathEvaluator.createExpression(xpathQuery); } catch (XPathException ex) { throw new IllegalStateException("Unexpected xpath query: " + xpathQuery, ex); } } }
Source:
private static void maybeShowTranslateDescriptionUnlockNotification(@NonNull Context context) { if (!WikipediaApp.getInstance().isAnyActivityResumed()) { Intent intent = AddTitleDescriptionsActivity.Companion.newIntent(context, Constants.InvokeSource.EDIT_FEED_TRANSLATE_TITLE_DESC); NotificationCompat.Builder builder = NotificationPresenter.getDefaultBuilder(context); PendingIntent pendingIntent = PendingIntent.getActivity(context, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(0, context.getString(R.string.title_description_get_started), pendingIntent); NotificationPresenter.showNotification(context, 0, context.getString(R.string.translation_description_edit_task_unlock_title), context.getString(R.string.translation_description_edit_task_unlock_body), context.getString(R.string.translation_description_edit_task_unlock_body), R.drawable.ic_mode_edit_white_24dp, R.color.accent50, intent); } }

Target:
private static void maybeShowTranslateDescriptionUnlockNotification(@NonNull Context context) { if (!WikipediaApp.getInstance().isAnyActivityResumed()) { Intent intent = AddTitleDescriptionsActivity.Companion.newIntent(context, Constants.InvokeSource.EDIT_FEED_TRANSLATE_TITLE_DESC); NotificationCompat.Builder builder = NotificationPresenter.getDefaultBuilder(context); PendingIntent pendingIntent = PendingIntent.getActivity(context, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(0, context.getString(R.string.title_description_get_started), pendingIntent); NotificationPresenter.showNotification(context, builder, 0, context.getString(R.string.translation_description_edit_task_unlock_title), context.getString(R.string.translation_description_edit_task_unlock_body), context.getString(R.string.translation_description_edit_task_unlock_body), R.drawable.ic_mode_edit_white_24dp, R.color.accent50, intent); } }
Source:
boolean cleanupOnError(Throwable e, boolean diagActive) { if (SanityManager.DEBUG) SanityManager.ASSERT(cm != null, "cannot cleanup on error with null context manager"); return cm.cleanupOnError(e, diagActive); }

Target:
boolean cleanupOnError(Throwable e, boolean diagActive) { if (SanityManager.DEBUG) SanityManager.ASSERT(cm != null, "cannot cleanup on error with null context manager"); boolean result = cm.cleanupOnError(e, diagActive); csf.removeContext(cm); return result; }
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { if (networkExists()) { return Collections.singletonList(new PermissionSubject(getParameters().getVdsGroupId(), VdcObjectType.VdsGroups, ActionGroup.CONFIGURE_CLUSTER_NETWORK)); } else { Guid networkId = getParameters().getNetwork() == null ? null : getParameters().getNetwork().getId(); return Collections.singletonList(new PermissionSubject(networkId, VdcObjectType.Network, getActionType().getActionGroup())); } }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { Guid networkId = getParameters().getNetwork() == null ? null : getParameters().getNetwork().getId(); return Collections.singletonList(new PermissionSubject(networkId, VdcObjectType.Network, getActionType().getActionGroup())); }
Source:
private void notifyError(final GraphError error) { if (httpCall.isCanceled()) { return; } Runnable action = () -> { if (error instanceof GraphNetworkError) { graphCallback.onNetworkError((GraphNetworkError) error); } else if (error instanceof GraphHttpError) { graphCallback.onHttpError((GraphHttpError) error); } else if (error instanceof GraphParseError) { graphCallback.onParseError((GraphParseError) error); } else { graphCallback.onFailure(error); } }; if (handler != null) { handler.post(action); } else { action.run(); } }

Target:
private void notifyError(final GraphError error) { Runnable action = () -> graphCallback.onFailure(error); if (handler != null) { handler.post(action); } else { action.run(); } }
Source:
private void loadFrameWidgetFromURI(String fileName, final float duration) { ApplicationAssets assets = controller.getApplicationAssets(); assets.get(fileName, Texture.class, new AssetLoadedCallback<Texture>() { @Override public void loaded(String fileName, Texture asset) { Image image = new Image(); loadTextureIntoImage(asset, image); FrameWidget focusItem = new FrameWidget(image, controller); focusItem.setDuration(duration); addFocusItem(focusItem); } }); }

Target:
private void loadFrameWidgetFromURI(String fileName, final float duration) { EditorGameAssets assets = controller.getEditorGameAssets(); assets.get(fileName, Texture.class, new AssetLoadedCallback<Texture>() { @Override public void loaded(String fileName, Texture asset) { Image image = new Image(); loadTextureIntoImage(asset, image); FrameWidget focusItem = new FrameWidget(image, controller); focusItem.setDuration(duration); addFocusItem(focusItem); } }); }
Source:
private MistTaskConfigs(@Parameter(NumTasks.class) final int numTasks, @Parameter(TaskMemorySize.class) final int taskMemSize, @Parameter(NumExecutors.class) final int numTaskExecutors, @Parameter(NumTaskCores.class) final int numTaskCores, @Parameter(RPCServerPort.class) final int rpcServerPort) { this.numTasks = numTasks; this.numTaskExecutors = numTaskExecutors; this.taskMemSize = taskMemSize; this.numTaskCores = numTaskCores; this.rpcServerPort = rpcServerPort + 10; }

Target:
private MistTaskConfigs(@Parameter(NumTasks.class) final int numTasks, @Parameter(TaskMemorySize.class) final int taskMemSize, @Parameter(NumExecutors.class) final int numTaskExecutors, @Parameter(NumTaskCores.class) final int numTaskCores, @Parameter(RPCServerPort.class) final int rpcServerPort) { this.numTasks = numTasks; this.numTaskExecutors = numTaskExecutors; this.taskMemSize = taskMemSize; this.numTaskCores = numTaskCores; this.rpcServerPort = rpcServerPort + 10 > MAX_PORT_NUM ? rpcServerPort - 10 : rpcServerPort + 10; }
Source:
public boolean matchesSafely(Map<? extends K, ? extends V> map) { return map.containsKey(key) && super.valueMatcher.matches(map.get(key)); }

Target:
public boolean matchesSafely(Map<? extends K, ? extends V> map) { try{ return map.containsKey(key) && super.valueMatcher.matches(map.get(key)); } catch (NullPointerException e){ return false; } }
Source:
protected void doAsyncAddEntry(final PendingAddOp op) { if (throttler != null) { throttler.acquire(); } boolean wasClosed = false; synchronized (this) { if (metadata.isClosed()) { wasClosed = true; } else { long entryId = ++lastAddPushed; long currentLedgerLength = addToLength(op.payload.readableBytes()); op.setEntryId(entryId); op.setLedgerLength(currentLedgerLength); pendingAddOps.add(op); } } if (wasClosed) { try { bk.getMainWorkerPool().submit(new SafeRunnable() { @Override public void safeRun() { LOG.warn("Attempt to add to closed ledger: {}", ledgerId); op.cb.addComplete(BKException.Code.LedgerClosedException, LedgerHandle.this, INVALID_ENTRY_ID, op.ctx); } @Override public String toString() { return String.format("AsyncAddEntryToClosedLedger(lid=%d)", ledgerId); } }); } catch (RejectedExecutionException e) { op.cb.addComplete(bk.getReturnRc(BKException.Code.InterruptedException), LedgerHandle.this, INVALID_ENTRY_ID, op.ctx); } return; } if (!waitForWritable(distributionSchedule.getWriteSet(op.getEntryId()), op.getEntryId(), 0, waitForWriteSetMs)) { op.allowFastFailOnBlockedServer(); } try { bk.getMainWorkerPool().submitOrdered(ledgerId, op); } catch (RejectedExecutionException e) { op.cb.addComplete(bk.getReturnRc(BKException.Code.InterruptedException), LedgerHandle.this, INVALID_ENTRY_ID, op.ctx); } }

Target:
protected void doAsyncAddEntry(final PendingAddOp op) { if (throttler != null) { throttler.acquire(); } boolean wasClosed = false; synchronized (this) { if (metadata.isClosed()) { wasClosed = true; } else { long entryId = ++lastAddPushed; long currentLedgerLength = addToLength(op.payload.readableBytes()); op.setEntryId(entryId); op.setLedgerLength(currentLedgerLength); pendingAddOps.add(op); } } if (wasClosed) { try { bk.getMainWorkerPool().submit(new SafeRunnable() { @Override public void safeRun() { LOG.warn("Attempt to add to closed ledger: {}", ledgerId); op.cb.addCompleteWithLatency(BKException.Code.LedgerClosedException, LedgerHandle.this, INVALID_ENTRY_ID, 0, op.ctx); } @Override public String toString() { return String.format("AsyncAddEntryToClosedLedger(lid=%d)", ledgerId); } }); } catch (RejectedExecutionException e) { op.cb.addCompleteWithLatency(bk.getReturnRc(BKException.Code.InterruptedException), LedgerHandle.this, INVALID_ENTRY_ID, 0, op.ctx); } return; } DistributionSchedule.WriteSet ws = distributionSchedule.getWriteSet(op.getEntryId()); try { if (!waitForWritable(ws, op.getEntryId(), 0, waitForWriteSetMs)) { op.allowFailFastOnUnwritableChannel(); } } finally { ws.recycle(); } try { bk.getMainWorkerPool().executeOrdered(ledgerId, op); } catch (RejectedExecutionException e) { op.cb.addCompleteWithLatency(bk.getReturnRc(BKException.Code.InterruptedException), LedgerHandle.this, INVALID_ENTRY_ID, 0, op.ctx); } }
Source:
@Test public void testToAscii() throws UnsupportedEncodingException { String s = "h\u00E9h\u00E9"; assertEquals("hehe", StringUtils.toAscii(s)); }

Target:
public void testToAscii() throws UnsupportedEncodingException { String s = "h\u00E9h\u00E9"; assertEquals("hehe", StringUtils.toAscii(s)); }
Source:
public List<List<Double>> getJointOfForwardsAndBackwards(final ImmutableList<Integer> events) { UnmodifiableListIterator<Integer> iterator = events.listIterator(events.size()); List<Integer> backwardsEvents = Lists.newArrayList(); while (iterator.hasPrevious()) { backwardsEvents.add(iterator.previous()); } final List<List<Double>> forwardProbs = getProbsFromEventSequence(events); final List<List<Double>> backwardProbs = getProbsFromEventSequence(ImmutableList.copyOf(backwardsEvents)); final List<List<Double>> joints = Lists.newArrayList(); for (int iTimeForward = 0; iTimeForward < forwardProbs.size(); iTimeForward++) { final int iTimeBackward = forwardProbs.size() - iTimeForward - 1; final List<Double> forwardProb = forwardProbs.get(iTimeForward); final List<Double> backwardProb = backwardProbs.get(iTimeBackward); final List<Double> joint = Lists.newArrayList(); for (int iState = 0; iState < forwardProb.size(); iState++) { joint.add(forwardProb.get(iState) * backwardProb.get(iState)); } joints.add(joint); } return joints; }

Target:
public List<List<Double>> getJointOfForwardsAndBackwards(final ImmutableList<Integer> events) { final UnmodifiableListIterator<Integer> iterator = events.listIterator(events.size()); final List<Integer> backwardsEvents = Lists.newArrayList(); while (iterator.hasPrevious()) { backwardsEvents.add(iterator.previous()); } final List<List<Double>> forwardProbs = getProbsFromEventSequence(events); final List<List<Double>> backwardProbs = getProbsFromEventSequence(ImmutableList.copyOf(backwardsEvents)); final List<List<Double>> joints = Lists.newArrayList(); for (int iTimeForward = 0; iTimeForward < forwardProbs.size(); iTimeForward++) { final int iTimeBackward = forwardProbs.size() - iTimeForward - 1; final List<Double> forwardProb = forwardProbs.get(iTimeForward); final List<Double> backwardProb = backwardProbs.get(iTimeBackward); final List<Double> joint = Lists.newArrayList(); for (int iState = 0; iState < forwardProb.size(); iState++) { joint.add(forwardProb.get(iState) * backwardProb.get(iState)); } joints.add(joint); } return joints; }
Source:
public Ample.TabletMutator putBulkFile(Ample.FileMeta bulkref, long tid) { Preconditions.checkState(updatesEnabled, "Cannot make updates after calling mutate."); Value tidBytes = new Value(Long.toString(tid).getBytes()); mutation.put(TabletsSection.BulkFileColumnFamily.NAME, bulkref.meta(), tidBytes); return this; }

Target:
public Ample.TabletMutator putBulkFile(Ample.FileMeta bulkref, long tid) { Preconditions.checkState(updatesEnabled, "Cannot make updates after calling mutate."); mutation.put(TabletsSection.BulkFileColumnFamily.NAME, bulkref.meta(), new Value(Long.toString(tid))); return this; }