auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onPlace(BlockPlaceEvent event) { Player player = event.getPlayer(); Block block = event.getBlock(); Material type = block.getType(); Location blockLocation = block.getLocation(); if (!ProtectionSystem.build(player, blockLocation, true)) { return; } event.setCancelled(true); if (!this.config.buggedBlocks || this.config.buggedBlocksExclude.contains(type)) { return; } ItemStack itemInHand = event.getItemInHand(); if ((itemInHand.getAmount() - 1) == 0) { if (Reflections.USE_PRE_9_METHODS) { player.setItemInHand(null); } else { itemInHand.setAmount(0); } } else { itemInHand.setAmount(itemInHand.getAmount() - 1); } Location playerLocation = player.getLocation(); boolean sameColumn = (playerLocation.getBlockX() == blockLocation.getBlockX()) && (playerLocation.getBlockZ() == blockLocation.getBlockZ()); double distanceUp = (playerLocation.getY() - blockLocation.getBlockY()); boolean upToTwoBlocks = (distanceUp > 0) && (distanceUp <= 2); if (sameColumn && upToTwoBlocks) { player.setVelocity(new Vector(0, 0.4, 0)); } Bukkit.getScheduler().runTaskLater(FunnyGuilds.getInstance(), () -> { block.setType(type); ItemStack returnItem = event.getItemInHand().clone(); returnItem.setAmount(1); Bukkit.getScheduler().runTaskLater(FunnyGuilds.getInstance(), () -> { event.getBlockReplacedState().update(true); if (!player.isOnline()) { return; } if (this.config.buggedBlockReturn) { player.getInventory().addItem(returnItem); } }, this.config.buggedBlocksTimer); }, 0); }

Target:
public void onPlace(BlockPlaceEvent event) { Player player = event.getPlayer(); Block block = event.getBlock(); Material type = block.getType(); Location blockLocation = block.getLocation(); if (!ProtectionSystem.build(player, blockLocation, true)) { return; } event.setCancelled(true); if (!this.config.buggedBlocks || this.config.buggedBlocksExclude.contains(type)) { return; } ItemStack itemInHand = event.getItemInHand(); if ((itemInHand.getAmount() - 1) == 0) { if (Reflections.USE_PRE_9_METHODS) { player.setItemInHand(null); } else { itemInHand.setAmount(0); } } else { itemInHand.setAmount(itemInHand.getAmount() - 1); } Location playerLocation = player.getLocation(); boolean sameColumn = (playerLocation.getBlockX() == blockLocation.getBlockX()) && (playerLocation.getBlockZ() == blockLocation.getBlockZ()); double distanceUp = (playerLocation.getY() - blockLocation.getBlockY()); boolean upToTwoBlocks = (distanceUp > 0) && (distanceUp <= 2); if (sameColumn && upToTwoBlocks) { player.setVelocity(ANTI_GLITCH_VELOCITY); } Bukkit.getScheduler().runTask(FunnyGuilds.getInstance(), () -> { block.setType(type); ItemStack returnItem = event.getItemInHand().clone(); returnItem.setAmount(1); Bukkit.getScheduler().runTaskLater(FunnyGuilds.getInstance(), () -> { event.getBlockReplacedState().update(true); if (!player.isOnline()) { return; } if (this.config.buggedBlockReturn) { player.getInventory().addItem(returnItem); } }, this.config.buggedBlocksTimer); }); }
Source:
private void parseEntry(boolean forward) { currentEntry = cache.getEntry(ptr); final byte[] cep = currentEntry.path; if (!forward) { if (nextSubtreePos > 0) { final DirCacheTree p = tree.getChild(nextSubtreePos - 1); if (p.contains(cep, pathOffset, cep.length)) { nextSubtreePos--; currentSubtree = p; } } } if (nextSubtreePos != tree.getChildCount()) { final DirCacheTree s = tree.getChild(nextSubtreePos); if (s.contains(cep, pathOffset, cep.length)) { currentSubtree = s; nextSubtreePos++; if (s.isValid()) s.getObjectId().copyRawTo(subtreeId, 0); mode = FileMode.TREE.getBits(); path = cep; pathLen = pathOffset + s.nameLength(); return; } } mode = currentEntry.getRawMode(); path = cep; pathLen = cep.length; currentSubtree = null; byte[] entryName = new byte[pathLen - pathOffset]; System.arraycopy(path, pathOffset, entryName, 0, pathLen - pathOffset); if (Arrays.equals(entryName, DOT_GIT_ATTRIBUTES_BYTES)) attributesNode = new LazyLoadingAttributesNode( currentEntry.getObjectId()); }

Target:
private void parseEntry(boolean forward) { currentEntry = cache.getEntry(ptr); final byte[] cep = currentEntry.path; if (!forward) { if (nextSubtreePos > 0) { final DirCacheTree p = tree.getChild(nextSubtreePos - 1); if (p.contains(cep, pathOffset, cep.length)) { nextSubtreePos--; currentSubtree = p; } } } if (nextSubtreePos != tree.getChildCount()) { final DirCacheTree s = tree.getChild(nextSubtreePos); if (s.contains(cep, pathOffset, cep.length)) { currentSubtree = s; nextSubtreePos++; if (s.isValid()) s.getObjectId().copyRawTo(subtreeId, 0); mode = FileMode.TREE.getBits(); path = cep; pathLen = pathOffset + s.nameLength(); return; } } mode = currentEntry.getRawMode(); path = cep; pathLen = cep.length; currentSubtree = null; if (RawParseUtils.match(path, pathOffset, DOT_GIT_ATTRIBUTES_BYTES) == path.length) attributesNode = new LazyLoadingAttributesNode( currentEntry.getObjectId()); }
Source:
private DataSetReference.Builder handlePersons(ResultProtos.Result result, DataSetReference.Builder builder) throws IOException { if (result.getMetadata() != null) { List<CharSequence> creatorNames = new ArrayList<>(); for (eu.dnetlib.data.proto.FieldTypeProtos.Author sourceAuthor : result.getMetadata().getAuthorList()) { if (StringUtils.isNotBlank(sourceAuthor.getFullname())) { creatorNames.add(sourceAuthor.getFullname()); } } if (!creatorNames.isEmpty()) { builder.setCreatorNames(creatorNames); } } return builder; }

