auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static OkHttpClient HttpClientBuilder() { ConnectionSpec spec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) .tlsVersions(TlsVersion.TLS_1_2) .cipherSuites( CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_DHE_RSA_WITH_AES_128_GCM_SHA256) .build(); OkHttpClient httpClient = new OkHttpClient.Builder() .connectTimeout(5000, TimeUnit.MILLISECONDS) .readTimeout(30000, TimeUnit.MILLISECONDS) .writeTimeout(30000, TimeUnit.MILLISECONDS) .connectionSpecs(Collections.singletonList(spec)) .build(); return httpClient; }

Target:
public static OkHttpClient HttpClientBuilder() { OkHttpClient httpClient; if (Build.VERSION.SDK_INT == 24) { ConnectionSpec spec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) .tlsVersions(TlsVersion.TLS_1_2) .cipherSuites(CipherSuite.TLS_DHE_RSA_WITH_AES_128_GCM_SHA256) .build(); httpClient = new OkHttpClient.Builder() .connectTimeout(5000, TimeUnit.MILLISECONDS) .readTimeout(30000, TimeUnit.MILLISECONDS) .writeTimeout(30000, TimeUnit.MILLISECONDS) .connectionSpecs(Collections.singletonList(spec)) .build(); } else { httpClient = new OkHttpClient.Builder() .connectTimeout(5000, TimeUnit.MILLISECONDS) .readTimeout(30000, TimeUnit.MILLISECONDS) .writeTimeout(30000, TimeUnit.MILLISECONDS) .build(); } return httpClient; }
Source:
private void reject(final RawData raw, final MessageFormatException cause) { EmptyMessage rst = new EmptyMessage(Type.RST); rst.setMID(cause.getMid()); rst.setToken(new byte[0]); rst.setDestination(raw.getAddress()); rst.setDestinationPort(raw.getPort()); reject(rst); LOGGER.log( Level.FINE, "rejected malformed message from [{0}], reason: {1}", new Object[]{raw.getInetSocketAddress(), cause.getMessage()}); }

Target:
private void reject(final RawData raw, final MessageFormatException cause) { EmptyMessage rst = new EmptyMessage(Type.RST); rst.setMID(cause.getMid()); rst.setToken(new byte[0]); rst.setDestination(raw.getAddress()); rst.setDestinationPort(raw.getPort()); for (MessageInterceptor interceptor : interceptors) { interceptor.sendEmptyMessage(rst); } connector.send(serializer.serializeEmptyMessage(rst)); LOGGER.log( Level.FINE, "rejected malformed message from [{0}], reason: {1}", new Object[]{raw.getInetSocketAddress(), cause.getMessage()}); }
Source:
public int nextClearBit(final int i) { int x = i >> 6; long w = ~bitmap.get(x); w >>>= i; if (w != 0) { return i + numberOfTrailingZeros(w); } int length = bitmap.limit(); for (++x; x < length; ++x) { long map = ~bitmap.get(x); if (map != 0L) { return x * 64 + numberOfTrailingZeros(map); } } return length * 64; }

Target:
public int nextClearBit(final int i) { int x = i >> 6; long w = ~bitmap.get(x); w >>>= i; if (w != 0) { return i + numberOfTrailingZeros(w); } int length = bitmap.limit(); for (++x; x < length; ++x) { long map = ~bitmap.get(x); if (map != 0L) { return x * 64 + numberOfTrailingZeros(map); } } return MAX_CAPACITY; }
Source:
protected WeldBeanDeploymentArchive createAdditionalBeanDeploymentArchive(Class<?> beanClass) { Set<String> beanClasses = new HashSet<String>(); beanClasses.add(beanClass.getName()); WeldBeanDeploymentArchive additionalBda = new WeldBeanDeploymentArchive(beanClass.getClassLoader().getClass().getName() + "@" + System.identityHashCode(beanClass.getClassLoader()) + ADDITIONAL_BDA_ID_SUFFIX, beanClasses, null); additionalBda.getServices().add(ResourceLoader.class, resourceLoader); additionalBda.getServices().addAll(getServices().entrySet()); beanDeploymentArchives.add(additionalBda); for (WeldBeanDeploymentArchive archive : beanDeploymentArchives) { archive.setAccessibleBeanDeploymentArchives(beanDeploymentArchives); } additionalBeanDeploymentArchives.put(beanClass.getClassLoader(), additionalBda); return additionalBda; }

Target:
protected WeldBeanDeploymentArchive createAdditionalBeanDeploymentArchive(Class<?> beanClass) { Set<String> beanClasses = new HashSet<String>(); beanClasses.add(beanClass.getName()); WeldBeanDeploymentArchive additionalBda = new WeldBeanDeploymentArchive(ADDITIONAL_BDA_ID, beanClasses, null); additionalBda.getServices().add(ResourceLoader.class, resourceLoader); additionalBda.getServices().addAll(getServices().entrySet()); beanDeploymentArchives.add(additionalBda); for (WeldBeanDeploymentArchive archive : beanDeploymentArchives) { archive.setAccessibleBeanDeploymentArchives(beanDeploymentArchives); } return additionalBda; }
Source:
public void init(ProjectScreen presenter) { this.presenter = presenter; if (!this.presenter.canEditContributors()) { this.editContributors.hidden = true; } if (!this.presenter.userCanUpdateProject()) { this.addAsset.hidden = true; this.importAsset.hidden = true; } if (!this.presenter.userCanBuildProject()) { this.build.disabled = true; this.deploy.disabled = true; } if (!this.presenter.userCanDeleteRepository()) { this.deleteProject.hidden = true; } }

Target:
public void init(ProjectScreen presenter) { this.presenter = presenter; }
Source:
private void removeEntitiesFromStorageDomain(final List<VM> vmsForStorageDomain, final List<VmTemplate> vmTemplatesForStorageDomain, final List<DiskImage> disksForStorageDomain, final Guid storageDomainId) { TransactionSupport.executeInNewTransaction(() -> { if (!vmsForStorageDomain.isEmpty() || !vmTemplatesForStorageDomain.isEmpty() || !disksForStorageDomain.isEmpty()) { for (VM vm : vmsForStorageDomain) { removeEntityLeftOver(vm.getId(), vm.getName(), storageDomainId); unregisteredOVFDataDao.saveOVFData(new OvfEntityData( vm.getId(), vm.getName(), VmEntityType.VM, vm.getClusterArch(), vm.getCompatibilityVersion(), storageDomainId, null, null)); } for (VmTemplate vmTemplate : vmTemplatesForStorageDomain) { removeEntityLeftOver(vmTemplate.getId(), vmTemplate.getName(), storageDomainId); unregisteredOVFDataDao.saveOVFData(new OvfEntityData( vmTemplate.getId(), vmTemplate.getName(), VmEntityType.TEMPLATE, vmTemplate.getClusterArch(), clusterDao.get(vmTemplate.getClusterId()).getCompatibilityVersion(), storageDomainId, null, null)); } storageDomainDao.removeEntitesFromStorageDomain(storageDomainId); } return null; }); }

