auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void executeNextOperation() { if (getParameters().getPhase() == StorageDomainParametersBase.Phase.PROCESS_OVF_UPDATE_FOR_STORAGE_DOMAIN) { ActionReturnValue returnValue = runInternalActionWithTasksContext(ActionType.ProcessOvfUpdateForStorageDomain, createProcessOvfUpdateForDomainParams()); if (!returnValue.getSucceeded()) { propagateFailure(returnValue); setCommandStatus(CommandStatus.FAILED); setSucceeded(true); throw new EngineException(returnValue.getFault().getError(), returnValue.getFault().getMessage()); } setCommandStatus(CommandStatus.SUCCEEDED); setSucceeded(true); } }

Target:
private void executeNextOperation() { if (getParameters().getPhase() == StorageDomainParametersBase.Phase.PROCESS_OVF_UPDATE_FOR_STORAGE_DOMAIN) { ActionReturnValue returnValue = runInternalActionWithTasksContext(ActionType.ProcessOvfUpdateForStorageDomain, createProcessOvfUpdateForDomainParams()); if (!returnValue.getSucceeded()) { propagateFailure(returnValue); setCommandStatus(CommandStatus.FAILED); throw new EngineException(returnValue.getFault().getError(), returnValue.getFault().getMessage()); } setCommandStatus(CommandStatus.SUCCEEDED); setSucceeded(true); } }
Source:
protected BinaryBlockReader(InputStream in, BinaryConverter<M> protoConverter, boolean skipEmptyRecords) { in_ = in; protoConverter_ = protoConverter; skipEmptyBlobs = skipEmptyRecords; searcher_ = new StreamSearcher(Protobufs.KNOWN_GOOD_POSITION_MARKER); }

Target:
protected BinaryBlockReader(InputStream in, BinaryConverter<M> protoConverter, boolean skipEmptyRecords) { in_ = in; protoConverter_ = protoConverter; searcher_ = new StreamSearcher(Protobufs.KNOWN_GOOD_POSITION_MARKER); this.skipEmptyRecords = skipEmptyRecords; }
Source:
protected void recreateParentService(OperationContext context, PathAddress parentAddress, ModelNode parentModel) throws OperationFailedException { SubsystemAdd.INSTANCE.performRuntime(context, null, parentModel); try { ServiceName name = SubsystemExtension.SERVICE_NAME; ServiceRegistry serviceRegistry = context.getServiceRegistry(true); MonitorService service = (MonitorService) serviceRegistry.getRequiredService(name).getValue(); service.startMonitorService(); } catch (Exception e) { throw new OperationFailedException("Failed to recreate Hawkular WildFly Agent service", e); } }

Target:
protected void recreateParentService(OperationContext context, PathAddress parentAddress, ModelNode parentModel) throws OperationFailedException { SubsystemAdd.INSTANCE.performRuntime(context, new ModelNode().set(ModelDescriptionConstants.OP_ADDR, parentAddress.toModelNode()), parentModel); }
Source:
public final void semanticHighlights(CquerySemanticHighlights highlights) { URI uriReceived = highlights.getUri(); CquerySemanticHighlights.semanticHighlightingsMap.put(uriReceived, highlights.getSymbols()); List<PresentationReconcilerCPP> matchingReconcilers = new ArrayList<>(); for (PresentationReconcilerCPP eachReconciler: PresentationReconcilerCPP.presentationReconcilers) { IDocument currentReconcilerDoc = eachReconciler.getTextViewer().getDocument(); URI currentReconcilerUri = LSPEclipseUtils.toUri(LSPEclipseUtils.getFile(currentReconcilerDoc)); if (uriReceived.equals(currentReconcilerUri)) { matchingReconcilers.add(eachReconciler); } } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { for (PresentationReconcilerCPP p: matchingReconcilers) { IDocument currentReconcilerDoc = p.getTextViewer().getDocument(); TextPresentation textPresentation = p.createPresentation(new Region(0, currentReconcilerDoc.getLength()), currentReconcilerDoc); p.getTextViewer().changeTextPresentation(textPresentation, false); } } }); }

Target:
public final void semanticHighlights(CquerySemanticHighlights highlights) { URI uriReceived = highlights.getUri(); List<PresentationReconcilerCPP> matchingReconcilers = new ArrayList<>(); for (PresentationReconcilerCPP eachReconciler: PresentationReconcilerCPP.presentationReconcilers) { IDocument currentReconcilerDoc = eachReconciler.getTextViewer().getDocument(); URI currentReconcilerUri = getUri(currentReconcilerDoc); if(currentReconcilerUri == null) { continue; } if (uriReceived.equals(currentReconcilerUri)) { matchingReconcilers.add(eachReconciler); } } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { for (PresentationReconcilerCPP p: matchingReconcilers) { p.setSemanticHighlights(highlights.getSymbols()); IDocument currentReconcilerDoc = p.getTextViewer().getDocument(); if (currentReconcilerDoc == null) { continue; } TextPresentation textPresentation = p.createPresentation(new Region(0, currentReconcilerDoc.getLength()), currentReconcilerDoc); p.getTextViewer().changeTextPresentation(textPresentation, false); } } }); }
Source:
public void decorate(World world, Random random, Chunk source) { int sourceX = (source.getX() << 4) + random.nextInt(16); int sourceZ = (source.getZ() << 4) + random.nextInt(16); int sourceY = flowing ? 4 + random.nextInt(120) : 10 + random.nextInt(108); Block block = world.getBlockAt(sourceX, sourceY, sourceZ); if ((block.getType() == Material.NETHERRACK || block.isEmpty()) && block.getRelative(BlockFace.UP).getType() == Material.NETHERRACK) { int netherrackBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).getType() == Material.NETHERRACK) { netherrackBlockCount++; } } int airBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).isEmpty()) { airBlockCount++; } } if (netherrackBlockCount == 5 || flowing && airBlockCount == 1 && netherrackBlockCount == 4) { BlockState state = block.getState(); state.setType(Material.LAVA); state.update(true); ((GlowWorld) block.getWorld()).requestSinglePulse((GlowBlock) block, 10); } } }