Target:
private void handlePersons(ResultProtos.Result result, DataSetReference.Builder builder) { if (result.getMetadata() != null) { builder.setCreatorNames(result.getMetadata().getAuthorList().stream() .filter(x -> StringUtils.isNotBlank(x.getFullname())) .map(Author::getFullname) .collect(Collectors.toList())); } }
Source:
private String handleAggregationFunction(CallExpression aggregation, Map<VariableReferenceExpression, Selection> inputSelections) { String prestoAgg = aggregation.getDisplayName().toLowerCase(ENGLISH); List<RowExpression> params = aggregation.getArguments(); switch (prestoAgg) { case "count": if (params.size() <= 1) { return format("count(%s)", params.isEmpty() ? "*" : inputSelections.get(getVariableReference(params.get(0)))); } break; case "approx_percentile": return handleApproxPercentile(aggregation, inputSelections); default: if (UNARY_AGGREGATION_MAP.containsKey(prestoAgg) && aggregation.getArguments().size() == 1) { return format("%s(%s)", UNARY_AGGREGATION_MAP.get(prestoAgg), inputSelections.get(getVariableReference(params.get(0)))); } } throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("aggregation function '%s' not supported yet", aggregation)); }

Target:
private String handleAggregationFunction(CallExpression aggregation, Map<VariableReferenceExpression, Selection> inputSelections) { String prestoAggregation = aggregation.getDisplayName().toLowerCase(ENGLISH); List<RowExpression> parameters = aggregation.getArguments(); switch (prestoAggregation) { case "count": if (parameters.size() <= 1) { return format("count(%s)", parameters.isEmpty() ? "*" : inputSelections.get(getVariableReference(parameters.get(0)))); } break; case "approx_percentile": return handleApproxPercentile(aggregation, inputSelections); default: if (UNARY_AGGREGATION_MAP.containsKey(prestoAggregation) && aggregation.getArguments().size() == 1) { return format("%s(%s)", UNARY_AGGREGATION_MAP.get(prestoAggregation), inputSelections.get(getVariableReference(parameters.get(0)))); } } throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("aggregation function '%s' not supported yet", aggregation)); }
Source:
public void testDeleteLoadBalancer() throws SerializationException, StateAccessException, MappingStatusException, Rule.RuleIndexOutOfBoundsException { String path = pb.getPoolHealthMonitorMappingsPath(pool.id, healthMonitor.id); Assert.assertTrue(zk.exists(path)); Assert.assertTrue(dataClient.loadBalancersGetAll().size() == 1); UUID lbId = dataClient.poolGet(pool.id).getLoadBalancerId(); dataClient.loadBalancerDelete(lbId); Assert.assertFalse(zk.exists(path)); Assert.assertNull(dataClient.poolGet(pool.id)); }

Target:
public void testDeleteLoadBalancer() throws SerializationException, StateAccessException, MappingStatusException, Rule.RuleIndexOutOfBoundsException { String path = pb.getPoolHealthMonitorMappingsPath(pool.id, healthMonitor.id); Assert.assertTrue(zk.exists(path)); UUID lbId = dataClient.poolGet(pool.id).getLoadBalancerId(); dataClient.loadBalancerDelete(lbId); Assert.assertFalse(zk.exists(path)); Assert.assertNull(dataClient.poolGet(pool.id)); }
Source:
protected Command getSaveCommand() { return () -> scenarioSimulationEditorWrapper.wrappedSave("Save"); }

Target:
protected Command getSaveCommand() { return () -> scenarioSimulationEditorWrapper.wrappedSave(ConstantHolder.SAVE); }
Source:
void doIndexTestTest( String dataSource, String indexTaskFilePath, String queryFilePath, boolean waitForNewVersion ) throws IOException { final String fullDatasourceName = dataSource + config.getExtraDatasourceNameSuffix(); final String taskSpec = StringUtils.replace( getTaskAsString(indexTaskFilePath), "%%DATASOURCE%%", fullDatasourceName ); long startSubTaskCount = -1; final boolean assertRunsSubTasks = taskSpec.contains("index_parallel"); if (assertRunsSubTasks) { startSubTaskCount = countCompleteSubTasks(fullDatasourceName); } submitTaskAndWait(taskSpec, fullDatasourceName, waitForNewVersion); if (assertRunsSubTasks) { final long newSubTasks = countCompleteSubTasks(fullDatasourceName) - startSubTaskCount; Assert.assertTrue("new sub tasks : " + newSubTasks, newSubTasks > 0); } try { String queryResponseTemplate; try { InputStream is = AbstractITBatchIndexTest.class.getResourceAsStream(queryFilePath); queryResponseTemplate = IOUtils.toString(is, "UTF-8"); } catch (IOException e) { throw new ISE(e, "could not read query file: %s", queryFilePath); } queryResponseTemplate = StringUtils.replace( queryResponseTemplate, "%%DATASOURCE%%", fullDatasourceName ); queryHelper.testQueriesFromString(queryResponseTemplate, 2); } catch (Exception e) { LOG.error(e, "Error while testing"); throw new RuntimeException(e); } }

Target:
void doIndexTestTest( String dataSource, String indexTaskFilePath, String queryFilePath, boolean waitForNewVersion ) throws IOException { final String fullDatasourceName = dataSource + config.getExtraDatasourceNameSuffix(); final String taskSpec = StringUtils.replace( getTaskAsString(indexTaskFilePath), "%%DATASOURCE%%", fullDatasourceName ); submitTaskAndWait(taskSpec, fullDatasourceName, waitForNewVersion); try { String queryResponseTemplate; try { InputStream is = AbstractITBatchIndexTest.class.getResourceAsStream(queryFilePath); queryResponseTemplate = IOUtils.toString(is, "UTF-8"); } catch (IOException e) { throw new ISE(e, "could not read query file: %s", queryFilePath); } queryResponseTemplate = StringUtils.replace( queryResponseTemplate, "%%DATASOURCE%%", fullDatasourceName ); queryHelper.testQueriesFromString(queryResponseTemplate, 2); } catch (Exception e) { LOG.error(e, "Error while testing"); throw new RuntimeException(e); } }
Source:
private CloudbreakImageCatalogV3 getImagesFromCatalog(Workspace workspace, com.sequenceiq.cloudbreak.cloud.model.Image image) throws CloudbreakImageCatalogException { String imageCatalogUrl; try { imageCatalogUrl = imageCatalogService.get(workspace.getId(), image.getImageCatalogName()).getImageCatalogUrl(); } catch (NotFoundException ex) { imageCatalogUrl = image.getImageCatalogUrl(); } return imageCatalogProvider.getImageCatalogV3(imageCatalogUrl); }