Target:
private void removeEntitiesFromStorageDomain(final List<VM> vmsForStorageDomain, final List<VmTemplate> vmTemplatesForStorageDomain, final List<DiskImage> disksForStorageDomain, final Guid storageDomainId) { if (!vmsForStorageDomain.isEmpty() || !vmTemplatesForStorageDomain.isEmpty() || !disksForStorageDomain.isEmpty()) { TransactionSupport.executeInNewTransaction(() -> { for (VM vm : vmsForStorageDomain) { removeEntityLeftOver(vm.getId(), vm.getName(), storageDomainId); unregisteredOVFDataDao.saveOVFData(new OvfEntityData( vm.getId(), vm.getName(), VmEntityType.VM, vm.getClusterArch(), vm.getCompatibilityVersion(), storageDomainId, null, null)); } for (VmTemplate vmTemplate : vmTemplatesForStorageDomain) { removeEntityLeftOver(vmTemplate.getId(), vmTemplate.getName(), storageDomainId); unregisteredOVFDataDao.saveOVFData(new OvfEntityData( vmTemplate.getId(), vmTemplate.getName(), VmEntityType.TEMPLATE, vmTemplate.getClusterArch(), clusterDao.get(vmTemplate.getClusterId()).getCompatibilityVersion(), storageDomainId, null, null)); } storageDomainDao.removeEntitesFromStorageDomain(storageDomainId); return null; } }); }
Source:
public ContainerBuilder(Container origin) { if (origin == null) { throw new IllegalArgumentException("origin cannot be null."); } this.id = origin.getId(); this.name = origin.getName(); this.status = origin.getStatus(); this.description = origin.getDescription(); this.isPrivate = origin.getIsPrivate(); this.parentAccountId = origin.getParentAccountId(); this.version = CONTAINER_METADATA_VERSION_1; }

Target:
public ContainerBuilder(Container origin) { if (origin == null) { throw new IllegalArgumentException("origin cannot be null."); } id = origin.getId(); name = origin.getName(); status = origin.getStatus(); description = origin.getDescription(); isPrivate = origin.isPrivate(); parentAccountId = origin.getParentAccountId(); }
Source:
private DatasetResponseWithStatusCodeAndHeaders fetchOnlyOnce(final URI resource, final URI requesterWebID, final LinkedDataCacheEntry linkedDataCacheEntry, final HttpHeaders headers) { String cacheKey = makeCacheKey(resource, requesterWebID); CountDownLatch latch = new CountDownLatch(1); CountDownLatch preExistingLatch = countDownLatchMap.putIfAbsent(cacheKey, latch); try { if (preExistingLatch != null) { if (logger.isDebugEnabled()) { logger.debug("resource " + cacheKey + " is being fetched in another thread, we wait for its result and use it " + "if it turns out to be cacheable"); } try { preExistingLatch.await(); } catch (InterruptedException e) { logger.warn("interrupted while waiting for another thread to fetch '" + resource + "'"); } Element element = cache.get(cacheKey); if (element != null) { if (logger.isDebugEnabled()) { logger.debug("resource " + cacheKey + " turned out to be cacheable, using it"); } LinkedDataCacheEntry entry = (LinkedDataCacheEntry) element.getObjectValue(); return entry.recreateResponse(); } if (logger.isDebugEnabled()) { logger.debug("resource " + cacheKey + " did not turn out to be cacheable - fetching it, too"); } } return fetchAndCacheIfAppropriate(resource, requesterWebID, linkedDataCacheEntry, headers); } finally { countDownLatchMap.remove(cacheKey, latch); latch.countDown(); } }

Target:
private DatasetResponseWithStatusCodeAndHeaders fetchOnlyOnce(final URI resource, final URI requesterWebID, final LinkedDataCacheEntry linkedDataCacheEntry, final HttpHeaders headers) { String cacheKey = makeCacheKey(resource, requesterWebID); CountDownLatch latch = new CountDownLatch(1); CountDownLatch preExistingLatch = countDownLatchMap.putIfAbsent(cacheKey, latch); try { if (preExistingLatch != null) { if (logger.isDebugEnabled()) { logger.debug("resource {}" + " is being fetched in another thread, we wait for its result and use it " + "if it turns out to be cacheable", cacheKey); } try { preExistingLatch.await(); } catch (InterruptedException e) { logger.warn("interrupted while waiting for another thread to fetch '" + resource + "'"); } Element element = cache.get(cacheKey); if (element != null) { if (logger.isDebugEnabled()) { logger.debug("resource turned out to be cacheable, using it", cacheKey); } LinkedDataCacheEntry entry = (LinkedDataCacheEntry) element.getObjectValue(); return entry.recreateResponse(); } if (logger.isDebugEnabled()) { logger.debug("resource did not turn out to be cacheable - fetching it, too", cacheKey); } } return fetchAndCacheIfAppropriate(resource, requesterWebID, linkedDataCacheEntry, headers); } finally { countDownLatchMap.remove(cacheKey, latch); latch.countDown(); } }
Source:
public Optional<SmeltingResult> getResult(@Nonnull ItemStackSnapshot ingredient) { if (isValid(ingredient)) { return Optional.of(new SmeltingResult(this.exemplaryResult, this.experience)); } else { return Optional.empty(); } }

Target:
public Optional<SmeltingResult> getResult(@Nonnull ItemStackSnapshot ingredient) { if (isValid(ingredient)) { return Optional.of(new SmeltingResult(this.exemplaryResult, this.experience)); } return Optional.empty(); }
Source:
private ResourcePool tryFindResourcePool(Folder folder, String hostname) { Iterable<ResourcePool> resourcePools = ImmutableSet.<ResourcePool>of(); try { ManagedEntity[] resourcePoolEntities = new InventoryNavigator(folder).searchManagedEntities("ResourcePool"); resourcePools = Iterables.transform(Arrays.asList(resourcePoolEntities), new Function<ManagedEntity, ResourcePool>() { public ResourcePool apply(ManagedEntity input) { return (ResourcePool) input; } }); Optional<ResourcePool> optionalResourcePool = Iterables.tryFind(resourcePools, VSpherePredicate.isResourcePoolOf(hostname)); return optionalResourcePool.orNull(); } catch (Exception e) { logger.error("Problem in finding a valid resource pool", e); } return null; }