Target:
public void decorate(World world, Random random, Chunk source) { int sourceX = (source.getX() << 4) + random.nextInt(16); int sourceZ = (source.getZ() << 4) + random.nextInt(16); int sourceY = flowing ? 4 + random.nextInt(120) : 10 + random.nextInt(108); Block block = world.getBlockAt(sourceX, sourceY, sourceZ); if ((block.getType() == Material.NETHERRACK || block.isEmpty()) && block.getRelative(BlockFace.UP).getType() == Material.NETHERRACK) { int netherrackBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).getType() == Material.NETHERRACK) { netherrackBlockCount++; } } int airBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).isEmpty()) { airBlockCount++; } } if (netherrackBlockCount == 5 || flowing && airBlockCount == 1 && netherrackBlockCount == 4) { BlockState state = block.getState(); state.setType(Material.LAVA); state.update(true); ((GlowWorld) block.getWorld()).requestSinglePulse((GlowBlock) block, 0); } } }
Source:
public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) { GlowBlockState snowstate = state.getBlock().getRelative(BlockFace.DOWN).getState(); byte data = snowstate.getRawData(); if (snowstate.getType() == Material.SNOW && !(data >= 7)) { data++; snowstate.setRawData(data); snowstate.update(); } else if (!(snowstate.getType() == Material.SNOW)) { super.placeBlock(player, state, face, holding, clickedLoc); } }

Target:
public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) { GlowBlockState snowstate = state.getBlock().getRelative(BlockFace.DOWN).getState(); byte data = snowstate.getRawData(); if ((snowstate.getType() == Material.SNOW) && (data < 7)) { data++; snowstate.setRawData(data); snowstate.update(); } else if (snowstate.getType() != Material.SNOW) { super.placeBlock(player, state, face, holding, clickedLoc); } }
Source:
public boolean contains(IkeTsPayload tsPayload) { for (IkeTrafficSelector subTs : tsPayload.trafficSelectors) { boolean hasSuperTs = false; for (IkeTrafficSelector superTs : this.trafficSelectors) { if (superTs.contains(subTs)) { hasSuperTs = true; break; } } if (!hasSuperTs) return false; } return true; }

Target:
public boolean contains(IkeTsPayload tsPayload) { subTsLoop: for (IkeTrafficSelector subTs : tsPayload.trafficSelectors) { for (IkeTrafficSelector superTs : this.trafficSelectors) { if (superTs.contains(subTs)) { continue subTsLoop; } } return false; } return true; }
Source:
public Client deregisterClient(String registrationId) { try (Jedis j = pool.getResource()) { if (!"OK".equals(j.rename((REG_EP + registrationId).getBytes(), ("TODELETE#" + REG_EP + registrationId).getBytes()))) { System.err.println("del meh"); return null; } byte[] key = j.get(("TODELETE#" + REG_EP + registrationId).getBytes()); if (key == null) { return null; } byte[] data = j.get(ByteArrayUtils.concatenate(EP_CLIENT.getBytes(), key)); Client c = deserialize(data); j.del(("TODELETE#" + REG_EP + registrationId).getBytes()); j.del(ByteArrayUtils.concatenate(EP_CLIENT.getBytes(), key)); for (ClientRegistryListener l : listeners) { l.unregistered(c); } return c; } }

Target:
public Client deregisterClient(String registrationId) { try (Jedis j = pool.getResource()) { byte[] regKey = (REG_EP + registrationId).getBytes(); byte[] delRegKey = ("TODELETE#" + REG_EP + registrationId).getBytes(); if (!"OK".equals(j.rename(regKey, delRegKey))) { return null; } byte[] key = j.get(delRegKey); if (key == null) { return null; } byte[] epKey = ByteArrayUtils.concatenate(EP_CLIENT.getBytes(), key); byte[] data = j.get(epKey); Client c = deserialize(data); j.del(delRegKey); j.del(epKey); for (ClientRegistryListener l : listeners) { l.unregistered(c); } return c; } }
Source:
public void createInitialLayout(IPageLayout layout) { layout.setEditorAreaVisible(false); layout.addPerspectiveShortcut(ID); layout.addNewWizardShortcut(NewTmfProjectWizard.ID); IFolderLayout topLeftFolder = layout.createFolder( "topLeftFolder", IPageLayout.LEFT, 0.15f, IPageLayout.ID_EDITOR_AREA); topLeftFolder.addView(PROJECT_VIEW_ID); IFolderLayout topRightFolder = layout.createFolder( "topRightFolder", IPageLayout.TOP, 0.50f, IPageLayout.ID_EDITOR_AREA); topRightFolder.addView(EVENTS_VIEW_ID); IFolderLayout middleRightFolder = layout.createFolder( "middleRightFolder", IPageLayout.BOTTOM, 0.50f, "topRightFolder"); middleRightFolder.addView(STATISTICS_VIEW_ID); IFolderLayout bottomRightFolder = layout.createFolder( "bottomRightFolder", IPageLayout.BOTTOM, 0.55f, "middleRightFolder"); bottomRightFolder.addView(HISTOGRAM_VIEW_ID); bottomRightFolder.addView(PROPERTIES_VIEW_ID); bottomRightFolder.addView(BOOKMARKS_VIEW_ID); layout.addPerspectiveShortcut(ID); layout.addNewWizardShortcut(NewTmfProjectWizard.ID); }

