auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public MergingPageIterator( Collection<Iterator<Page>> iterators, List<Type> types, List<Integer> sortFields, List<SortOrder> sortOrders) { requireNonNull(sortFields, "sortFields is null"); requireNonNull(sortOrders, "sortOrders is null"); checkArgument(sortFields.size() == sortOrders.size(), "sortFields and sortOrders size must match"); this.types = ImmutableList.copyOf(requireNonNull(types, "types is null")); this.sortFields = ImmutableList.copyOf(sortFields); this.sortOrders = ImmutableList.copyOf(sortOrders); this.pageBuilder = new PageBuilder(types); iterators.stream() .map(PagePositionIterator::new) .filter(PagePositionIterator::hasNext) .forEach(queue::add); }

Target:
public MergingPageIterator( Collection<Iterator<Page>> iterators, List<Type> types, List<Integer> sortFields, List<SortOrder> sortOrders) { requireNonNull(sortFields, "sortFields is null"); requireNonNull(sortOrders, "sortOrders is null"); checkArgument(sortFields.size() == sortOrders.size(), "sortFields and sortOrders size must match"); this.types = ImmutableList.copyOf(requireNonNull(types, "types is null")); this.sortFields = ImmutableList.copyOf(sortFields); this.sortOrders = ImmutableList.copyOf(sortOrders); this.pageBuilder = new PageBuilder(types); this.pagePositions = mergeSorted( iterators.stream() .map(pages -> concat(transform(pages, PagePositionIterator::new))) .collect(toList()), naturalOrder()); }
Source:
public void onStop() { super.onStop(); isActivityStarted = false; AppConstants.videoListDeleteMode = false; try { if (playerFragment != null) { playerFragment.onStop(); } } catch (Exception ex) { logger.error(ex); } }

Target:
public void onStop() { super.onStop(); isActivityStarted = false; try { if (playerFragment != null) { playerFragment.onStop(); } } catch (Exception ex) { logger.error(ex); } }
Source:
public void insertTemplateTitle(String title) { wait.forElementClickable(editTemplateTitleInput); editTemplateTitleInput.sendKeys(title); }

Target:
public InfoboxBuilderPage insertTemplateTitle(String title) { wait.forElementClickable(editTemplateTitleInput); editTemplateTitleInput.sendKeys(title); return this; }
Source:
public static void addServiceProvider (IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) throws CoreException { ASTNode node= problem.getCoveredNode(context.getASTRoot()); if (! (node instanceof Name)) { return; } Name name= (Name) node; ITypeBinding typeBinding= name.resolveTypeBinding(); if (typeBinding != null) { ICompilationUnit targetCU= ASTResolving.findCompilationUnitForBinding(context.getCompilationUnit(), context.getASTRoot(), typeBinding); IType type= context.getCompilationUnit().getJavaProject().findType(typeBinding.getQualifiedName()); ITypeHierarchy th= type.newTypeHierarchy(null); IType[] subTypes= th.getAllSubtypes(type); List<IType> typeProposals= new ArrayList<>(Arrays.asList(type)); typeProposals.addAll(Arrays.asList(subTypes)); Image image= JavaPluginImages.get(JavaPluginImages.IMG_MISC_PUBLIC); for (IType t : typeProposals) { proposals.add(new NewProviderMethodDeclaration( Messages.format(CorrectionMessages.LocalCorrectionsSubProcessor_add_provider_method_description, t.getElementName()), targetCU, context.getASTRoot(), typeBinding, IProposalRelevance.CREATE_METHOD, image, t.getElementName())); } } }

Target:
public static void addServiceProvider (IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) throws CoreException { ASTNode node= problem.getCoveredNode(context.getASTRoot()); if (! (node instanceof Name) && ! (node.getParent() instanceof ProvidesDirective)) { return; } Name name= (Name) node; ProvidesDirective prov= (ProvidesDirective) name.getParent(); ITypeBinding targetBinding= name.resolveTypeBinding(); ITypeBinding serviceBinding= prov.getName().resolveTypeBinding(); if (targetBinding != null && serviceBinding != null) { ICompilationUnit targetCU= ASTResolving.findCompilationUnitForBinding(context.getCompilationUnit(), context.getASTRoot(), targetBinding); IJavaProject proj= context.getCompilationUnit().getJavaProject(); IType type= proj.findType(serviceBinding.getQualifiedName()); ITypeHierarchy th= type.newTypeHierarchy(null); IType[] subTypes= th.getAllSubtypes(type); List<IType> typeProposals= new ArrayList<> (Arrays.asList(type)); typeProposals.addAll(Arrays.asList(subTypes)); Image image= JavaPluginImages.get(JavaPluginImages.IMG_MISC_PUBLIC); for (IType t : typeProposals) { if (proj.findType(t.getFullyQualifiedName()) != null && !Flags.isPrivate(t.getFlags())) { proposals.add(new NewProviderMethodDeclaration( Messages.format(CorrectionMessages.LocalCorrectionsSubProcessor_add_provider_method_description, t.getElementName()), targetCU, context.getASTRoot(), targetBinding, IProposalRelevance.CREATE_METHOD, image, t.getElementName())); } } } }
Source:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (player == null || controller == null) { return false; } if (player.getHand().isEmpty()) { return true; } Cards revealedCards = new CardsImpl(); revealedCards.addAll(player.getHand()); Card sourceCard = game.getCard(source.getSourceId()); player.revealCards(sourceCard != null ? sourceCard.getIdName() : "Discard", revealedCards, game); if (!controller.chooseUse(outcome, "Choose a a card to discard? (Otherwise " + player.getLogName() + " has to discard 2 cards).", source, game)) { player.discard(2, false, source, game); return true; } TargetCard target = new TargetCard(1, Zone.HAND, new FilterNonlandCard()); if (controller.choose(Outcome.Benefit, revealedCards, target, game)) { Card card = revealedCards.get(target.getFirstTarget(), game); player.discard(card, source, game); } return true; }

