auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); OCFile file = getFile(); Bundle args = getArguments(); if (file == null) file = args.getParcelable(FileDisplayActivity.EXTRA_FILE); if (mAccount == null) mAccount = args.getParcelable(FileDisplayActivity.EXTRA_ACCOUNT); if (savedInstanceState == null) { if (file == null) { throw new IllegalStateException("Instanced with a NULL OCFile"); } if (mAccount == null) { throw new IllegalStateException("Instanced with a NULL ownCloud Account"); } } else { file = savedInstanceState.getParcelable(EXTRA_FILE); mAccount = savedInstanceState.getParcelable(EXTRA_ACCOUNT); } setFile(file); setHasOptionsMenu(true); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); OCFile file = getFile(); Bundle args = getArguments(); if (file == null) { file = args.getParcelable(FileDisplayActivity.EXTRA_FILE); } if (mAccount == null) { mAccount = args.getParcelable(FileDisplayActivity.EXTRA_ACCOUNT); } if (savedInstanceState == null) { if (file == null) { throw new IllegalStateException("Instanced with a NULL OCFile"); } if (mAccount == null) { throw new IllegalStateException("Instanced with a NULL ownCloud Account"); } } else { file = savedInstanceState.getParcelable(EXTRA_FILE); mAccount = savedInstanceState.getParcelable(EXTRA_ACCOUNT); } setFile(file); setHasOptionsMenu(true); }
Source:
public void cyl(CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession) throws WorldEditException { Pattern block = we.getBlockPattern(player, args.getString(0)); String[] radiuses = args.getString(1).split(","); final double radiusX, radiusZ; switch (radiuses.length) { case 1: radiusX = radiusZ = Math.max(1, Double.parseDouble(radiuses[0])); break; case 2: radiusX = Math.max(1, Double.parseDouble(radiuses[0])); radiusZ = Math.max(1, Double.parseDouble(radiuses[1])); break; default: player.printError("You must either specify 1 or 2 radius values."); return; } int height = args.argsLength() > 2 ? args.getInteger(2) : 1; Vector pos = session.getPlacementPosition(player); int affected = editSession.makeCylinder(pos, block, radiusX, radiusZ, height, true); player.findFreePosition(); player.print(affected + " block(s) have been created."); }

Target:
public void cyl(CommandContext args, LocalSession session, LocalPlayer player, EditSession editSession) throws WorldEditException { Pattern block = we.getBlockPattern(player, args.getString(0)); String[] radiuses = args.getString(1).split(","); final double radiusX, radiusZ; switch (radiuses.length) { case 1: radiusX = radiusZ = Math.max(1, Double.parseDouble(radiuses[0])); break; case 2: radiusX = Math.max(1, Double.parseDouble(radiuses[0])); radiusZ = Math.max(1, Double.parseDouble(radiuses[1])); break; default: player.printError("You must either specify 1 or 2 radius values."); return; } int height = args.argsLength() > 2 ? args.getInteger(2) : 1; Vector pos = session.getPlacementPosition(player); int affected = editSession.makeCylinder(pos, block, radiusX, radiusZ, height, true); player.print(affected + " block(s) have been created."); }
Source:
public boolean consumes(ISemanticToken token) { IASTNode node= token.getNode(); if (node instanceof IASTName) { if (node instanceof ICPPASTQualifiedName) { return false; } IBinding binding= token.getBinding(); if (binding instanceof ICPPEnumeration) { IType fType = ((ICPPEnumeration) binding).getFixedType(); return fType == null; } if (binding instanceof IEnumeration) { return true; } if (binding instanceof ICPPUnknownBinding) { if (heuristicallyResolvesToEnumeration((ICPPUnknownBinding) binding)) { return true; } } } return false; }

Target:
public boolean consumes(ISemanticToken token) { IASTNode node= token.getNode(); if (node instanceof IASTName) { if (node instanceof ICPPASTQualifiedName) { return false; } IBinding binding= token.getBinding(); if (binding instanceof ICPPUnknownBinding) { binding = heuristicallyResolvesToEnumeration((ICPPUnknownBinding) binding); } if (binding instanceof IEnumeration) { if (binding instanceof ICPPEnumeration) { return !((ICPPEnumeration) binding).isScoped(); } return true; } } return false; }
Source:
public List<GHAsset> getAssets() throws IOException { Requester builder = owner.root.retrieve().method("POST"); GHAsset[] assets = builder.method("GET").withUrlPath(getApiTailUrl("assets")).toArray(GHAsset[].class); return Arrays.asList(GHAsset.wrap(assets, this)); }

Target:
public List<GHAsset> getAssets() throws IOException { Requester builder = owner.root.createRequest(); GHAsset[] assets = builder.withUrlPath(getApiTailUrl("assets")).fetchArray(GHAsset[].class); return Arrays.asList(GHAsset.wrap(assets, this)); }
Source:
public XBee64BitAddress(int[] address) { this.address = new byte[address.length]; for (int i = 0; i < address.length; i++) this.address[i] = (byte)address[i]; }