Target:
private Optional<ResourcePool> tryFindResourcePool(Folder folder, String hostname) { Iterable<ResourcePool> resourcePools = ImmutableSet.<ResourcePool>of(); try { ManagedEntity[] resourcePoolEntities = new InventoryNavigator(folder).searchManagedEntities("ResourcePool"); resourcePools = Iterables.transform(Arrays.asList(resourcePoolEntities), new Function<ManagedEntity, ResourcePool>() { public ResourcePool apply(ManagedEntity input) { return (ResourcePool) input; } }); Optional<ResourcePool> optionalResourcePool = Iterables.tryFind(resourcePools, VSpherePredicate.isResourcePoolOf(hostname)); return optionalResourcePool; } catch (Exception e) { logger.error("Problem in finding a valid resource pool", e); } return Optional.absent(); }
Source:
private void mkAssignments() throws Exception { try { mkAssignments(null); } catch(Exception e) { this.mkAssignmentsErrors.mark(); throw e; } }

Target:
private void mkAssignments() throws Exception { mkAssignments(null); }
Source:
public void instantiationWithHttpRequestPopulatesCorrectly() throws IOException { HttpServletRequest mockRequest = mock(HttpServletRequest.class); String expectedPathInfo = "someUrlPath"; String expectedMethod = "GET"; Enumeration<String> expectedHeaderNames = new Vector<String>(Arrays.asList("header1")).elements(); String bodyContent = "bodyContent"; String expectedContentType = "contentType"; when(mockRequest.getPathInfo()).thenReturn(expectedPathInfo); when(mockRequest.getMethod()).thenReturn(expectedMethod); when(mockRequest.getQueryString()).thenReturn("hello=world"); when(mockRequest.getHeaderNames()).thenReturn(expectedHeaderNames); when(mockRequest.getHeader("header1")).thenReturn("thisIsHeader1"); when(mockRequest.getReader()).thenReturn(new BufferedReader(new StringReader(bodyContent))); when(mockRequest.getContentType()).thenReturn(expectedContentType); ClientDriverRequest clientDriverRequest = new ClientDriverRequest(mockRequest); assertThat((String) clientDriverRequest.getPath(), is(expectedPathInfo)); assertThat(clientDriverRequest.getMethod(), is(Method.GET)); assertThat(clientDriverRequest.getParams().size(), is(1)); assertThat((String) clientDriverRequest.getParams().get("hello").iterator().next(), is("world")); assertThat((String) clientDriverRequest.getHeaders().get("header1"), is("thisIsHeader1")); assertThat((String) clientDriverRequest.getBodyContentType(), is(expectedContentType)); }

Target:
public void instantiationWithHttpRequestPopulatesCorrectly() throws IOException { HttpServletRequest mockRequest = mock(HttpServletRequest.class); String expectedPathInfo = "someUrlPath"; String expectedMethod = "GET"; Enumeration<String> expectedHeaderNames = Collections.enumeration(Arrays.asList("header1")); String bodyContent = "bodyContent"; String expectedContentType = "contentType"; when(mockRequest.getPathInfo()).thenReturn(expectedPathInfo); when(mockRequest.getMethod()).thenReturn(expectedMethod); when(mockRequest.getParameterMap()).thenReturn(new HashMap<String, String[]>() {{ put("hello", new String[] { "world" });}}); when(mockRequest.getHeaderNames()).thenReturn(expectedHeaderNames); when(mockRequest.getHeader("header1")).thenReturn("thisIsHeader1"); when(mockRequest.getReader()).thenReturn(new BufferedReader(new StringReader(bodyContent))); when(mockRequest.getContentType()).thenReturn(expectedContentType); ClientDriverRequest clientDriverRequest = new ClientDriverRequest(mockRequest); assertThat((String) clientDriverRequest.getPath(), is(expectedPathInfo)); assertThat(clientDriverRequest.getMethod(), is(Method.GET)); assertThat(clientDriverRequest.getParams().size(), is(1)); assertThat((String) clientDriverRequest.getParams().get("hello").iterator().next(), is("world")); assertThat((String) clientDriverRequest.getHeaders().get("header1"), is("thisIsHeader1")); assertThat((String) clientDriverRequest.getBodyContentType(), is(expectedContentType)); }
Source:
private void closeConnection(String deviceId) { DeviceConfig device = deviceConfigCache.get(deviceId); if (device == null) { logger.error("Could not find device '{}'", deviceId); return; } EpsonProjectorDevice remoteController = device.getConnection(); if (remoteController != null) { try { logger.debug("Closing connection to device '{}' ", deviceId); remoteController.disconnect(); } catch (EpsonProjectorException e) { logger.debug("Error occurred when closing connection to device '{}'", deviceId); } } }

Target:
private void closeConnection(String deviceId) { DeviceConfig device = deviceConfigCache.get(deviceId); if (device == null) { logger.warn("Could not find device '{}'", deviceId); return; } EpsonProjectorDevice remoteController = device.getConnection(); if (remoteController != null) { try { logger.debug("Closing connection to device '{}' ", deviceId); remoteController.disconnect(); } catch (EpsonProjectorException e) { logger.debug("Error occurred when closing connection to device '{}'", deviceId); } } }
Source:
public static String formatFilesize(long filesize, int decimalPlaces) { int multipleCount = 0; long filesizeRemainder = 0; long filesizeValue = filesize; while (filesizeValue > 1024 && multipleCount < filesizeSuffixes.length) { filesizeRemainder = filesizeValue % 1024; filesizeValue /= 1024; multipleCount++; } StringBuilder filesizeBuilder = new StringBuilder(); filesizeBuilder.append(filesizeValue); if (filesizeRemainder > 0 && decimalPlaces > 0) { int decimalMultiplier = 1; for (int i = 0; i < decimalPlaces; i++) { decimalMultiplier *= 10; } filesizeRemainder = (filesizeRemainder * decimalMultiplier) / 1024; if (filesizeRemainder > 0) { filesizeBuilder.append(".").append(filesizeRemainder); } } filesizeBuilder.append(" "); if (multipleCount < filesizeSuffixes.length) { filesizeBuilder.append(filesizeSuffixes[multipleCount]); } else { filesizeBuilder.append(filesizeSuffixes[filesizeSuffixes.length - 1]); } return filesizeBuilder.toString(); }