Target:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); if (player == null || controller == null) { return false; } if (player.getHand().isEmpty()) { return true; } Cards revealedCards = new CardsImpl(); revealedCards.addAll(player.getHand()); Card sourceCard = game.getCard(source.getSourceId()); player.revealCards(sourceCard != null ? sourceCard.getIdName() : "Discard", revealedCards, game); if (!controller.chooseUse(outcome, "Choose a card to discard? (Otherwise " + player.getLogName() + " has to discard 2 cards).", source, game)) { player.discard(2, false, source, game); return true; } TargetCard target = new TargetCard(1, Zone.HAND, new FilterNonlandCard()); if (controller.choose(Outcome.Benefit, revealedCards, target, game)) { Card card = revealedCards.get(target.getFirstTarget(), game); player.discard(card, source, game); } return true; }
Source:
public static Code valueOf(final int value) { int classCode = getCodeClass(value); int detailCode = getCodeDetail(value); if (classCode > 0) { throw new MessageFormatException(String.format("Not a CoAP request code: %s", formatCode(classCode, detailCode))); } switch (detailCode) { case 1: return GET; case 2: return POST; case 3: return PUT; case 4: return DELETE; case 5: return FETCH; case 6: return PATCH; default: throw new MessageFormatException(String.format("Unknown CoAP request code: %s", formatCode(classCode, detailCode))); } }

Target:
public static Type valueOf(final int value) { switch (value) { case 0: return CON; case 1: return NON; case 2: return ACK; case 3: return RST; default: throw new IllegalArgumentException("Unknown CoAP type " + value); } }
Source:
public boolean getHasIngressFlows() { if (m_lastIngressFlow == null) { return false; } return (new Date().getTime() - m_lastIngressFlow.getTime()) / 1000 < OnmsSnmpInterface.MAX_FLOW_AGE; }

Target:
public boolean getHasIngressFlows() { if (m_lastIngressFlow == null) { return false; } return (System.currentTimeMillis() - m_lastIngressFlow.getTime()) / 1000 < OnmsSnmpInterface.MAX_FLOW_AGE; }
Source:
public void shouldShutdownTask() throws Exception { mockTaskServiceWrapper.scheduledTasks.add(testTask); deserialize(handle(newPostRequest(getURI(), "{\"action\": \"shutdowntask\", \"tasks\":[\"" + getTestTaskName() + "\"]}"))); assertThat(mockTaskServiceWrapper.scheduledTasks, not(hasItem(testTask))); }

Target:
public void shouldShutdownTask() throws Exception { mockTaskServiceWrapper.scheduledTasks.add(testTask); assertThat(mockTaskServiceWrapper.scheduledTasks, hasItem(testTask)); deserialize(handle(newPostRequest(getURI(), "{\"action\": \"shutdowntask\", \"tasks\":[\"" + getTestTaskName() + "\"]}"))); assertThat(mockTaskServiceWrapper.scheduledTasks, not(hasItem(testTask))); }
Source:
private static void checkZoomLevel(long zoomLevel) { checkCondition(zoomLevel > 0, "Zoom level must be > 0"); checkCondition(zoomLevel <= MAX_ZOOM_LEVEL, "Zoom level must be <= %d", MAX_ZOOM_LEVEL); }

Target:
private static void checkZoomLevel(long zoomLevel) { checkCondition(zoomLevel > 0, ZOOM_LEVEL_TOO_SMALL); checkCondition(zoomLevel <= MAX_ZOOM_LEVEL, ZOOM_LEVEL_TOO_LARGE); }
Source:
@Override public SimpleFeature apply(SimpleFeature input) { Geometry g = (Geometry) input.getDefaultGeometry(); Geometry newGeometry; if ((g != null) || (g instanceof Point) || (g instanceof MultiPoint) || (!g .isEmpty())) { if (g instanceof MultiPolygon) { newGeometry = simplify((MultiPolygon) g); } else if (g instanceof Polygon) { newGeometry = simplify((Polygon) g); } else { DouglasPeuckerSimplifier tss = new DouglasPeuckerSimplifier(g); tss.setDistanceTolerance(distance); tss.setEnsureValid(false); newGeometry = tss.getResultGeometry(); } input.setDefaultGeometry(newGeometry); } return input; }

Target:
@Override public SimpleFeature apply(SimpleFeature input) { Geometry g = (Geometry) input.getDefaultGeometry(); Geometry newGeometry; if ((g == null) || (g.isEmpty())) return input; if (g.getDimension() == 2) { if (g instanceof MultiPolygon) { newGeometry = simplify((MultiPolygon) g); } else { newGeometry = simplify((Polygon) g); } } else { DouglasPeuckerSimplifier tss = new DouglasPeuckerSimplifier(g); tss.setDistanceTolerance(distance); tss.setEnsureValid(false); newGeometry = tss.getResultGeometry(); } input.setDefaultGeometry(newGeometry); return input; }
Source:
private Boolean connectToServer(final Server s, final PrimeConnectionListener listener) { int tryNum = 0; Exception lastException = null; totalCounter.increment(); boolean success = false; do { try { logger.debug("Executing PrimeConnections request to server with path {}, tryNum={}", s, primeConnectionsURIPath, tryNum); success = connector.connect(s, primeConnectionsURIPath); successCounter.increment(); break; } catch (Exception e) { logger.debug("Error connecting to server: {}", e.getMessage()); lastException = e; sleepBeforeRetry(tryNum); } logger.debug("server:{}, result={}, tryNum={}, maxRetries={}", s, success, tryNum, maxRetries); tryNum++; } while (!success && (tryNum <= maxRetries)); if (listener != null) { try { listener.primeCompleted(s, lastException); } catch (Exception e) { logger.error("Error calling PrimeComplete listener for server '{}'", s.getHost(), e); } } logger.debug("Either done, or quitting server:{}, result={}, tryNum={}, maxRetries={}", s, success, tryNum, maxRetries); return success; }

Target:
private Boolean connectToServer(final Server s, final PrimeConnectionListener listener) { int tryNum = 0; Exception lastException = null; totalCounter.increment(); boolean success = false; do { try { logger.debug("Executing PrimeConnections request to server with path {}, tryNum={}", s, primeConnectionsURIPath, tryNum); success = connector.connect(s, primeConnectionsURIPath); successCounter.increment(); lastException = null; break; } catch (Exception e) { logger.debug("Error connecting to server: {}", e.getMessage()); lastException = e; sleepBeforeRetry(tryNum); } logger.debug("server:{}, result={}, tryNum={}, maxRetries={}", s, success, tryNum, maxRetries); tryNum++; } while (!success && (tryNum <= maxRetries)); if (listener != null) { try { listener.primeCompleted(s, lastException); } catch (Exception e) { logger.error("Error calling PrimeComplete listener for server '{}'", s, e); } } logger.debug("Either done, or quitting server:{}, result={}, tryNum={}, maxRetries={}", s, success, tryNum, maxRetries); return success; }
Source:
private Map<String, Object> createTicket(VM vm, GraphicsInfo graphicsInfo) { Map<String, Object> jsonModel = new HashMap<>(); jsonModel.put("host", graphicsInfo.getIp()); Integer tlsPort = graphicsInfo.getTlsPort(); final GraphicsType type = getParameters().getGraphicsType(); boolean useSsl = false; if (type == GraphicsType.SPICE) { useSsl = tlsPort != null ? tlsPort != -1 : false; } else { final VDS host = vdsDao.getByName(vm.getVmHost()); useSsl = host != null && host.isVncEncryptionEnabled(); tlsPort = graphicsInfo.getPort(); } int port = useSsl ? tlsPort : graphicsInfo.getPort(); jsonModel.put("port", String.valueOf(port)); jsonModel.put("ssl_target", useSsl); return jsonModel; }

