auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<Question> listDisplayNameQuestionsBySurveyId(Long surveyId) { PersistenceManager pm = PersistenceFilter.getManager(); javax.jdo.Query query = pm.newQuery(Question.class); query.setFilter("surveyId == surveyIdParam && localeNameFlag == true"); query.declareParameters("Long surveyIdParam"); query.setOrdering("order asc"); List<Question> results = (List<Question>) query.execute( surveyId); if (results != null && results.size() > 0) { return results; } else { return null; } }

Target:
public List<Question> listDisplayNameQuestionsBySurveyId(Long surveyId) { PersistenceManager pm = PersistenceFilter.getManager(); javax.jdo.Query query = pm.newQuery(Question.class); query.setFilter("surveyId == surveyIdParam && localeNameFlag == true"); query.declareParameters("Long surveyIdParam"); query.setOrdering("order asc"); List<Question> results = (List<Question>) query.execute( surveyId); if (results != null && results.size() > 0) { return results; } else { return Collections.emptyList(); } }
Source:
SupersonicOsmNetworkReader createInstance() { if (coordinateTransformation == null) { throw new IllegalArgumentException("Target coordinate transformation is required parameter!"); } OsmNetworkParser parser = new OsmNetworkParser( coordinateTransformation, linkProperties, includeLinkAtCoordWithHierarchy, Executors.newWorkStealingPool()); return new SupersonicOsmNetworkReader( parser, preserveNodeWithId, includeLinkAtCoordWithHierarchy, afterLinkCreated, adjustFreeSpeed ); }

Target:
SupersonicOsmNetworkReader createInstance() { if (coordinateTransformation == null) { throw new IllegalArgumentException("Target coordinate transformation is required parameter!"); } OsmNetworkParser parser = new OsmNetworkParser( coordinateTransformation, linkProperties, includeLinkAtCoordWithHierarchy, Executors.newWorkStealingPool()); return new SupersonicOsmNetworkReader( parser, preserveNodeWithId, includeLinkAtCoordWithHierarchy, afterLinkCreated, freeSpeedFactor, adjustCapacityLength ); }
Source:
public IngestPackage(ArticlePackage articlePackage, ArticleMetadata articleMetadata, ArticleCustomMetadata customMetadata) { this.articlePackage = articlePackage; this.articleMetadata = articleMetadata; this.articleCustomMetadata = customMetadata; }

Target:
public IngestPackage(ArticlePackage articlePackage, ArticleMetadata articleMetadata, ArticleCustomMetadata customMetadata) { this.articlePackage = Objects.requireNonNull(articlePackage); this.articleMetadata = Objects.requireNonNull(articleMetadata); this.articleCustomMetadata = Objects.requireNonNull(customMetadata); }
Source:
private static long retrieveIsoFileSize(Map.Entry<String, Map<String, String>> isoFileWithMetadata) { String sizeValue = isoFileWithMetadata.getValue().get("size"); if (sizeValue == null) { return DEFAULT_ISO_FILE_SIZE; } try { return Long.valueOf(sizeValue); } catch (NumberFormatException e) { log.errorFormat("File's '{0}' size is illegal number", isoFileWithMetadata.getKey(), e); return DEFAULT_ISO_FILE_SIZE; } }

Target:
private static long retrieveIsoFileSize(Map.Entry<String, Map<String, String>> isoFileWithMetadata) { String sizeValue = isoFileWithMetadata.getValue().get("size"); if (sizeValue == null) { return SIZE_IS_NOT_AVAILABLE; } try { return Long.valueOf(sizeValue); } catch (NumberFormatException e) { log.errorFormat("File's '{0}' size is illegal number", isoFileWithMetadata.getKey(), e); return SIZE_IS_NOT_AVAILABLE; } }
Source:
private boolean add(WebSocketPassiveScanner passiveScanner){ if(getPassiveScannersSet().contains(passiveScanner)){ LOGGER.warn("Insertion prevent in order to avoid the duplication"); return false; } boolean result = getPassiveScannersSet().add(passiveScanner); if(result){ isIteratorUpdated = false; } return result; }

Target:
public synchronized boolean add(WebSocketPassiveScanner passiveScanner) { if (passiveScanner == null) { throw new IllegalArgumentException("Parameter passiveScanner must not be null."); } WebSocketPassiveScannerDecorator wsPlugin = new WebSocketPassiveScannerDecorator(passiveScanner); return addPlugin(wsPlugin); }
Source:
public int hashCode() { return Objects.hash( generatedId, getName(), getType(), getId(), getReference(), getReferenceContent(), getSelector(), getEntrypoints(), getImage(), getMemoryLimit(), getMountSources(), getCommand(), getArgs(), getVolumes(), getEnv(), getEndpoints()); }

Target:
public int hashCode() { return Objects.hash( generatedId, alias, type, componentId, reference, referenceContent, image, memoryLimit, getSelector(), getEntrypoints(), getMountSources(), getCommand(), getArgs(), getVolumes(), getEnv(), getEndpoints()); }
Source:
private void ping() throws IOException, InterruptedException { Future<?> f = channel.callAsync(new Ping()); long start = System.currentTimeMillis(); long end = System.nanoTime() + (timeout * 1000L); long remaining = end - System.nanoTime(); do { try { f.get(Math.max(10000,remaining),TimeUnit.NANOSECONDS); return; } catch (ExecutionException e) { if (e.getCause() instanceof RequestAbortedException) return; onDead(e); return; } catch (TimeoutException e) { } remaining = end - System.nanoTime(); } while(remaining>0); onDead(new TimeoutException("Ping started at "+start+" hasn't completed by "+System.currentTimeMillis())); }

Target:
private void ping() throws IOException, InterruptedException { Future<?> f = channel.callAsync(new Ping()); long start = System.currentTimeMillis(); long end = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(timeout); long remaining = end - System.nanoTime(); do { try { f.get(Math.max(TimeUnit.MILLISECONDS.toNanos(10),remaining),TimeUnit.NANOSECONDS); return; } catch (ExecutionException e) { if (e.getCause() instanceof RequestAbortedException) return; onDead(e); return; } catch (TimeoutException e) { } remaining = end - System.nanoTime(); } while(remaining>0); onDead(new TimeoutException("Ping started at "+start+" hasn't completed by "+System.currentTimeMillis())); }
Source:
public void init(MapBackedPreferences preferences) { INSTANCE.preferences = preferences; emptyNode = preferences.node("emptyNode"); buildIdToUnameLookup(); buildBackCompatMapping(); validateTree(); log.debugFormat("Osinfo Repository:\n {0}", toString()); }