Target:
public XBee64BitAddress(int[] address) { if (address == null) throw new NullPointerException("Address cannot be null."); if (address.length > 2) throw new IllegalArgumentException("Address cannot contain more than 8 integers."); this.address = new byte[address.length]; for (int i = 0; i < address.length; i++) this.address[i] = (byte)address[i]; }
Source:
private boolean hasImmutableAnnotation(DetailAST classDefToken) { final DetailAST modifiersToken = classDefToken.findFirstToken(TokenTypes.MODIFIERS); for (DetailAST ast = modifiersToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { if (ast.getType() == TokenTypes.ANNOTATION) { final DetailAST annotationIdent = ast.findFirstToken(TokenTypes.IDENT); return annotationIdent != null && IMMUTABLE_NOTATION.equals(annotationIdent.getText()); } } return false; }

Target:
private boolean hasImmutableAnnotation(DetailAST classDefToken) { DetailAST immutableAnnotation = AnnotationUtil.getAnnotation(classDefToken, IMMUTABLE_NOTATION); return immutableAnnotation != null; }
Source:
public void testConditionalReplaceFromNonOwner() { initAndTest(); Cache<Object, String> nonOwner = getFirstNonOwner("k1"); boolean retval = nonOwner.replace("k1", "valueX", "value2"); if (testRetVals) assertFalse(retval, "Should not have replaced"); assertOnAllCachesAndOwnership("k1", "value"); assertFalse(nonOwner.getAdvancedCache().getComponentRegistry().getComponent(DistributionManager.class).getCacheTopology().isWriteOwner("k1")); retval = nonOwner.replace("k1", "value", "value2"); asyncWait("k1", ReplaceCommand.class, getSecondNonOwner("k1")); if (testRetVals) assertTrue(retval,"Should have replaced"); assertOnAllCachesAndOwnership("k1", "value2"); }

Target:
public void testConditionalReplaceFromNonOwner() { initAndTest(); Cache<Object, String> nonOwner = getFirstNonOwner("k1"); boolean retval = nonOwner.replace("k1", "valueX", "value2"); if (testRetVals) assertFalse(retval, "Should not have replaced"); assertOnAllCachesAndOwnership("k1", "value"); assertFalse(extractComponent(nonOwner, DistributionManager.class).getCacheTopology().isWriteOwner("k1")); retval = nonOwner.replace("k1", "value", "value2"); asyncWait("k1", ReplaceCommand.class, getSecondNonOwner("k1")); if (testRetVals) assertTrue(retval,"Should have replaced"); assertOnAllCachesAndOwnership("k1", "value2"); }
Source:
private static String getVUSOncogenicSummary(Alteration alteration) { List<Evidence> evidences = EvidenceUtils.getEvidence(Collections.singletonList(alteration), Collections.singleton(EvidenceType.VUS), null); String summary = null; Date lastEdit = null; for (Evidence evidence : evidences) { if (evidence.getLastEdit() == null) { continue; } if (lastEdit == null) { lastEdit = evidence.getLastEdit(); } else if (lastEdit.compareTo(evidence.getLastEdit()) < 0) { lastEdit = evidence.getLastEdit(); } } if (lastEdit != null) { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); summary = "As of " + sdf.format(lastEdit) + ", no functional data about this alteration was available."; } return summary; }

Target:
private static String getVUSOncogenicSummary(Alteration alteration) { List<Evidence> evidences = EvidenceUtils.getEvidence(Collections.singletonList(alteration), Collections.singleton(EvidenceType.VUS), null); String summary = "no functional data about this alteration was available."; Date lastEdit = null; for (Evidence evidence : evidences) { if (evidence.getLastEdit() == null) { continue; } if (lastEdit == null) { lastEdit = evidence.getLastEdit(); } else if (lastEdit.compareTo(evidence.getLastEdit()) < 0) { lastEdit = evidence.getLastEdit(); } } if (lastEdit != null) { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); summary = "as of " + sdf.format(lastEdit) + ", " + summary; } return summary.substring(0, 1).toUpperCase() + summary.substring(1); }
Source:
public RefreshLocalVisitor(IProgressMonitor monitor) { this.monitor = SubMonitor.convert(monitor, TOTAL_WORK); workspace = (Workspace) ResourcesPlugin.getWorkspace(); resourceChanged = false; String msg = Messages.resources_errorMultiRefresh; errors = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IResourceStatus.FAILED_READ_LOCAL, msg, null); }

Target:
public RefreshLocalVisitor(IProgressMonitor monitor) { this.monitor = SubMonitor.convert(monitor); workspace = (Workspace) ResourcesPlugin.getWorkspace(); resourceChanged = false; String msg = Messages.resources_errorMultiRefresh; errors = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IResourceStatus.FAILED_READ_LOCAL, msg, null); }
Source:
public String getLanguage() { if (null == this.language) { return ""; } return this.language; }

Target:
public String getLanguage() { return this.language!=null ? this.language : "" ; }
Source:
private String getRelativeName(ObjectType objectType) { String name = objectType.getDisplayName(); if (name.equals(namespace)) { return name; } return !name.startsWith(namespace) ? name : name.substring(namespace.length() + 1); }

Target:
private String getRelativeName(ObjectType objectType) { String name = objectType.getDisplayName(); return !name.startsWith(namespace) ? name : name.substring(namespace.length() + 1); }
Source:
public Stage rerunStage(String pipelineName, String pipelineCounter, String stageName, HttpOperationResult result) { String identifier = StringUtils.join(Arrays.asList(pipelineName, pipelineCounter, stageName), "/"); HealthStateType healthStateType = HealthStateType.general(HealthStateScope.forStage(pipelineName, stageName)); Stage stage = null; try { stage = rerunStage(pipelineName, pipelineCounter, stageName, new ResultUpdatingErrorHandler(result)); if (result.isSuccess()) { result.accepted(String.format("Request to schedule stage %s accepted", identifier), "", healthStateType); } } catch (RuntimeException e) { String message = String.format( "Stage rerun request for stage [%s] could not be completed " + "because of an unexpected failure. Cause: %s", identifier, e.getMessage() ); LOGGER.error(message, e); result.internalServerError(message, healthStateType); } return stage; }

Target:
public Stage rerunStage(String pipelineName, String pipelineCounter, String stageName, HttpOperationResult result) { String identifier = StringUtils.join(Arrays.asList(pipelineName, pipelineCounter, stageName), "/"); HealthStateType healthStateType = HealthStateType.general(HealthStateScope.forStage(pipelineName, stageName)); Stage stage = null; try { stage = rerunStage(pipelineName, pipelineCounter, stageName, new ResultUpdatingErrorHandler(result)); if (result.isSuccess()) { result.accepted(String.format("Request to schedule stage %s accepted", identifier), "", healthStateType); } } catch (RuntimeException e) { if (result.isSuccess()) { String message = String.format( "Stage rerun request for stage [%s] could not be completed " + "because of an unexpected failure. Cause: %s", identifier, e.getMessage() ); LOGGER.error(message, e); result.internalServerError(message, healthStateType); } } return stage; }
Source:
public int getOpacity() { Bitmap bm = bitmap; return (bm == null || bm.hasAlpha() || bitmapPaint.getAlpha() < 255) ? PixelFormat.TRANSLUCENT : PixelFormat.OPAQUE; }