Target:
private Map<String, Object> createTicket(VM vm, GraphicsInfo graphicsInfo) { Map<String, Object> jsonModel = new HashMap<>(); jsonModel.put("host", graphicsInfo.getIp()); Integer tlsPort = graphicsInfo.getTlsPort(); final GraphicsType type = getParameters().getGraphicsType(); boolean useSsl = false; if (type == GraphicsType.SPICE) { useSsl = tlsPort != null ? tlsPort != -1 : false; } else { final VdsDynamic host = vdsDynamicDao.get(vm.getRunOnVds()); useSsl = host != null && host.isVncEncryptionEnabled(); tlsPort = graphicsInfo.getPort(); } int port = useSsl ? tlsPort : graphicsInfo.getPort(); jsonModel.put("port", String.valueOf(port)); jsonModel.put("ssl_target", useSsl); return jsonModel; }
Source:
private void setExistingTag(Object tagObject) { if (tagObject instanceof RevTag) existingTag = (RevTag) tagObject; else { setNoExistingTag(); setErrorMessage(UIText.CreateTagDialog_LightweightTagMessage); return; } if (!tagNameText.getText().equals(existingTag.getTagName())) tagNameText.setText(existingTag.getTagName()); if (commitCombo != null) commitCombo.setSelectedElement(existingTag.getObject()); String message = existingTag.getFullMessage(); tagMessageText.setText(null != message ? message : ""); }

Target:
private void setExistingTag(Object tagObject) { if (tagObject instanceof RevTag) existingTag = new TagWrapper((RevTag) tagObject); else if (tagObject instanceof Ref) { existingTag = new TagWrapper((Ref) tagObject); } else { setNoExistingTag(); return; } if (!tagNameText.getText().equals(existingTag.getName())) tagNameText.setText(existingTag.getName()); if (commitCombo != null) commitCombo.setSelectedElement(existingTag.getId()); String message = existingTag.getMessage(); tagMessageText.setText(null != message ? message : ""); }
Source:
public IO<Unit> println(final String s) { return () -> { result = s; return Unit.unit(); }; }

Target:
public IO<String> println(final String s) { return () -> { return s; }; }
Source:
void setValue(Object primitive) { if (primitive instanceof Character) { this.value = String.valueOf(((Character) primitive).charValue()); } else { $Gson$Preconditions.checkArgument(primitive instanceof Number || isPrimitiveOrString(primitive)); this.value = primitive; } }

Target:
void setValue(Object primitive) { if (primitive instanceof Character) { char c = ((Character) primitive).charValue(); this.value = String.valueOf(c); } else { $Gson$Preconditions.checkArgument(primitive instanceof Number || isPrimitiveOrString(primitive)); this.value = primitive; } }
Source:
public boolean equals(Object obj) { if(obj instanceof Lock) { Lock other = (Lock) obj; boolean result = false; result = this.owner.equals(other.owner); result = result && this.created.equals(other.created); result = result && this.failed == other.failed; return result; } return false; }

Target:
public boolean equals(Object obj) { return EqualsBuilder.reflectionEquals(this, obj); }
Source:
public void onShowProfiler(OpenProfileEvent event) { String profilePath = event.getFilePath(); String htmlPath = event.getHtmlPath(); String htmlLocalPath = event.getHtmlLocalPath(); for (int idx = 0; idx < editors_.size(); idx++) { String path = editors_.get(idx).getPath(); if (path != null && profilePath.equals(path)) { ensureVisible(false); view_.selectTab(idx); return; } } ensureVisible(true); if (event.getDocId() != null) { server_.getSourceDocument(event.getDocId(), new ServerRequestCallback<SourceDocument>() { @Override public void onResponseReceived(SourceDocument response) { addTab(response); } @Override public void onError(ServerError error) { Debug.logError(error); } }); } else { server_.newDocument( FileTypeRegistry.PROFILER.getTypeId(), null, (JsObject) ProfilerContents.create( profilePath, htmlPath, htmlLocalPath, event.getCreateProfile()).cast(), new SimpleRequestCallback<SourceDocument>("Show Profiler") { @Override public void onResponseReceived(SourceDocument response) { addTab(response); } @Override public void onError(ServerError error) { Debug.logError(error); } }); } }

Target:
public void onShowProfiler(OpenProfileEvent event) { String profilePath = event.getFilePath(); String htmlPath = event.getHtmlPath(); String htmlLocalPath = event.getHtmlLocalPath(); for (int idx = 0; idx < editors_.size(); idx++) { String path = editors_.get(idx).getPath(); if (path != null && profilePath.equals(path)) { ensureVisible(false); view_.selectTab(idx); return; } } ensureVisible(true); if (event.getDocId() != null) { server_.getSourceDocument(event.getDocId(), new ServerRequestCallback<SourceDocument>() { @Override public void onResponseReceived(SourceDocument response) { addTab(response); } @Override public void onError(ServerError error) { Debug.logError(error); globalDisplay_.showErrorMessage("Source Document Error", error.getUserMessage()); } }); } else { server_.newDocument( FileTypeRegistry.PROFILER.getTypeId(), null, (JsObject) ProfilerContents.create( profilePath, htmlPath, htmlLocalPath, event.getCreateProfile()).cast(), new SimpleRequestCallback<SourceDocument>("Show Profiler") { @Override public void onResponseReceived(SourceDocument response) { addTab(response); } @Override public void onError(ServerError error) { Debug.logError(error); globalDisplay_.showErrorMessage("Source Document Error", error.getUserMessage()); } }); } }
Source:
public boolean isBypassIfSameMimeType() { return (bypassIfSameMimeType != null) ? bypassIfSameMimeType : Boolean.FALSE; }