Target:
private CloudbreakImageCatalogV3 getImagesFromCatalog(Workspace workspace, com.sequenceiq.cloudbreak.cloud.model.Image image) throws CloudbreakImageCatalogException { String imageCatalogName = image.getImageCatalogName(); String imageCatalogUrl = image.getImageCatalogUrl(); try { imageCatalogUrl = imageCatalogService.get(workspace.getId(), imageCatalogName).getImageCatalogUrl(); LOGGER.info("Image catalog with name and url is used for image filtering.", imageCatalogName, imageCatalogUrl); } catch (NotFoundException ex) { LOGGER.info("Image catalog with name not found. The following image catalog url will be used for image filtering: {}.", imageCatalogName, imageCatalogUrl); } return imageCatalogProvider.getImageCatalogV3(imageCatalogUrl); }
Source:
private void closeQuietly(Socket socket) { try { socket.close(); } catch (Throwable t) { t.printStackTrace(); } }

Target:
private static void closeQuietly(Socket socket) { if (socket == null){ return; } try { socket.close(); } catch (IOException e) { e.printStackTrace(); } }
Source:
public Future<Long> write(ByteBuffer src, Callback<Long> callback) { if (src == null) { throw new IllegalArgumentException("Source buffer cannot be null"); } long bytesWritten = 0; Exception exception = null; FutureResult<Long> future = new FutureResult<Long>(); if (!isOpen()) { exception = new ClosedChannelException(); } else { byte[] srcData; int start = 0; int length = src.remaining(); if (src.hasArray()) { srcData = src.array(); start = src.arrayOffset(); } else { srcData = new byte[src.remaining()]; src.get(srcData); } try { data.write(srcData, start, length); bytesWritten = length; } catch (Exception e) { exception = e; } } future.done(bytesWritten, exception); if (callback != null) { callback.onCompletion(bytesWritten, exception); } return future; }

Target:
public Future<Long> write(ByteBuffer src, Callback<Long> callback) { if (src == null) { throw new IllegalArgumentException("Source buffer cannot be null"); } long bytesWritten = 0; Exception exception = null; FutureResult<Long> future = new FutureResult<Long>(); if (!isOpen()) { exception = new ClosedChannelException(); } else { byte[] srcData; int start = 0; int length = src.remaining(); if (src.hasArray()) { srcData = src.array(); start = src.arrayOffset(); } else { srcData = new byte[length]; src.get(srcData); } try { data.write(srcData, start, length); bytesWritten = length; } catch (Exception e) { exception = e; } } future.done(bytesWritten, exception); if (callback != null) { callback.onCompletion(bytesWritten, exception); } return future; }
Source:
private static Schema.Type getType(String name, PrimitiveObjectInspector.PrimitiveCategory category) { switch (category) { case BOOLEAN: return Schema.nullableOf(Schema.of(Schema.Type.BOOLEAN)).getType(); case BYTE: case CHAR: case SHORT: case INT: return Schema.nullableOf(Schema.of(Schema.Type.INT)).getType(); case LONG: return Schema.nullableOf(Schema.of(Schema.Type.LONG)).getType(); case FLOAT: return Schema.nullableOf(Schema.of(Schema.Type.FLOAT)).getType(); case DOUBLE: return Schema.nullableOf(Schema.of(Schema.Type.DOUBLE)).getType(); case STRING: case VARCHAR: return Schema.nullableOf(Schema.of(Schema.Type.STRING)).getType(); case BINARY: return Schema.nullableOf(Schema.of(Schema.Type.BYTES)).getType(); case VOID: return Schema.Type.NULL; case DATE: case TIMESTAMP: case DECIMAL: case UNKNOWN: default: throw new IllegalArgumentException(String.format("Table schema contains field '%s' with unsupported type %s", name, category.name())); } }

Target:
private static Schema getType(String name, PrimitiveObjectInspector.PrimitiveCategory category) { System.out.println("### primitive cat " + category); switch (category) { case BOOLEAN: return Schema.nullableOf(Schema.of(Schema.Type.BOOLEAN)); case BYTE: case SHORT: case INT: return Schema.nullableOf(Schema.of(Schema.Type.INT)); case LONG: return Schema.nullableOf(Schema.of(Schema.Type.LONG)); case FLOAT: return Schema.nullableOf(Schema.of(Schema.Type.FLOAT)); case DOUBLE: return Schema.nullableOf(Schema.of(Schema.Type.DOUBLE)); case CHAR: case STRING: case VARCHAR: return Schema.nullableOf(Schema.of(Schema.Type.STRING)); case BINARY: return Schema.nullableOf(Schema.of(Schema.Type.BYTES)); case VOID: case DATE: case TIMESTAMP: case DECIMAL: case UNKNOWN: default: throw new IllegalArgumentException(String.format("Table schema contains field '%s' with unsupported type %s", name, category.name())); } }
Source:
public void dispose() { super.dispose(); boldStylerProvider.dispose(); }

Target:
public void dispose() { if (boldStylerProvider != null) { boldStylerProvider.dispose(); } super.dispose(); }
Source:
public void update() { ticks++; if (world.isRemote) { if (ticks % (5 + world.rand.nextInt(10)) == 0 || targetPos == null) { updateLaser(); } } else { avgPower.tick(); previousTarget = targetPos != null ? targetPos.toImmutable() : null; if (getTarget() == null) { targetPos = null; } if (ticks % (10 + world.rand.nextInt(20)) == 0 || getTarget() == null) { findTarget(); } ILaserTarget target = getTarget(); if (target != null) { long max = getMaxPowerPerTick(); max *= battery.getStored() + max; max /= battery.getCapacity() / 2; max = Math.min(Math.min(max, getMaxPowerPerTick()), target.getRequiredLaserPower()); long power = battery.extractPower(0, max); long excess = target.receiveLaserPower(power); if (excess > 0) { battery.addPowerChecking(excess, false); } avgPower.push(power - excess); } else { avgPower.clear(); } if (changedTarget()) { sendNetworkUpdate(NET_RENDER_DATA); } } }