Target:
@Override public int getOpacity() { Bitmap bm = bitmap; return (bm.hasAlpha() || bitmapPaint.getAlpha() < 255) ? PixelFormat.TRANSLUCENT : PixelFormat.OPAQUE; }
Source:
public <U> Vector<U> map(Function<? super T, ? extends U> mapper) { Objects.requireNonNull(mapper, "mapper is null"); final AtomicReference<Object[]> newLeading = new AtomicReference<>(Arrays.empty()); final Object[] newMiddle = new Object[middle.leafCount()]; final AtomicReference<Object[]> newTrailing = new AtomicReference<>(Arrays.empty()); unsafeLeafIterator((leafCount, array, arrayStart, arrayLength) -> { final Object[] copy = copyMap(mapper, array, arrayStart, arrayStart + arrayLength); if (leafCount == 0) { newLeading.set(copy); } else if (leafCount <= newMiddle.length) { newMiddle[leafCount - 1] = copy; } else { newTrailing.set(copy); } }); final BitMappedTrie<U> middle = BitMappedTrie.ofAll(newMiddle, this.middle.length(), BRANCHING_BASE); return ofAll(newLeading.get(), leadingOffset, middle, newTrailing.get(), trailingLength); }

Target:
public <U> Vector<U> map(Function<? super T, ? extends U> mapper) { return ofAll(trie.map(mapper)); }
Source:
private File getScriptFile() { URL logbackTestUrl = DescribeIT.class.getResource("/logback-test.xml"); if (logbackTestUrl == null || logbackTestUrl.getFile().isEmpty()) { fail( "Expected to use logback-test.xml to determine location of " + "target/test-classes, but got URL %s", logbackTestUrl); } File resourcesDir = new File(logbackTestUrl.getFile()).getParentFile(); File scriptsDir = new File(resourcesDir, isDse ? "DescribeIT/dse" : "DescribeIT/oss"); LOG.debug("Looking for a matching script in directory {}", scriptsDir); File[] candidates = scriptsDir.listFiles(); assertThat(candidates).isNotNull(); File bestFile = null; Version bestVersion = null; for (File candidate : candidates) { String fileName = candidate.getName(); String candidateVersionString = fileName.substring(0, fileName.lastIndexOf('.')); Version candidateVersion = Version.parse(candidateVersionString); LOG.debug("Considering {}, which resolves to version {}", fileName, candidateVersion); if (candidateVersion.compareTo(serverVersion) > 0) { LOG.debug("too high, discarding"); } else if (bestVersion != null && bestVersion.compareTo(candidateVersion) >= 0) { LOG.debug("not higher than {}, discarding", bestVersion); } else { LOG.debug("best so far"); bestVersion = candidateVersion; bestFile = candidate; } } if (bestFile == null) { fail("Could not find create script with version <= %s in %s", serverVersion, scriptsDir); throw new AssertionError(); } else { LOG.info( "Using to test against {}", bestFile, isDse ? "DSE" : "Cassandra", serverVersion); return bestFile; } }

Target:
private File getScriptFile() { URL logbackTestUrl = DescribeIT.class.getResource("/logback-test.xml"); if (logbackTestUrl == null || logbackTestUrl.getFile().isEmpty()) { fail( "Expected to use logback-test.xml to determine location of " + "target/test-classes, but got URL %s", logbackTestUrl); } File resourcesDir = new File(logbackTestUrl.getFile()).getParentFile(); File scriptsDir = new File(resourcesDir, isDse ? "DescribeIT/dse" : "DescribeIT/oss"); LOG.debug("Looking for a matching script in directory {}", scriptsDir); File[] candidates = scriptsDir.listFiles(); assertThat(candidates).isNotNull(); File bestFile = null; Version bestVersion = null; for (File candidate : candidates) { String fileName = candidate.getName(); String candidateVersionString = fileName.substring(0, fileName.lastIndexOf('.')); Version candidateVersion = Version.parse(candidateVersionString); LOG.debug("Considering {}, which resolves to version {}", fileName, candidateVersion); if (candidateVersion.compareTo(serverVersion) > 0) { LOG.debug("too high, discarding"); } else if (bestVersion != null && bestVersion.compareTo(candidateVersion) >= 0) { LOG.debug("not higher than {}, discarding", bestVersion); } else { LOG.debug("best so far"); bestVersion = candidateVersion; bestFile = candidate; } } assertThat(bestFile) .as("Could not find create script with version <= %s in %s", serverVersion, scriptsDir) .isNotNull(); LOG.info( "Using to test against {}", bestFile, isDse ? "DSE" : "Cassandra", serverVersion); return bestFile; }
Source:
private static String selectionToString(Table table) { StringBuilder buffer = new StringBuilder(); for (TableItem tableItem : table.getSelection()) { if (buffer.length() > 0) { buffer.append(System.lineSeparator()); } for (int column = 0; column < table.getColumnCount(); column++) { if (column > 0) { buffer.append('\t'); } buffer.append(tableItem.getText(column)); } } return buffer.toString(); }

Target:
private static String selectionToString(Table table) { StringBuilder builder = new StringBuilder(); for (TableItem tableItem : table.getSelection()) { if (builder.length() > 0) { builder.append(System.lineSeparator()); } for (int column = 0; column < table.getColumnCount(); column++) { if (column > 0) { builder.append('\t'); } builder.append(tableItem.getText(column)); } } return builder.toString(); }
Source:
public static final Image getDecoratedImage(final Image decoratorTarget, final List<IPapyrusDecoration> decorations, final Point size) { if (decoratorTarget == null) { return null; } if (decorations == null) { return decoratorTarget; } Image decoratedImage = null; String decoratedImageId = calcId(decoratorTarget, decorations); decoratedImage = Activator.getDefault().getImageRegistry().get(decoratedImageId); if (decoratedImage == null) { ImageDescriptor[] decorationImages = new ImageDescriptor[5]; IPapyrusDecoration[] decorationByPosition = new IPapyrusDecoration[5]; for (IPapyrusDecoration decoration : decorations) { IPapyrusDecoration existingDecoration = decorationByPosition[decoration.getPositionForJFace()]; if (existingDecoration == null || existingDecoration.getPriority() < decoration.getPriority()) { decorationImages[decoration.getPositionForJFace()] = decoration.getDecorationImageForME(); decorationByPosition[decoration.getPositionForJFace()] = decoration; } } ImageDescriptor decoratedImageDesc = new DecorationOverlayIcon(decoratorTarget, decorationImages, size); Activator.getDefault().getImageRegistry().put(decoratedImageId, decoratedImageDesc); return Activator.getDefault().getImageRegistry().get(decoratedImageId); } return decoratedImage; }