Target:
public void createInitialLayout(IPageLayout layout) { layout.setEditorAreaVisible(false); IFolderLayout topLeftFolder = layout.createFolder( "topLeftFolder", IPageLayout.LEFT, 0.15f, IPageLayout.ID_EDITOR_AREA); topLeftFolder.addView(PROJECT_VIEW_ID); IFolderLayout topRightFolder = layout.createFolder( "topRightFolder", IPageLayout.TOP, 0.50f, IPageLayout.ID_EDITOR_AREA); topRightFolder.addView(EVENTS_VIEW_ID); IFolderLayout middleRightFolder = layout.createFolder( "middleRightFolder", IPageLayout.BOTTOM, 0.50f, "topRightFolder"); middleRightFolder.addView(STATISTICS_VIEW_ID); IFolderLayout bottomRightFolder = layout.createFolder( "bottomRightFolder", IPageLayout.BOTTOM, 0.55f, "middleRightFolder"); bottomRightFolder.addView(HISTOGRAM_VIEW_ID); bottomRightFolder.addView(PROPERTIES_VIEW_ID); bottomRightFolder.addView(BOOKMARKS_VIEW_ID); layout.addPerspectiveShortcut(ID); layout.addNewWizardShortcut(NewTmfProjectWizard.ID); }
Source:
private void configureNetworking(VirtualMachine vm, VirtualApplianceCachingTemplate template, Datacenter datacenter, TemplateOptions options) { if (!options.getNetworks().isEmpty()) { List<Ip<?, ?>> ips = Lists.newArrayList(); Enterprise enterprise = adminService.getCurrentEnterprise(); Iterable<ExternalNetwork> externalNetworks = enterprise.listExternalNetworks(datacenter); for (String networkId : options.getNetworks()) { Network<?> network = template.getVirtualDatacenter().getPrivateNetwork(Ints.tryParse(networkId)); if (network == null) { network = find(externalNetworks, networkId(networkId)); } Ip<?, ?> availableIp = get(network.listUnusedIps(), 0); logger.debug(">> Found available %s ip %s", availableIp.getNetworkType().name().toLowerCase(), availableIp.getIp()); ips.add(availableIp); } vm.setNics(ips); } else { Optional<PublicIp> publicIp = tryFind(template.getVirtualDatacenter().listPurchasedPublicIps(), IpPredicates.<PublicIp> notUsed()); if (publicIp.isPresent()) { logger.debug(">> Found available public ip %s", publicIp.get().getIp()); vm.setNics(Lists.<Ip<?, ?>> newArrayList(publicIp.get())); } else { logger.debug(">> No available public ip found. Using a private ip"); } } }

Target:
private void configureNetworking(VirtualMachine vm, VirtualApplianceCachingTemplate template, Datacenter datacenter, TemplateOptions options) { if (!options.getNetworks().isEmpty()) { ImmutableList.Builder<Ip<?, ?>> ips = ImmutableList.<Ip<?, ?>> builder(); Enterprise enterprise = adminService.getCurrentEnterprise(); Iterable<ExternalNetwork> externalNetworks = enterprise.listExternalNetworks(datacenter); for (String networkId : options.getNetworks()) { Network<? extends Ip<?, ?>> network = template.getVirtualDatacenter().getPrivateNetwork( Ints.tryParse(networkId)); if (network == null) { final Integer id = Ints.tryParse(networkId); network = find(externalNetworks, new Predicate<Network<?>>() { @Override public boolean apply(final Network<?> input) { return Integer.valueOf(id).equals(input.getId()); } }, null); } checkArgument(network != null, "No network was found with id: %s", networkId); Iterable<? extends Ip<?, ?>> unusedIps = network.listUnusedIps(); checkArgument(!isEmpty(unusedIps), "There are no available ips in network: %s", networkId); Ip<?, ?> availableIp = get(unusedIps, 0); logger.debug(">> Found available ip: %s", availableIp); ips.add(availableIp); } vm.setNics(ips.build()); } else { Optional<PublicIp> publicIp = tryFind(template.getVirtualDatacenter().listPurchasedPublicIps(), IpPredicates.<PublicIp> notUsed()); if (publicIp.isPresent()) { logger.debug(">> Found available public ip %s", publicIp.get().getIp()); vm.setNics(ImmutableList.<Ip<?, ?>> of(publicIp.get())); } else { logger.debug(">> No available public ip found. Using a private ip"); } } }
Source:
public void validate(final JSONObject event) { final boolean allItemsPass = validators.stream().anyMatch(new Predicate<EventValidator>() { @Override public boolean test(final EventValidator validator) { return !validator.accepts(event); } }); Preconditions.checkState(!allItemsPass, "Some validation failed"); }

Target:
public void validate(final JSONObject event) { final boolean allItemsPass = validators.stream().anyMatch(ev -> !ev.accepts(event)); Preconditions.checkState(!allItemsPass, "Some validation failed"); }
Source:
public boolean equals(final Object o) { if (this == o) { return true; } else if (o == null || getClass() != o.getClass()) { return false; } final Movement other = (Movement) o; return task == other.task && source == other.source && destination == other.destination; }

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Movement<?> movement = (Movement<?>) o; return Objects.equals(task, movement.task) && Objects.equals(source, movement.source) && Objects.equals(destination, movement.destination); }
Source:
public static ActionInvocation loadInvocation(String key, String token) { InvocationContext invocationContext = (InvocationContext) getInvocationMap().get(key); if ((invocationContext == null) || !invocationContext.token.equals(token)) { return null; } ActionInvocation savedInvocation = null; if (invocationContext.invocation != null) { final ActionContext savedActionContext; final ActionContext previousActionContext; savedInvocation = invocationContext.invocation; savedActionContext = savedInvocation.getInvocationContext(); previousActionContext = ActionContext.getContext(); ActionContext.setContext(savedActionContext); savedActionContext.setValueStack(savedInvocation.getStack()); savedActionContext.setValueStack(savedInvocation.getStack()); if (previousActionContext != null) { savedActionContext.put(ServletActionContext.PAGE_CONTEXT, previousActionContext.get(ServletActionContext.PAGE_CONTEXT)); } else { savedActionContext.put(ServletActionContext.PAGE_CONTEXT, null); } } return savedInvocation; }

Target:
public static ActionInvocation loadInvocation(String key, String token) { InvocationContext invocationContext = (InvocationContext) getInvocationMap().get(key); if ((invocationContext == null) || !invocationContext.token.equals(token)) { return null; } final ActionInvocation savedInvocation = invocationContext.invocation; if (savedInvocation != null) { final ActionContext savedActionContext = savedInvocation.getInvocationContext(); final ActionContext previousActionContext = ActionContext.getContext(); ActionContext.setContext(savedActionContext); savedActionContext.setValueStack(savedInvocation.getStack()); if (previousActionContext != null) { savedActionContext.put(ServletActionContext.PAGE_CONTEXT, previousActionContext.get(ServletActionContext.PAGE_CONTEXT)); } else { savedActionContext.put(ServletActionContext.PAGE_CONTEXT, null); } } return savedInvocation; }
Source:
private static void removeTokens(ArrayList<String> nameParts, PersonNameType personName) { if (!nameParts.isEmpty() && !nameParts.get(0).isEmpty()) { personName.setGivenName(nameParts.get(0)); nameParts.remove(0); if (LOG.isTraceEnabled()) { LOG.trace("Assertion.userInfo.personName.givenName = " + personName.getGivenName()); } } if (!nameParts.isEmpty() && !nameParts.get(nameParts.size() - 1).isEmpty()) { personName.setFamilyName(nameParts.get(nameParts.size() - 1)); nameParts.remove(nameParts.size() - 1); if (LOG.isTraceEnabled()) { LOG.trace("Assertion.userInfo.personName.familyName = " + personName.getFamilyName()); } } if (!nameParts.isEmpty()) { StringBuilder midName = new StringBuilder(); for (String name : nameParts) { midName.append(name + " "); } midName.setLength(midName.length() - 1); personName.setSecondNameOrInitials(midName.toString()); if (LOG.isTraceEnabled()) { LOG.trace( "Assertion.userInfo.personName.secondNameOrInitials = " + personName.getSecondNameOrInitials()); } } }