Target:
public void init(MapBackedPreferences preferences) { INSTANCE.preferences = preferences; emptyNode = preferences.node("emptyNode"); buildIdToUnameLookup(); buildBackCompatMapping(); validateTree(); if (log.isDebugEnabled()) { log.debugFormat("Osinfo Repository:\n {0}", toString()); } }
Source:
public void onNewDynamicDependency(final @Observes AddPomDependencyEvent event) { final Path projectPathOptional = event.getProjectPath(); final DependencyType dependencyTypeOptional = event.getDependencyType(); addDependenciesToPom(projectPathOptional, mapper.getDependencies(dependencyTypeOptional)); }

Target:
public void onNewDynamicDependency(final @Observes AddPomDependencyEvent event) { final Path projectPath = event.getProjectPath(); final DependencyType dependencyType = event.getDependencyType(); addDependenciesToPom(projectPath, mapper.getDependencies(dependencyType)); }
Source:
public AlterReplicaLogDirsResponse getErrorResponse(int throttleTimeMs, Throwable e) { AlterReplicaLogDirsResponseData data = new AlterReplicaLogDirsResponseData(); data.setResults(this.data.dirs().stream().flatMap(x -> { Stream<AlterReplicaLogDirTopicResult> y = x.topics().stream().map(topic -> { return new AlterReplicaLogDirTopicResult() .setTopicName(topic.name()) .setPartitions( topic.partitions().stream().map(partitionId -> { return new AlterReplicaLogDirsResponseData.AlterReplicaLogDirPartitionResult() .setErrorCode(Errors.forException(e).code()) .setPartitionIndex(partitionId); }).collect(Collectors.toList())); }); return y; }).collect(Collectors.toList())); return new AlterReplicaLogDirsResponse(data.setThrottleTimeMs(throttleTimeMs)); }

Target:
public AlterReplicaLogDirsResponse getErrorResponse(int throttleTimeMs, Throwable e) { AlterReplicaLogDirsResponseData data = new AlterReplicaLogDirsResponseData(); data.setResults(this.data.dirs().stream().flatMap(alterDir -> alterDir.topics().stream().map(topic -> new AlterReplicaLogDirTopicResult() .setTopicName(topic.name()) .setPartitions(topic.partitions().stream().map(partitionId -> new AlterReplicaLogDirsResponseData.AlterReplicaLogDirPartitionResult() .setErrorCode(Errors.forException(e).code()) .setPartitionIndex(partitionId)).collect(Collectors.toList())))).collect(Collectors.toList())); return new AlterReplicaLogDirsResponse(data.setThrottleTimeMs(throttleTimeMs)); }
Source:
private double[] getNumericalPercentages( int classNum, RangedClassifier classifier, FeatureCollection collection) throws IOException { double max = ((Number) classifier.getMax(classifier.getSize() - 1)).doubleValue(); double min = ((Number) classifier.getMin(0)).doubleValue(); double classWidth = (max - min) / classNum; Subtract subtract = FF.subtract(getParameters().get(0), FF.literal(min)); Divide divide = FF.divide(subtract, FF.literal(classWidth)); GroupByVisitor groupBy = new GroupByVisitor( Aggregate.COUNT, getParameters().get(0), Arrays.asList(divide), null); collection.accepts(groupBy, null); Object[] result = groupBy.getResult().toArray(); return calculateNumerical(result, classifier, collection.size(), classNum, min, classWidth); }

Target:
private double[] getNumericalPercentages( int classNum, RangedClassifier classifier, FeatureCollection collection) throws IOException { double max = ((Number) classifier.getMax(classifier.getSize() - 1)).doubleValue(); double min = ((Number) classifier.getMin(0)).doubleValue(); double classWidth = (max - min) / classNum; Subtract subtract = FF.subtract(getParameters().get(0), FF.literal(min)); Divide divide = FF.divide(subtract, FF.literal(classWidth)); Function abs = FF.function("abs", divide); GroupByVisitor groupBy = new GroupByVisitor( Aggregate.COUNT, getParameters().get(0), Arrays.asList(abs), null); collection.accepts(groupBy, null); Map<List<Integer>, Integer> result = groupBy.getResult().toMap(); return calculateNumericalPercentages(result, collection.size(), classNum); }
Source:
public void createXClasses() throws DocumentAccessException { LOGGER.info("create classes for database '{}'", webUtils.getWikiRef()); for (ClassDefinition classDef : Utils.getComponentList(ClassDefinition.class)) { if (!isBlacklisted(classDef)) { createXClass(classDef); LOGGER.debug("created class '{}'", classDef.getName()); } else { LOGGER.info("skipping blacklisted class '{}'", classDef.getName()); } } }

Target:
public void createXClasses() { LOGGER.info("create classes for database '{}'", webUtils.getWikiRef()); for (ClassPackage classPackage : classPackages) { if (classPackage.isActivated()) { try { createXClasses(classPackage); } catch (XClassCreateException exc) { LOGGER.error("failed to create classes for package '{}'", classPackage.getName(), exc); } } else { LOGGER.info("skipping package '{}'", classPackage.getName()); } } }
Source:
public void should_pass_if_difference_is_equal_to_given_percentage() { bigDecimals.assertIsCloseToPercentage(someInfo(), ONE, ONE, withPercentage(ZERO)); bigDecimals.assertIsCloseToPercentage(someInfo(), ONE, TWO, withPercentage(valueOf(100))); }

Target:
public void should_pass_if_difference_is_equal_to_given_percentage() { bigDecimals.assertIsCloseToPercentage(someInfo(), ONE, ONE, withPercentage(ZERO)); bigDecimals.assertIsCloseToPercentage(someInfo(), ONE, TWO, withPercentage(valueOf(50))); }
Source:
public MachineResolver( String pluginPublisher, String pluginName, Pair<String, String> projectsRootPathEnvVar, Container container, CheContainer cheContainer, String defaultSidecarMemoryLimitBytes, List<ChePluginEndpoint> containerEndpoints, Map<String, String> wsAttributes) { this.pluginName = pluginName; this.pluginPublisherName = pluginPublisher + "/" + pluginName; this.container = container; this.cheContainer = cheContainer; this.defaultSidecarMemoryLimitBytes = defaultSidecarMemoryLimitBytes; this.containerEndpoints = containerEndpoints; this.wsAttributes = wsAttributes != null ? wsAttributes : Collections.emptyMap(); this.projectsRootPathEnvVar = projectsRootPathEnvVar; }