Target:
public static String formatFilesize(long filesize, int decimalPlaces) { int multipleCount = 0; long filesizeRemainder = 0; long filesizeValue = filesize; while (filesizeValue > UNIT_FACTOR && multipleCount < filesizeSuffixes.length) { filesizeRemainder = filesizeValue % UNIT_FACTOR; filesizeValue /= UNIT_FACTOR; multipleCount++; } StringBuilder filesizeBuilder = new StringBuilder(); filesizeBuilder.append(filesizeValue); if (filesizeRemainder > 0 && decimalPlaces > 0) { int decimalMultiplier = 1; for (int i = 0; i < decimalPlaces; i++) { decimalMultiplier *= 10; } filesizeRemainder = (filesizeRemainder * decimalMultiplier) / UNIT_FACTOR; if (filesizeRemainder > 0) { filesizeBuilder.append(".").append(filesizeRemainder); } } filesizeBuilder.append(" "); if (multipleCount < filesizeSuffixes.length) { filesizeBuilder.append(filesizeSuffixes[multipleCount]); } else { filesizeBuilder.append(filesizeSuffixes[filesizeSuffixes.length - 1]); } return filesizeBuilder.toString(); }
Source:
public void deleteCommand(@ApiParam("The id of the workspace") @PathParam("id") String id, @ApiParam("The name of the command to remove") @PathParam("name") String commandName) throws ServerException, BadRequestException, NotFoundException, ConflictException, ForbiddenException { final WorkspaceImpl workspace = workspaceManager.getWorkspace(id); if (workspace.getConfig().getCommands().removeIf(command -> command.getName().equals(commandName))) { workspaceManager.updateWorkspace(id, workspace); } else { throw new NotFoundException(String.format("Failed to delete command '%s'", commandName)); } }

Target:
public void deleteCommand(@ApiParam("The id of the workspace") @PathParam("id") String id, @ApiParam("The name of the command to remove") @PathParam("name") String commandName) throws ServerException, BadRequestException, NotFoundException, ConflictException, ForbiddenException { final WorkspaceImpl workspace = workspaceManager.getWorkspace(id); if (workspace.getConfig().getCommands().removeIf(command -> command.getName().equals(commandName))) { workspaceManager.updateWorkspace(id, workspace); } else { throw new NotFoundException(String.format("Command with name '%s' was not found in workspace with id %s", commandName, id)); } }
Source:
protected void doExecute() { Collection<EObject> impactedEObjects = new ArrayList<EObject>(); DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); final ECrossReferenceAdapter xReferencer = session.getSemanticCrossReferencer(); ModelAccessor modelAccessor = session.getModelAccessor(); for (EObject eObject : toRemoveXRefFrom) { ECrossReferenceAdapter filteredCrossReferencer = new ECrossReferenceAdapter() { @Override public Collection<Setting> getInverseReferences(EObject eObject, boolean resolve) { Collection<Setting> settings = xReferencer.getInverseReferences(eObject, resolve); Collection<Setting> settingsToTryToUnset = Lists.newArrayList(); for (Setting s : settings) { if (!toRemoveXRefFrom.contains(s.getEObject())) { settingsToTryToUnset.add(s); } } return settingsToTryToUnset; } }; impactedEObjects.addAll(modelAccessor.eRemoveInverseCrossReferences(eObject, filteredCrossReferencer, isReferenceToIgnorePredicate)); } for (EObject impactedEObject : impactedEObjects) { Resource resource = impactedEObject.eResource(); if (session.getSemanticResources().contains(resource)) { session.getRefreshEditorsListener().disable(); break; } } DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); toRemoveXRefFrom.clear(); session = null; }

Target:
protected void doExecute() { Collection<EObject> impactedEObjects = new ArrayList<EObject>(); DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); for (EObject eObject : toRemoveXRefFrom) { ECrossReferenceAdapter filteredCrossReferencer = new ECrossReferenceAdapter() { @Override public Collection<Setting> getInverseReferences(EObject eObject, boolean resolve) { Collection<Setting> settings = xReferencer.getInverseReferences(eObject, resolve); Collection<Setting> settingsToTryToUnset = Lists.newArrayList(); for (Setting s : settings) { if (!toRemoveXRefFrom.contains(s.getEObject())) { settingsToTryToUnset.add(s); } } return settingsToTryToUnset; } }; impactedEObjects.addAll(modelAccessor.eRemoveInverseCrossReferences(eObject, filteredCrossReferencer, isReferenceToIgnorePredicate)); } for (EObject impactedEObject : impactedEObjects) { Resource resource = impactedEObject.eResource(); if (semanticResources.contains(resource)) { refreshEditorsPrecommitListener.disable(); break; } } DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); toRemoveXRefFrom.clear(); modelAccessor = null; xReferencer = null; semanticResources = null; refreshEditorsPrecommitListener = null; }
Source:
public VDS getServer(Guid clusterId, String hostnameOrIp) { List<VDS> servers = getVdsDao().getAllForHostname(hostnameOrIp); if (servers.size() > 0) { return getServerOfCluster(clusterId, servers); } List<VdsNetworkInterface> ifaces; try { ifaces = getInterfaceDao().getAllInterfacesWithIpAddress(clusterId, InetAddress.getByName(hostnameOrIp).getHostAddress()); switch (ifaces.size()) { case 0: return null; case 1: VDS server = getVdsDao().get(ifaces.get(0).getVdsId()); if (server != null && server.getVdsGroupId().equals(clusterId)) { return server; } return null; default: throw new RuntimeException(String.format("There are multiple servers in DB having same IP address %1$s! " + "Cannot arrive at correct server id for bricks related to this ip address in cluster %2$s", hostnameOrIp, clusterId)); } } catch (UnknownHostException e) { throw new RuntimeException(e); } }

Target:
public VdsStatic getServer(Guid clusterId, String hostnameOrIp) { VdsStatic server = getVdsStaticDao().getByHostName(hostnameOrIp); if (server != null) { return server.getVdsGroupId().equals(clusterId) ? server : null; } List<VdsNetworkInterface> ifaces; try { ifaces = getInterfaceDao().getAllInterfacesWithIpAddress(clusterId, InetAddress.getByName(hostnameOrIp).getHostAddress()); switch (ifaces.size()) { case 0: return null; case 1: return getVdsStaticDao().get(ifaces.get(0).getVdsId().getValue()); default: throw new RuntimeException(String.format("There are multiple servers in DB having same IP address %1$s!", hostnameOrIp, clusterId)); } } catch (UnknownHostException e) { throw new RuntimeException(e); } }
Source:
public Optional<Duration> nextBackoff() { return numTimesRetried.getAndIncrement() < maxNumRetries ? Optional.of(Duration.ofMinutes(0)) : Optional.empty(); }