Target:
public void update() { if (world.isRemote) { if (clientLaserMoveInterval.markTimeIfDelay(world) || targetPos == null) { updateLaser(); } return; } avgPower.tick(); BlockPos previousTargetPos = targetPos; if (getTarget() == null) { targetPos = null; } if (serverTargetMoveInterval.markTimeIfDelay(world) || getTarget() == null) { findTarget(); } ILaserTarget target = getTarget(); if (target != null) { long max = getMaxPowerPerTick(); max *= battery.getStored() + max; max /= battery.getCapacity() / 2; max = Math.min(Math.min(max, getMaxPowerPerTick()), target.getRequiredLaserPower()); long power = battery.extractPower(0, max); long excess = target.receiveLaserPower(power); if (excess > 0) { battery.addPowerChecking(excess, false); } avgPower.push(power - excess); } else { avgPower.clear(); } if (!Objects.equals(previousTargetPos, targetPos)) { sendNetworkUpdate(NET_RENDER_DATA); } }
Source:
private void setBackgroundColor( View view, boolean selected, boolean read, Keyword firstTag) { if (selected || K9.useBackgroundAsUnreadIndicator()) { int res; if (selected) { res = R.attr.messageListSelectedBackgroundColor; } else { if (read) { res = R.attr.messageListReadItemBackgroundColor; } else { res = R.attr.messageListUnreadItemBackgroundColor; } } TypedValue outValue = new TypedValue(); fragment.getActivity().getTheme().resolveAttribute(res, outValue, true); int backgroundColor = outValue.data; if (firstTag != null) { if (K9.getK9Theme() == K9.Theme.LIGHT) { backgroundColor = firstTag.blendLightBackgroundColor(backgroundColor); } else { backgroundColor = firstTag.blendDarkBackgroundColor(backgroundColor); } } view.setBackgroundColor(backgroundColor); } else { view.setBackgroundColor(Color.TRANSPARENT); } }

Target:
private void setBackgroundColor( View view, boolean selected, boolean read, Keyword firstTag) { if (selected || K9.useBackgroundAsUnreadIndicator() || (K9.blendBackgroundWithTagColor() && firstTag != null)) { int res; if (selected) { res = R.attr.messageListSelectedBackgroundColor; } else if (K9.useBackgroundAsUnreadIndicator()) { if (read) { res = R.attr.messageListReadItemBackgroundColor; } else { res = R.attr.messageListUnreadItemBackgroundColor; } } else { res = R.attr.messageListReadItemBackgroundColor; } TypedValue outValue = new TypedValue(); fragment.getActivity().getTheme().resolveAttribute(res, outValue, true); int color = outValue.data; if (K9.blendBackgroundWithTagColor() && !selected) { color = blendBackgroundWithKeyword(color, firstTag); } view.setBackgroundColor(color); } else { view.setBackgroundColor(Color.TRANSPARENT); } }
Source:
public DocumentRevsList next() { if (!iteratorValid) { return null; } try { requestsOutstanding.decrementAndGet(); return completionService.take().get(); } catch (InterruptedException ie) { iteratorValid = false; throw new RuntimeException(ie); } catch (ExecutionException ee) { iteratorValid = false; throw new RuntimeException("Problem getting response from queue because the " + "original request threw an exception: ", ee.getCause()); } }

Target:
public DocumentRevsList next() { if (!iteratorValid) { throw new NoSuchElementException("Iterator has been invalidated"); } try { Future<DocumentRevsList> pollResult = completionService.poll(responseTimeout, responseTimeoutUnits); if (pollResult == null) { throw new NoSuchElementException("Poll timed out"); } requestsOutstanding.decrementAndGet(); return pollResult.get(); } catch (InterruptedException ie) { iteratorValid = false; throw new RuntimeException(ie); } catch (ExecutionException ee) { iteratorValid = false; throw new RuntimeException("Problem getting response from queue because the " + "original request threw an exception: ", ee.getCause()); } }
Source:
public void sendEventBundle(EventBundle events) { events = filterBundle(events); if (events.size() == 0) { return; } preProcessBundle(events); send(marshall(events)); }

Target:
public void sendEventBundle(EventBundle events) { events = filterBundle(events); if (events.isEmpty()) { return; } preProcessBundle(events); send(marshall(events)); }
Source:
public <T extends Entity> EntitySpec<T> resolveSpec(Set<String> encounteredCatalogTypes) { if (alreadyBuilt.getAndSet(true)) throw new IllegalStateException("Spec can only be used once: "+this); EntitySpec<?> spec = serviceSpecResolver.resolve(type, loader, encounteredCatalogTypes); if (spec == null) { final String msgDetails; CatalogItem<?, ?> item = CatalogUtils.getCatalogItemOptionalVersion(mgmt, Strings.removeFromStart(type, "catalog:")); String proto = Urls.getProtocol(type); if (item != null && encounteredCatalogTypes.contains(item.getSymbolicName())) { msgDetails = "Cycle between catalog items detected, starting from " + type + ". Other catalog items being resolved up the stack are " + encounteredCatalogTypes + ". Tried loading it as a Java class instead but failed."; } else if (proto != null) { msgDetails = "The reference " + type + " looks like a URL (running the CAMP Brooklyn assembly-template instantiator) but the protocol " + proto + " isn't white listed (" + BrooklynCampConstants.YAML_URL_PROTOCOL_WHITELIST + "). " + "Not a catalog item or java type as well."; } else { msgDetails = "No resolver knew how to handle it. Using resolvers: " + serviceSpecResolver; } throw new IllegalStateException("Unable to create spec for type " + type + ". " + msgDetails); } populateSpec(spec, encounteredCatalogTypes); @SuppressWarnings("unchecked") EntitySpec<T> typedSpec = (EntitySpec<T>) spec; return typedSpec; }

Target:
public <T extends Entity> EntitySpec<T> resolveSpec(Set<String> encounteredCatalogTypes) { if (alreadyBuilt.getAndSet(true)) throw new IllegalStateException("Spec can only be used once: "+this); EntitySpec<?> spec = serviceSpecResolver.resolve(type, loader, encounteredCatalogTypes); if (spec == null) { final String msgDetails; CatalogItem<?, ?> item = CatalogUtils.getCatalogItemOptionalVersion(mgmt, Strings.removeFromStart(type, "catalog:")); String proto = Urls.getProtocol(type); if (item != null && encounteredCatalogTypes.contains(item.getSymbolicName())) { msgDetails = "Cycle between catalog items detected, starting from " + type + ". Other catalog items being resolved up the stack are " + encounteredCatalogTypes + ". Tried loading it as a Java class instead but failed."; } else if (proto != null) { msgDetails = "The reference " + type + " looks like a URL (running the CAMP Brooklyn assembly-template instantiator) but the protocol " + proto + " isn't white listed (" + BrooklynCampConstants.YAML_URL_PROTOCOL_WHITELIST + "). " + "It's also neither a catalog item nor a java type."; } else { msgDetails = "No resolver knew how to handle it. Using resolvers: " + serviceSpecResolver; } throw new IllegalStateException("Unable to create spec for type " + type + ". " + msgDetails); } populateSpec(spec, encounteredCatalogTypes); @SuppressWarnings("unchecked") EntitySpec<T> typedSpec = (EntitySpec<T>) spec; return typedSpec; }
Source:
public List<BytecodeNode> getChildNodes() { return null; }