Target:
public MachineResolver( String pluginPublisher, String pluginName, Pair<String, String> projectsRootPathEnvVar, Container container, CheContainer cheContainer, String defaultSidecarMemoryLimitBytes, List<ChePluginEndpoint> containerEndpoints, Map<String, String> wsAttributes) { this.pluginPublisherAndName = pluginPublisher + "/" + pluginName; this.container = container; this.cheContainer = cheContainer; this.defaultSidecarMemoryLimitBytes = defaultSidecarMemoryLimitBytes; this.containerEndpoints = containerEndpoints; this.wsAttributes = wsAttributes != null ? wsAttributes : Collections.emptyMap(); this.projectsRootPathEnvVar = projectsRootPathEnvVar; }
Source:
public ResourcePath getParent() { if(!hasParent()){ throw new UnsupportedOperationException("I am on the root level already"); } return new ResourcePath(this.m_elements.subList(0, this.m_elements.size()-1)); }

Target:
public ResourcePath getParent() { if(!hasParent()){ throw new UnsupportedOperationException("I am on the root level already"); } return new ResourcePath(this.elements.subList(0, this.elements.size()-1)); }
Source:
public static boolean matchingRowColumn(final Cell left, final Cell right) { short lrowlength = left.getRowLength(); short rrowlength = right.getRowLength(); byte lfamlength = left.getFamilyLength(); byte rfamlength = right.getFamilyLength(); int lqlength = left.getQualifierLength(); int rqlength = right.getQualifierLength(); if ((lrowlength + lfamlength + lqlength) != (rrowlength + rfamlength + rqlength)) { return false; } if (!matchingRows(left, lrowlength, right, rrowlength)) { return false; } return matchingColumn(left, lfamlength, lqlength, right, rfamlength, rqlength); }

Target:
public static boolean matchingRowColumn(final Cell left, final Cell right) { short lrowlength = left.getRowLength(); short rrowlength = right.getRowLength(); if (lrowlength != rrowlength) { return false; } byte lfamlength = left.getFamilyLength(); byte rfamlength = right.getFamilyLength(); if (lfamlength != rfamlength) { return false; } int lqlength = left.getQualifierLength(); int rqlength = right.getQualifierLength(); if (lqlength != rqlength) { return false; } if (!matchingRows(left, lrowlength, right, rrowlength)) { return false; } return matchingColumn(left, lfamlength, lqlength, right, rfamlength, rqlength); }
Source:
public NanoHTTPD.Response serve(IHTTPSession session) { Method method = session.getMethod(); NanoHTTPD.Response res = null; try { for (String uri : route_priority) { Router r = routerArray.get(uri); switch (method) { case GET: res = r.doGet(session); break; case PUT: res = r.doPut(session); break; case POST: res = r.doPost(session); break; case DELETE: res = r.doDelete(session); break; case HEAD: res = r.doHead(session); break; case OPTIONS: res = r.doOptions(session); break; case TRACE: res = r.doTrace(session); break; case CONNECT: res = r.doConnect(session); break; case PATCH: res = r.doPatch(session); break; default: res = new IStatusResponse(Response.Status.METHOD_NOT_ALLOWED); } if (res != null) return res; } } catch (Exception e) { return new IStatusResponse(Response.Status.INTERNAL_ERROR); } return new IStatusResponse(Response.Status.NOT_FOUND); }

Target:
public NanoHTTPD.Response serve(IHTTPSession session) { Method method = session.getMethod(); NanoHTTPD.Response res = null; try { for (String uri : route_priority) { Router r = routerArray.get(uri); switch (method) { case GET: res = r.doGet(session); break; case PUT: res = r.doPut(session); break; case POST: res = r.doPost(session); break; case DELETE: res = r.doDelete(session); break; case HEAD: res = r.doHead(session); break; case OPTIONS: res = r.doOptions(session); break; case TRACE: res = r.doTrace(session); break; case CONNECT: res = r.doConnect(session); break; case PATCH: res = r.doPatch(session); break; default: res = new IStatusResponse(Response.Status.METHOD_NOT_ALLOWED); } if (res != null) return res; } } catch (Exception e) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); e.printStackTrace(new PrintStream(baos)); if (outputStackTrace) { return new IStatusResponse(Response.Status.INTERNAL_ERROR, MIME_PLAINTEXT, new ByteArrayInputStream(baos.toByteArray()), baos.toByteArray().length); } else { return new IStatusResponse(Response.Status.INTERNAL_ERROR); } } return new IStatusResponse(Response.Status.NOT_FOUND); }
Source:
public String[] getFilePaths(RepoObject repoObject) throws RepoException { return new String[]{}; }

Target:
public String[] getFilePaths(RepoObject repoObject) throws RepoException { return new String[0]; }
Source:
public void checkAttributeValue(PerunSessionImpl sess, Resource resource, Group group, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { String attributeValue; if(attribute.getValue() == null) { return; } if(attribute.getValue() instanceof String) { attributeValue = (String) attribute.getValue(); if (!pattern.matcher(attributeValue).matches()) { throw new WrongAttributeValueException(attribute, "Invalid attribute adName value. It should contain only letters, digits, hyphens or dots."); } } else { throw new WrongAttributeValueException(attribute, "Attribute adName value must be a String."); } Attribute resourceAdOuName; try { resourceAdOuName = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, resource, A_R_D_AD_OU_NAME); } catch (AttributeNotExistsException ex) { throw new ConsistencyErrorException(ex); } if(resourceAdOuName.getValue() == null) { return; } List<Group> groupsWithSameADNameInSameOu = sess.getPerunBl().getSearcherBl().getGroupsByGroupResourceSetting(sess, attribute, resourceAdOuName); if(!groupsWithSameADNameInSameOu.isEmpty()) { throw new WrongReferenceAttributeValueException(attribute, resourceAdOuName, group, resource, resource, null, "Attribute AD Name can't be set for group and resource in this OU, because this value is already " + "set for different group and resource in the same OU!"); } }