Target:
private static void removeTokens(ArrayList<String> nameParts, PersonNameType personName) { if (!nameParts.isEmpty() && !nameParts.get(0).isEmpty()) { personName.setGivenName(nameParts.get(0)); nameParts.remove(0); LOG.trace("Assertion.userInfo.personName.givenName = {}", personName.getGivenName()); } if (!nameParts.isEmpty() && !nameParts.get(nameParts.size() - 1).isEmpty()) { personName.setFamilyName(nameParts.get(nameParts.size() - 1)); nameParts.remove(nameParts.size() - 1); LOG.trace("Assertion.userInfo.personName.familyName = {}", personName.getFamilyName()); } if (!nameParts.isEmpty()) { StringBuilder midName = new StringBuilder(); for (String name : nameParts) { midName.append(name + " "); } midName.setLength(midName.length() - 1); personName.setSecondNameOrInitials(midName.toString()); LOG.trace("Assertion.userInfo.personName.secondNameOrInitials = {}", personName.getSecondNameOrInitials()); } }
Source:
protected void updateCurrentTime(long position) { if ((currentTimeTextView.getVisibility() == VISIBLE) && (Math.abs(position - lastUpdatedPosition) >= 1000 || lastUpdatedPosition == 0)) { lastUpdatedPosition = position; currentTimeTextView.setText(TimeFormatUtil.formatMs(position)); } }

Target:
protected void updateCurrentTime(long position) { if (Math.abs(position - lastUpdatedPosition) >= 1000 || lastUpdatedPosition == 0) { lastUpdatedPosition = position; currentTimeTextView.setText(TimeFormatUtil.formatMs(position)); } }
Source:
protected @Nullable Tree getEnclosingClassOrMethod(Tree tree) { TreePath path = getPath(tree); Set<Tree.Kind> classAndMethodKinds = EnumSet.copyOf(TreeUtils.classTreeKinds()); classAndMethodKinds.add(Kind.METHOD); classAndMethodKinds.add(Kind.TYPE_ANNOTATION); classAndMethodKinds.add(Kind.ANNOTATION); Tree enclosing = TreeUtils.enclosingOfKind(path, classAndMethodKinds); if (enclosing != null) { if (enclosing.getKind() == Kind.ANNOTATION || enclosing.getKind() == Kind.TYPE_ANNOTATION) { return null; } return enclosing; } Element e = getEnclosingElementForArtificialTree(tree); if (e != null) { Element enclosingMethodOrClass = e; while (enclosingMethodOrClass != null && enclosingMethodOrClass.getKind() != ElementKind.METHOD && !enclosingMethodOrClass.getKind().isClass() && !enclosingMethodOrClass.getKind().isInterface()) { enclosingMethodOrClass = enclosingMethodOrClass.getEnclosingElement(); } return declarationFromElement(enclosingMethodOrClass); } return getCurrentClassTree(tree); }

Target:
protected @Nullable Tree getEnclosingClassOrMethod(Tree tree) { TreePath path = getPath(tree); Tree enclosing = TreeUtils.enclosingOfKind(path, classMethodAnnotationKinds); if (enclosing != null) { if (enclosing.getKind() == Kind.ANNOTATION || enclosing.getKind() == Kind.TYPE_ANNOTATION) { return null; } return enclosing; } Element e = getEnclosingElementForArtificialTree(tree); if (e != null) { Element enclosingMethodOrClass = e; while (enclosingMethodOrClass != null && enclosingMethodOrClass.getKind() != ElementKind.METHOD && !enclosingMethodOrClass.getKind().isClass() && !enclosingMethodOrClass.getKind().isInterface()) { enclosingMethodOrClass = enclosingMethodOrClass.getEnclosingElement(); } return declarationFromElement(enclosingMethodOrClass); } return getCurrentClassTree(tree); }
Source:
public void connect() throws Exception { log.debug( String.format( "connect enter (%1$s:%2$s, %3$d, %4$d)", _host, _port, _hardTimeout, _softTimeout ) ); try { if (_client != null) { throw new IOException("Already connected"); } _client = _getSSHClient(); _client.setHardTimeout(_hardTimeout); _client.setSoftTimeout(_softTimeout); _client.setHost(_host, _port); log.debug("connecting"); _client.connect(); } catch(Exception e) { log.debug( String.format( "Could not connect to host %1$s", _client.getDisplayHost() ), e ); throw e; } }

Target:
public void connect() throws Exception { if (log.isDebugEnabled()) { log.debug( String.format( "connect enter (%1$s:%2$s, %3$d, %4$d)", _host, _port, _hardTimeout, _softTimeout ) ); } try { if (_client != null) { throw new IOException("Already connected"); } _client = _getSSHClient(); _client.setHardTimeout(_hardTimeout); _client.setSoftTimeout(_softTimeout); _client.setHost(_host, _port); log.debug("connecting"); _client.connect(); } catch(Exception e) { log.debug( String.format( "Could not connect to host %1$s", _client.getDisplayHost() ), e ); throw e; } }
Source:
public void dispose(IMediaStream stream){ if (amfInjectionListener != null){ amfInjectionListener.dispose(stream); } }