Target:
public List<BytecodeNode> getChildNodes() { return ImmutableList.of(); }
Source:
private boolean checkCreateInstancePermission(PermissionSubject permSubject) { final Set<VdcObjectType> overriddenPermissionObjectTypes = new HashSet<VdcObjectType>() {{ add(VdcObjectType.VdsGroups); add(VdcObjectType.VmTemplate); }}; final boolean isInstanceCreateObjectType = overriddenPermissionObjectTypes.contains(permSubject.getObjectType()); if (!isInstanceCreateObjectType) { return false; } final PermissionSubject alteredPermissionSubject = new PermissionSubject(permSubject.getObjectId(), permSubject.getObjectType(), ActionGroup.CREATE_INSTANCE, permSubject.getMessage()); return checkSinglePermission(alteredPermissionSubject, getReturnValue().getCanDoActionMessages()); }

Target:
private boolean checkCreateInstancePermission(PermissionSubject permSubject) { final List<VdcObjectType> overriddenPermissionObjectTypes = Arrays.asList( VdcObjectType.VdsGroups, VdcObjectType.VmTemplate); final boolean instanceCreateObjectType = overriddenPermissionObjectTypes.contains(permSubject.getObjectType()); if (!instanceCreateObjectType) { return false; } final PermissionSubject alteredPermissionSubject = new PermissionSubject(permSubject.getObjectId(), permSubject.getObjectType(), ActionGroup.CREATE_INSTANCE, permSubject.getMessage()); return checkSinglePermission(alteredPermissionSubject, getReturnValue().getCanDoActionMessages()); }
Source:
public static boolean isInteger( char[] digitChars, int offset, int len ) { String cmpStr = ( digitChars[offset] == '-' ) ? MIN_INT_STR_NO_SIGN : MAX_INT_STR; int cmpLen = cmpStr.length(); if ( len < cmpLen ) return true; if ( len > cmpLen ) return false; for ( int i = 0; i < cmpLen; ++i ) { int diff = digitChars[offset + i] - cmpStr.charAt( i ); if ( diff != 0 ) { return ( diff < 0 ); } } return true; }

Target:
public static boolean isInteger( char[] digitChars, int offset, int len ) { return isInteger(digitChars,offset,len,digitChars[offset] == '-'); }
Source:
public Map<String, Object> parseToMap(final String input) { if (!supportSkipHeaderRows && (hasHeaderRow || maxSkipHeaderRows > 0)) { throw new UnsupportedOperationException("hasHeaderRow or maxSkipHeaderRows is not supported. " + "Please check the indexTask supports these options."); } try { List<String> values = parseLine(input); if (skippedHeaderRows < maxSkipHeaderRows) { skippedHeaderRows++; return null; } if (hasHeaderRow && !hasParsedHeader) { if (fieldNames == null) { setFieldNames(values); } hasParsedHeader = true; return null; } if (fieldNames == null) { setFieldNames(ParserUtils.generateFieldNames(values.size())); } Map<String, String> fieldValueMap = Utils.zipMapPartial(fieldNames, values); return Maps.transformEntries(fieldValueMap, multiValueTransformer); } catch (Exception e) { throw new ParseException(e, "Unable to parse row [%s]", input); } }

Target:
public Map<String, Object> parseToMap(final String input) { if (!supportSkipHeaderRows && (hasHeaderRow || maxSkipHeaderRows > 0)) { throw new UnsupportedOperationException("hasHeaderRow or maxSkipHeaderRows is not supported. " + "Please check the indexTask supports these options."); } try { List<String> values = parseLine(input); if (skippedHeaderRows < maxSkipHeaderRows) { skippedHeaderRows++; return null; } if (hasHeaderRow && !hasParsedHeader) { if (fieldNames == null) { setFieldNames(values); } hasParsedHeader = true; return null; } if (fieldNames == null) { setFieldNames(ParserUtils.generateFieldNames(values.size())); } return computeKeyValues(fieldNames, values); } catch (Exception e) { throw new ParseException(e, "Unable to parse row [%s]", input); } }
Source:
protected void auditClass(Audit.Action action, ChangeSpec changeSpec) { Audit[] annotations = getResourceClass().getAnnotationsByType(Audit.class); if (annotations == null) { return; } for (Audit annotation : annotations) { for (Audit.Action auditAction : annotation.action()) { if (auditAction == action) { LogMessageImpl message = new LogMessageImpl(annotation, this, Optional.ofNullable(changeSpec)); getRequestScope().getAuditLogger().log(message); } } } }

Target:
protected void auditClass(Audit.Action action, ChangeSpec changeSpec) { Audit[] annotations = getResourceClass().getAnnotationsByType(Audit.class); if (annotations == null) { return; } for (Audit annotation : annotations) { for (Audit.Action auditAction : annotation.action()) { if (auditAction == action) { LogMessage message = new LogMessageImpl(annotation, this, Optional.ofNullable(changeSpec)); getRequestScope().getAuditLogger().log(message); } } } }
Source:
public static void main(String[] args) { PrintStream stderr = System.err; String suiteClassName = System.getProperty(TEST_SUITE_PROPERTY_NAME); if (args.length >= 1 && args[args.length - 1].equals("--persistent_test_runner")) { System.err.println("Requested test strategy is currently unsupported."); System.exit(1); } if (!checkTestSuiteProperty(suiteClassName)) { System.exit(2); } int exitCode; try { exitCode = runTestsInSuite(suiteClassName, args); } catch (Throwable e) { e.printStackTrace(System.err); exitCode = 1; } System.err.printf("%nBazelTestRunner exiting with a return value of %d%n", exitCode); System.err.println("JVM shutdown hooks (if any) will run now."); System.err.println("The JVM will exit once they complete."); System.err.println(); printStackTracesIfJvmExitHangs(stderr); DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date shutdownTime = new Date(); String formattedShutdownTime = format.format(shutdownTime); System.err.printf("-- JVM shutdown starting at %s --%n%n", formattedShutdownTime); System.exit(exitCode); }