Target:
public void checkAttributeValue(PerunSessionImpl sess, Resource resource, Group group, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { String attributeValue; if(attribute.getValue() == null) { return; } if(attribute.getValue() instanceof String) { attributeValue = (String) attribute.getValue(); if (!pattern.matcher(attributeValue).matches()) { throw new WrongAttributeValueException(attribute, "Invalid attribute adName value. It should contain only letters, digits, hyphens, underscores or dots."); } } else { throw new WrongAttributeValueException(attribute, "Attribute adName value must be a String."); } Attribute resourceAdOuName; try { resourceAdOuName = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, resource, A_R_D_AD_OU_NAME); } catch (AttributeNotExistsException ex) { throw new ConsistencyErrorException(ex); } if(resourceAdOuName.getValue() == null) { return; } List<Group> groupsWithSameADNameInSameOu = sess.getPerunBl().getSearcherBl().getGroupsByGroupResourceSetting(sess, attribute, resourceAdOuName); if(!groupsWithSameADNameInSameOu.isEmpty()) { throw new WrongReferenceAttributeValueException(attribute, resourceAdOuName, group, resource, resource, null, "Attribute AD Name can't be set for group and resource in this OU, because this value is already " + "set for different group and resource in the same OU!"); } }
Source:
public void testStopEarly() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(RegexpCheck.class); checkConfig.addAttribute("format", "a"); checkConfig.addAttribute("illegalPattern", "false"); checkConfig.addAttribute("duplicateLimit", "-1"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputStopEarly.java"), expected); }

Target:
public void testStopEarly() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(RegexpCheck.class); checkConfig.addAttribute("format", "a"); checkConfig.addAttribute("illegalPattern", "false"); checkConfig.addAttribute("duplicateLimit", "-1"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRegexpCheckStopEarly.java"), expected); }
Source:
public void beforeStep(StepExecution stepExecution) { importContentFileUtils.deleteAllContentFiles(rawJudgmentClass); File contentSourceDir = new File(importContentDir); Collection<File> importFiles = importFileUtils.listImportFiles(importDir); Collection<File> contentFiles = Lists.newArrayList(); for (File importFile : importFiles) { File contentFile = importContentFileFinder.findContentFile(contentSourceDir, importFile); contentFiles.add(contentFile); } for (File contentFile : contentFiles) { importContentFileUtils.copyContentFile(contentFile, rawJudgmentClass); } }

Target:
public void beforeStep(StepExecution stepExecution) { deleteDownloadedContentFiles(); downloadContentFiles(); }
Source:
private void addDrops(Player p, Set<ItemStack> customDrops, List<ItemStack> drops) { int random = ThreadLocalRandom.current().nextInt(100); for (ItemStack drop : customDrops) { if (Slimefun.hasUnlocked(p, drop, true)) { SlimefunItem sfi = SlimefunItem.getByItem(drop); if (sfi instanceof RandomMobDrop && ((RandomMobDrop)sfi).getDropChance() <= random) continue; if (circuitBoard != null && circuitBoard.isItem(drop) && !circuitBoard.isDroppedFromGolems()) continue; drops.add(drop.clone()); } } }

Target:
private void addDrops(Player p, Set<ItemStack> customDrops, List<ItemStack> drops) { int random = ThreadLocalRandom.current().nextInt(100); for (ItemStack drop : customDrops) { if (Slimefun.hasUnlocked(p, drop, true)) { SlimefunItem sfi = SlimefunItem.getByItem(drop); if (sfi instanceof RandomMobDrop && ((RandomMobDrop)sfi).getDropChance() <= random) continue; if (sfi instanceof BasicCircuitBoard && !((BasicCircuitBoard)sfi).isDroppedFromGolems()) continue; drops.add(drop.clone()); } } }
Source:
void addContextEntry(final int index) { expression.ifPresent(c -> { final ContextEntry ce = new ContextEntry(); ce.setVariable(new InformationItem()); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddContextEntryCommand(c, ce, model, new DMNGridRow(), index, uiModelMapper, () -> { resize(); startEditingCell(index, ContextUIModelMapperHelper.NAME_COLUMN_COUNT); })); }); }

Target:
void addContextEntry(final int index) { expression.ifPresent(c -> { final ContextEntry ce = new ContextEntry(); final InformationItem informationItem = new InformationItem(); informationItem.setName(new Name()); ce.setVariable(informationItem); final CommandResult<CanvasViolation> result = sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddContextEntryCommand(c, ce, model, new DMNGridRow(), index, uiModelMapper, this::resize)); if (!CommandUtils.isError(result)) { selectCell(index, ContextUIModelMapperHelper.NAME_COLUMN_INDEX, false, false); startEditingCell(index, ContextUIModelMapperHelper.NAME_COLUMN_INDEX); } }); }
Source:
public boolean setReplicaStoppedState(List<ReplicaId> replicaIds, boolean markStop) { Set<String> replicasToUpdate = new HashSet<>(); for (ReplicaId replicaId : replicaIds) { if (!(replicaId instanceof AmbryReplica)) { throw new IllegalArgumentException( "HelixParticipant only works with the AmbryReplica implementation of ReplicaId"); } replicasToUpdate.add(replicaId.getPartitionId().toPathString()); } boolean setStoppedResult; synchronized (helixAdministrationLock) { logger.trace("Getting stopped replicas from instanceConfig"); List<String> stoppedListInHelix = getStoppedReplicas(); if (stoppedListInHelix == null) { stoppedListInHelix = new ArrayList<>(); } Set<String> stoppedSet = new HashSet<>(stoppedListInHelix); boolean stoppedSetUpdated = markStop ? stoppedSet.addAll(replicasToUpdate) : stoppedSet.removeAll(replicasToUpdate); if(stoppedSetUpdated){ logger.trace("Updating the stopped list in Helix InstanceConfig"); setStoppedResult = setStoppedReplicas(new ArrayList<>(stoppedSet)); }else{ logger.trace("No replicas should be added or removed, no need to update the stopped list"); setStoppedResult = true; } } return setStoppedResult; }