Target:
public void dispose(IMediaStream stream){ if (amfInjectionListener != null){ amfInjectionListener.dispose(stream); amfInjectionListener = null; } }
Source:
LRESULT wmChar (long hwnd, long wParam, long lParam) { if (ignoreCharacter) return null; LRESULT result = super.wmChar (hwnd, wParam, lParam); if (result != null) return result; switch ((int) wParam) { case SWT.DEL: if (OS.GetKeyState (OS.VK_CONTROL) < 0) { return LRESULT.ZERO; } } switch ((int) wParam) { case SWT.TAB: return LRESULT.ZERO; case SWT.CR: if (!ignoreDefaultSelection) sendSelectionEvent (SWT.DefaultSelection); ignoreDefaultSelection = false; if (getSelectionIndex() == -1) { if ((style & SWT.DROP_DOWN) != 0 && (style & SWT.READ_ONLY) == 0) { if (OS.SendMessage(handle, OS.CB_GETDROPPEDSTATE, 0, 0) != 0) { OS.SendMessage(handle, OS.CB_SHOWDROPDOWN, 0, 0); } return LRESULT.ZERO; } } case SWT.ESC: if ((style & SWT.DROP_DOWN) != 0) { if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) == 0) { return LRESULT.ZERO; } } } return result; }

Target:
LRESULT wmChar (long hwnd, long wParam, long lParam) { if (ignoreCharacter) return null; LRESULT result = super.wmChar (hwnd, wParam, lParam); if (result != null) return result; switch ((int) wParam) { case SWT.TAB: return LRESULT.ZERO; case SWT.CR: if (!ignoreDefaultSelection) sendSelectionEvent (SWT.DefaultSelection); ignoreDefaultSelection = false; if (getSelectionIndex() == -1) { if ((style & SWT.DROP_DOWN) != 0 && (style & SWT.READ_ONLY) == 0) { if (OS.SendMessage(handle, OS.CB_GETDROPPEDSTATE, 0, 0) != 0) { OS.SendMessage(handle, OS.CB_SHOWDROPDOWN, 0, 0); } return LRESULT.ZERO; } } case SWT.ESC: if ((style & SWT.DROP_DOWN) != 0) { if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) == 0) { return LRESULT.ZERO; } } case SWT.DEL: if (OS.GetKeyState (OS.VK_CONTROL) < 0) { return LRESULT.ZERO; } } return result; }
Source:
private void makeWikipediaZeroCrouton(int bgcolor, int fgcolor, String verbiage) { Style style = new Style.Builder() .setBackgroundColor(bgcolor) .setGravity(Gravity.CENTER) .setTextAppearance(android.R.attr.textAppearanceMedium) .setTextColor(fgcolor) .setHeight(192) .build(); Crouton.makeText(this, verbiage, style, R.id.zero_crouton_container).show(); }

Target:
private void makeWikipediaZeroCrouton(int bgcolor, int fgcolor, String verbiage) { Style style = new Style.Builder() .setBackgroundColor(bgcolor) .setGravity(Gravity.CENTER) .setTextSize(20) .setTextColor(fgcolor) .setHeight((int) Math.floor(192.0 * WikipediaApp.SCREEN_DENSITY)) .build(); Crouton.makeText(this, verbiage, style, R.id.zero_crouton_container).show(); }
Source:
protected JobDesc create(QualifiedJobId qualifiedJobId, Configuration jobConf, String appId, String version, Framework framework, long submitTimeMillis) { if (null == qualifiedJobId) { throw new IllegalArgumentException( "Cannot create a JobKey from a null qualifiedJobId."); } String userName = jobConf.get(Constants.USER_CONF_KEY_HADOOP2); if (StringUtils.isBlank(userName)) { userName = jobConf.get(Constants.USER_CONF_KEY); } return new JobDesc(qualifiedJobId, userName, appId, version, submitTimeMillis, framework); }

Target:
protected JobDesc create(QualifiedJobId qualifiedJobId, Configuration jobConf, String appId, String version, Framework framework, long submitTimeMillis) { if (null == qualifiedJobId) { throw new IllegalArgumentException( "Cannot create a JobKey from a null qualifiedJobId."); } String userName = HadoopConfUtil.getUserNameInConf(jobConf); return new JobDesc(qualifiedJobId, userName, appId, version, submitTimeMillis, framework); }
Source:
public void render(Context context, C value, SafeHtmlBuilder sb) { Integer errCount = (value != null && value.getErrorCount() != null ? value.getErrorCount() : 0); DOMTokenList tooltipClasses = tooltip.getClassList(); tooltip.setTextContent(Integer.toString(errCount)); if (errCount > 0) { tooltipClasses.add(ERROR_PRESENT_STYLE); } else { tooltipClasses.remove(ERROR_PRESENT_STYLE); } if (viewPresenter.isUserAuthorizedForPerspective(EXECUTION_ERRORS) && errCount > 0) { tooltip.setTitle(Constants.INSTANCE.ErrorCountNumberView(errCount)); tooltip.setAttribute(DATA_INSTANCE_ATTRIBUTE, value.getId().toString()); tooltipClasses.add(LINK_AVAILABLE_STYLE); initTooltipsAsync(); } else { tooltip.removeAttribute("title"); tooltip.removeAttribute(DATA_INSTANCE_ATTRIBUTE); tooltipClasses.remove(LINK_AVAILABLE_STYLE); } sb.appendHtmlConstant(tooltip.getOuterHTML()); }

Target:
public void render(Context context, C value, SafeHtmlBuilder sb) { Integer errCount = (value != null && value.getErrorCount() != null ? value.getErrorCount() : 0); DOMTokenList tooltipClasses = tooltip.getClassList(); tooltip.setTextContent(Integer.toString(errCount)); if (errCount > 0) { tooltipClasses.add(ERROR_PRESENT_STYLE); } else { tooltipClasses.remove(ERROR_PRESENT_STYLE); } if (viewPresenter.getViewErrorsActionCondition().test(value)) { tooltip.setTitle(Constants.INSTANCE.ErrorCountNumberView(errCount)); tooltip.setAttribute(DATA_INSTANCE_ATTRIBUTE, value.getId().toString()); tooltipClasses.add(LINK_AVAILABLE_STYLE); initTooltipsAsync(); } else { tooltip.removeAttribute("title"); tooltip.removeAttribute(DATA_INSTANCE_ATTRIBUTE); tooltipClasses.remove(LINK_AVAILABLE_STYLE); } sb.appendHtmlConstant(tooltip.getOuterHTML()); }
Source:
protected BasicDataSource getDatasource() { MetadataStorageConnectorConfig connectorConfig = getConfig(); BasicDataSource dataSource = new BasicDataSource(); dataSource.setUsername(connectorConfig.getUser()); dataSource.setPassword(connectorConfig.getPassword()); String uri = connectorConfig.getConnectURI(); dataSource.setUrl(uri); if (connectorConfig.isUseValidationQuery()) { dataSource.setValidationQuery(connectorConfig.getValidationQuery()); dataSource.setTestOnBorrow(true); } return dataSource; }