Target:
public static void main(String[] args) { PrintStream stderr = System.err; String suiteClassName = System.getProperty(TEST_SUITE_PROPERTY_NAME); if (args.length >= 1 && args[args.length - 1].equals("--persistent_test_runner")) { System.err.println("Requested test strategy is currently unsupported."); System.exit(1); } if (!checkTestSuiteProperty(suiteClassName)) { System.exit(2); } int exitCode; try { exitCode = runTestsInSuite(suiteClassName, args); } catch (Throwable e) { e.printStackTrace(); exitCode = 1; } System.err.printf("%nBazelTestRunner exiting with a return value of %d%n", exitCode); System.err.println("JVM shutdown hooks (if any) will run now."); System.err.println("The JVM will exit once they complete."); System.err.println(); printStackTracesIfJvmExitHangs(stderr); DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date shutdownTime = new Date(); String formattedShutdownTime = format.format(shutdownTime); System.err.printf("-- JVM shutdown starting at %s --%n%n", formattedShutdownTime); System.exit(exitCode); }
Source:
protected IType getType(IBinding binding) { if (!isAnonymousBinding(binding)) { if (binding instanceof IVariable) { return ((IVariable) binding).getType(); } else { return null; } } return null; }

Target:
protected IType getType(IBinding binding) { if (!isAnonymousBinding(binding) && binding instanceof IVariable) return ((IVariable) binding).getType(); return null; }
Source:
public static String createFrame(ProtocolRead c) { String frame = null; String address[] = null; String who = null; String what = null; String where = null; who = c.getProperty("who"); what = c.getProperty("what"); address = c.getProperty("address").split("\\*"); where = address[0]; if (who.equalsIgnoreCase("4")) { if (what.substring(0, 2).equalsIgnoreCase("14")) { frame = "*#" + who + "*#" + where + "*#" + what + "##"; } else { switch (Integer.parseInt(what)) { case 40: frame = "*" + who + "*" + what + "*" + where + "##"; break; case 110: frame = "*#" + who + "*#" + where + "*#14*0200*3##"; break; default: frame = "*" + who + "*" + what + "*#" + where + "##"; break; } } } else { frame = "*" + who + "*" + what + "*" + where + "##"; } return (frame); }

Target:
public static String createFrame(ProtocolRead c) { String frame = null; String address[] = null; String who = null; String what = null; String where = null; who = c.getProperty("who"); what = c.getProperty("what"); address = c.getProperty("address").split("\\*"); where = address[0]; if (who.equals("4")) { if (what.substring(0, 2).equals("14")) { frame = "*#" + who + "*#" + where + "*#" + what + "##"; } else { switch (Integer.parseInt(what)) { case 40: frame = "*" + who + "*" + what + "*" + where + "##"; break; case 110: frame = "*#" + who + "*#" + where + "*#14*0200*3##"; break; default: frame = "*" + who + "*" + what + "*#" + where + "##"; break; } } } else { frame = "*" + who + "*" + what + "*" + where + "##"; } return (frame); }
Source:
public Blob getBlobFromJSON(ObjectNode jsonObject) { if (!(jsonObject.has("providerId") && jsonObject.has("key"))) { return null; } String providerId = jsonObject.get("providerId").textValue(); BlobProvider blobProvider = Framework.getService(BlobManager.class).getBlobProvider(providerId); if (blobProvider == null) { return null; } NuxeoPrincipal principal = ClientLoginModule.getCurrentPrincipal(); if (principal == null) { throw new NuxeoException("The current user does not have the rights to fetch the blob", HttpServletResponse.SC_UNAUTHORIZED); } String authorizedUser = blobProvider.getProperties().get(NUXEO_USER_PROPERTY); if (principal.isAdministrator() || (!principal.isAdministrator() && principal.getName().equals(authorizedUser))) { try { String key = providerId + ":" + jsonObject.get("key").textValue(); BlobInfo blobInfo = new BlobInfo(); blobInfo.key = key; return blobProvider.readBlob(blobInfo); } catch (IOException e) { throw new NuxeoException(e); } } else { throw new NuxeoException("The current user does not have the rights to fetch the blob", HttpServletResponse.SC_UNAUTHORIZED); } }

Target:
public Blob getBlobFromJSON(ObjectNode jsonObject) { if (!(jsonObject.has("providerId") && jsonObject.has("key"))) { return null; } String providerId = jsonObject.get("providerId").textValue(); BlobProvider blobProvider = Framework.getService(BlobManager.class).getBlobProvider(providerId); if (blobProvider == null) { return null; } if (!blobProvider.hasCreateFromKeyPermission()) { throw new NuxeoException("The current user does not have the rights to fetch the blob", HttpServletResponse.SC_UNAUTHORIZED); } try { BlobInfo blobInfo = new BlobInfo(); blobInfo.key = providerId + ":" + jsonObject.get("key").textValue(); return blobProvider.readBlob(blobInfo); } catch (IOException e) { throw new NuxeoException(e); } }
Source:
public void startServer() throws DataBridgeException, StreamDefinitionStoreException { try { msgCount.set(0); start(listeningPort); } catch (Throwable t) { t.printStackTrace(); } }

Target:
public void startServer() throws DataBridgeException, StreamDefinitionStoreException { msgCount.set(0); start(listeningPort); }
Source:
protected void executeCommand() { GlusterVolumeEntity volume = getGlusterVolume(); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.CommitRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(getUpServer().getId(), volume.getName(), getParameters().getBricks())); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS_COMMIT_FAILED, returnValue.getVdsError() .getMessage()); return; } endStepJobCommitted(); getDbUtils().removeBricksFromVolumeInDb(volume, getParameters().getBricks(), getParameters().getReplicaCount()); releaseVolumeLock(); getGlusterVolumeDao().updateVolumeTask(volume.getId(), null); getReturnValue().setActionReturnValue(returnValue.getReturnValue()); }

Target:
protected void executeCommand() { GlusterVolumeEntity volume = getGlusterVolume(); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.CommitRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(getUpServer().getId(), volume.getName(), getParameters().getBricks())); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS_COMMIT_FAILED, returnValue.getVdsError() .getMessage()); return; } endStepJobCommitted(); getDbUtils().removeBricksFromVolumeInDb(volume, getParameters().getBricks(), getParameters().getReplicaCount()); getGlusterVolumeDao().updateVolumeTask(volume.getId(), null); releaseVolumeLock(); getReturnValue().setActionReturnValue(returnValue.getReturnValue()); }
Source:
public void testSendInvoice() throws StripeException { InvoiceItem invItem = InvoiceItem.create(getInvoiceItemParams()); Map<String,Object> params = new HashMap<String,Object>(); Long dueDate = (System.currentTimeMillis() / 1000) + 600; params.put("customer", invItem.getCustomer()); params.put("billing", "send_invoice"); params.put("due_date", dueDate); Invoice invoice = Invoice.create(params); assertEquals(invoice.getBilling(), "send_invoice"); assertEquals(invoice.getDueDate(), dueDate); Map<String,Object> updateParams = new HashMap<String,Object>(); updateParams.put("paid", true); Invoice updatedInvoice = invoice.update(updateParams); assertEquals(updatedInvoice.getPaid(), true); }