Target:
public boolean setReplicaStoppedState(List<ReplicaId> replicaIds, boolean markStop) { Set<String> replicasToUpdate = new HashSet<>(); for (ReplicaId replicaId : replicaIds) { if (!(replicaId instanceof AmbryReplica)) { throw new IllegalArgumentException( "HelixParticipant only works with the AmbryReplica implementation of ReplicaId"); } replicasToUpdate.add(replicaId.getPartitionId().toPathString()); } boolean setStoppedResult; synchronized (helixAdministrationLock) { logger.trace("Getting stopped replicas from instanceConfig"); List<String> stoppedListInHelix = getStoppedReplicas(); Set<String> stoppedSet = new HashSet<>(stoppedListInHelix); boolean stoppedSetUpdated = markStop ? stoppedSet.addAll(replicasToUpdate) : stoppedSet.removeAll(replicasToUpdate); if (stoppedSetUpdated) { logger.trace("Updating the stopped list in Helix InstanceConfig"); setStoppedResult = setStoppedReplicas(new ArrayList<>(stoppedSet)); } else { logger.trace("No replicas should be added or removed, no need to update the stopped list"); setStoppedResult = true; } } return setStoppedResult; }
Source:
public Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable { Object returnValue; if (ctx.isOriginLocal()) { Object key = command.getKey(); if (command.hasFlag(Flag.CACHE_MODE_LOCAL) || command.hasFlag(Flag.SKIP_REMOTE_LOOKUP) || command.hasFlag(Flag.IGNORE_RETURN_VALUES) || dataContainer.containsKey(key)) { return invokeNextInterceptor(ctx, command); } L1WriteSynchronizer l1WriteSync = new L1WriteSynchronizer(dataContainer, l1Lifespan, stateTransferLock); L1WriteSynchronizer presentSync = concurrentWrites.putIfAbsent(key, l1WriteSync); if (presentSync == null) { try { returnValue = invokeNextInterceptor(ctx, command); l1WriteSync.runL1UpdateIfPossible(returnValue, command); } catch (Throwable t) { l1WriteSync.retrievalEncounteredException(t); throw t; } finally { concurrentWrites.remove(key); } } else { log.tracef("Found current request for key %s, waiting for their invocation's response", key); try { returnValue = presentSync.get(); } catch (ExecutionException e) { throw e.getCause(); } } } else { returnValue = invokeNextInterceptor(ctx, command); if (returnValue != null) { l1Manager.addRequestor(command.getKey(), ctx.getOrigin()); } } return returnValue; }

Target:
public Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable { Object returnValue; if (ctx.isOriginLocal()) { Object key = command.getKey(); if (command.hasFlag(Flag.CACHE_MODE_LOCAL) || command.hasFlag(Flag.SKIP_REMOTE_LOOKUP) || command.hasFlag(Flag.IGNORE_RETURN_VALUES) || cdl.localNodeIsOwner(key) || dataContainer.containsKey(key)) { return invokeNextInterceptor(ctx, command); } L1WriteSynchronizer l1WriteSync = new L1WriteSynchronizer(dataContainer, l1Lifespan, stateTransferLock, cdl); L1WriteSynchronizer presentSync = concurrentWrites.putIfAbsent(key, l1WriteSync); if (presentSync == null) { try { returnValue = invokeNextInterceptor(ctx, command); l1WriteSync.runL1UpdateIfPossible(returnValue, command); } catch (Throwable t) { l1WriteSync.retrievalEncounteredException(t); throw t; } finally { concurrentWrites.remove(key); } } else { if (trace) { log.tracef("Found current request for key %s, waiting for their invocation's response", key); } try { returnValue = presentSync.get(); } catch (ExecutionException e) { throw e.getCause(); } } } else { returnValue = invokeNextInterceptor(ctx, command); if (returnValue != null) { l1Manager.addRequestor(command.getKey(), ctx.getOrigin()); } } return returnValue; }
Source:
public String toString() { final List<String> segmentNames = this.mastSegments.values().stream().map(CdmaMastSegment::getMastSegment) .collect(Collectors.toList()); return "CdmaRun [mastSegments=" + String.join(",", segmentNames) + "]"; }

Target:
public String toString() { return "CdmaRun [mastSegments=" + this.mastSegments.keySet() + "]"; }
Source:
public void submitWithCodeReviewRequest() throws IOException, ParseException, ExpiredException, IllegalArgumentException, TmcCoreException, URISyntaxException, NoLanguagePluginFoundException { Path testPath = Paths.get( "home", "test", "2014-mooc-no-deadline", "viikko1", "viikko1-Viikko1_001.Nimi"); settings.setCurrentCourse( rootFinder.getCurrentCourse(testPath.toString()).or(new Course())); ArgumentCaptor<Map> capture = ArgumentCaptor.forClass(Map.class); this.courseSubmitter = new ExerciseSubmitter(rootFinder, langs, urlCommunicator, tmcApi, settings); rootFinder.setReturnValue(testPath.toString()); courseSubmitter.submitWithCodeReviewRequest(testPath, "Help"); Mockito.verify(urlCommunicator) .makePostWithByteArray(URI.create(anyString()), any(byte[].class), anyMap(), capture.capture()); assertEquals("1", capture.getValue().get("request_review")); assertEquals("Help", capture.getValue().get("message_for_reviewer")); }

Target:
public void submitWithCodeReviewRequest() throws IOException, ParseException, ExpiredException, IllegalArgumentException, TmcCoreException, URISyntaxException, NoLanguagePluginFoundException { Path testPath = Paths.get( "home", "test", "2014-mooc-no-deadline", "viikko1", "viikko1-Viikko1_001.Nimi"); settings.setCurrentCourse( rootFinder.getCurrentCourse(testPath.toString()).or(new Course())); ArgumentCaptor<Map> capture = ArgumentCaptor.forClass(Map.class); this.courseSubmitter = new ExerciseSubmitter(rootFinder, langs, urlCommunicator, tmcApi, settings); rootFinder.setReturnValue(testPath.toString()); courseSubmitter.submitWithCodeReviewRequest(testPath, "Help"); Mockito.verify(urlCommunicator) .makePostWithByteArray(Mockito.any(URI.class), any(byte[].class), anyMap(), capture.capture()); assertEquals("1", capture.getValue().get("request_review")); assertEquals("Help", capture.getValue().get("message_for_reviewer")); }
Source:
private String deleteBucket() throws CommandException, IOException { try { getClient().deleteBucket(new DeleteBucketRequest(bucketName)); } catch (final FailedRequestException e) { if (CommandExceptionFactory.hasStatusCode(e, 409)) { CommandExceptionFactory.getInstance().handleException(this.getClass().getSimpleName(), new CommandException("Error: Tried to delete a non-empty bucket.\nUse --force to delete all objects in the bucket."), true); } CommandExceptionFactory.getInstance().handleException(this.getClass().getSimpleName(), e, true); } return "Success: Deleted bucket '" + bucketName + "'."; }