Target:
public boolean isBypassIfSameMimeType() { return Boolean.TRUE.equals(bypassIfSameMimeType); }
Source:
private static String formatErrorMessageAfter(WindupRuleProvider provider, WindupRuleProvider otherProvider) { return "Rule \"" + provider.getID() + "\" from phase \"" + provider.getPhase() + "\" is to set to execute after\n" + "rule \"" + otherProvider.getID() + "\" from later phase \"" + otherProvider.getPhase() + "\".\nPossible solution is to specify phase " + otherProvider.getPhase() + " or later for the first rule."; }

Target:
private static String formatErrorMessageAfter(WindupRuleProvider provider, WindupRuleProvider otherProvider) { return WindupRuleProvider.class.getSimpleName() + '[' + provider.getID() + "] from phase " + provider.getPhase() + " is to set to execute after\n" + WindupRuleProvider.class.getSimpleName() + '[' + otherProvider.getID() + "] from later phase " + otherProvider.getPhase() + ".\nPossible solution is to specify phase " + otherProvider.getPhase() + " or later for the former."; }
Source:
public void serialize(ICStorageElement element) { if (superClass != null) element.setAttribute(IProjectType.SUPERCLASS, superClass.getId()); element.setAttribute(IBuildObject.ID, id); if (name != null) { element.setAttribute(IBuildObject.NAME, name); } if (unusedChildren != null) { element.setAttribute(IProjectType.UNUSED_CHILDREN, unusedChildren); } if (isAbstract != null) { element.setAttribute(IProjectType.IS_ABSTRACT, isAbstract.toString()); } if (binaryParserList != null) { Iterator<String> bparsIter = binaryParserList.listIterator(); StringBuilder listValue = new StringBuilder(EMPTY_STRING); while (bparsIter.hasNext()) { String current = bparsIter.next(); listValue.append(current); if ((bparsIter.hasNext())) { listValue.append(";"); } } element.setAttribute(BINARY_PARSER, listValue.toString()); } if (osList != null) { Iterator<String> osIter = osList.listIterator(); String listValue = EMPTY_STRING; while (osIter.hasNext()) { String current = osIter.next(); listValue += current; if ((osIter.hasNext())) { listValue += ","; } } element.setAttribute(OS_LIST, listValue); } if (archList != null) { Iterator<String> archIter = archList.listIterator(); String listValue = EMPTY_STRING; while (archIter.hasNext()) { String current = archIter.next(); listValue += current; if ((archIter.hasNext())) { listValue += ","; } } element.setAttribute(ARCH_LIST, listValue); } isDirty = false; }

Target:
public void serialize(ICStorageElement element) { if (superClass != null) element.setAttribute(IProjectType.SUPERCLASS, superClass.getId()); element.setAttribute(IBuildObject.ID, id); if (name != null) { element.setAttribute(IBuildObject.NAME, name); } if (unusedChildren != null) { element.setAttribute(IProjectType.UNUSED_CHILDREN, unusedChildren); } if (isAbstract != null) { element.setAttribute(IProjectType.IS_ABSTRACT, isAbstract.toString()); } if (binaryParserList != null) { Iterator<String> bparsIter = binaryParserList.listIterator(); StringBuilder listValue = new StringBuilder(); while (bparsIter.hasNext()) { String current = bparsIter.next(); listValue.append(current); if ((bparsIter.hasNext())) { listValue.append(';'); } } element.setAttribute(BINARY_PARSER, listValue.toString()); } if (osList != null) { Iterator<String> osIter = osList.listIterator(); String listValue = EMPTY_STRING; while (osIter.hasNext()) { String current = osIter.next(); listValue += current; if ((osIter.hasNext())) { listValue += ","; } } element.setAttribute(OS_LIST, listValue); } if (archList != null) { Iterator<String> archIter = archList.listIterator(); String listValue = EMPTY_STRING; while (archIter.hasNext()) { String current = archIter.next(); listValue += current; if ((archIter.hasNext())) { listValue += ","; } } element.setAttribute(ARCH_LIST, listValue); } isDirty = false; }
Source:
public static byte[] compressBytes(byte[] srcBytes) { ByteArrayOutputStream resultBao = new ByteArrayOutputStream(); GZIPOutputStream zipOutputStream = null; try { zipOutputStream = new GZIPOutputStream(resultBao); zipOutputStream.write(srcBytes); } catch (IOException e) { e.printStackTrace(); return null; } IOUtils.closeQuietly(zipOutputStream); return resultBao.toByteArray(); }

Target:
public static byte[] compressBytes(byte[] srcBytes) { ByteArrayOutputStream resultBao = new ByteArrayOutputStream(); GZIPOutputStream zipOutputStream = null; try { zipOutputStream = new GZIPOutputStream(resultBao); zipOutputStream.write(srcBytes); } catch (IOException e) { logger.error("Unable to compress session cookie", e); return null; } IOUtils.closeQuietly(zipOutputStream); return resultBao.toByteArray(); }
Source:
private boolean isFileKeyChanged(Object currFileKey) { boolean changed = currFileKey != MISSING_FILEKEY && !currFileKey.equals(fileKey); LOG.debug("file={}, FileKey changed from to {}", file, fileKey, currFileKey); return changed; }

Target:
private boolean isFileKeyChanged(Object currFileKey) { boolean changed = currFileKey != MISSING_FILEKEY && !currFileKey.equals(fileKey); if (changed) { LOG.debug("file={}, FileKey changed from to {}", file, fileKey, currFileKey); } return changed; }
Source:
private Optional<InetSocketAddress> getRandomHostByActiveConnections(Set<InetSocketAddress> desiredHosts) { Set<InetSocketAddress> localFilteredHosts = filterLocalHosts(desiredHosts); Map<InetSocketAddress, CassandraClientPoolingContainer> matchingPools = Maps.filterKeys(currentPools, localFilteredHosts::contains); if (matchingPools.isEmpty()) { return Optional.empty(); } return Optional.of(WeightedHosts.create(matchingPools).getRandomHost()); }