Target:
public void testSendInvoice() throws StripeException { InvoiceItem invItem = InvoiceItem.create(getInvoiceItemParams()); Map<String,Object> params = new HashMap<String,Object>(); Long dueDate = (System.currentTimeMillis() / 1000) + 600; params.put("customer", invItem.getCustomer()); params.put("billing", "send_invoice"); params.put("due_date", dueDate); Invoice invoice = Invoice.create(params); assertEquals("send_invoice", invoice.getBilling()); assertEquals(dueDate, invoice.getDueDate()); Map<String,Object> updateParams = new HashMap<String,Object>(); updateParams.put("paid", true); Invoice updatedInvoice = invoice.update(updateParams); assertTrue(updatedInvoice.getPaid()); }
Source:
public AboutPageView(Binder uiBinder, CommonResource commonResource) { initWidget(uiBinder.createAndBindUi(this)); activeStyleName = commonResource.style().active(); $(buttonCanada).click(new Function() { @Override public void f() { $(buttonCanada).addClass(activeStyleName); $(buttonQuebec).removeClass(activeStyleName); $(canada).show(); $(quebec).hide(); } }); $(buttonQuebec).click(new Function() { @Override public void f() { $(buttonCanada).removeClass(activeStyleName); $(buttonQuebec).addClass(activeStyleName); $(quebec).show(); $(canada).hide(); } }); }

Target:
public AboutPageView(Binder uiBinder, CommonResource commonResource) { initWidget(uiBinder.createAndBindUi(this)); activeStyleName = commonResource.style().active(); $(buttonCanada).click(new Function() { @Override public void f() { $(buttonQuebec).removeClass(activeStyleName); $(buttonCanada).addClass(activeStyleName); $(canada).show(); $(quebec).hide(); } }); $(buttonQuebec).click(new Function() { @Override public void f() { $(buttonCanada).removeClass(activeStyleName); $(buttonQuebec).addClass(activeStyleName); $(quebec).show(); $(canada).hide(); } }); }
Source:
private void verifyDestinationStorage(Map<String, Storage.StoragePoolType> sourcePools, Host destHost) { if (MapUtils.isNotEmpty(sourcePools)) { LOGGER.debug("Verifying NFS source pools are already mounted on destination host " + destHost.getUuid()); CheckStorageAvailabilityCommand cmd = new CheckStorageAvailabilityCommand(sourcePools); try { Answer answer = _agentMgr.send(destHost.getId(), cmd); if (answer == null || !answer.getResult()) { throw new CloudRuntimeException("Storage verification failed on host " + destHost.getUuid() +": " + answer.getDetails()); } } catch (AgentUnavailableException | OperationTimedoutException e) { e.printStackTrace(); throw new CloudRuntimeException("Cannot perform storage verification on host " + destHost.getUuid() + "due to: " + e.getMessage()); } } }

Target:
private void verifyDestinationStorage(Map<String, Storage.StoragePoolType> sourcePools, Host destHost) { if (MapUtils.isNotEmpty(sourcePools)) { LOGGER.debug("Verifying source pools are already available on destination host " + destHost.getUuid()); CheckStorageAvailabilityCommand cmd = new CheckStorageAvailabilityCommand(sourcePools); try { Answer answer = agentManager.send(destHost.getId(), cmd); if (answer == null || !answer.getResult()) { throw new CloudRuntimeException("Storage verification failed on host " + destHost.getUuid() +": " + answer.getDetails()); } } catch (AgentUnavailableException | OperationTimedoutException e) { e.printStackTrace(); throw new CloudRuntimeException("Cannot perform storage verification on host " + destHost.getUuid() + "due to: " + e.getMessage()); } } }
Source:
private DlmsConnection createConnection() throws IOException { final byte[] authenticationKey = Hex.decode(this.getSecurityKey(SecurityKeyType.E_METER_AUTHENTICATION) .getKey()); final byte[] encryptionKey = Hex.decode(this.getSecurityKey(SecurityKeyType.E_METER_ENCRYPTION).getKey()); Authentication auth = Authentication.newGmacAuthentication(authenticationKey, encryptionKey); final TcpConnectionBuilder tcpConnectionBuilder = new TcpConnectionBuilder(InetAddress.getByName(this.device.getIpAddress())) .setAuthentication(auth) .setLogicalDeviceId(this.logicalDeviceAddress); final Integer challengeLength = this.device.getChallengeLength(); if (challengeLength != null) { tcpConnectionBuilder.setChallengeLength(challengeLength); } return tcpConnectionBuilder.buildLnConnection(); }

Target:
private DlmsConnection createConnection() throws IOException { final byte[] authenticationKey = Hex.decode(this.getSecurityKey(SecurityKeyType.E_METER_AUTHENTICATION) .getKey()); final byte[] encryptionKey = Hex.decode(this.getSecurityKey(SecurityKeyType.E_METER_ENCRYPTION).getKey()); Authentication auth = Authentication.newGmacAuthentication(authenticationKey, encryptionKey, CryptographicAlgorithm.AES_GMC_128); final TcpConnectionBuilder tcpConnectionBuilder = new TcpConnectionBuilder(InetAddress.getByName(this.device.getIpAddress())) .setAuthentication(auth) .setResponseTimeout(this.responseTimeout) .setLogicalDeviceId(this.logicalDeviceAddress) .setClientId(clientAccessPoint); final Integer challengeLength = this.device.getChallengeLength(); if (challengeLength != null) { tcpConnectionBuilder.setChallengeLength(challengeLength); } return tcpConnectionBuilder.buildLnConnection(); }
Source:
private void initArticleHeaderView() { pageHeaderView.setCallback(new PageHeaderView.Callback() { @Override public void onImageClicked() { openImageInGallery(null); } @Override public void onCallToActionClicked() { if (imageEditType == ImageEditType.ADD_TAGS) { getActivity().startActivityForResult(SuggestedEditsImageTagEditActivity.Companion.newIntent(getActivity(), imagePage), ACTIVITY_REQUEST_IMAGE_TAGS_EDIT); } if (imageEditType == ImageEditType.ADD_CAPTION_TRANSLATION ? (callToActionTargetSummary != null && callToActionSourceSummary != null) : callToActionSourceSummary != null) { getActivity().startActivityForResult(DescriptionEditActivity.newIntent(getActivity(), callToActionIsTranslation ? callToActionTargetSummary.getPageTitle() : callToActionSourceSummary.getPageTitle(), null, callToActionSourceSummary, callToActionTargetSummary, callToActionIsTranslation ? TRANSLATE_CAPTION : ADD_CAPTION, LEAD_IMAGE), ACTIVITY_REQUEST_IMAGE_CAPTION_EDIT); } } }); }