Target:
private String deleteBucket() throws CommandException, IOException { try { getClient().deleteBucket(new DeleteBucketRequest(bucketName)); } catch (final FailedRequestException e) { if (e.getStatusCode() == 409) { throw new CommandException("Error: Tried to delete a non-empty bucket.\nUse --force to delete all objects in the bucket."); } throw e; } return "Success: Deleted bucket '" + bucketName + "'."; }
Source:
public PinotColumnMetadata(String name, Type type) { super(name, type); this.name = name; }

Target:
public PinotColumnMetadata(String name, Type type) { super(requireNonNull(name, "name is null"), requireNonNull(type, "type is null")); this.name = name; }
Source:
RSocketServer(DuplexConnection connection, RSocket requestHandler, Consumer<Throwable> errorConsumer) { this.connection = connection; this.requestHandler = requestHandler; this.errorConsumer = errorConsumer; this.sendingSubscriptions = new IntObjectHashMap<>(); this.channelProcessors = new IntObjectHashMap<>(); this.receiveDisposable = connection .receive() .flatMap(this::handleFrame) .doOnError(t -> { errorConsumer.accept(t); Collection<Subscription> values; synchronized (this) { values = sendingSubscriptions.values(); } values .forEach(Subscription::cancel); }) .then() .subscribe(); this.connection .onClose() .doOnError(errorConsumer::accept) .doFinally(s -> { cleanup(); receiveDisposable.dispose(); }) .subscribe(); }

Target:
RSocketServer(DuplexConnection connection, RSocket requestHandler, Consumer<Throwable> errorConsumer) { this.connection = connection; this.requestHandler = requestHandler; this.errorConsumer = errorConsumer; this.sendingSubscriptions = new IntObjectHashMap<>(); this.channelProcessors = new IntObjectHashMap<>(); this.receiveDisposable = connection .receive() .flatMap(this::handleFrame) .doOnError(errorConsumer::accept) .then() .subscribe(); this.connection .onClose() .doOnError(errorConsumer::accept) .doFinally(s -> { cleanup(); receiveDisposable.dispose(); }) .subscribe(); }
Source:
public void checkEndOfExecutionPath(CheckerContext context, ConstraintManager constraintManager) { ExplodedGraph.Node exitNode = context.getNode(); exitNode.parents().stream().forEach(node -> { MethodYield yield = exitNode.selectedMethodYield(node); if (yield instanceof ExceptionalCheckBasedYield && ((ExceptionalCheckBasedYield) yield).raisedByCheck(this)) { reportIssueOnMethodInvocation(node); } }); }

Target:
public void checkEndOfExecutionPath(CheckerContext context, ConstraintManager constraintManager) { ExplodedGraph.Node exitNode = context.getNode(); exitNode.parents().stream().forEach(node -> { MethodYield yield = exitNode.selectedMethodYield(node); if (yield != null && yield.generatedByCheck(this)) { reportIssueOnMethodInvocation(node); } }); }
Source:
private Session session() throws IOException { try { JSch.setConfig("StrictHostKeyChecking", "no"); JSch.setLogger(SSHChannel.LOGGER); final JSch jsch = new JSch(); final File file = this.key.asFile(); jsch.setHostKeyRepository(SSHChannel.REPO); jsch.addIdentity(file.getAbsolutePath()); Logger.info( this, "Opening SSH session to %s@%s:%s (%d bytes in RSA key)...", this.login, this.addr, this.port, file.length() ); final Session session = jsch.getSession( this.login, this.addr, this.port ); session.setServerAliveInterval((int) TimeUnit.SECONDS.toMillis(10)); session.setServerAliveCountMax(Tv.MILLION); session.connect(); return session; } catch (JSchException ex) { throw new IOException(ex); } }