Target:
public static final Image getDecoratedImage(final Image decoratorTarget, final List<IPapyrusDecoration> decorations, final Point size) { if (decoratorTarget == null) { return null; } if (decorations == null) { return decoratorTarget; } Image decoratedImage = null; String decoratedImageId = calcId(decoratorTarget, decorations); decoratedImage = Activator.getDefault().getImageRegistry().get(decoratedImageId); if (decoratedImage == null) { ImageDescriptor[] decorationImages = new ImageDescriptor[NB_DECORATIONS]; IPapyrusDecoration[] decorationByPosition = new IPapyrusDecoration[NB_DECORATIONS]; for (IPapyrusDecoration decoration : decorations) { IPapyrusDecoration existingDecoration = decorationByPosition[decoration.getPositionForJFace()]; if (existingDecoration == null || existingDecoration.getPriority() < decoration.getPriority()) { decorationImages[decoration.getPositionForJFace()] = decoration.getDecorationImageForME(); decorationByPosition[decoration.getPositionForJFace()] = decoration; } } ImageDescriptor decoratedImageDesc = new DecorationOverlayIcon(decoratorTarget, decorationImages, size); Activator.getDefault().getImageRegistry().put(decoratedImageId, decoratedImageDesc); return Activator.getDefault().getImageRegistry().get(decoratedImageId); } return decoratedImage; }
Source:
public boolean doPreDeleteIdP(String idPName) throws IdentityProviderManagementException { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext() .getTenantDomain(); try { destroyConnector(idPName, tenantDomain); } catch (IdentityProvisioningException e) { log.error("Error when provisioning IDP deletion", e); throw new IdentityProviderManagementException("Error when provisioning IDP deletion",e); } return true; }

Target:
public boolean doPreDeleteIdP(String idPName) throws IdentityProviderManagementException { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext() .getTenantDomain(); try { destroyConnector(idPName, tenantDomain); } catch (IdentityProvisioningException e) { throw new IdentityProviderManagementException("Error when provisioning IDP deletion", e); } return true; }
Source:
private Optional<Metacard> generateMetacard( MimeType mimeType, MimeTypeToTransformerMapper mapper, TemporaryFileBackedOutputStream tfbos, String metacardId) { LOGGER.trace("ENTERING: generateMetacard"); List<InputTransformer> listOfCandidates = mapper.findMatches(InputTransformer.class, mimeType); if (LOGGER.isDebugEnabled()) { LOGGER.debug("List of matches for mimeType [{}]: {}", mimeType, listOfCandidates); } Metacard generatedMetacard = null; for (InputTransformer transformer : listOfCandidates) { try (InputStream inputStreamMessageCopy = tfbos.asByteSource().openStream()) { if (StringUtils.isEmpty(metacardId)) { generatedMetacard = transformer.transform(inputStreamMessageCopy); } else { generatedMetacard = transformer.transform(inputStreamMessageCopy, metacardId); } } catch (CatalogTransformerException e) { LOGGER.debug("Transformer could not create metacard.", transformer, e); } catch (IOException e) { LOGGER.debug("Could not open input stream", e); } if (generatedMetacard != null) { break; } } if (generatedMetacard == null) { return Optional.empty(); } LOGGER.trace("EXITING: generateMetacard"); return Optional.of(generatedMetacard); }

Target:
private Optional<Metacard> generateMetacard( MimeType mimeType, MimeTypeToTransformerMapper mapper, TemporaryFileBackedOutputStream tfbos, String metacardId) { LOGGER.trace("ENTERING: generateMetacard"); List<InputTransformer> listOfCandidates = mapper.findMatches(InputTransformer.class, mimeType); if (LOGGER.isDebugEnabled()) { LOGGER.debug("List of matches for mimeType [{}]: {}", mimeType, listOfCandidates); } Metacard generatedMetacard = null; for (InputTransformer transformer : listOfCandidates) { try (InputStream inputStreamMessageCopy = tfbos.asByteSource().openStream()) { if (StringUtils.isEmpty(metacardId)) { generatedMetacard = transformer.transform(inputStreamMessageCopy); } else { generatedMetacard = transformer.transform(inputStreamMessageCopy, metacardId); } } catch (CatalogTransformerException e) { LOGGER.debug("Transformer could not create metacard.", transformer, e); } catch (IOException e) { LOGGER.debug("Could not open input stream", e); } if (generatedMetacard != null) { break; } } LOGGER.trace("EXITING: generateMetacard"); return Optional.ofNullable(generatedMetacard); }
Source:
public void addFeatures() { DefaultBiomeFeatures.addStructures(this); DefaultBiomeFeatures.addStoneVariants(this); DefaultBiomeFeatures.addOres(this); addFeature(GenerationStage.Decoration.SURFACE_STRUCTURES, Biome.createDecoratedFeature(TropicraftFeatures.VILLAGE.get(), IFeatureConfig.NO_FEATURE_CONFIG, Placement.NOPE, IPlacementConfig.NO_PLACEMENT_CONFIG)); addStructure(TropicraftFeatures.VOLCANO.get(), IFeatureConfig.NO_FEATURE_CONFIG); addFeature(GenerationStage.Decoration.SURFACE_STRUCTURES, createDecoratedFeature(TropicraftFeatures.VOLCANO.get(), IFeatureConfig.NO_FEATURE_CONFIG, Placement.NOPE, IPlacementConfig.NO_PLACEMENT_CONFIG)); addStructure(TropicraftFeatures.HOME_TREE.get(), new VillageConfig(Constants.MODID + ":home_tree/starts", 10)); addFeature(GenerationStage.Decoration.SURFACE_STRUCTURES, createDecoratedFeature(TropicraftFeatures.HOME_TREE.get(), new VillageConfig(Constants.MODID + ":home_tree/starts", 10), Placement.NOPE, IPlacementConfig.NO_PLACEMENT_CONFIG)); }