Target:
private Optional<InetSocketAddress> getRandomHostByActiveConnections(Set<InetSocketAddress> desiredHosts) { Set<InetSocketAddress> localFilteredHosts = maybeFilterLocalHosts(desiredHosts); Map<InetSocketAddress, CassandraClientPoolingContainer> matchingPools = Maps.filterKeys(currentPools, localFilteredHosts::contains); if (matchingPools.isEmpty()) { return Optional.empty(); } return Optional.of(WeightedHosts.create(matchingPools).getRandomHost()); }
Source:
protected Supplier<Operation> createOperationSupplier() { return () -> new DistributedObjectDestroyOperation(parameters.serviceName, parameters.name); }

Target:
protected Supplier<Operation> createOperationSupplier() { return this; }
Source:
public void testBasicOperatorStream() throws InjectionException, IOException, ClassNotFoundException { final Configuration filteredConf = filteredMappedStream.getConfiguration(); final Injector injector = Tang.Factory.getTang().newInjector(filteredConf); final String serializedMap = injector.getNamedInstance(SerializedUdf.class); Assert.assertEquals(SerializeUtils.serializeToString(defaultMap), serializedMap); final MISTQuery query = queryBuilder.build(); final DAG<MISTStream, MISTEdge> dag = query.getDAG(); final Map<MISTStream, MISTEdge> neighbors = dag.getEdges(sourceStream); Assert.assertEquals(1, neighbors.size()); final MISTEdge edgeInfo = neighbors.get(filteredStream); Assert.assertEquals(Direction.LEFT, edgeInfo.getDirection()); Assert.assertEquals(new Integer(0), edgeInfo.getIndex()); final Map<MISTStream, MISTEdge> neighbors2 = dag.getEdges(filteredStream); Assert.assertEquals(1, neighbors2.size()); final MISTEdge edgeInfo2 = neighbors2.get(filteredMappedStream); Assert.assertEquals(Direction.LEFT, edgeInfo2.getDirection()); Assert.assertEquals(new Integer(0), edgeInfo2.getIndex()); }

Target:
public void testBasicOperatorStream() throws InjectionException, IOException, ClassNotFoundException { final Configuration filteredConf = filteredMappedStream.getConfiguration(); final Injector injector = Tang.Factory.getTang().newInjector(filteredConf); final String serializedMap = injector.getNamedInstance(SerializedUdf.class); Assert.assertEquals(SerializeUtils.serializeToString(defaultMap), serializedMap); final MISTQuery query = queryBuilder.build(); final DAG<MISTStream, MISTEdge> dag = query.getDAG(); final Map<MISTStream, MISTEdge> neighbors = dag.getEdges(sourceStream); Assert.assertEquals(1, neighbors.size()); final MISTEdge edgeInfo = neighbors.get(filteredStream); Assert.assertEquals(Direction.LEFT, edgeInfo.getDirection()); Assert.assertEquals(0, edgeInfo.getIndex()); final Map<MISTStream, MISTEdge> neighbors2 = dag.getEdges(filteredStream); Assert.assertEquals(1, neighbors2.size()); final MISTEdge edgeInfo2 = neighbors2.get(filteredMappedStream); Assert.assertEquals(Direction.LEFT, edgeInfo2.getDirection()); Assert.assertEquals(0, edgeInfo2.getIndex()); }
Source:
public Object get(Object key) { FSDataInputStream in = null; BufferedReader bin = null; try { this.connect(); in = fs.open(filePath); bin = new BufferedReader(new InputStreamReader(in)); String line; while ((line = bin.readLine()) != null) { try { Map<String, Object> tuple = extractFields(line); if (tuple != null && !tuple.isEmpty() && getKey(tuple).equals(key)) { logger.debug("Found line in FS {}", getValue(tuple)); return getValue(tuple); } } catch (Exception parseExp) { logger.info("Unable to parse line {}", line); } } } catch (IOException e) { throw new RuntimeException(e); } finally { if (bin != null) { IOUtils.closeQuietly(bin); } if (in != null) { IOUtils.closeQuietly(in); } } return null; }

Target:
public Object get(Object key) { try ( FSDataInputStream in = openWithRetryFsInputStream(filePath); BufferedReader bin = new BufferedReader(new InputStreamReader(in)); ) { String line; while ((line = bin.readLine()) != null) { try { Map<String, Object> tuple = extractFields(line); if (tuple != null && !tuple.isEmpty() && getKey(tuple).equals(key)) { logger.debug("Found line in FS {}", getValue(tuple)); return getValue(tuple); } } catch (Exception parseExp) { throw new RuntimeException(parseExp); } } } catch (IOException e) { throw new RuntimeException(e); } return null; }
Source:
public void initialize() { createRAIFromDim = Functions.unary(ops(), Ops.Create.Img.class, RandomAccessibleInterval.class, Dimensions.class, Util.getTypeFromInterval(in()).createVariable()); createRAIFromRAI = RAIs.function(ops(), Ops.Create.Img.class, in()); derivativeComputers = new UnaryComputerOp[in().numDimensions()]; for (int i = 0; i < in().numDimensions(); i++) { derivativeComputers[i] = RAIs.computer(ops(), Ops.Filter.DirectionalDerivative.class, in(), i); } }

Target:
public void initialize() { createRAI = RAIs.function(ops(), Ops.Create.Img.class, in()); derivativeComputers = new UnaryComputerOp[in().numDimensions()]; for (int i = 0; i < in().numDimensions(); i++) { derivativeComputers[i] = RAIs.computer(ops(), Ops.Filter.PartialDerivative.class, in(), i); } }
Source:
protected void deliverResult(R receiver, HttpCalloutOutcomes result) { if(result == HttpCalloutOutcomes.Success) { if(loggedIn == null) { CommCareApplication._().logout(); listener.keysReadyForSync(receiver); return; } else { listener.keysLoginComplete(receiver); return; } } CommCareApplication._().logout(); listener.keysDoneOther(receiver, result); }

Target:
protected void deliverResult(R receiver, HttpCalloutOutcomes result) { if(result == HttpCalloutOutcomes.Success) { if(loggedIn == null) { CommCareApplication._().logout(); listener.keysReadyForSync(receiver); return; } else { listener.keysLoginComplete(receiver); return; } } else if(result == HttpCalloutOutcomes.NetworkFailure) { if(calloutNeeded && userRecordExists){ result = HttpCalloutOutcomes.NetworkFailureBadPassword; } } CommCareApplication._().logout(); listener.keysDoneOther(receiver, result); }
Source:
private boolean hasMagicLinkLoginIntent() { String action = getIntent().getAction(); Uri uri = getIntent().getData(); return Intent.ACTION_VIEW.equals(action) && uri != null && uri.getHost().contains(SignInActivity.MAGIC_LOGIN); }