Target:
public Optional<Duration> nextBackoff() { numTimesRetried += 1; return numTimesRetried <= maxNumRetries ? Optional.of(Duration.ZERO) : Optional.empty(); }
Source:
public Block getBlock(int[] positions, int positionCount) { checkState(outputType != null, "This stream reader produces null block "); return RunLengthEncodedBlock.create(outputType, null, positionCount); }

Target:
public Block getBlock(int[] positions, int positionCount) { return createNullBlock(outputType, positionCount); }
Source:
public static XARecoveryModule getRegisteredXARecoveryModule () { if (registeredXARecoveryModule == null) { RecoveryManager recMan = RecoveryManager.manager(); Vector recoveryModules = recMan.getModules(); if (recoveryModules != null) { Enumeration modules = recoveryModules.elements(); while (modules.hasMoreElements()) { RecoveryModule m = (RecoveryModule) modules.nextElement(); if (m instanceof XARecoveryModule) { registeredXARecoveryModule = (XARecoveryModule) m; } } } } return registeredXARecoveryModule; }

Target:
public static XARecoveryModule getRegisteredXARecoveryModule () { if (registeredXARecoveryModule == null) { RecoveryManager recMan = RecoveryManager.manager(); Vector recoveryModules = recMan.getModules(); if (recoveryModules != null) { Enumeration modules = recoveryModules.elements(); while (modules.hasMoreElements()) { RecoveryModule m = (RecoveryModule) modules.nextElement(); if (m instanceof XARecoveryModule) { registeredXARecoveryModule = (XARecoveryModule) m; break; } } } } return registeredXARecoveryModule; }
Source:
private String getHelp() { StringBuilder sb = new StringBuilder(); sb.append(help.get("usage") + "\n\n"); sb.append("Actions:\n"); for(Map.Entry<String, Map<String, ParserArgument>> usage : usages.entrySet()) { sb.append("\t" + usage.getKey() + "\n"); sb.append("\t\t" + "Options:\n"); for(Map.Entry<String, ParserArgument> entry : usage.getValue().entrySet()) { sb.append( String.format( "\t\t\t--%-30s%-60s\n", entry.getKey() + (entry.getValue().getType() != ArgumentType.no_argument ? "=[" + entry.getValue().getMetavar() + "]" : ""), entry.getValue().getHelp() ) ); } sb.append("\n"); } sb.append("\n" + help.get("underlinetext") + "\n"); return sb.toString(); }

Target:
private String getHelp() { StringBuilder args = new StringBuilder(); for(Map.Entry<String, Map<String, ParserArgument>> usage : usages.entrySet()) { args.append( String.format( "%1$soptional arguments:%n", usage.getKey().contains("__single__") ? "" : usage.getKey() + " " ) ); for(Map.Entry<String, ParserArgument> entry : usage.getValue().entrySet()) { args.append( String.format( " --%-30s%-60s\n", entry.getKey() + (entry.getValue().getType() != ArgumentType.no_argument ? "=[" + entry.getValue().getMetavar() + "]" : ""), entry.getValue().getHelp() ) ); } args.append("\n"); } StringBuilder sb = new StringBuilder(); sb.append( String.format( "%s%n%n%s%n%n%s%n", help.get("usage"), help.get("underlinetext"), args.toString() ) ); return sb.toString(); }
Source:
private void deleteDataSource(Long dsObjId) { String dataSourceId = Long.toString(dsObjId); String deleteQuery = "image_id:" + dataSourceId; try { UpdateResponse updateResponse = solrCore.deleteByQuery(deleteQuery); } catch (SolrServerException | IOException ex) { logger.log(Level.SEVERE, "Error deleting content from Solr. Solr image id " + dataSourceId, ex); } }

Target:
private void deleteDataSource(Long dsObjId) throws IOException, SolrServerException { String dataSourceId = Long.toString(dsObjId); String deleteQuery = "image_id:" + dataSourceId; solrCore.deleteByQuery(deleteQuery); }
Source:
public Optional<String> checkValue(String value) { if (StringUtil.isNullOrEmpty(value)) { return Optional.of(Localization.lang("empty BibTeX key")); } String cleaned = BibtexKeyGenerator.cleanKey(value, Globals.prefs.getUnwantedCharacters()); if (cleaned.equals(value)) { return Optional.empty(); } else { return Optional.of(Localization.lang("Invalid BibTeX key")); } }

Target:
public Optional<String> checkValue(String value) { if (StringUtil.isNullOrEmpty(value)) { return Optional.of(Localization.lang("empty BibTeX key")); } String cleaned = BibtexKeyGenerator.cleanKey(value, ""); if (cleaned.equals(value)) { return Optional.empty(); } else { return Optional.of(Localization.lang("Invalid BibTeX key")); } }
Source:
private StreamLoader(long position) throws IOException { if (packOut == null) throw new IllegalStateException(DfsText.get().unexpectedEofInPack); in = packOut.out.openInputStream(position); int c = in.read(); if (c < 0) throw new IllegalStateException(DfsText.get().unexpectedEofInPack); type = (c >> 4) & 7; if (type == Constants.OBJ_OFS_DELTA || type == Constants.OBJ_REF_DELTA) throw new IllegalStateException(MessageFormat.format( DfsText.get().readBackDelta, Integer.toString(type))); long sz = c & 15; int shift = 4; while ((c & 0x80) != 0) { c = in.read(); if (c < 0) throw new IllegalStateException(DfsText.get().unexpectedEofInPack); sz += ((long) (c & 0x7f)) << shift; shift += 7; } size = sz; }

Target:
private StreamLoader(long position) throws IOException { if (packOut == null) throw new IllegalStateException(DfsText.get().unexpectedEofInPack); in = packOut.out.openInputStream(position); int c = in.read(); if (c < 0) throw new IllegalStateException(DfsText.get().unexpectedEofInPack); type = (c >> 4) & 7; if (type == OBJ_OFS_DELTA || type == OBJ_REF_DELTA) throw new IllegalStateException(MessageFormat.format( DfsText.get().readBackDelta, Integer.toString(type))); long sz = c & 0x0f; int shift = 4; while ((c & 0x80) != 0) { c = in.read(); if (c < 0) throw new IllegalStateException(DfsText.get().unexpectedEofInPack); sz += ((long) (c & 0x7f)) << shift; shift += 7; } size = sz; }
Source:
void _checkShrink () { if (keys == null) { if (!ignoreShrink) { int count = (int) OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0); if (count == 0 && items.length > 4) { for (;count<items.length && items[count] != null && !items[count].isDisposed();count++); } if (items.length > 4 && items.length - count > 3) { int length = Math.max (4, (count + 3) / 4 * 4); TableItem newItems = new TableItem [length]; System.arraycopy (items, 0, newItems, 0, count); items = newItems; } } } else { if (!ignoreShrink) { if (keys.length > 4 && keys.length - keyCount > 3) { int length = Math.max (4, (keyCount + 3) / 4 * 4); int newKeys = new int [length]; System.arraycopy (keys, 0, newKeys, 0, keyCount); keys = newKeys; TableItem newItems = new TableItem [length]; System.arraycopy (items, 0, newItems, 0, keyCount); items = newItems; } } } }