Target:
public void addFeatures() { DefaultBiomeFeatures.addStructures(this); DefaultBiomeFeatures.addStoneVariants(this); DefaultBiomeFeatures.addOres(this); addFeature(GenerationStage.Decoration.SURFACE_STRUCTURES, Biome.createDecoratedFeature(TropicraftFeatures.VILLAGE.get(), IFeatureConfig.NO_FEATURE_CONFIG, Placement.NOPE, IPlacementConfig.NO_PLACEMENT_CONFIG)); addStructure(TropicraftFeatures.VOLCANO.get(), IFeatureConfig.NO_FEATURE_CONFIG); addFeature(GenerationStage.Decoration.SURFACE_STRUCTURES, createDecoratedFeature(TropicraftFeatures.VOLCANO.get(), IFeatureConfig.NO_FEATURE_CONFIG, Placement.NOPE, IPlacementConfig.NO_PLACEMENT_CONFIG)); }
Source:
@After public void agentCleanup() throws IOException, InterruptedException { if (testExecuted) { s.toComputer().disconnect(new OfflineCause.UserCause(null, null)); j.jenkins.removeNode(s); } }

Target:
@After public void agentCleanup() throws IOException, InterruptedException { if (s != null) { j.jenkins.removeNode(s); } }
Source:
private static @Nullable State getEventState(TimeEvent event) { if (event.hasValue()) { int value = event.getValue(); if (value == StateValues.READING_REQUEST) { return State.READ; } else if (value == StateValues.WRITING_REQUEST) { return State.WRITE; } } if (event instanceof TimeLinkEvent) { return State.LINK; } return null; }

Target:
private static @Nullable State getEventState(TimeEvent event) { if (event.hasValue()) { int value = event.getValue(); if (value == StateValues.READING_REQUEST) { return State.READ; } else if (value == StateValues.WRITING_REQUEST) { return State.WRITE; } throw new IllegalStateException("Disk Request Presentation provider: Unknown value: " + value); } if (event instanceof TimeLinkEvent) { return State.LINK; } return null; }
Source:
public Collection<ParameterOption> getParameterOptions(URI uri, String param, Locale locale) { if (uri.toString().equals("system:i18n")) { Locale translation = locale != null ? locale : Locale.getDefault(); switch (param) { case "language": return getAvailable(locale, l -> new ParameterOption(l.getLanguage(), l.getDisplayLanguage(translation))); case "region": return getAvailable(locale, l -> new ParameterOption(l.getCountry(), l.getDisplayCountry(translation))); case "variant": return getAvailable(locale, l -> new ParameterOption(l.getVariant(), l.getDisplayVariant(translation))); case "timezone": Collection<ParameterOption> collection = new LinkedList<ParameterOption>(); String[] ids = TimeZone.getAvailableIDs(); List<TimeZone> timeZones = Arrays.asList(ids).stream().map(TimeZone::getTimeZone) .collect(Collectors.toList()); Collections.sort(timeZones, (s1, s2) -> s2.getRawOffset() - s1.getRawOffset()); for (TimeZone instance : timeZones) { collection.add(new ParameterOption(instance.getID(), getTimeZoneRepresentation(instance))); } return collection; default: return null; } } return null; }

Target:
public Collection<ParameterOption> getParameterOptions(URI uri, String param, Locale locale) { if (uri.toString().equals("system:i18n")) { Locale translation = locale != null ? locale : Locale.getDefault(); return processParamType(param, locale, translation); } return null; }
Source:
public static void main(String[] args) { try { String mode = args[0]; if ("stop".equals(mode)) { ServerLauncher.shutdown(true); } else { new OxdServerApplication().run(args); } } catch (Throwable e) { LOG.error("Failed to start oxd-server.", e); System.exit(1); } }

Target:
public static void main(String[] args) { try { if (args.length > 0 && "stop".equalsIgnoreCase(args[0])) { ServerLauncher.shutdown(true); return; } else { new OxdServerApplication().run(args); } } catch (Throwable e) { if (args.length > 0 && "stop".equalsIgnoreCase(args[0])) { LOG.error("Failed to stop oxd-server.", e); } else { LOG.error("Failed to start oxd-server.", e); } System.exit(1); } }
Source:
public void generateLibraryRs() throws MojoExecutionException { final Multimap<String, SymbolLoader> libMap = ArrayListMultimap.create(); for ( final Artifact lib : libraries ) { final File unpackedLibDirectory = mojo.getUnpackedLibFolder( lib ); final File rFile = new File( unpackedLibDirectory, "R.txt" ); if ( rFile.isFile() ) { final File libManifestFile = new File( unpackedLibDirectory, "AndroidManifest.xml" ); final String packageName = VariantConfiguration.getManifestPackage( libManifestFile ); log.debug( "Reading R for " + packageName + " at " + rFile ); final SymbolLoader libSymbols = loadSymbols( rFile ); libMap.put( packageName, libSymbols ); } } if ( libMap.isEmpty() ) { return; } final File projectR = new File( targetDirectory, "R.txt" ); final SymbolLoader fullSymbolValues = loadSymbols( projectR ); for ( final String packageName : libMap.keySet() ) { log.info( "Generating R file for aar: " + packageName ); final Collection<SymbolLoader> symbols = libMap.get( packageName ); final SymbolWriter writer = new SymbolWriter( genDirectory.getAbsolutePath(), packageName, fullSymbolValues ); for ( SymbolLoader symbolLoader : symbols ) { writer.addSymbolsToWrite( symbolLoader ); } writeSymbols( writer, packageName ); } }