Target:
private boolean hasMagicLinkLoginIntent() { String action = getIntent().getAction(); Uri uri = getIntent().getData(); String host = (uri != null && uri.getHost() != null) ? uri.getHost() : ""; return Intent.ACTION_VIEW.equals(action) && host.contains(SignInActivity.MAGIC_LOGIN); }
Source:
private void onOwnershipMsg(final AvroElasticMemoryMessage msg) { final String operationId = msg.getOperationId().toString(); final OwnershipMsg ownershipMsg = msg.getOwnershipMsg(); final int blockId = ownershipMsg.getBlockId(); final int oldOwnerId = ownershipMsg.getOldOwnerId(); final int newOwnerId = ownershipMsg.getNewOwnerId(); Trace.setProcessId("src-" + TRACE_PROCESS_ID); try (final TraceScope onOwnershipMsgScope = Trace.startSpan("[4]on_ownership_msg. blockId: " + blockId, HTraceUtils.fromAvro(msg.getTraceInfo()))) { memoryStore.updateOwnership(blockId, oldOwnerId, newOwnerId); memoryStore.removeBlock(blockId); sender.get().sendOwnershipAckMsg(operationId, blockId, TraceInfo.fromSpan(onOwnershipMsgScope.getSpan())); } }

Target:
private void onOwnershipMsg(final AvroElasticMemoryMessage msg) { final String operationId = msg.getOperationId().toString(); final OwnershipMsg ownershipMsg = msg.getOwnershipMsg(); final int blockId = ownershipMsg.getBlockId(); final int oldOwnerId = ownershipMsg.getOldOwnerId(); final int newOwnerId = ownershipMsg.getNewOwnerId(); Trace.setProcessId("src_eval"); try (final TraceScope onOwnershipMsgScope = Trace.startSpan(String.format("on_ownership_msg. blockId: %d", blockId), HTraceUtils.fromAvro(msg.getTraceInfo()))) { memoryStore.updateOwnership(blockId, oldOwnerId, newOwnerId); memoryStore.removeBlock(blockId); sender.get().sendOwnershipAckMsg(operationId, blockId, TraceInfo.fromSpan(onOwnershipMsgScope.getSpan())); } }
Source:
public void testGroupBoundary() throws Exception { byte[] bytes = new byte[2]; bytes[0] = (1 << 1 )| 1; bytes[1] = (1 << 0) | (2 << 2) | (3 << 4); ByteBufferInputStream stream = new ByteBufferInputStream(ByteBuffer.wrap(bytes)); RunLengthBitPackingHybridDecoder decoder = new RunLengthBitPackingHybridDecoder(2, stream); assertEquals(decoder.readInt(), 1); assertEquals(decoder.readInt(), 2); assertEquals(decoder.readInt(), 3); assertEquals(stream.available(), 0); }

Target:
public void testGroupBoundary() throws Exception { byte[] bytes = new byte[2]; bytes[0] = (1 << 1 )| 1; bytes[1] = (1 << 0) | (2 << 2) | (3 << 4); ByteArrayInputStream stream = new ByteArrayInputStream(bytes); RunLengthBitPackingHybridDecoder decoder = new RunLengthBitPackingHybridDecoder(2, stream); assertEquals(decoder.readInt(), 1); assertEquals(decoder.readInt(), 2); assertEquals(decoder.readInt(), 3); assertEquals(stream.available(), 0); }
Source:
private void emitElapsedWindow(final long timestamp) { final long relativeTimestamp = timestamp - firstTimestamp; while (windowEmissionTime <= relativeTimestamp) { final Window<T> window = windowQueue.poll(); outputEmitter.emitData(new MistDataEvent(window.getWindowData(), window.getLatestTimestamp())); final MistWatermarkEvent latestWatermark = window.getLatestWatermark(); if (latestWatermark != null) { outputEmitter.emitWatermark(latestWatermark); } windowEmissionTime += emitPeriod; } }

Target:
private void emitElapsedWindow(final long timestamp) { while (windowEmissionTime <= timestamp) { final Window<T> window = windowQueue.poll(); outputEmitter.emitData(new MistDataEvent((WindowData)window, window.getLatestTimestamp())); final MistWatermarkEvent latestWatermark = window.getLatestWatermark(); if (latestWatermark != null) { outputEmitter.emitWatermark(latestWatermark); } windowEmissionTime += emitPeriod; } }
Source:
public void recoverDeletedKey() { recoverDeletedKeyRunner((keyToDeleteAndRecover) -> { assertKeyEquals(keyToDeleteAndRecover, client.createKey(keyToDeleteAndRecover)); assertNotNull(client.deleteKey(keyToDeleteAndRecover.getName())); pollOnKeyDeletion(keyToDeleteAndRecover.getName()); Key recoveredKey = client.recoverDeletedKey(keyToDeleteAndRecover.getName()); assertEquals(keyToDeleteAndRecover.getName(), recoveredKey.getName()); assertEquals(keyToDeleteAndRecover.notBefore(), recoveredKey.getProperties().getNotBefore()); assertEquals(keyToDeleteAndRecover.getExpires(), recoveredKey.getProperties().getExpires()); }); }

Target:
public void recoverDeletedKey() { recoverDeletedKeyRunner((keyToDeleteAndRecover) -> { assertKeyEquals(keyToDeleteAndRecover, client.createKey(keyToDeleteAndRecover)); assertNotNull(client.deleteKey(keyToDeleteAndRecover.getName())); pollOnKeyDeletion(keyToDeleteAndRecover.getName()); Key recoveredKey = client.recoverDeletedKey(keyToDeleteAndRecover.getName()); assertEquals(keyToDeleteAndRecover.getName(), recoveredKey.getName()); assertEquals(keyToDeleteAndRecover.getNotBefore(), recoveredKey.getProperties().getNotBefore()); assertEquals(keyToDeleteAndRecover.getExpires(), recoveredKey.getProperties().getExpires()); }); }
Source:
public int getBuildScheduleDelay() { if (isAnyServer()) { int max = DEFAULT_BUILD_SCHEDULE_DELAY; for (GerritServer server : PluginImpl.getInstance().getServers()) { if (server.getConfig() != null) { max = Math.max(0, server.getConfig().getBuildScheduleDelay()); } } return max; } else if (PluginImpl.getInstance().getServer(serverName) == null || PluginImpl.getInstance().getServer(serverName).getConfig() == null) { return DEFAULT_BUILD_SCHEDULE_DELAY; } else { int buildScheduleDelay = PluginImpl.getInstance().getServer(serverName).getConfig() .getBuildScheduleDelay(); return Math.max(0, buildScheduleDelay); } }