Target:
void _checkShrink () { if (keys == null) { if (!ignoreShrink) { int count = (int) OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0); if (count == 0 && items.length > 4) { while (count<items.length && items[count] != null && !items[count].isDisposed()) { count++; } } if (items.length > 4 && items.length - count > 3) { int length = Math.max (4, (count + 3) / 4 * 4); TableItem newItems = new TableItem [length]; System.arraycopy (items, 0, newItems, 0, count); items = newItems; } } } else { if (!ignoreShrink) { if (keys.length > 4 && keys.length - keyCount > 3) { int length = Math.max (4, (keyCount + 3) / 4 * 4); int newKeys = new int [length]; System.arraycopy (keys, 0, newKeys, 0, keyCount); keys = newKeys; TableItem newItems = new TableItem [length]; System.arraycopy (items, 0, newItems, 0, keyCount); items = newItems; } } } }
Source:
public MergingPageOutput(Iterable<? extends Type> types, long minPageSizeInBytes, int minRowCount, int maxPageSizeInBytes) { this.types = ImmutableList.copyOf(requireNonNull(types, "types is null")); checkArgument(minPageSizeInBytes >= 0, "minPageSizeInBytes must be greater or equal than zero"); checkArgument(minRowCount >= 0, "minRowCount must be greater or equal than zero"); checkArgument(maxPageSizeInBytes > 0, "maxPageSizeInBytes must be greater than zero"); checkArgument(maxPageSizeInBytes >= minPageSizeInBytes, "maxPageSizeInBytes must be greater or equal than minPageSizeInBytes"); checkArgument(minPageSizeInBytes <= 1024 * 1024, "minPageSizeInBytes must be less or equal than 1048576"); this.minPageSizeInBytes = minPageSizeInBytes; this.minRowCount = minRowCount; pageBuilder = PageBuilder.withMaxPageSize(maxPageSizeInBytes, this.types); }

Target:
public MergingPageOutput(Iterable<? extends Type> types, long minPageSizeInBytes, int minRowCount, int maxPageSizeInBytes) { this.types = ImmutableList.copyOf(requireNonNull(types, "types is null")); checkArgument(minPageSizeInBytes >= 0, "minPageSizeInBytes must be greater or equal than zero"); checkArgument(minRowCount >= 0, "minRowCount must be greater or equal than zero"); checkArgument(maxPageSizeInBytes > 0, "maxPageSizeInBytes must be greater than zero"); checkArgument(maxPageSizeInBytes >= minPageSizeInBytes, "maxPageSizeInBytes must be greater or equal than minPageSizeInBytes"); checkArgument(minPageSizeInBytes <= MAX_MIN_PAGE_SIZE, "minPageSizeInBytes must be less or equal than %d", MAX_MIN_PAGE_SIZE); this.minPageSizeInBytes = minPageSizeInBytes; this.minRowCount = minRowCount; pageBuilder = PageBuilder.withMaxPageSize(maxPageSizeInBytes, this.types); }
Source:
private String getWktFromGeometry(String geometry) { String wkt = getWktFromGml3(geometry); if (StringUtils.isNotBlank(wkt)) { return wkt; } LOGGER.debug("Error converting gml to wkt using gml3 configuration. Trying gml2.", geometry); return getWktFromGml2(geometry); }

Target:
private String getWktFromGeometry(String geometry) { String wkt = getWktFromGml3(geometry); if (StringUtils.isNotBlank(wkt)) { return wkt; } LOGGER.debug("Error converting gml to wkt using gml3 configuration. Trying gml2."); return getWktFromGml2(geometry); }
Source:
private static long getUnsignedLongValue(String bits){ long value = 0; int i = 0; for (int j = bits.length() - 1; j >= 0; j--, i++) { if (bits.charAt(j) == '1') { value += (long) Math.pow(2.0, (double) i); } } return value; }

Target:
private static long getUnsignedLongValue(String bits){ long value = 0; int i = 0; for (int j = bits.length() - 1; j >= 0; j--, i++) { if (bits.charAt(j) == '1') { value += 1L << i; } } return value; }
Source:
public int read(byte[] dest, int off, int siz) throws IOException { checkClosed(); if (siz == 0) { return 0; } int bytesRead = 0; while (bytesRead < siz && isBufAvailable()) { final int toCopy = Math.min(siz - bytesRead, len - curPosition); System.arraycopy(this.bytes, curPosition, bytes, off + bytesRead, toCopy); bytesRead += toCopy; curPosition += toCopy; } return bytesRead > 0 ? bytesRead : -1; }

Target:
public int read(byte[] dest, int off, int siz) throws IOException { checkClosed(); if (siz == 0) { return 0; } int bytesRead = 0; while (bytesRead < siz && isBufAvailable()) { final int toCopy = Math.min(siz - bytesRead, len - curPosition); System.arraycopy(this.bytes, curPosition, dest, off + bytesRead, toCopy); bytesRead += toCopy; curPosition += toCopy; } return bytesRead > 0 ? bytesRead : -1; }
Source:
public void testDefaultNormalizerTwice() { String[] testSentence = new String[] {"a", "b", "c", "d", "e", "f", "g", "h"}; TokenNormalizerFeatureGenerator featureGenerator = new TokenNormalizerFeatureGenerator(new IdentityFeatureGenerator()); for (int i = 0; i < testSentence.length; i++) { featureGenerator.createFeatures(features, testSentence, i, null); Assert.assertEquals(features.get(i), testSentence[i]); } testSentence = new String[] {"i", "j", "l", "m", "n", "o", "p", "q"}; features = new ArrayList<>(); for (int i = 0; i < testSentence.length; i++) { featureGenerator.createFeatures(features, testSentence, i, null); Assert.assertEquals(features.get(i), testSentence[i]); } }