Target:
private Session session() throws IOException { try { JSch.setConfig("StrictHostKeyChecking", "no"); JSch.setLogger(SSHChannel.LOGGER); final JSch jsch = new JSch(); final File file = this.key.asFile(); jsch.setHostKeyRepository(SSHChannel.REPO); jsch.addIdentity(file.getAbsolutePath()); Logger.info( this, "Opening SSH session to %s@%s:%s (%d bytes in RSA key)...", this.login, this.addr, this.port, file.length() ); final Session session = jsch.getSession( this.login, this.addr, this.port ); session.setServerAliveInterval( (int) TimeUnit.SECONDS.toMillis(Tv.TEN) ); session.setServerAliveCountMax(Tv.MILLION); session.connect(); return session; } catch (JSchException ex) { throw new IOException(ex); } }
Source:
public void testCreateEnvironmentClientCertificateCredential() { Configuration configuration = Configuration.getGlobalConfiguration(); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo"); configuration.put(Configuration.PROPERTY_AZURE_CLIENT_CERTIFICATE_PATH, "bar"); configuration.put(Configuration.PROPERTY_AZURE_TENANT_ID, "baz"); EnvironmentCredential credential = new EnvironmentCredentialBuilder().build(); StepVerifier.create(credential.getToken(new TokenRequestContext().addScopes("qux/.default")) .doOnSuccess(s -> fail()) .onErrorResume(t -> { String message = t.getMessage(); Assert.assertFalse(message != null && message.contains("Cannot create any credentials with the current environment variables")); return Mono.just(new AccessToken("token", OffsetDateTime.MAX)); })) .expectNextMatches(token -> "token".equals(token.getToken())) .verifyComplete(); }

Target:
public void testCreateEnvironmentClientCertificateCredential() { Configuration.getGlobalConfiguration() .put(Configuration.PROPERTY_AZURE_CLIENT_ID, "foo") .put(Configuration.PROPERTY_AZURE_USERNAME, "bar") .put(Configuration.PROPERTY_AZURE_PASSWORD, "baz"); EnvironmentCredential credential = new EnvironmentCredentialBuilder().build(); StepVerifier.create(credential.getToken(new TokenRequestContext().addScopes("qux/.default")) .doOnSuccess(s -> fail()) .onErrorResume(t -> { String message = t.getMessage(); Assert.assertFalse(message != null && message.contains("Cannot create any credentials with the current environment variables")); return Mono.just(new AccessToken("token", OffsetDateTime.MAX)); })) .expectNextMatches(token -> "token".equals(token.getToken())) .verifyComplete(); }
Source:
public void resolveNegativeEntryNumber() throws Exception { Git git = new Git(db); writeTrashFile("file.txt", "content"); git.add().addFilepattern("file.txt").call(); git.commit().setMessage("create file").call(); try { db.resolve("master@{-12}"); fail("Exception not thrown"); } catch (IOException e) { assertNotNull(e); } }

Target:
public void resolveNegativeEntryNumber() throws Exception { Git git = new Git(db); writeTrashFile("file.txt", "content"); git.add().addFilepattern("file.txt").call(); git.commit().setMessage("create file").call(); try { db.resolve("master@{-12}"); fail("Exception not thrown"); } catch (RevisionSyntaxException e) { assertNotNull(e); } }
Source:
public boolean performFinish() { try { Repository repository = repositorySearchWizardPage.getRepository(); String repoName = repository.toString(); URIish uri = new URIish("git://github.com/" + repoName + Constants.DOT_GIT); boolean allSelected = true; Collection<Ref> selectedBranches = Collections.emptyList(); IPreferenceStore preferenceStore = org.eclipse.egit.ui.Activator .getDefault().getPreferenceStore(); int timeout = preferenceStore .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT); String defaultRepoDir = preferenceStore .getString(UIPreferences.DEFAULT_REPO_DIR); final CloneOperation cloneOperation = new CloneOperation(uri, allSelected, selectedBranches, new File(defaultRepoDir + File.separator + repoName), Constants.R_HEADS + Constants.MASTER, Constants.DEFAULT_REMOTE_NAME, timeout); getContainer().run(false, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { cloneOperation.run(monitor); RepositoryUtil repositoryUtil = Activator.getDefault() .getRepositoryUtil(); repositoryUtil.addConfiguredRepository(cloneOperation .getGitDir()); } }); } catch (URISyntaxException uriSyntaxException) { GitHubUi.logError(uriSyntaxException); return false; } catch (InvocationTargetException invocationTargetException) { GitHubUi.logError(invocationTargetException); return false; } catch (InterruptedException interruptedException) { GitHubUi.logError(interruptedException); return false; } return true; }

Target:
public boolean performFinish() { try { Repository repository = repositorySearchWizardPage.getRepository(); String repoName = repository.toString(); URIish uri = new URIish("git://github.com/" + repoName + Constants.DOT_GIT); boolean allSelected = true; Collection<Ref> selectedBranches = Collections.emptyList(); IPreferenceStore preferenceStore = org.eclipse.egit.ui.Activator .getDefault().getPreferenceStore(); int timeout = preferenceStore .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT); String defaultRepoDir = preferenceStore .getString(UIPreferences.DEFAULT_REPO_DIR); final CloneOperation cloneOperation = new CloneOperation(uri, allSelected, selectedBranches, new File(defaultRepoDir + File.separator + repoName), Constants.R_HEADS + Constants.MASTER, Constants.DEFAULT_REMOTE_NAME, timeout); Job job = new Job(Messages.RepositoryImportWizard_CloningRepository) { protected IStatus run(IProgressMonitor monitor) { try { monitor.beginTask( Messages.RepositoryImportWizard_CloningRepository, 100); cloneOperation.run(monitor); monitor.worked(90); RepositoryUtil repositoryUtil = Activator.getDefault() .getRepositoryUtil(); monitor.worked(99); repositoryUtil.addConfiguredRepository(cloneOperation .getGitDir()); monitor.done(); } catch (InvocationTargetException invocationTargetException) { GitHubUi.logError(invocationTargetException); } catch (InterruptedException interruptedException) { GitHubUi.logError(interruptedException); } return Status.OK_STATUS; } }; job.setPriority(Job.SHORT); job.schedule(); } catch (URISyntaxException uriSyntaxException) { GitHubUi.logError(uriSyntaxException); return false; } return true; }
Source:
protected void propertyChanged() { super.propertyChanged(); deriveAndSet(); }

Target:
protected void propertyChanged()
Source:
public Expression implement( RexToLixTranslator translator, RexCall call, List<Expression> expressions) { if (backupMethodName != null) { if (anyAnyOperands(call)) { return callBackupMethodAnyType(translator, call, expressions); } final Type type0 = expressions.get(0).getType(); final Type type1 = expressions.get(1).getType(); final SqlBinaryOperator op = (SqlBinaryOperator) call.getOperator(); final Primitive primitive = Primitive.ofBoxOr(type0); if (primitive == null || type1 == BigDecimal.class || COMPARISON_OPERATORS.contains(op) && !COMP_OP_TYPES.contains(primitive)) { return Expressions.call(SqlFunctions.class, backupMethodName, expressions); } final Primitive boxPrimitive0 = Primitive.ofBox(type0); final Primitive boxPrimitive1 = Primitive.ofBox(type1); if (EQUALS_OPERATORS.contains(op) && boxPrimitive0 != null && boxPrimitive1 != null && !isConstantNullExpression(expressions.get(0)) && !isConstantNullExpression(expressions.get(1))) { return Expressions.call(SqlFunctions.class, backupMethodName, expressions); } } final Type returnType = translator.typeFactory.getJavaClass(call.getType()); return RexToLixTranslator.convert( Expressions.makeBinary(expressionType, expressions.get(0), expressions.get(1)), returnType); }