Target:
public int getBuildScheduleDelay() { if (isAnyServer()) { int max = 0; for (GerritServer server : PluginImpl.getInstance().getServers()) { if (server.getConfig() != null) { max = Math.max(max, server.getConfig().getBuildScheduleDelay()); } } return max; } else if (PluginImpl.getInstance().getServer(serverName) == null || PluginImpl.getInstance().getServer(serverName).getConfig() == null) { return DEFAULT_BUILD_SCHEDULE_DELAY; } else { int buildScheduleDelay = PluginImpl.getInstance().getServer(serverName).getConfig() .getBuildScheduleDelay(); return Math.max(0, buildScheduleDelay); } }
Source:
public CompletableFuture<List<Pair<SharedItem,FileWrapper>>> getFiles(List<SharedItem> pointers) { List<CompletableFuture<Optional<?>>> futures = pointers.stream().map(s -> network.getFile(s)).collect(Collectors.toList()); CompletableFuture<List<Pair<SharedItem, FileWrapper>>> identity = CompletableFuture.completedFuture(Collections.emptyList()); return futures.stream().reduce(identity, (a, b) -> b.thenCompose(opt -> a.thenApply(set -> { ArrayList<Pair<SharedItem, FileWrapper>> combined = new ArrayList<>(set.size() + 1); combined.addAll(set); if(opt.isPresent()) { Pair<SharedItem, FileWrapper> pair = (Pair<SharedItem, FileWrapper>)opt.get(); combined.add(new Pair<>(pair.left,pair.right)); } return combined; })), (a, b) -> b.thenCompose(setb -> a.thenApply(seta -> Stream.concat(seta.stream(), setb.stream()).collect(Collectors.toList())))); }

Target:
public CompletableFuture<List<Pair<SharedItem, FileWrapper>>> getFiles(List<SharedItem> pointers) { return Futures.combineAllInOrder(pointers.stream() .map(s -> network.getFile(s.cap, s.owner) .thenApply(opt -> opt.map(f -> new Pair<>(s, f)))) .collect(Collectors.toList())) .thenApply(res -> res.stream() .flatMap(Optional::stream) .collect(Collectors.toList())); }
Source:
public ElytronIntegrationChecker build() { return new ElytronIntegrationChecker(this); }

Target:
public ElytronIntegrationChecker build() { validate(); return new ElytronIntegrationChecker(this); }
Source:
public static Set<AccountGroup.Id> groupsFor( SchemaFactory<ReviewDb> dbfactory, String[] groupNames, Logger log, String groupNotFoundWarning) { final Set<AccountGroup.Id> result = new HashSet<AccountGroup.Id>(); try { final ReviewDb db = dbfactory.open(); try { for (String name : groupNames) { AccountGroupName group = db.accountGroupNames().get(new AccountGroup.NameKey(name)); if (group == null) { log.warn(MessageFormat.format(groupNotFoundWarning, name)); } else { result.add(group.getId()); } } } finally { db.close(); } } catch (OrmException e) { log.error("Database error: " + e); } return result; }

Target:
public static Set<AccountGroup.Id> groupsFor( SchemaFactory<ReviewDb> dbfactory, String[] groupNames, Logger log, String groupNotFoundWarning) { final Set<AccountGroup.Id> result = new HashSet<AccountGroup.Id>(); try { final ReviewDb db = dbfactory.open(); try { for (String name : groupNames) { AccountGroupName group = db.accountGroupNames().get(new AccountGroup.NameKey(name)); if (group == null) { log.warn(MessageFormat.format(groupNotFoundWarning, name)); } else { result.add(group.getId()); } } } finally { db.close(); } } catch (OrmException e) { log.error("Database error, cannot load groups", e); } return result; }
Source:
public static String getTokenToUse(String credentialId, Item item, String token) { if (StringUtils.isEmpty(credentialId)) { return token; } StringCredentials credentials = lookupCredentials(StringUtils.trim(credentialId), item); final String response; if (credentials != null) { response = credentials.getSecret().getPlainText(); } else { response = token; } return response; }

Target:
public static String getTokenToUse(String credentialId, Item item, String token) { String response; if (StringUtils.isEmpty(credentialId)) { response = token; } else { StringCredentials credentials = lookupCredentials(StringUtils.trim(credentialId), item); if (credentials != null) { response = credentials.getSecret().getPlainText(); } else { response = token; } } if (StringUtils.isEmpty(response)) { throw new IllegalArgumentException("the token with the provided ID could not be found and no token was specified"); } return response; }
Source:
private void handleProgressNotification(ProgressReportDto progress) { if (isNullOrEmpty(progress.getId())) { return; } String taskId = progress.getId(); if (taskFinished(progress)) { progresses.remove(taskId); progressResolver.updateProgressBar(progress); progressResolver.removeProgress(progress); updateCurrentTask(); return; } if (progress.isComplete()) { return; } if (progresses.isEmpty()) { addFirstProgress(progress); } progresses.put(taskId, Pair.of(progress, currentTimeMillis())); progressResolver.addProgress(progress); String currentTaskId = currentProgress.getId(); if (taskId.equals(currentTaskId)) { currentProgress = progress; progressResolver.updateProgressBar(currentProgress); } progressResolver.show(); }

Target:
private void handleProgressNotification(ProgressReportDto progress) { if (isNullOrEmpty(progress.getId())) { return; } String progressId = progress.getId(); if (progressFinished(progress)) { progresses.remove(progressId); backgroundLoader.updateProgressBar(progress); backgroundLoader.removeProgress(progress); updateCurrentProgress(); return; } if (progress.isComplete()) { return; } if (progresses.isEmpty()) { addFirstProgress(progress); } progresses.put(progressId, Pair.of(progress, currentTimeMillis())); backgroundLoader.addProgress(progress); if (currentProgress == null) { currentProgress = progress; } String currentTaskId = currentProgress.getId(); if (progressId.equals(currentTaskId)) { currentProgress = progress; backgroundLoader.updateProgressBar(currentProgress); } backgroundLoader.show(); }
Source:
ServerToServerWithExternalIp(DimensionDataCloudControlApi api) { this.api = checkNotNull(api, "api"); }