Target:
public void testDefaultNormalizerTwice() { String[] testSentence = new String[] {"a", "b", "c", "d", "e", "f", "g", "h"}; TokenNormalizerFeatureGenerator featureGenerator = new TokenNormalizerFeatureGenerator(new IdentityFeatureGenerator()); List<String> features = new ArrayList<>(); for (int i = 0; i < testSentence.length; i++) { featureGenerator.createFeatures(features, testSentence, i, null); Assert.assertEquals(features.get(i), testSentence[i]); } testSentence = new String[] {"i", "j", "l", "m", "n", "o", "p", "q"}; features = new ArrayList<>(); for (int i = 0; i < testSentence.length; i++) { featureGenerator.createFeatures(features, testSentence, i, null); Assert.assertEquals(features.get(i), testSentence[i]); } }
Source:
public void testNoNotifyOnSavepoint() throws IOException { TestBufferReceivedListener listener = new TestBufferReceivedListener(); LocalInputChannel channel = new LocalInputChannel( new SingleInputGateBuilder().build(), 0, new ResultPartitionID(), new ResultPartitionManager(), new TaskEventDispatcher(), new TestCounter(), new TestCounter()); CheckpointBarrier barrier = new CheckpointBarrier(123L, 123L, new CheckpointOptions(SAVEPOINT, CheckpointStorageLocationReference.getDefault())); channel.notifyPriorityEvent(new BufferConsumer(toBuffer(barrier).getMemorySegment(), FreeingBufferRecycler.INSTANCE, getDataType(barrier))); channel.checkError(); assertTrue(listener.notifiedOnBarriers.isEmpty()); }

Target:
public void testNoNotifyOnSavepoint() throws IOException { TestBufferReceivedListener listener = new TestBufferReceivedListener(); SingleInputGate inputGate = new SingleInputGateBuilder().build(); inputGate.registerBufferReceivedListener(listener); LocalInputChannel channel = InputChannelBuilder.newBuilder().buildLocalChannel(inputGate); CheckpointBarrier barrier = new CheckpointBarrier(123L, 123L, new CheckpointOptions(SAVEPOINT, CheckpointStorageLocationReference.getDefault())); channel.notifyPriorityEvent(new BufferConsumer(toBuffer(barrier).getMemorySegment(), FreeingBufferRecycler.INSTANCE, getDataType(barrier))); channel.checkError(); assertTrue(listener.notifiedOnBarriers.isEmpty()); }
Source:
private void printSubscriptions(List<SubscriptionListEntry> entries) { PrintStream console = System.out; int[] columnWidth = new int[4]; columnWidth[0] = entries.stream().mapToInt(s -> s.id.length()).max().orElse(-1); columnWidth[1] = entries.stream().mapToInt(s -> s.callbackUrl.length()).max().orElse(-1); columnWidth[2] = entries.stream().mapToInt(s -> s.isEnterprise.length()).max().orElse(-1); columnWidth[3] = entries.stream().mapToInt(s -> s.sourceIds.length()).max().orElse(-1); columnWidth[0] = Math.max(columnWidth[0], SUBSCRIPTION_ID_COLUMN_HEADER.length()); columnWidth[1] = Math.max(columnWidth[1], CALLBACK_COLUMN_HEADER.length()); columnWidth[2] = Math.max(columnWidth[2], ENTERPRISE_COLUMN_HEADER.length()); columnWidth[3] = Math.max(columnWidth[3], SOURCE_ID_COLUMN_HEADER.length()); String rowFormatString = String.format( "%%-%ds | %%-%ds | %%-%ds | %%-%ds", columnWidth[0], columnWidth[1], columnWidth[2], columnWidth[3]); console.println(); console.print("Total subscriptions found: " + entries.size()); console.println(); console.println(); console.print(CYAN_CONSOLE_COLOR); console.printf( rowFormatString, SUBSCRIPTION_ID_COLUMN_HEADER, CALLBACK_COLUMN_HEADER, ENTERPRISE_COLUMN_HEADER, SOURCE_ID_COLUMN_HEADER); console.println(DEFAULT_CONSOLE_COLOR); for (SubscriptionListEntry entry : entries) { String rowColor = (entry.ping()) ? DEFAULT_CONSOLE_COLOR : RED_CONSOLE_COLOR; console.print(rowColor); console.printf( rowFormatString, entry.id, entry.callbackUrl, entry.isEnterprise, entry.sourceIds); console.println(DEFAULT_CONSOLE_COLOR); } }

Target:
private void printSubscriptions(List<SubscriptionListEntry> entries) { PrintStream console = System.out; int[] columnWidth = new int[] { SUBSCRIPTION_ID_COLUMN_HEADER.length(), CALLBACK_COLUMN_HEADER.length(), ENTERPRISE_COLUMN_HEADER.length(), SOURCE_ID_COLUMN_HEADER.length() }; for (SubscriptionListEntry entry : entries) { int column0Width = entry.id.length(); int column1Width = entry.callbackUrl.length(); int column2Width = entry.isEnterprise.length(); int column3Width = entry.sourceIds.length(); if (column0Width > columnWidth[0]) columnWidth[0] = column0Width; if (column1Width > columnWidth[1]) columnWidth[1] = column1Width; if (column2Width > columnWidth[2]) columnWidth[2] = column2Width; if (column3Width > columnWidth[3]) columnWidth[3] = column3Width; } String rowFormatString = String.format( "%%-%ds | %%-%ds | %%-%ds | %%-%ds", columnWidth[0], columnWidth[1], columnWidth[2], columnWidth[3]); console.println(); console.print("Total subscriptions found: " + entries.size()); console.println(); console.println(); console.print(CYAN_CONSOLE_COLOR); console.printf( rowFormatString, SUBSCRIPTION_ID_COLUMN_HEADER, CALLBACK_COLUMN_HEADER, ENTERPRISE_COLUMN_HEADER, SOURCE_ID_COLUMN_HEADER); console.println(DEFAULT_CONSOLE_COLOR); for (SubscriptionListEntry entry : entries) { String rowColor = (entry.ping()) ? DEFAULT_CONSOLE_COLOR : RED_CONSOLE_COLOR; console.print(rowColor); console.printf( rowFormatString, entry.id, entry.callbackUrl, entry.isEnterprise, entry.sourceIds); console.println(DEFAULT_CONSOLE_COLOR); } }
Source:
public void authenticate(String username, final String password, final AsyncCallback<LoginResult> callback) { LoginResult result = new LoginResult(); if (username == null || "".equals(username) || password == null || "".equals(password)) { result.success = false; callback.onSuccess(result); return; } username = username.trim().toLowerCase(); final AuthRequest req = AuthRequest.forUser(username); req.setPassword(password); final AuthResult res; try { res = accountManager.authenticate(req); } catch (AccountException e) { result.success = false; callback.onSuccess(result); return; } result.success = true; result.isNew = res.isNew(); webSession.get().login(res, false); callback.onSuccess(result); }