Target:
public Expression implement( RexToLixTranslator translator, RexCall call, List<Expression> expressions) { if (backupMethodName != null) { if (anyAnyOperands(call)) { return callBackupMethodAnyType(translator, call, expressions); } final Type type0 = expressions.get(0).getType(); final Type type1 = expressions.get(1).getType(); final SqlBinaryOperator op = (SqlBinaryOperator) call.getOperator(); final Primitive primitive = Primitive.ofBoxOr(type0); if (primitive == null || type1 == BigDecimal.class || COMPARISON_OPERATORS.contains(op) && !COMP_OP_TYPES.contains(primitive)) { return Expressions.call(SqlFunctions.class, backupMethodName, expressions); } final Primitive boxPrimitive0 = Primitive.ofBox(type0); final Primitive boxPrimitive1 = Primitive.ofBox(type1); if (EQUALS_OPERATORS.contains(op) && boxPrimitive0 != null && boxPrimitive1 != null) { return Expressions.call(SqlFunctions.class, backupMethodName, expressions); } } final Type returnType = translator.typeFactory.getJavaClass(call.getType()); return RexToLixTranslator.convert( Expressions.makeBinary(expressionType, expressions.get(0), expressions.get(1)), returnType); }
Source:
public Response enforce(@PathParam("tenant") String tenant, String xacmlRequest) { LOGGER.debug("Enforcing policies for tenant [" + tenant + "]"); PDP pdp = pdpFactory.get(tenant, extractSubjectIds(xacmlRequest)); return Response.ok(pdp.evaluate(xacmlRequest)).build(); }

Target:
public Response enforce(@PathParam("tenant") String tenant, String xacmlRequest) { LOGGER.debug("Enforcing policies for tenant [{}]", tenant); PDP pdp = pdpFactory.get(tenant, extractSubjectIds(xacmlRequest)); return Response.ok(pdp.evaluate(xacmlRequest)).build(); }
Source:
private void handleInternalLink(PageTitle title) { if (!isAdded()) { return; } if (title.isSpecial()) { Utils.visitInExternalBrowser(getActivity(), Uri.parse(title.getMobileUri())); return; } if (referenceDialog != null && referenceDialog.isShowing()) { referenceDialog.dismiss(); } if (title.getNamespace() != null || (!app.isProdRelease() && app.getLinkPreviewVersion() == 0)) { HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_INTERNAL_LINK); getPageActivity().displayNewPage(title, historyEntry); new LinkPreviewFunnel(app).logNavigate(); } else { getPageActivity().showLinkPreview(title, HistoryEntry.SOURCE_INTERNAL_LINK); } }

Target:
private void handleInternalLink(PageTitle title) { if (!isAdded()) { return; } if (title.isSpecial()) { Utils.visitInExternalBrowser(getActivity(), Uri.parse(title.getMobileUri())); return; } if (referenceDialog != null && referenceDialog.isShowing()) { referenceDialog.dismiss(); } if (!TextUtils.isEmpty(title.getNamespace()) || (!app.isProdRelease() && app.getLinkPreviewVersion() == 0)) { HistoryEntry historyEntry = new HistoryEntry(title, HistoryEntry.SOURCE_INTERNAL_LINK); getPageActivity().displayNewPage(title, historyEntry); new LinkPreviewFunnel(app).logNavigate(); } else { getPageActivity().showLinkPreview(title, HistoryEntry.SOURCE_INTERNAL_LINK); } }
Source:
public synchronized T get() { if (container==null) { Class<T> fixture = (Class<T>) type.getRawType(); File buildlog = diag.touch("docker-" + fixture.getSimpleName() + ".build.log"); File runlog = diag.touch("docker-" + fixture.getSimpleName() + ".run.log"); try { Starter<T> containerStarter = docker.build(fixture, buildlog).start(fixture); if (portOffset != null) containerStarter.withPortOffset(portOffset); container = containerStarter.withLog(runlog).start(); } catch (InterruptedException | IOException e) { throw new Error("Failed to start container - " + fixture.getName(), e); } } return container; }

Target:
public synchronized T get() { if (container==null) { Class<T> fixture = (Class<T>) type.getRawType(); File buildlog = diag.touch("docker-" + fixture.getSimpleName() + ".build.log"); File runlog = diag.touch("docker-" + fixture.getSimpleName() + ".run.log"); try { Starter<T> containerStarter = docker.build(fixture, buildlog).start(fixture); if (portOffset != null) { containerStarter.withPortOffset(portOffset); } container = containerStarter.withLog(runlog).start(); } catch (InterruptedException | IOException e) { throw new Error("Failed to start container - " + fixture.getName(), e); } } return container; }
Source:
private static boolean isGraphicsMagickAvailable() { CompareCmd gmConsole = new CompareCmd(true); gmConsole.setOutputConsumer(new ArrayListOutputConsumer()); IMOperation gmOperation = new IMOperation(); try { gmConsole.run(gmOperation.version()); } catch (IOException e) { return false; } catch (InterruptedException e) { return false; } catch (IM4JavaException e) { return false; } return true; }

Target:
private static boolean isGraphicsMagickAvailable() { CompareCmd gmConsole = new CompareCmd(true); gmConsole.setOutputConsumer(new ArrayListOutputConsumer()); IMOperation gmOperation = new IMOperation(); try { gmConsole.run(gmOperation.version()); } catch (IOException e) { LOGGER.warn(e, e); return false; } catch (InterruptedException e) { LOGGER.warn(e, e); return false; } catch (IM4JavaException e) { LOGGER.warn(e, e); return false; } return true; }
Source:
public void checkForSurvey(final SurveyCallbacks callbacks) { if (MPConfig.DEBUG) Log.d(LOGTAG, "Checking for surveys..."); if (null == callbacks) { Log.i(LOGTAG, "Skipping survey check because callback is null."); return; } final String checkDistinctId = getDistinctId(); if (null == checkDistinctId) { Log.i(LOGTAG, "Skipping survey check because user has not yet been identified."); return; } if (Build.VERSION.SDK_INT < 10) { Log.i(LOGTAG, "Surveys not supported on OS older than API 10, reporting null."); callbacks.foundSurvey(null); return; } mDecideUpdates.setSurveyCallback(callbacks, checkDistinctId, mMessages); }

Target:
public void checkForSurvey(final SurveyCallbacks callbacks) { if (MPConfig.DEBUG) Log.d(LOGTAG, "Checking for surveys..."); if (null == callbacks) { Log.i(LOGTAG, "Skipping survey check because callback is null."); return; } final Survey found = getNextSurvey(); callbacks.foundSurvey(found); }
Source:
public synchronized void close() throws IOException { if (writeBuffer != null) { ReferenceCountUtil.safeRelease(writeBuffer); writeBuffer = null; } fileChannel.close(); }

Target:
public synchronized void close() throws IOException { ReferenceCountUtil.safeRelease(writeBuffer); fileChannel.close(); }