Target:
protected BasicDataSource getDatasource() { MetadataStorageConnectorConfig connectorConfig = getConfig(); BasicDataSource dataSource = new BasicDataSource(); dataSource.setUsername(connectorConfig.getUser()); dataSource.setPassword(connectorConfig.getPassword()); String uri = connectorConfig.getConnectURI(); dataSource.setUrl(uri); dataSource.setValidationQuery(connectorConfig.getValidationQuery()); dataSource.setTestOnBorrow(true); return dataSource; }
Source:
public void putObject( String bucketName, String objectName, String filename, PutObjectOptions options) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException { UploadObjectArgs.Builder builder = UploadObjectArgs.builder().bucket(bucketName).object(objectName).filename(filename); if (!options.contentType().equals("application/octet-stream")) { builder.contentType(options.contentType()); } uploadObject(builder.build()); }

Target:
public void putObject( String bucketName, String objectName, String filename, PutObjectOptions options) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException { UploadObjectArgs.Builder builder = UploadObjectArgs.builder().bucket(bucketName).object(objectName).filename(filename); if (options != null) { builder.sse(options.sse()); if (!options.contentType().equals("application/octet-stream")) { builder.contentType(options.contentType()); } } uploadObject(builder.build()); }
Source:
public void undelete(RepositoryPath path) throws IOException { Repository repository = path.getRepository(); Storage storage = repository.getStorage(); logger.debug("Attempting to restore: path-[{}]; ", path); super.undelete(path); repositoryEventListenerRegistry.dispatchUndeleteTrashEvent(storage.getId(), repository.getId()); logger.debug("The trash for {}:{} has been undeleted.", storage.getId(), repository.getId()); }

Target:
public void undelete(RepositoryPath path) throws IOException { Repository repository = path.getRepository(); Storage storage = repository.getStorage(); logger.debug("Attempting to restore: [{}]; ", path); super.undelete(path); repositoryEventListenerRegistry.dispatchUndeleteTrashEvent(storage.getId(), repository.getId()); logger.debug("The trash for {}:{} has been undeleted.", storage.getId(), repository.getId()); }
Source:
protected KeyPair reloadClientIdentity(Path path) throws IOException, GeneralSecurityException { if (isStrict()) { PosixFilePermission violation = KeyUtils.validateStrictKeyFilePermissions(path, IoUtils.EMPTY_LINK_OPTIONS); if (violation != null) { if (log.isDebugEnabled()) { log.debug("reloadClientIdentity({}) ignore due to permission violation: {}", path, violation); } return null; } String ownerViolation = KeyUtils.validateStrictKeyFileOwner(path, IoUtils.EMPTY_LINK_OPTIONS); if (ownerViolation != null) { if (log.isDebugEnabled()) { log.debug("reloadClientIdentity({}) ignore due to owner violation: {}", path, ownerViolation); } return null; } } String location = path.toString(); ClientIdentityLoader idLoader = getClientIdentityLoader(); if (idLoader.isValidLocation(location)) { return idLoader.loadClientIdentity(location, getFilePasswordProvider()); } if (log.isDebugEnabled()) { log.debug("reloadClientIdentity({}) invalid location", location); } return null; }

Target:
protected KeyPair reloadClientIdentity(Path path) throws IOException, GeneralSecurityException { if (isStrict()) { Pair<String, Object> violation = KeyUtils.validateStrictKeyFilePermissions(path, IoUtils.EMPTY_LINK_OPTIONS); if (violation != null) { if (log.isDebugEnabled()) { log.debug("reloadClientIdentity({}) ignore due to {}", path, violation.getFirst()); } return null; } } String location = path.toString(); ClientIdentityLoader idLoader = getClientIdentityLoader(); if (idLoader.isValidLocation(location)) { return idLoader.loadClientIdentity(location, getFilePasswordProvider()); } if (log.isDebugEnabled()) { log.debug("reloadClientIdentity({}) invalid location", location); } return null; }
Source:
public SessionFactory<F> resolve(Message<?> message) { DefaultFtpSessionFactory sessionFactory = new DefaultFtpSessionFactory(); sessionFactory.setHost(this.headerExpression.getValue(message).toString()); sessionFactory.setUsername(this.userNameExpression.getValue(message).toString()); sessionFactory.setPassword(this.passwordExpression.getValue(message).toString()); sessionFactory.setPort(Integer.valueOf(this.portExpression.getValue(message).toString())); return (SessionFactory<F>) sessionFactory; }

Target:
public SessionFactory<F> resolve(Message<?> message) { DefaultFtpSessionFactory sessionFactory = new DefaultFtpSessionFactory(); sessionFactory.setHost(evaluationContext != null ? this.headerExpression.getValue(evaluationContext, message, String.class) : this.headerExpression.getValue(message, String.class)); sessionFactory.setUsername(evaluationContext != null ? this.userNameExpression.getValue(evaluationContext, message, String.class) : this.userNameExpression.getValue(message, String.class)); sessionFactory.setPassword(evaluationContext != null ? this.passwordExpression.getValue(evaluationContext, message, String.class) : this.passwordExpression.getValue(message, String.class)); sessionFactory.setPort(evaluationContext != null ? this.portExpression.getValue(evaluationContext, message, Integer.class) : this.portExpression.getValue(message, Integer.class)); return (SessionFactory<F>) sessionFactory; }
Source:
public Collection<ConceptName> getIndexTermsForLocale(Locale locale) { Vector<ConceptName> indexTermsForLocale = new Vector<ConceptName>(); if (!getIndexTerms().isEmpty()) { for (ConceptName name : getIndexTerms()) { if (name.getLocale().equals(locale)) { indexTermsForLocale.add(name); } } } return indexTermsForLocale; }