Target:
public void authenticate(String username, final String password, final AsyncCallback<LoginResult> callback) { LoginResult result = new LoginResult(); if (username == null || "".equals(username.trim()) || password == null || "".equals(password)) { result.success = false; callback.onSuccess(result); return; } username = username.trim(); final AuthRequest req = AuthRequest.forUser(username); req.setPassword(password); final AuthResult res; try { res = accountManager.authenticate(req); } catch (AccountException e) { result.success = false; callback.onSuccess(result); return; } result.success = true; result.isNew = res.isNew(); webSession.get().login(res, false); callback.onSuccess(result); }
Source:
public int compareTo(final AESharedItemStack b) { Preconditions.checkState(this.itemStack.getCount() == 1, "ItemStack#getCount() has to be 1"); Preconditions.checkArgument(b.getDefinition().getCount() == 1, "ItemStack#getCount() has to be 1"); if (this.itemStack == b.getDefinition()) { return 0; } final int id = this.itemId - b.itemId; if (id != 0) { return id; } final int damageValue = this.itemDamage - b.itemDamage; if (damageValue != 0) { return damageValue; } return this.hashCode - b.hashCode; }

Target:
public int compareTo(final AESharedItemStack b) { Preconditions.checkState(this.itemStack.getCount() == 1, "ItemStack#getCount() has to be 1"); Preconditions.checkArgument(b.getDefinition().getCount() == 1, "ItemStack#getCount() has to be 1"); if (this.itemStack == b.getDefinition()) { return 0; } final int id = this.itemId - b.itemId; if (id != 0) { return id; } final int damageValue = this.itemDamage - b.itemDamage; if (damageValue != 0) { return damageValue; } return System.identityHashCode(this.getDefinition().getTag()) - System.identityHashCode(b.getDefinition().getTag()); }
Source:
public void updateOrderFulfillerStatus_shouldEditFulfillerStatusWithAccessioNumberInOrder() { Order originalOrder = orderService.getOrder(111); String commentText = "We got the new order"; String accessionNumber = "12345"; assertNotEquals(originalOrder.getAccessionNumber(), 0); orderService.updateOrderFulfillerStatus(originalOrder, Order.FulfillerStatus.IN_PROGRESS, commentText, accessionNumber); Order updatedOrder = orderService.getOrder(111); assertEquals(updatedOrder.getAccessionNumber(), accessionNumber); }

Target:
public void updateOrderFulfillerStatus_shouldEditFulfillerStatusWithAccessioNumberInOrder() { Order originalOrder = orderService.getOrder(111); String commentText = "We got the new order"; String accessionNumber = "12345"; assertNotEquals(originalOrder.getAccessionNumber(), accessionNumber); orderService.updateOrderFulfillerStatus(originalOrder, Order.FulfillerStatus.IN_PROGRESS, commentText, accessionNumber); Order updatedOrder = orderService.getOrder(111); assertEquals(updatedOrder.getAccessionNumber(), accessionNumber); }
Source:
public boolean selectionExists(ISelector selector) { return (Boolean) this.browser.syncRun(String.format("return %s.length > 0;", selector.getStatement())); }

Target:
public boolean selectionExists(ISelector selector) { Boolean result = (Boolean) this.browser.syncRun(String.format("return %s.length > 0;", selector.getStatement())); return result != null && result; }
Source:
public String toString() { if (type == TransitionType.RULE) { Attributes a = rule.getAttributes(); UnparserFilter unparser = new UnparserFilter(true, context.colorOptions.color(context.krunOptions.experimental.outputFile != null), context.krunOptions.output, context); unparser.visitNode(a); return "\nRule tagged " + unparser.getResult() + " "; } else if (type == TransitionType.LABEL) { return "\nRule labelled " + label + " "; } else if (type == TransitionType.REDUCE) { return "\nMaude 'reduce' command "; } else if (type == TransitionType.UNLABELLED) { return "\nUnlabelled rule "; } else if (type == TransitionType.DEADLOCK) { return "\nDeadlock "; } else { return "\nRead " + StringBuiltin.of(readString).value(); } }

Target:
public String toString() { if (type == TransitionType.RULE) { Attributes a = rule.getAttributes(); UnparserFilter unparser = new UnparserFilter(true, context.colorOptions.color(), context.krunOptions.output, context); unparser.visitNode(a); return "\nRule tagged " + unparser.getResult() + " "; } else if (type == TransitionType.LABEL) { return "\nRule labelled " + label + " "; } else if (type == TransitionType.REDUCE) { return "\nMaude 'reduce' command "; } else if (type == TransitionType.UNLABELLED) { return "\nUnlabelled rule "; } else if (type == TransitionType.DEADLOCK) { return "\nDeadlock "; } else { return "\nRead " + StringBuiltin.of(readString).value(); } }
Source:
public void deactivateUser(HttpServletRequest request, HttpServletResponse response, @PathVariable String uid) throws IOException { ResponseWriter writer = null; try { User editingUser = userFetcher.userFor(request).get(); if (!editingUser.is(Role.ADMIN)) { throw new ResourceForbiddenException(); } Id userId = Id.valueOf(idCodec.decode(uid)); Optional<User> user = userStore.userForId(userId); if (user.isPresent()) { UserRef userRef = user.get().getUserRef(); Credentials credentialsMaybe = credentialsStore.find(userRef).requireValue(); Credentials credentials = credentialsMaybe; credentialsStore.expired(credentials.authToken()); } else { throw new NotFoundException(userId); } } catch (Exception e) { log.error("Request exception " + request.getRequestURI(), e); ErrorSummary summary = ErrorSummary.forException(e); new ErrorResultWriter().write(summary, writer, request, response); } }

Target:
public void deactivateUser(HttpServletRequest request, HttpServletResponse response, @PathVariable String uid) throws IOException { ResponseWriter writer = null; try { User editingUser = userFetcher.userFor(request).get(); if (!editingUser.is(Role.ADMIN)) { throw new ResourceForbiddenException(); } Id userId = Id.valueOf(idCodec.decode(uid)); Optional<User> user = userStore.userForId(userId); if (user.isPresent()) { UserRef userRef = user.get().getUserRef(); Credentials credentials = credentialsStore.find(userRef).requireValue(); credentialsStore.expired(credentials.authToken()); } else { throw new NotFoundException(userId); } } catch (Exception e) { log.error("Request exception " + request.getRequestURI(), e); ErrorSummary summary = ErrorSummary.forException(e); new ErrorResultWriter().write(summary, writer, request, response); } }