Target:
public void generateLibraryRs() throws MojoExecutionException { final Multimap<String, SymbolLoader> libMap = ArrayListMultimap.create(); for ( final Artifact lib : libraries ) { final File unpackedLibDirectory = mojo.getUnpackedLibFolder( lib ); final File rFile = new File( unpackedLibDirectory, "R.txt" ); if ( rFile.isFile() ) { final File libManifestFile = new File( unpackedLibDirectory, "AndroidManifest.xml" ); final String packageName = VariantConfiguration.getManifestPackage( libManifestFile ); log.debug( "Reading R for " + packageName + " at " + rFile ); final SymbolLoader libSymbols = loadSymbols( rFile ); libMap.put( packageName, libSymbols ); } } if ( libMap.isEmpty() ) { return; } final File projectR = new File( targetDirectory, "R.txt" ); final SymbolLoader fullSymbolValues = loadSymbols( projectR ); for ( final String packageName : libMap.keySet() ) { log.info( "Generating R file for " + libraryType + " : " + packageName ); final Collection<SymbolLoader> symbols = libMap.get( packageName ); final SymbolWriter writer = new SymbolWriter( genDirectory.getAbsolutePath(), packageName, fullSymbolValues ); for ( SymbolLoader symbolLoader : symbols ) { writer.addSymbolsToWrite( symbolLoader ); } writeSymbols( writer, packageName ); } }
Source:
static String getSQL(Token[] statement) { boolean wasDelimiter = true; StringBuffer sb = new StringBuffer(); for (int i = 0; i < statement.length; i++) { if (!statement[i].isDelimiter && (!wasDelimiter || (i != 0 && statement[i - 1].getSQL().equals(")")))) { sb.append(' '); } sb.append(statement[i].getSQL()); wasDelimiter = statement[i].isDelimiter; } return sb.toString(); }

Target:
static String getSQL(Token[] statement) { boolean wasDelimiter = true; StringBuffer sb = new StringBuffer(); for (int i = 0; i < statement.length; i++) { if (!statement[i].isDelimiter && (!wasDelimiter || (i > 0 && ")".equals(statement[i - 1].getSQL())))) { sb.append(' '); } sb.append(statement[i].getSQL()); wasDelimiter = statement[i].isDelimiter; } return sb.toString(); }
Source:
RequestStatus getStatus() { FreenetURI finalURI = getFinalURI(); InsertExceptionMode failureCode = null; String failureReasonShort = null; String failureReasonLong = null; if(putFailedMessage != null) { failureCode = putFailedMessage.code; failureReasonShort = putFailedMessage.getShortFailedMessage(); failureReasonShort = putFailedMessage.getLongFailedMessage(); } String mimeType = null; if(persistence == Persistence.FOREVER) { mimeType = clientMetadata.getMIMEType(); } File fnam = getOrigFilename(); if(fnam != null) fnam = new File(fnam.getPath()); int total=0, min=0, fetched=0, fatal=0, failed=0; Date latestSuccess = CurrentTimeUTC.get(), latestFailure = null; boolean totalFinalized = false; if(progressMessage != null) { if(progressMessage instanceof SimpleProgressMessage) { SimpleProgressMessage msg = (SimpleProgressMessage)progressMessage; total = (int) msg.getTotalBlocks(); min = (int) msg.getMinBlocks(); fetched = (int) msg.getFetchedBlocks(); latestSuccess = msg.getLatestSuccess(); fatal = (int) msg.getFatalyFailedBlocks(); failed = (int) msg.getFailedBlocks(); latestFailure = msg.getLatestFailure(); totalFinalized = msg.isTotalFinalized(); } } return new UploadFileRequestStatus( identifier, persistence, started, finished, succeeded, total, min, fetched, latestSuccess, fatal, failed, latestFailure, totalFinalized, priorityClass, finalURI, uri, failureCode, failureReasonShort, failureReasonLong, getDataSize(), mimeType, fnam, isCompressing()); }

Target:
RequestStatus getStatus() { FreenetURI finalURI = getFinalURI(); InsertExceptionMode failureCode = null; String failureReasonShort = null; String failureReasonLong = null; if(putFailedMessage != null) { failureCode = putFailedMessage.code; failureReasonShort = putFailedMessage.getShortFailedMessage(); failureReasonShort = putFailedMessage.getLongFailedMessage(); } String mimeType = null; if(persistence == Persistence.FOREVER) { mimeType = clientMetadata.getMIMEType(); } File fnam = getOrigFilename(); if(fnam != null) fnam = new File(fnam.getPath()); int total=0, min=0, fetched=0, fatal=0, failed=0; Date latestSuccess = CurrentTimeUTC.get(); Date latestFailure = null; boolean totalFinalized = false; if(progressMessage != null) { if(progressMessage instanceof SimpleProgressMessage) { SimpleProgressMessage msg = (SimpleProgressMessage)progressMessage; total = (int) msg.getTotalBlocks(); min = (int) msg.getMinBlocks(); fetched = (int) msg.getFetchedBlocks(); latestSuccess = msg.getLatestSuccess(); fatal = (int) msg.getFatalyFailedBlocks(); failed = (int) msg.getFailedBlocks(); latestFailure = msg.getLatestFailure(); totalFinalized = msg.isTotalFinalized(); } } return new UploadFileRequestStatus( identifier, persistence, started, finished, succeeded, total, min, fetched, latestSuccess, fatal, failed, latestFailure, totalFinalized, priorityClass, finalURI, uri, failureCode, failureReasonShort, failureReasonLong, getDataSize(), mimeType, fnam, isCompressing()); }
Source:
public Set<Warning> getWarnings() { ExtensionList<UpdateSiteWarningsConfiguration> list = ExtensionList.lookup(UpdateSiteWarningsConfiguration.class); if (list.size() == 0) { return null; } Set<Warning> warnings = new HashSet<>(); UpdateSiteWarningsConfiguration configuration = list.get(0); for (Warning warning: configuration.getAllWarnings()) { if (configuration.isIgnored(warning)) { continue; } if (!warning.isPluginWarning(this.name)) { continue; } if (!warning.isRelevantToVersion(new VersionNumber(this.version))) { continue; } warnings.add(warning); } return warnings; }

Target:
public Set<Warning> getWarnings() { ExtensionList<UpdateSiteWarningsConfiguration> list = ExtensionList.lookup(UpdateSiteWarningsConfiguration.class); if (list.size() == 0) { return Collections.emptySet(); } Set<Warning> warnings = new HashSet<>(); UpdateSiteWarningsConfiguration configuration = list.get(0); for (Warning warning: configuration.getAllWarnings()) { if (configuration.isIgnored(warning)) { continue; } if (!warning.isPluginWarning(this.name)) { continue; } if (!warning.isRelevantToVersion(new VersionNumber(this.version))) { continue; } warnings.add(warning); } return warnings; }
Source:
public void testTxRemoteNodeFailover(){ withAllIsolationsAndConcurrencies(new IgniteClosure<Object, Void>() { @Override public Void apply(Object o) { try { txRemoteNodeFailover(); } catch (Exception ignore) { ignore.printStackTrace(); assert false : "Impossible situation"; } return null; } }); }