Target:
public Collection<ConceptName> getIndexTermsForLocale(Locale locale) { Vector<ConceptName> indexTermsForLocale = new Vector<ConceptName>(); if (CollectionUtils.isNotEmpty(getIndexTerms())) { for (ConceptName name : getIndexTerms()) { if (name.getLocale().equals(locale)) { indexTermsForLocale.add(name); } } } return indexTermsForLocale; }
Source:
private static Collection<ConnectionReference> getAllFBNElementConnections(FBNetworkElement model) { List<ConnectionReference> connections = new ArrayList<>(); for (IInterfaceElement elem : model.getInterface().getAllInterfaceElements()) { connections.addAll((elem.isIsInput() ? elem.getInputConnections() : elem.getOutputConnections()).stream() .map(conn -> new ConnectionReference(conn)).collect(Collectors.toList())); } return connections; }

Target:
private static Collection<ConnectionReference> getAllFBNElementConnections(FBNetworkElement model) { List<ConnectionReference> connections = new ArrayList<>(); for (IInterfaceElement elem : model.getInterface().getAllInterfaceElements()) { connections.addAll(getConnectionList(elem).stream().map(conn -> new ConnectionReference(conn)) .collect(Collectors.toList())); } return connections; }
Source:
static Map<String, List<String>> addQuotaProjectIdToRequestMetadata( String quotaProjectId, Map<String, List<String>> requestMetadata) { Preconditions.checkNotNull(requestMetadata, "requestMetadata"); Map<String, List<String>> newRequestMetadata = new HashMap<>(requestMetadata); if (quotaProjectId != null && !requestMetadata.containsKey(QUOTA_PROJECT_ID_HEADER_KEY)) { newRequestMetadata.put( QUOTA_PROJECT_ID_HEADER_KEY, Collections.singletonList(quotaProjectId)); } return Collections.unmodifiableMap(newRequestMetadata); }

Target:
static Map<String, List<String>> addQuotaProjectIdToRequestMetadata( String quotaProjectId, Map<String, List<String>> requestMetadata) { Preconditions.checkNotNull(requestMetadata); Map<String, List<String>> newRequestMetadata = new HashMap<>(requestMetadata); if (quotaProjectId != null && !requestMetadata.containsKey(QUOTA_PROJECT_ID_HEADER_KEY)) { newRequestMetadata.put( QUOTA_PROJECT_ID_HEADER_KEY, Collections.singletonList(quotaProjectId)); } return Collections.unmodifiableMap(newRequestMetadata); }
Source:
public void nonInterleavedOperationsTest() throws Exception { for (int i = 0; i < 10; i++) { Queue<OperationType> opChain = new LinkedList<>(); opChain.add(OperationType.PUT_NB); opChain.add(OperationType.AWAIT_CREATION); opChain.add(OperationType.GET_INFO_NB); opChain.add(OperationType.GET_NB); opChain.add(OperationType.DELETE_NB); opChain.add(OperationType.AWAIT_DELETION); opChain.add(OperationType.GET_INFO_DELETED_NB); opChain.add(OperationType.GET_DELETED_NB); testFramework.checkOperationChains( Collections.singletonList(testFramework.startOperationChain(32 * 1024, i, opChain))); } }

Target:
public void nonInterleavedOperationsTest() throws Exception { Random random = new Random(); for (int i = 0; i < 10; i++) { Queue<OperationType> operations = new LinkedList<>(); operations.add(OperationType.PUT_NB); operations.add(OperationType.AWAIT_CREATION); operations.add(OperationType.GET_INFO_NB); operations.add(OperationType.GET_NB); operations.add(OperationType.DELETE_NB); operations.add(OperationType.AWAIT_DELETION); operations.add(OperationType.GET_INFO_DELETED_NB); operations.add(OperationType.GET_DELETED_NB); int blobSize = random.nextInt(100 * 1024); testFramework.checkOperationChains( Collections.singletonList(testFramework.startOperationChain(blobSize, i, operations))); } }
Source:
private List<Integer> getKeys(final Collection<NMFData> dataValues) { final List<Integer> keys = new ArrayList<>(); final Set<Integer> keySet = Sets.newTreeSet(); for (final NMFData datum : dataValues) { keySet.addAll( datum.getColumns() .stream() .map(Pair::getFirst) .collect(Collectors.toList())); } return keys; }

Target:
private List<Integer> getKeys(final Collection<NMFData> dataValues) { final ArrayList<Integer> keys = new ArrayList<>(); final Set<Integer> keySet = Sets.newTreeSet(); for (final NMFData datum : dataValues) { keySet.addAll( datum.getColumns() .stream() .distinct() .map(Pair::getFirst) .collect(Collectors.toList())); } keys.ensureCapacity(keySet.size()); keys.addAll(keySet); return keys; }
Source:
public BlobIdTransformerTest() throws IOException { BlobIdStringPair[] blobIdStringPairs = new BlobIdStringPair[]{BLOB_ID_PAIR_VERSION_1_CONVERTED, BLOB_ID_PAIR_VERSION_2_CONVERTED, BLOB_ID_PAIR_VERSION_3_CONVERTED}; mockStoreKeyConverter = createAndSetupMockStoreKeyConverter(blobIdStringPairs); transformer = new BlobIdTransformer(mockStoreKeyConverter, blobIdFactory, null); blobIdStringPairList = new ArrayList<>(Arrays.asList(blobIdStringPairs)); blobIdStringPairList.add(new BlobIdStringPair(VERSION_3_UNCONVERTED, null)); }

Target:
public BlobIdTransformerTest() throws IOException { Pair<String, String>[] pairs = new Pair[]{BLOB_ID_PAIR_VERSION_1_CONVERTED, BLOB_ID_PAIR_VERSION_2_CONVERTED, BLOB_ID_PAIR_VERSION_3_CONVERTED, BLOB_ID_PAIR_VERSION_3_NULL}; factory = new MockStoreKeyConverterFactory(null, null); factory.setReturnInputIfAbsent(true); StoreKeyConverter storeKeyConverter = createAndSetupMockStoreKeyConverter(factory, pairs); transformer = new BlobIdTransformer(storeKeyConverter, blobIdFactory); pairList = new ArrayList<>(Arrays.asList(pairs)); pairList.add(new Pair<>(VERSION_3_UNCONVERTED, VERSION_3_UNCONVERTED)); }
Source:
public SweepResults sweepSnapshotValues() { TodoSchemaTableFactory tableFactory = TodoSchemaTableFactory.of(Namespace.DEFAULT_NAMESPACE); TableReference indexTable = tableFactory.getSnapshotsStreamValueTable(null).getTableRef(); SweepBatchConfig sweepConfig = ImmutableSweepBatchConfig.builder() .candidateBatchSize(AtlasDbConstants.DEFAULT_SWEEP_CANDIDATE_BATCH_HINT) .deleteBatchSize(AtlasDbConstants.DEFAULT_SWEEP_DELETE_BATCH_HINT) .maxCellTsPairsToExamine(AtlasDbConstants.DEFAULT_SWEEP_READ_LIMIT) .build(); return sweepTaskRunner.get().run(indexTable, sweepConfig, PtBytes.EMPTY_BYTE_ARRAY); }