Target:
ServerToServerWithExternalIp(DimensionDataCloudControlApi api) { this.api = api; }
Source:
public Operation defaultResponse(Response response) { this.addResponse("default",response); this.addResponseObject("default",response); return this; }

Target:
public Operation defaultResponse(Response response) { this.addResponseObject("default",response); return this; }
Source:
public static File getHadoopTokens(HadoopSecurityManager hadoopSecurityManager, Props props, Logger log) throws HadoopSecurityManagerException { File tokenFile = null; try { tokenFile = File.createTempFile("mr-azkaban", ".token"); } catch (Exception e) { e.printStackTrace(); throw new HadoopSecurityManagerException("Failed to create the token file.", e); } hadoopSecurityManager.prefetchToken(tokenFile, props, log); return tokenFile; }

Target:
public static File getHadoopTokens(HadoopSecurityManager hadoopSecurityManager, Props props, Logger log) throws HadoopSecurityManagerException { File tokenFile = null; try { tokenFile = File.createTempFile("mr-azkaban", ".token"); } catch (Exception e) { throw new HadoopSecurityManagerException("Failed to create the token file.", e); } hadoopSecurityManager.prefetchToken(tokenFile, props, log); return tokenFile; }
Source:
public static void testIntervalForAttributes(ITmfStateSystem ss, List<ITmfStateInterval> expected, String... path) { try { int quark = ss.getQuarkAbsolute(path); List<ITmfStateInterval> actual = StateSystemUtils.queryHistoryRange(ss, quark, ss.getStartTime(), ss.getCurrentEndTime()); for (int i = 0; i < expected.size(); i++) { if (i >= actual.size()) { fail(Arrays.deepToString(path) + ": Missing interval " + (i + 1)); } ITmfStateInterval act = actual.get(i); ITmfStateInterval exp = expected.get(i); if (!compareIntervalContent(exp, act)) { fail(Arrays.deepToString(path) + ":Interval at position " + (i + 1) + ": expected: " + displayInterval(exp) + " actual: " + displayInterval(act)); } } assertEquals(Arrays.deepToString(path) + ":Number of intervals", expected.size(), actual.size()); } catch (AttributeNotFoundException e) { fail("Attribute " + Arrays.deepToString(path) + " does not exist"); } catch (StateSystemDisposedException e) { fail("State system was disposed"); } }

Target:
public static void testIntervalForAttributes(ITmfStateSystem ss, List<ITmfStateInterval> expected, String... path) { try { int quark = ss.getQuarkAbsolute(path); List<ITmfStateInterval> actual = StateSystemUtils.queryHistoryRange(ss, quark, ss.getStartTime(), ss.getCurrentEndTime()); for (int i = 0; i < expected.size(); i++) { if (i >= actual.size()) { fail(Arrays.deepToString(path) + ": Missing interval " + i); } ITmfStateInterval act = actual.get(i); ITmfStateInterval exp = expected.get(i); if (!compareIntervalContent(exp, act)) { fail(Arrays.deepToString(path) + ":Interval at position " + i + ": expected: " + displayInterval(exp) + " actual: " + displayInterval(act)); } } assertEquals(Arrays.deepToString(path) + ":Number of intervals", expected.size(), actual.size()); } catch (AttributeNotFoundException e) { fail("Attribute " + Arrays.deepToString(path) + " does not exist"); } catch (StateSystemDisposedException e) { fail("State system was disposed"); } }
Source:
public void buildSimpleContext() { MDC.clear(); MDCBuilder.buildMdcContextFromCrn(null); assertNull(MDC.get(LoggerContextKey.TENANT.toString())); assertNull(MDC.get(LoggerContextKey.USER_CRN.toString())); }

Target:
public void buildSimpleContext() { MDCBuilder.buildMdcContextFromCrn(null); assertNull(MDC.get(LoggerContextKey.TENANT.toString())); assertNull(MDC.get(LoggerContextKey.USER_CRN.toString())); }
Source:
public void start(LeaderRetrievalListener listener) throws Exception { Preconditions.checkNotNull(listener, "Listener must not be null."); Preconditions.checkState(leaderListener == null, "DefaultLeaderRetrievalService can " + "only be started once."); LOG.info("Starting DefaultLeaderRetrievalService with {}.", leaderRetrievalDriver); synchronized (lock) { leaderListener = listener; leaderRetrievalDriver.start(leaderRetrievalStateHandler); running = true; } }

Target:
public void start(LeaderRetrievalListener listener) throws Exception { checkNotNull(listener, "Listener must not be null."); Preconditions.checkState(leaderListener == null, "DefaultLeaderRetrievalService can " + "only be started once."); synchronized (lock) { leaderListener = listener; leaderRetrievalDriver = leaderRetrievalDriverFactory.createLeaderRetrievalDriver( this, new LeaderRetrievalFatalErrorHandler()); LOG.info("Starting DefaultLeaderRetrievalService with {}.", leaderRetrievalDriver); running = true; } }
Source:
public static String lowerCaseFirstChar(String s) { if (s.isEmpty()) { return s; } return Character.toLowerCase(s.charAt(0)) + s.substring(1); }

Target:
public static String lowerCaseFirstChar(String s) { if (s.isEmpty()) { return s; } char first = s.charAt(0); if (isLowerCase(first)) { return s; } return toLowerCase(first) + s.substring(1); }
Source:
private void assertCorrectGetManagedInterfaceForVdsResult(VdsNetworkInterface result) { assertNotNull(result); assertTrue(result.getIsManagement()); }

Target:
static private void assertCorrectGetManagedInterfaceForVdsResult(VdsNetworkInterface result) { assertNotNull(result); assertTrue(result.getIsManagement()); }
Source:
public int read(byte b, int offset, int readSize) { int len = 0; while (len < 1) { try { len = m_in.read(b, offset, readSize); } catch (IOException e) { while (!reconnect()) { try { Thread.sleep(10000); } catch (InterruptedException ie) { } } } } return (len); }

Target:
public int read(byte b, int offset, int readSize) { int len = 0; while (len < 1) { try { len = m_in.read(b, offset, readSize); } catch (IOException e) { logger.trace("got exception while reading: {}", e.getMessage()); while (!reconnect()) { try { logger.trace("sleeping before reconnecting"); Thread.sleep(10000); } catch (InterruptedException ie) { logger.warn("interrupted while sleeping on read reconnect"); } } } } return (len); }