Target:
private void initArticleHeaderView() { pageHeaderView.setCallback(new PageHeaderView.Callback() { @Override public void onImageClicked() { openImageInGallery(null); } @Override public void onCallToActionClicked() { if (imageEditType == ImageEditType.ADD_TAGS) { getActivity().startActivityForResult(SuggestedEditsImageTagEditActivity.Companion.newIntent(getActivity(), imagePage), ACTIVITY_REQUEST_IMAGE_TAGS_EDIT); return; } if (imageEditType == ImageEditType.ADD_CAPTION_TRANSLATION ? (callToActionTargetSummary != null && callToActionSourceSummary != null) : callToActionSourceSummary != null) { getActivity().startActivityForResult(DescriptionEditActivity.newIntent(getActivity(), callToActionIsTranslation ? callToActionTargetSummary.getPageTitle() : callToActionSourceSummary.getPageTitle(), null, callToActionSourceSummary, callToActionTargetSummary, callToActionIsTranslation ? TRANSLATE_CAPTION : ADD_CAPTION, LEAD_IMAGE), ACTIVITY_REQUEST_IMAGE_CAPTION_EDIT); } } }); }
Source:
public void testGetOnlyQueriesCacheOnOwners() throws CacheLoaderException { prepareClearTest(); final MagicKey k = new MagicKey("key1", c1, c2); final String v1 = "real-data"; final String v2 = "stale-data"; CacheStore store = TestingUtil.extractComponent(c3, CacheLoaderManager.class).getCacheStore(); store.store(TestInternalCacheEntryFactory.create(k, v2)); c1.put(k, v1); assertEquals(v1, c3.get(k)); }

Target:
public void testGetOnlyQueriesCacheOnOwners() throws CacheLoaderException { final MagicKey k = new MagicKey("key1", c1, c2); final String v1 = "real-data"; final String v2 = "stale-data"; CacheStore store = TestingUtil.extractComponent(c3, CacheLoaderManager.class).getCacheStore(); store.store(TestInternalCacheEntryFactory.create(k, v2)); c1.put(k, v1); assertEquals(v1, c3.get(k)); }
Source:
public void start() throws Exception { defaultVersions.clear(); String[] userSpecifiedVersion = OseeServerProperties.getOseeVersion(); if (userSpecifiedVersion != null && userSpecifiedVersion.length > 0) { defaultVersions.addAll(Arrays.asList(userSpecifiedVersion)); } else { defaultVersions.add(OseeCodeVersion.getVersion()); } dataStore = new ApplicationServerDataStore(getLogger(), getDatabaseService()); serverInfo = createOseeServerInfo(getLogger(), dataStore, defaultVersions); timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { try { boolean wasRegistered = executeLookupRegistration(); setServletRequestsAllowed(wasRegistered); } catch (Exception ex) { getLogger().error(ex, "Error during lookup registration"); } finally { timer.cancel(); } } }, 5 * 1000); }

Target:
public void start() throws Exception { defaultVersions.clear(); String[] userSpecifiedVersion = OseeServerProperties.getOseeVersion(); if (Conditions.hasValues(userSpecifiedVersion)) { for (String version : userSpecifiedVersion) { defaultVersions.add(version); } } else { defaultVersions.add(OseeCodeVersion.getVersion()); } dataStore = new ApplicationServerDataStore(getLogger(), getDatabaseService()); serverInfo = createOseeServerInfo(getLogger(), dataStore, defaultVersions); timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { try { boolean wasRegistered = executeLookupRegistration(); setServletRequestsAllowed(wasRegistered); } catch (Exception ex) { getLogger().error(ex, "Error during lookup registration"); } finally { timer.cancel(); } } }, 5 * 1000); }
Source:
static int applyMaskPenaltyRule3(ByteMatrix matrix) { int numPenalties = 0; byte[][] array = matrix.getArray(); int width = matrix.getWidth(); int height = matrix.getHeight(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { byte[] arrayY = array[y]; if (x + 6 < width && arrayY[x + 0] == 1 && arrayY[x + 1] == 0 && arrayY[x + 2] == 1 && arrayY[x + 3] == 1 && arrayY[x + 4] == 1 && arrayY[x + 5] == 0 && arrayY[x + 6] == 1 && (isWhiteHorizontal(arrayY, x - 4, x) || isWhiteHorizontal(arrayY, x + 7, x + 11))) { numPenalties++; } if (y + 6 < height && array[y + 0][x] == 1 && array[y + 1][x] == 0 && array[y + 2][x] == 1 && array[y + 3][x] == 1 && array[y + 4][x] == 1 && array[y + 5][x] == 0 && array[y + 6][x] == 1 && (isWhiteVertical(array, x, y - 4, y) || isWhiteVertical(array, x, y + 7, y + 11))) { numPenalties++; } } } return numPenalties * N3; }

Target:
static int applyMaskPenaltyRule3(ByteMatrix matrix) { int numPenalties = 0; byte[][] array = matrix.getArray(); int width = matrix.getWidth(); int height = matrix.getHeight(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { byte[] arrayY = array[y]; if (x + 6 < width && arrayY[x] == 1 && arrayY[x + 1] == 0 && arrayY[x + 2] == 1 && arrayY[x + 3] == 1 && arrayY[x + 4] == 1 && arrayY[x + 5] == 0 && arrayY[x + 6] == 1 && (isWhiteHorizontal(arrayY, x - 4, x) || isWhiteHorizontal(arrayY, x + 7, x + 11))) { numPenalties++; } if (y + 6 < height && array[y][x] == 1 && array[y + 1][x] == 0 && array[y + 2][x] == 1 && array[y + 3][x] == 1 && array[y + 4][x] == 1 && array[y + 5][x] == 0 && array[y + 6][x] == 1 && (isWhiteVertical(array, x, y - 4, y) || isWhiteVertical(array, x, y + 7, y + 11))) { numPenalties++; } } } return numPenalties * N3; }
Source:
public void testPreserveAndPruneOldPacks() throws Exception { testPreserveOldPacks(); configureGc(gc, false).setPrunePreserved(true); gc.gc(); assertEquals(false, repo.getObjectDatabase().getPreservedDirectory().exists()); }

Target:
public void testPreserveAndPruneOldPacks() throws Exception { testPreserveOldPacks(); configureGc(gc, false).setPrunePreserved(true); gc.gc(); assertFalse(repo.getObjectDatabase().getPreservedDirectory().exists()); }