Target:
public void testTxRemoteNodeFailover() throws Exception { startGrid(getTestIgniteInstanceName(0)); runWithAllIsolations(new IgniteCallable<Void>() { @Override public Void call() throws Exception { txRemoteNodeFailover(); return null; } }); stopAllGrids(); }
Source:
private static void ignoreTest(ITestAnnotation annotation, Ignore ignore) { if (ignore != null) { annotation.setEnabled(false); if (annotation.getDescription() == null || annotation.getDescription().isEmpty()) { annotation.setDescription(ignore.value()); } else { annotation.setDescription(ignore.value() + ": " + annotation.getDescription()); } } }

Target:
private static void ignoreTest(ITestAnnotation annotation, Ignore ignore) { if (ignore == null) { return; } annotation.setEnabled(false); updateDescription(annotation, ignore); }
Source:
public LanguageFilterServer() { this.filterBoxService = new FilterBoxService(this); this.filterWorkspaceService = new FilterWorkspaceService(); }

Target:
public LanguageFilterServer() { filterBoxService = new FilterBoxService(this); filterWorkspaceService = new FilterWorkspaceService(); }
Source:
private <T extends Node<?> & TestDescriptor> T firstChild(TestDescriptor engineDescriptor, Class<T> testDescriptorClass) { return (T) engineDescriptor.getChildren().stream() .filter(testDescriptorClass::isInstance) .findFirst() .orElseGet(() -> fail("No child with class " + testDescriptorClass + " found")); }

Target:
private <T extends Node<?> & TestDescriptor> T firstChild(TestDescriptor engineDescriptor, Class<T> testDescriptorClass) { return (T) engineDescriptor.getChildren().stream() .filter(testDescriptorClass::isInstance) .findFirst() .orElseGet(() -> fail("No child of type " + testDescriptorClass + " found")); }
Source:
public void doubleDirectory() throws Exception { int gcWaitTime = 1000; File firstDir = new File("dir1"); File secondDir = new File("dir2"); ServerConfiguration conf = TestBKConfiguration.newServerConfiguration(); conf.setGcWaitTime(gcWaitTime); conf.setLedgerStorageClass(DbLedgerStorage.class.getName()); conf.setLedgerDirNames(new String[] { firstDir.getCanonicalPath(), secondDir.getCanonicalPath() }); Bookie bookie = new Bookie(conf); assertEquals(2, ((DbLedgerStorage) bookie.getLedgerStorage()).getLedgerStorageList().size()); bookie.shutdown(); FileUtils.deleteDirectory(firstDir); FileUtils.deleteDirectory(secondDir); }

Target:
public void doubleDirectory() throws Exception { int gcWaitTime = 1000; File firstDir = new File(tmpDir, "dir1"); File secondDir = new File(tmpDir, "dir2"); ServerConfiguration conf = TestBKConfiguration.newServerConfiguration(); conf.setGcWaitTime(gcWaitTime); conf.setLedgerStorageClass(DbLedgerStorage.class.getName()); conf.setLedgerDirNames(new String[] { firstDir.getCanonicalPath(), secondDir.getCanonicalPath() }); Bookie bookie = new Bookie(conf); assertEquals(2, ((DbLedgerStorage) bookie.getLedgerStorage()).getLedgerStorageList().size()); bookie.shutdown(); }
Source:
private void duplicateRow() { final Setting setting = getActionContext().getSetting(); final EObject eObject = setting.getEObject(); final EStructuralFeature eStructuralFeature = setting.getEStructuralFeature(); final EditingDomain editingDomain = getActionContext().getEditingDomain(); final List<?> toDuplicate = Arrays.asList( ((IStructuredSelection) getTableViewer().getSelection()).toArray()); final Collection<Object> copies = copyElements( eObject, eStructuralFeature, editingDomain, toDuplicate); getTableViewer().setSelection(new StructuredSelection(copies.iterator().next()), true); }

Target:
private void duplicateRow() { final Setting setting = getActionContext().getSetting(); final EObject eObject = setting.getEObject(); final EStructuralFeature eStructuralFeature = setting.getEStructuralFeature(); final List<?> toDuplicate = Arrays.asList( ((IStructuredSelection) getTableViewer().getSelection()).toArray()); final Collection<Object> copies = copyElements( eObject, eStructuralFeature, getEditingDomainForContainment(), toDuplicate); getTableViewer().setSelection(new StructuredSelection(copies.iterator().next()), true); }
Source:
private Student generateStudentWithoutSectionObject() { Student expected = new Student("email@email.com", "name 1", "googleId.1", "comment 1", "courseId1", "team 1", null); return expected; }

Target:
private Student generateStudentWithoutSectionObject() { return new Student("email@email.com", "name 1", "googleId.1", "comment 1", "courseId1", "team 1", null); }
Source:
RateLimitingRequestThrottler(DriverContext context, NanoClock clock) { this.logPrefix = context.sessionName(); this.clock = clock; DriverConfigProfile config = context.config().getDefaultProfile(); int maxRequestsPerSecond = config.getInt(DefaultDriverOption.REQUEST_THROTTLER_MAX_REQUESTS_PER_SECOND); this.stateRef = new AtomicReference<>(State.initial(maxRequestsPerSecond, clock.nanoTime())); this.maxQueueSize = config.getInt(DefaultDriverOption.REQUEST_THROTTLER_MAX_QUEUE_SIZE); Duration drainInterval = config.getDuration(DefaultDriverOption.REQUEST_THROTTLER_DRAIN_INTERVAL); this.drainIntervalNanos = drainInterval.toNanos(); this.scheduler = ((InternalDriverContext) context).nettyOptions().adminEventExecutorGroup().next(); LOG.debug( "[{}] Initializing with maxRequestsPerSecond = {}, maxQueueSize = {}, drainInterval = {}", logPrefix, maxRequestsPerSecond, maxQueueSize, drainInterval); }