Target:
public SweepResults sweepSnapshotValues() { TodoSchemaTableFactory tableFactory = TodoSchemaTableFactory.of(Namespace.DEFAULT_NAMESPACE); TableReference valueTable = tableFactory.getSnapshotsStreamValueTable(null).getTableRef(); return sweepTable(valueTable); }
Source:
public String forwardMenuDefaultPlugin(@Valid @NotNull @PathVariable String menuId, Model model) { Menu menu = menuReaderService .getMenu() .flatMap(it -> it.findMenu(menuId)) .orElseThrow( () -> new RuntimeException("menu with id [" + menuId + "] does not exist")); model.addAttribute(KEY_MENU_ID, menuId); String pluginId = menu.firstItem().map(MenuItem::getId).orElse(VoidPluginController.ID); String contextUri = URI + '/' + menuId + '/' + pluginId; addModelAttributes(model, contextUri); return getForwardPluginUri(pluginId); }

Target:
public String forwardMenuDefaultPlugin(@Valid @NotNull @PathVariable String menuId, Model model) { Menu filteredMenu = menuReaderService .getMenu() .flatMap(menu -> menu.findMenu(menuId)) .orElseThrow( () -> new RuntimeException("menu with id [" + menuId + "] does not exist")); model.addAttribute(KEY_MENU_ID, menuId); String pluginId = filteredMenu.firstItem().map(MenuItem::getId).orElse(VoidPluginController.ID); String contextUri = URI + '/' + menuId + '/' + pluginId; addModelAttributes(model, contextUri); return getForwardPluginUri(pluginId); }
Source:
public void error_missingIndexBackend_emptyOptional() { String keyPrefix = "somePrefix."; resetAll(); EasyMock.expect( configurationSourceMock.get( "indexes.indexName.backend" ) ) .andReturn( Optional.empty() ); EasyMock.expect( configurationSourceMock.resolve( "indexes.indexName.backend" ) ) .andReturn( Optional.of( keyPrefix + "indexes.indexName.backend" ) ); EasyMock.expect( configurationSourceMock.get( "indexes.default.backend" ) ) .andReturn( Optional.empty() ); EasyMock.expect( configurationSourceMock.resolve( "indexes.default.backend" ) ) .andReturn( Optional.of( keyPrefix + "indexes.default.backend" ) ); replayAll(); thrown.expect( SearchException.class ); thrown.expectMessage( "Missing backend reference for index 'indexName'" ); thrown.expectMessage( "Set the property 'somePrefix.indexes.indexName.backend' to a supported value" ); thrown.expectMessage( "or set 'somePrefix.indexes.default.backend' to set a default for all indexes" ); holder.startBuilding( "indexName", false ); verifyAll(); }

Target:
public void error_missingIndexBackend_emptyOptional() { String keyPrefix = "somePrefix."; resetAll(); EasyMock.expect( configurationSourceMock.get( "indexes.indexName.backend" ) ) .andReturn( Optional.empty() ); EasyMock.expect( configurationSourceMock.resolve( "indexes.indexName.backend" ) ) .andReturn( Optional.of( keyPrefix + "indexes.indexName.backend" ) ); EasyMock.expect( configurationSourceMock.get( "indexes.default.backend" ) ) .andReturn( Optional.empty() ); EasyMock.expect( configurationSourceMock.resolve( "indexes.default.backend" ) ) .andReturn( Optional.of( keyPrefix + "indexes.default.backend" ) ); replayAll(); thrown.expect( SearchException.class ); thrown.expectMessage( "Missing backend reference for index 'indexName'" ); thrown.expectMessage( "Set the property 'somePrefix.indexes.indexName.backend' to a supported value" ); thrown.expectMessage( "or set 'somePrefix.indexes.default.backend' to set a default value for all indexes" ); holder.startBuilding( "indexName", false ); verifyAll(); }
Source:
public GenericRow transform(GenericRow record) { for (Map.Entry<String, ExpressionEvaluator> entry : _expressionEvaluators.entrySet()) { String column = entry.getKey(); ExpressionEvaluator transformExpressionEvaluator = entry.getValue(); if (record.getValue(column) == null || column.equals(_timeColumn)) { Object result = transformExpressionEvaluator.evaluate(record); record.putValue(column, result); } } return record; }

Target:
public GenericRow transform(GenericRow record) { for (Map.Entry<String, ExpressionEvaluator> entry : _expressionEvaluators.entrySet()) { String column = entry.getKey(); ExpressionEvaluator transformExpressionEvaluator = entry.getValue(); if (record.getValue(column) == null) { Object result = transformExpressionEvaluator.evaluate(record); record.putValue(column, result); } } return record; }
Source:
public static String urlDecode(String arg) { try { return URLDecoder.decode(arg, UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }

Target:
private static String urlDecode(String arg) { try { return URLDecoder.decode(arg, UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
Source:
public ServerConversation(List<ServerMessage> messages) { this.messages = messages; long latest = 0; for (ServerMessage message : messages) { if (message.sentEpochMillis > latest) latest = message.sentEpochMillis; } ServerMessage lastMessage = messages.get(messages.size() - 1); this.isDismissed = lastMessage.isDismissed || lastMessage.type == ServerMessage.Type.FromUser; this.latestEpochMillis = latest; }

Target:
public ServerConversation(List<ServerMessage> messages) { this.messages = messages; long latest = 0; for (ServerMessage message : messages) { if (message.sentEpochMillis > latest) latest = message.sentEpochMillis; } ServerMessage lastMessage = messages.get(messages.size() - 1); this.isDisplayable = !lastMessage.isDismissed && lastMessage.type != ServerMessage.Type.FromUser; this.latestEpochMillis = latest; }