Target:
RateLimitingRequestThrottler(DriverContext context, NanoClock clock) { this.logPrefix = context.sessionName(); this.clock = clock; DriverConfigProfile config = context.config().getDefaultProfile(); this.maxRequestsPerSecond = config.getInt(DefaultDriverOption.REQUEST_THROTTLER_MAX_REQUESTS_PER_SECOND); this.maxQueueSize = config.getInt(DefaultDriverOption.REQUEST_THROTTLER_MAX_QUEUE_SIZE); Duration drainInterval = config.getDuration(DefaultDriverOption.REQUEST_THROTTLER_DRAIN_INTERVAL); this.drainIntervalNanos = drainInterval.toNanos(); this.lastUpdateNanos = clock.nanoTime(); this.storedPermits = maxRequestsPerSecond; this.scheduler = ((InternalDriverContext) context).nettyOptions().adminEventExecutorGroup().next(); LOG.debug( "[{}] Initializing with maxRequestsPerSecond = {}, maxQueueSize = {}, drainInterval = {}", logPrefix, maxRequestsPerSecond, maxQueueSize, drainInterval); }
Source:
public Mono<T> getValue() { if (cache != null) { return Mono.just(cache); } return Mono.defer(() -> { if (!wip.getAndSet(true)) { try { cache = supplier.get(); sink.next(cache); } catch (Exception e) { sink.error(e); } finally { wip.set(false); } } return emitterProcessor.next(); }); }

Target:
public Mono<T> getValue() { return Mono.defer(() -> { if (cache != null) { return Mono.just(cache); } if (!wip.getAndSet(true)) { try { cache = supplier.get(); sink.next(cache); } catch (Exception e) { sink.error(e); } } return replayProcessor.next(); }); }
Source:
public Xid[] recover(int flag) throws XAException { if (LOG.isTraceEnabled()) { LOG.trace("DummyXAResource.recover(flag=" + flag + ")"); } return null; }

Target:
public Xid[] recover(int flag) throws XAException { LOG.info("DummyXAResource.recover(flag=" + flag + ")"); return null; }
Source:
protected void configure() { final CommandName gerrit = Commands.named("gerrit"); command(gerrit, "approve").to(ReviewCommand.class); command(gerrit, "create-account").to(CreateAccountCommand.class); command(gerrit, "create-group").to(CreateGroupCommand.class); command(gerrit, "create-project").to(CreateProject.class); command(gerrit, "gsql").to(AdminQueryShell.class); command(gerrit, "set-reviewers").to(SetReviewersCommand.class); command(gerrit, "receive-pack").to(Receive.class); command(gerrit, "replicate").to(Replicate.class); command(gerrit, "set-project-parent").to(AdminSetParent.class); command(gerrit, "review").to(ReviewCommand.class); command(gerrit, "archive-project").to(ArchiveProject.class); command(gerrit, "deactivate-account").to(DeactivateAccountCommand.class); }

Target:
protected void configure() { final CommandName gerrit = Commands.named("gerrit"); command(gerrit, "approve").to(ReviewCommand.class); command(gerrit, "create-account").to(CreateAccountCommand.class); command(gerrit, "create-group").to(CreateGroupCommand.class); command(gerrit, "rename-group").to(RenameGroupCommand.class); command(gerrit, "create-project").to(CreateProjectCommand.class); command(gerrit, "gsql").to(AdminQueryShell.class); command(gerrit, "set-reviewers").to(SetReviewersCommand.class); command(gerrit, "receive-pack").to(Receive.class); command(gerrit, "replicate").to(Replicate.class); command(gerrit, "set-project-parent").to(AdminSetParent.class); command(gerrit, "review").to(ReviewCommand.class); command(gerrit, "deactivate-account").to(DeactivateAccountCommand.class); }
Source:
private static String parameterListString(List<String> duplicatedParameters) { StringBuilder duplicatedParametersString = new StringBuilder(); for (String duplicatedParameter : duplicatedParameters) { duplicatedParametersString.append(String.format("\"%s\", ", duplicatedParameter)); } return duplicatedParametersString.substring(0, duplicatedParametersString.length() - 2); }

Target:
private static String parameterListString(List<String> duplicatedParameters) { return "\"" + Joiner.on("\", \"").join(duplicatedParameters) + "\""; }
Source:
private void delay() { try { LOGGER.debug( "Waiting ms before attempting to re-retrieve and cache product {}", downloaderConfig.getDelayBetweenAttemptsMS(), filePath); Thread.sleep(downloaderConfig.getDelayBetweenAttemptsMS()); } catch (InterruptedException e1) { Thread.currentThread().interrupt(); } }

Target:
private void delay() { try { LOGGER.debug( "Waiting ms before attempting to re-retrieve and cache product {}", downloaderConfig.getDelayBetweenAttemptsMS(), filePath); Thread.sleep(downloaderConfig.getDelayBetweenAttemptsMS()); } catch (InterruptedException e1) { } }
Source:
private void saveAndRemoveEntries(Predicate<Map.Entry<SaveableReference, VersionRange>> matchingPredicate) { Map<SaveableReference,VersionRange> localCopy = null; synchronized (this) { localCopy = new HashMap<SaveableReference,VersionRange>(data); } List<SaveableReference> removed = new ArrayList<SaveableReference>(); for (Iterator<Map.Entry<SaveableReference,VersionRange>> it = localCopy.entrySet().iterator(); it.hasNext();) { Map.Entry<SaveableReference,VersionRange> entry = it.next(); if (matchingPredicate.apply(entry)) { Saveable s = entry.getKey().get(); if (s != null) { try { s.save(); } catch (Exception x) { LOGGER.log(Level.WARNING, "failed to save " + s, x); } } removed.add(entry.getKey()); } } synchronized (this) { for (SaveableReference ref : removed) { data.remove(ref); } } }

Target:
private void saveAndRemoveEntries(Predicate<Map.Entry<SaveableReference, VersionRange>> matchingPredicate) { Map<SaveableReference,VersionRange> localCopy = null; synchronized (this) { localCopy = new HashMap<SaveableReference,VersionRange>(data); } List<SaveableReference> removed = new ArrayList<SaveableReference>(); for (Map.Entry<SaveableReference,VersionRange> entry : localCopy.entrySet()) { if (matchingPredicate.apply(entry)) { Saveable s = entry.getKey().get(); if (s != null) { try { s.save(); } catch (Exception x) { LOGGER.log(Level.WARNING, "failed to save " + s, x); } } removed.add(entry.getKey()); } } synchronized (this) { data.keySet().removeAll(removed); } }