auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void ensureClassLoadingPropertyIsSet( Properties providerProperties ) { if (providerProperties.containsKey(FieldName.CLASSLOADER)) { return; } String providerClassName = providerProperties.getProperty(FieldName.CLASSNAME); if (StringUtil.isBlank(providerClassName)) { LOG.warnv("Required property: {0} not found among the index provider properties: {1}", FieldName.CLASSNAME, providerProperties); return; } String fqProviderClass = RepositoryConfiguration.getBuiltInIndexProviderClassName(providerClassName); if (fqProviderClass == null) { fqProviderClass = providerClassName; } int index = fqProviderClass.lastIndexOf("."); String providerModuleName = index != -1 ? fqProviderClass.substring(0, index) : fqProviderClass; if (providerModuleName.startsWith("org.modeshape.jcr")) { providerModuleName = ModeShapeExtension.ModuleID.MAIN; } providerProperties.setProperty(FieldName.CLASSLOADER, providerModuleName); }

Target:
private void ensureClassLoadingPropertyIsSet( Properties providerProperties ) { if (providerProperties.containsKey(FieldName.CLASSLOADER)) { return; } String providerClassName = providerProperties.getProperty(FieldName.CLASSNAME); if (StringUtil.isBlank(providerClassName)) { LOG.warnv("Required property: {0} not found among the index provider properties: {1}", FieldName.CLASSNAME, providerProperties); return; } String fqProviderClass = RepositoryConfiguration.getBuiltInIndexProviderClassName(providerClassName); if (fqProviderClass == null) { fqProviderClass = providerClassName; } int index = fqProviderClass.lastIndexOf("."); String providerModuleName = index != -1 ? fqProviderClass.substring(0, index) : fqProviderClass; if (providerModuleName.startsWith(ModeShapeExtension.ModuleID.MAIN)) { providerModuleName = ModeShapeExtension.ModuleID.MAIN; } providerProperties.setProperty(FieldName.CLASSLOADER, providerModuleName); }
Source:
private ListenableFuture<BoundStatement> saveQueryAsync(T entity, final EnumMap<Option.Type, Option> options) { final Map<AliasedMappedProperty, Object> columnToValue = new HashMap<AliasedMappedProperty, Object>(); final boolean useUnsetForNullValue = !shouldSaveNullFields(options) && manager.protocolVersionAsInt >= 4; final boolean includeColumnsWithNullValue = shouldSaveNullFields(options) || useUnsetForNullValue; for (AliasedMappedProperty col : mapper.allColumns) { Object value = col.mappedProperty.getValue(entity); if (!col.mappedProperty.isComputed() && (includeColumnsWithNullValue || value != null)) { columnToValue.put(col, value); } } return Futures.transform(getPreparedQueryAsync(QueryType.SAVE, columnToValue.keySet(), options), new Function<PreparedStatement, BoundStatement>() { @Override public BoundStatement apply(PreparedStatement input) { BoundStatement bs = input.bind(); int i = 0; for (Map.Entry<AliasedMappedProperty, Object> entry : columnToValue.entrySet()) { AliasedMappedProperty mapper = entry.getKey(); Object value = entry.getValue(); setObject(bs, i++, value, mapper, useUnsetForNullValue); } if (mapper.writeConsistency != null) bs.setConsistencyLevel(mapper.writeConsistency); for (Option option : options.values()) { option.validate(QueryType.SAVE, manager); i = option.apply(bs, i); } return bs; } }); }

Target:
private ListenableFuture<BoundStatement> saveQueryAsync(T entity, final EnumMap<Option.Type, Option> options) { final Map<AliasedMappedProperty, Object> values = new HashMap<AliasedMappedProperty, Object>(); boolean saveNullFields = shouldSaveNullFields(options); for (AliasedMappedProperty col : mapper.allColumns) { Object value = col.mappedProperty.getValue(entity); if (!col.mappedProperty.isComputed() && (saveNullFields || value != null)) { values.put(col, value); } } return Futures.transform(getPreparedQueryAsync(QueryType.SAVE, values.keySet(), options), new Function<PreparedStatement, BoundStatement>() { @Override public BoundStatement apply(PreparedStatement input) { BoundStatement bs = input.bind(); int i = 0; for (Map.Entry<AliasedMappedProperty, Object> entry : values.entrySet()) { AliasedMappedProperty mapper = entry.getKey(); Object value = entry.getValue(); setObject(bs, i++, value, mapper); } if (mapper.writeConsistency != null) bs.setConsistencyLevel(mapper.writeConsistency); for (Option option : options.values()) { option.validate(QueryType.SAVE, manager); i = option.apply(bs, i); } return bs; } }); }
Source:
public void startClusterManagementServiceWithRestServiceEnabledInvokesStartManager() throws IOException { LoggingSession loggingSession = mock(LoggingSession.class); DistributionConfigImpl distributionConfig = mock(DistributionConfigImpl.class); when(distributionConfig.getJmxManager()).thenReturn(true); when(distributionConfig.getLocators()).thenReturn(""); when(distributionConfig.getSecurableCommunicationChannels()) .thenReturn(new SecurableCommunicationChannel[] {}); when(distributionConfig.getSecurityAuthTokenEnabledComponents()).thenReturn(new String[] {}); InternalLocator internalLocator = new InternalLocator(0, loggingSession, null, null, null, null, null, null, distributionConfig, null); InternalCacheForClientAccess cache = mock(InternalCacheForClientAccess.class); InternalRegionFactory regionFactory = mock(InternalRegionFactory.class); when(cache.createInternalRegionFactory(RegionShortcut.REPLICATE)).thenReturn(regionFactory); when(cache.getOptionalService(HttpService.class)) .thenReturn(Optional.of(mock(HttpService.class))); when(cache.getCacheForProcessingClientRequests()).thenReturn(cache); BaseManagementService managementService = mock(BaseManagementService.class); BaseManagementService.setManagementService(cache, managementService); internalLocator.setInternalCache(cache); when(distributionConfig.getEnableManagementRestService()).thenReturn(true); internalLocator.startClusterManagementService(); verify(managementService).startManager(); }

Target:
public void startClusterManagementServiceWithRestServiceEnabledInvokesStartManager() throws Exception { createInternalLocator(); setupForStartClusterManagementService(); when(distributionConfig.getEnableManagementRestService()).thenReturn(true); internalLocator.startClusterManagementService(cache, agentUtil); verify(managementService).startManager(); verify(httpService).addWebApplication(eq("/management"), any(), any()); }
Source:
private void outputFloatingCommentFromBuffer(Node n) { Node parent = n.getParent(); if (TOKENS_SET_ACCEPT_EMPTY_CHILD.contains(parent.getToken())) { parent.addChildBefore(newFloatingCommentFromBuffer(), n); } else if (canHaveComment(n)) { linkCommentBufferToNode(n); } else { outputFloatingCommentFromBuffer(parent); } }

Target:
private void outputFloatingCommentFromBuffer(Node n) { Node parent = n.getParent(); if (parent == null) { linkCommentBufferToNode(n); } else if (TOKENS_CAN_HAVE_EMPTY_CHILD.contains(parent.getToken())) { parent.addChildBefore(newFloatingCommentFromBuffer(), n); } else if (canHaveComment(n)) { linkCommentBufferToNode(n); } else { outputFloatingCommentFromBuffer(parent); } }
Source:
private List<String> importFiles(Path path) throws Exception { String tempPath = new StringBuilder() .append(System.getProperty("java.io.tmpdir")) .append(File.separator) .append(FILE_PATH) .append(File.separator) .toString(); List<String> imported = new ArrayList<String>(); File destDir = new File(tempPath); ZipInputStream zis = new ZipInputStream(new FileInputStream(path.toFile())); ZipEntry zipEntry = zis.getNextEntry(); while (zipEntry != null) { File newFile = unzipFile(destDir, zipEntry, zis); zipEntry = zis.getNextEntry(); FileSystem fileSystem = getImportFileSystem(newFile, tempPath); if (fileSystem == null) { continue; } URI uri = URI.create( new StringBuilder() .append(SpacesAPI.Scheme.GIT) .append("://") .append(fileSystem.getName()) .toString()); String newFilePath = newFile.toPath() .toString() .replace( new StringBuilder(tempPath).append(fileSystem.getName()), ""); ioService.write( Paths.get(uri).resolve(newFilePath), java.nio.file.Files.readAllBytes(newFile.toPath())); imported.add( new StringBuilder() .append(fileSystem.getName()) .append(newFilePath) .toString()); fireEvent(newFile, tempPath, uri, newFilePath); } zis.closeEntry(); zis.close(); FileUtils.deleteDirectory(destDir); return imported; }

Target:
private List<String> importFiles(Path path) throws Exception { String tempPath = new StringBuilder() .append(System.getProperty("java.io.tmpdir")) .append(File.separator) .append(FILE_PATH) .append(File.separator) .toString(); List<String> imported = new ArrayList<>(); File destDir = new File(tempPath); try (ZipInputStream zis = new ZipInputStream(new FileInputStream(path.toFile()))) { ZipEntry zipEntry = zis.getNextEntry(); while (zipEntry != null) { File newFile = unzipFile(destDir, zipEntry, zis); zipEntry = zis.getNextEntry(); FileSystem fileSystem = getImportFileSystem(newFile, tempPath); if (fileSystem == null) { continue; } URI uri = URI.create( new StringBuilder() .append(SpacesAPI.Scheme.GIT) .append("://") .append(fileSystem.getName()) .toString()); String newFilePath = newFile.toPath() .toString() .replace( new StringBuilder(tempPath).append(fileSystem.getName()), ""); ioService.write( Paths.get(uri).resolve(newFilePath), java.nio.file.Files.readAllBytes(newFile.toPath())); imported.add( new StringBuilder() .append(fileSystem.getName()) .append(newFilePath) .toString()); fireEvent(newFile, tempPath, uri, newFilePath); } } FileUtils.deleteDirectory(destDir); return imported; }
Source:
public boolean hasNextAvailable(int timeout, TimeUnit timeUnit) { checkExceptionState(); long deadline = System.currentTimeMillis() + timeUnit.toMillis(timeout); try { do { long waitTime = deadline - System.currentTimeMillis(); waitForData(waitTime); } while (peekEvent == null && System.currentTimeMillis() < deadline); return peekEvent != null; } catch (InterruptedException e) { logger.warn("Event consumer thread was interrupted. Returning thread to event processor.", e); Thread.currentThread().interrupt(); return false; } }

Target:
public boolean hasNextAvailable(int timeout, TimeUnit timeUnit) { long deadline = System.currentTimeMillis() + timeUnit.toMillis(timeout); try { while (peekNullable() == null && System.currentTimeMillis() < deadline) { lock.lock(); try { long waitTime = deadline - System.currentTimeMillis(); if (peekNullable() == null && waitTime > 0) { boolean await = dataAvailable.await(Math.min(waitTime, MAX_AWAIT_AVAILABLE_DATA), TimeUnit.MILLISECONDS); logger.trace(await ? "Signaled new events are available" : "No signal received for new events, exiting await"); } } finally { lock.unlock(); } } return peekNullable() != null; } catch (InterruptedException e) { logger.warn("Event consumer thread was interrupted. Returning thread to event processor.", e); Thread.currentThread().interrupt(); return false; } }
Source:
public void testParseLanguage() { String langs[] = { "rb", "groovy", "js", "py" }; Map<String, ScriptExecutingMessageProcessor> scriptProcessors = ctx .getBeansOfType(ScriptExecutingMessageProcessor.class); assertEquals(4, scriptProcessors.size()); for (int i = 0; i < 4; i++) { ScriptExecutingMessageProcessor ruby = ctx.getBean( "org.springframework.integration.scripting.jsr223.ScriptExecutingMessageProcessor#" + i, ScriptExecutingMessageProcessor.class); AbstractScriptExecutor executor = (AbstractScriptExecutor) TestUtils.getPropertyValue(ruby, "scriptExecutor"); assertEquals(langs[i], executor.language); } }

Target:
public void testParseLanguage() { String langs[] = { "ruby", "Groovy", "ECMAScript", "python" }; Map<String, ScriptExecutingMessageProcessor> scriptProcessors = ctx .getBeansOfType(ScriptExecutingMessageProcessor.class); assertEquals(4, scriptProcessors.size()); for (int i = 0; i < 4; i++) { ScriptExecutingMessageProcessor processor = ctx.getBean( "org.springframework.integration.scripting.jsr223.ScriptExecutingMessageProcessor#" + i, ScriptExecutingMessageProcessor.class); AbstractScriptExecutor executor = (AbstractScriptExecutor) TestUtils.getPropertyValue(processor, "scriptExecutor"); assertEquals(langs[i], executor.language); } }
Source:
public void initialize() { logger.debug("Initializing WeatherUnderground handler."); super.initialize(); WeatherUndergroundConfiguration config = getConfigAs(WeatherUndergroundConfiguration.class); logger.debug("config apikey = {}", config.apikey); logger.debug("config location = {}", config.location); logger.debug("config language = {}", config.language); logger.debug("config refresh = {}", config.refresh); boolean validConfig = true; if (StringUtils.trimToNull(config.apikey) == null) { logger.error("Parameter 'apikey' is mandatory and must be configured, disabling thing '{}'", getThing().getUID()); validConfig = false; } if (StringUtils.trimToNull(config.location) == null) { logger.error("Parameter 'location' is mandatory and must be configured, disabling thing '{}'", getThing().getUID()); validConfig = false; } if (config.language != null) { String lang = StringUtils.trimToEmpty(config.language); if (lang.length() != 2) { logger.error("Parameter 'language' must be 2 letters, disabling thing '{}'", getThing().getUID()); validConfig = false; } } if (config.refresh != null && config.refresh < 5) { logger.error("Parameter 'refresh' must be at least 5 minutes, disabling thing '{}'", getThing().getUID()); validConfig = false; } if (validConfig) { startAutomaticRefresh(); } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR); } }

Target:
public void initialize() { logger.debug("Initializing WeatherUnderground handler."); WeatherUndergroundConfiguration config = getConfigAs(WeatherUndergroundConfiguration.class); logger.debug("config apikey = {}", config.apikey); logger.debug("config location = {}", config.location); logger.debug("config language = {}", config.language); logger.debug("config refresh = {}", config.refresh); boolean validConfig = true; String errors = ""; if (StringUtils.trimToNull(config.apikey) == null) { errors += " Parameter 'apikey' must be configured."; validConfig = false; } if (StringUtils.trimToNull(config.location) == null) { errors += " Parameter 'location' must be configured."; validConfig = false; } if (config.language != null) { String lang = StringUtils.trimToEmpty(config.language); if (lang.length() != 2) { errors += " Parameter 'language' must be 2 letters."; validConfig = false; } } if (config.refresh != null && config.refresh < 5) { errors += " Parameter 'refresh' must be at least 5 minutes."; validConfig = false; } errors = errors.trim(); if (validConfig) { startAutomaticRefresh(); } else { logger.debug("Disabling thing '{}': {}", getThing().getUID(), errors); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, errors); } }
Source:
private void checkUpdateReportsPanel(final String url, final Map<String, List<String>> params) { if (errorPopupManager == null) { errorPopupManager = (ErrorPopupManager) TypeResolver.getInstance().resolve(ErrorPopupManager.class); } if (applicationConstants == null) { applicationConstants = GWT.create(ApplicationConstants.class); } RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, buildStatusUrl(url)); try { requestBuilder.setTimeoutMillis(1000); requestBuilder.sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } @Override public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK && response.getText().trim().equals(REPORTS_WEBAPP_DEPLOYED_MSG)) { reportsWebappDeployed = true; getView().updateReportsPanel(url, params); } else { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } } }); } catch (RequestException e) { errorPopupManager.show(applicationConstants.reportsWebAppErrorMsg()); } }

Target:
private void checkUpdateReportsPanel(final String url, final Map<String, List<String>> params) { RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, buildStatusUrl(url)); try { requestBuilder.setTimeoutMillis(1000); requestBuilder.sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } @Override public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK && response.getText().trim().equals(REPORTS_WEBAPP_DEPLOYED_MSG)) { reportsWebappDeployed = true; getView().updateReportsPanel(url, params); } else { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } } }); } catch (RequestException e) { errorPopupManager.show(applicationConstants.reportsWebAppErrorMsg()); } }
Source:
public RequestBuilder buildRequest(Api api) { final RequestBuilder req = api.action("query") .param("prop", "pageprops|pageimages") .param("ppprop", "wikibase_item") .param("generator", "search") .param("gsrsearch", searchTerm) .param("gsrnamespace", "0") .param("gsrwhat", "text") .param("gsrinfo", "") .param("gsrprop", "redirecttitle") .param("gsrlimit", NUM_RESULTS_PER_QUERY) .param("list", "search") .param("srsearch", searchTerm) .param("srnamespace", "0") .param("srwhat", "text") .param("srinfo", "suggestion") .param("srprop", "") .param("srlimit", NUM_RESULTS_PER_QUERY) .param("piprop", "thumbnail") .param("pithumbsize", Integer.toString(WikipediaApp.PREFERRED_THUMB_SIZE)) .param("pilimit", NUM_RESULTS_PER_QUERY); if (continueOffset != null) { req.param("continue", continueOffset.cont); if (continueOffset.gsroffset > 0) { req.param("sroffset", Integer.toString(continueOffset.sroffset)); } if (continueOffset.gsroffset > 0) { req.param("gsroffset", Integer.toString(continueOffset.gsroffset)); } } else { req.param("continue", ""); } return req; }

Target:
public RequestBuilder buildRequest(Api api) { final RequestBuilder req = api.action("query") .param("prop", "pageprops|pageimages") .param("ppprop", "wikibase_item") .param("generator", "search") .param("gsrsearch", searchTerm) .param("gsrnamespace", "0") .param("gsrwhat", "text") .param("gsrinfo", "") .param("gsrprop", "redirecttitle") .param("gsrlimit", NUM_RESULTS_PER_QUERY) .param("list", "search") .param("srsearch", searchTerm) .param("srnamespace", "0") .param("srwhat", "text") .param("srinfo", "suggestion") .param("srprop", "") .param("srlimit", NUM_RESULTS_PER_QUERY) .param("piprop", "thumbnail") .param("pithumbsize", Integer.toString(WikipediaApp.PREFERRED_THUMB_SIZE)) .param("pilimit", NUM_RESULTS_PER_QUERY); if (continueOffset != null) { req.param("continue", continueOffset.cont); if (continueOffset.sroffset > 0) { req.param("sroffset", Integer.toString(continueOffset.sroffset)); } if (continueOffset.gsroffset > 0) { req.param("gsroffset", Integer.toString(continueOffset.gsroffset)); } } else { req.param("continue", ""); } return req; }
Source:
public ServiceResponse<SolverInstance> updateSolverState(String containerId, String solverId, SolverInstance instance) { checkMandatoryParameter( "ContainerID", containerId ); checkMandatoryParameter( "SolverId", solverId ); checkMandatoryParameter( "instance", instance ); if( config.isRest() ) { String uri = getURI( containerId, solverId ); return makeHttpPostRequestAndCreateServiceResponse( uri, instance, SolverInstance.class, getHeaders( instance ) ); } else { instance.setContainerId( containerId ); instance.setSolverId( solverId ); CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new UpdateSolverStateCommand( containerId, solverId, serialize( instance ) ) ) ); return (ServiceResponse<SolverInstance>) executeJmsCommand( script ).getResponses().get( 0 ); } }

Target:
public ServiceResponse<SolverInstance> updateSolverState(String containerId, String solverId, SolverInstance instance) { checkMandatoryParameter( "ContainerID", containerId ); checkMandatoryParameter( "SolverId", solverId ); checkMandatoryParameter( "instance", instance ); if ( config.isRest() ) { String uri = getURI( containerId, solverId ); return makeHttpPostRequestAndCreateServiceResponse( uri, instance, SolverInstance.class, getHeaders( instance ) ); } else { instance.setContainerId( containerId ); instance.setSolverId( solverId ); CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new UpdateSolverStateCommand( containerId, solverId, serialize( instance ) ) ) ); ServiceResponse<SolverInstance> response = (ServiceResponse<SolverInstance>) executeJmsCommand( script, UpdateSolverStateCommand.class.getName(), KieServerConstants.CAPABILITY_BRP ).getResponses().get( 0 ); throwExceptionOnFailure( response ); return response; } }
Source:
public boolean isEndOfInput() { return responseComplete.get() && chunksToWrite.size() <= 0; }

Target:
public boolean isEndOfInput() { return responseComplete.get() && !writeFuture.isDone() && chunksToWriteCount.get() == 0; }
Source:
public boolean equals(Object obj) { if (obj instanceof Identity) { return getGuid().equals(((Identity<?>) obj).getGuid()); } return false; }

Target:
public boolean equals(Object obj) { boolean equal = false; if (obj instanceof Identity) { Identity<T> identity = (Identity<T>) obj; if (getGuid() == identity.getGuid()) { equal = true; } equal = getGuid().equals(identity.getGuid()); } return equal; }
Source:
public void testSslWithClientAuthenticationFailsWithoutProperServerTrustStore() { SslConfiguration serverConfig = SslConfiguration.of( TestConstants.SERVER_KEY_STORE_JKS_PATH, TestConstants.SERVER_KEY_STORE_JKS_PATH, TestConstants.SERVER_KEY_STORE_JKS_PASSWORD); SslConfiguration clientConfig = SslConfiguration.of( TestConstants.CA_TRUST_STORE_PATH, TestConstants.CLIENT_KEY_STORE_JKS_PATH, TestConstants.CLIENT_KEY_STORE_JKS_PASSWORD); assertThatThrownBy(() -> { runSslConnectionTest(serverConfig, clientConfig, ClientAuth.WITH_CLIENT_AUTH); }).isInstanceOfSatisfying(RuntimeException.class, ex -> { if (System.getProperty("java.version").startsWith("1.8")) { assertThat(ex).hasCauseInstanceOf(SSLHandshakeException.class).hasMessageContaining("bad_certificate"); } else { assertThat(ex.getCause()).isInstanceOfAny(SSLException.class, SSLHandshakeException.class); assertThat(ex.getMessage()).contains("readHandshakeRecord", "certificate_unknown"); } }); }

Target:
public void testSslWithClientAuthenticationFailsWithoutProperServerTrustStore() { SslConfiguration serverConfig = SslConfiguration.of( TestConstants.SERVER_KEY_STORE_JKS_PATH, TestConstants.SERVER_KEY_STORE_JKS_PATH, TestConstants.SERVER_KEY_STORE_JKS_PASSWORD); SslConfiguration clientConfig = SslConfiguration.of( TestConstants.CA_TRUST_STORE_PATH, TestConstants.CLIENT_KEY_STORE_JKS_PATH, TestConstants.CLIENT_KEY_STORE_JKS_PASSWORD); assertThatThrownBy(() -> { runSslConnectionTest(serverConfig, clientConfig, ClientAuth.WITH_CLIENT_AUTH); }).isInstanceOfSatisfying(RuntimeException.class, ex -> { if (System.getProperty("java.version").startsWith("1.8")) { assertThat(ex).hasCauseInstanceOf(SSLHandshakeException.class).hasMessageContaining("bad_certificate"); } else { assertThat(ex.getCause()).isInstanceOfAny(SSLException.class, SSLHandshakeException.class); assertThat(ex.getMessage()).satisfiesAnyOf( message -> assertThat(message).contains("readHandshakeRecord"), message -> assertThat(message).contains("certificate_unknown")); } }); }
Source:
public void resourceChanged(final IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); delta = delta.findMember(getFile().getFullPath()); IFile file = null; IPath newPath = null; if (delta == null) return; if (delta.getKind() == IResourceDelta.REMOVED) { if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) { newPath = delta.getMovedToPath(); } } if ((delta.getKind() == IResourceDelta.CHANGED)) { if ((delta.getFlags() & IResourceDelta.CONTENT) != 0) { newPath = delta.getResource().getFullPath(); file = ResourcesPlugin.getWorkspace().getRoot().getFile(newPath); } } if (newPath != null) { file = ResourcesPlugin.getWorkspace().getRoot().getFile(newPath); } if (file != null) { synchronizeModelWithResource(file); } final AbstractEditorPage activePage = convertToAbstractEditorPage(getActivePageInstance()); if (activePage != null) { Display.getDefault().asyncExec(handlePageUpdate(activePage, file)); } }

Target:
public void resourceChanged(final IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); delta = delta.findMember(getFile().getFullPath()); IFile file = null; IPath newPath = null; if (delta == null) return; if (delta.getKind() == IResourceDelta.REMOVED) { if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) { newPath = delta.getMovedToPath(); } } if ((delta.getKind() == IResourceDelta.CHANGED)) { if ((delta.getFlags() & IResourceDelta.CONTENT) != 0) { newPath = delta.getResource().getFullPath(); file = ResourcesPlugin.getWorkspace().getRoot().getFile(newPath); } } if (newPath != null) { file = ResourcesPlugin.getWorkspace().getRoot().getFile(newPath); } if (file != null) { updateFileModelFromResource(file); } final AbstractEditorPage activePage = convertToAbstractEditorPage(getActivePageInstance()); if (activePage != null) { Display.getDefault().asyncExec(handlePageUpdate(activePage, file)); } }
Source:
public static String setCredentials(final String hostName, String username, String password) { final HostnameRequirement requirement = new HostnameRequirement(hostName); if (!SystemCredentialsProvider.getInstance().getDomainCredentialsMap().containsKey(requirement)) { generateDomain(hostName); } String credentialsId; StandardUsernamePasswordCredentials newCredential = new UsernamePasswordCredentialsImpl( CredentialsScope.GLOBAL, credentialsId = UUID.randomUUID().toString(), "", username, password ); SystemCredentialsProvider.getInstance().getDomainCredentialsMap().get(requirement).add(newCredential); return credentialsId; }

Target:
public static String setCredentials(final String hostName, String username, String password) { List<DomainSpecification> domainSpecifications = new ArrayList<>(); domainSpecifications.add(new HostnameSpecification(hostName, null)); Domain domain = new Domain("Generated for " + hostName, "", domainSpecifications); SystemCredentialsProvider.getInstance().getDomainCredentialsMap().put(domain, new ArrayList<Credentials>()); String credentialsId; StandardUsernamePasswordCredentials newCredential = new UsernamePasswordCredentialsImpl( CredentialsScope.GLOBAL, credentialsId = UUID.randomUUID().toString(), "Generated for " + username, username, password ); SystemCredentialsProvider.getInstance().getDomainCredentialsMap().get(domain).add(newCredential); try { SystemCredentialsProvider.getInstance().save(); } catch (IOException ex) { LOGGER.log(Level.WARNING, "SystemCredentialsProvider instance save failed: ", ex); } return credentialsId; }
Source:
public static ComponentURI of(CodeSystemURI codeSystemURI, short terminologyComponentId, String identifier) { return new ComponentURI(codeSystemURI, terminologyComponentId, Strings.nullToEmpty(identifier)); }

Target:
public static ComponentURI of(CodeSystemURI codeSystemURI, short terminologyComponentId, String identifier) { return getOrCache(new ComponentURI(codeSystemURI, terminologyComponentId, identifier)); }
Source:
public void testSendSerialData802ConnectionClosed() throws Exception { PowerMockito.doReturn(XBeeProtocol.RAW_802_15_4).when(xbeeDevice, "getXBeeProtocol"); PowerMockito.doThrow(new XBeeException(XBeeException.CONNECTION_NOT_OPEN)).when(xbeeDevice, "sendXBeePacket", tx16Packet); PowerMockito.doThrow(new XBeeException(XBeeException.CONNECTION_NOT_OPEN)).when(xbeeDevice, "sendXBeePacket", tx64Packet); try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } }

Target:
public void testSendSerialData802ConnectionClosed() throws Exception { PowerMockito.doReturn(XBeeProtocol.RAW_802_15_4).when(xbeeDevice, "getXBeeProtocol"); Mockito.when(xbeeDevice.isOpen()).thenReturn(false); try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx16 frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } }
Source:
public void invalidateSession( String subjectName, Function<Map<String, Object>, String> sessionSubjectExtractor) { final Optional<String> sessionIdOptional = getSessionAttributeMapsStream() .filter(e -> subjectName.equals(sessionSubjectExtractor.apply(e.getValue()))) .map(e -> e.getKey()) .findFirst(); if (sessionIdOptional.isPresent()) { idManager.invalidateSession(sessionIdOptional.get()); } }

Target:
public void invalidateSession( String subjectName, Function<Map<String, Object>, String> sessionSubjectExtractor) { final Optional<String> sessionIdOptional = idManager .latestSessionAttributes .entrySet() .stream() .filter(e -> subjectName.equals(sessionSubjectExtractor.apply(e.getValue()))) .map(Map.Entry::getKey) .findFirst(); sessionIdOptional.ifPresent(idManager::invalidateSession); }
Source:
public void test_attach_to_activated_cluster_with_offline_node() throws Exception { assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); waitForPassives(1); int activeId = findActive(1).getAsInt(); int passiveId = findPassives(1)[0]; stopNode(1, passiveId); startNode(1, 3); waitForDiagnostic(1, 3); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(1))); invokeConfigTool("attach", "-d", "localhost:" + getNodePort(1, activeId), "-s", "localhost:" + getNodePort(1, 3)); waitForPassive(1, 3); assertThat(getUpcomingCluster("localhost", getNodePort(1, activeId)).getNodeCount(), is(equalTo(3))); assertThat(getRuntimeCluster("localhost", getNodePort(1, activeId)).getNodeCount(), is(equalTo(3))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(3))); assertThat(getRuntimeCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(3))); startNode(1, passiveId); waitForPassive(1, passiveId); assertThat(getUpcomingCluster("localhost", getNodePort(1, passiveId)).getNodeCount(), is(equalTo(3))); assertThat(getRuntimeCluster("localhost", getNodePort(1, passiveId)).getNodeCount(), is(equalTo(3))); }

Target:
public void test_attach_to_activated_cluster_with_offline_node() throws Exception { assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); int activeId = findActive(1).getAsInt(); int passiveId = findPassives(1)[0]; stopNode(1, passiveId); startNode(1, 3); waitForDiagnostic(1, 3); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(1))); invokeConfigTool("attach", "-d", "localhost:" + getNodePort(1, activeId), "-s", "localhost:" + getNodePort(1, 3)); waitForPassive(1, 3); assertThat(getUpcomingCluster("localhost", getNodePort(1, activeId)).getNodeCount(), is(equalTo(3))); assertThat(getRuntimeCluster("localhost", getNodePort(1, activeId)).getNodeCount(), is(equalTo(3))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(3))); assertThat(getRuntimeCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(3))); startNode(1, passiveId); waitForPassive(1, passiveId); assertThat(getUpcomingCluster("localhost", getNodePort(1, passiveId)).getNodeCount(), is(equalTo(3))); assertThat(getRuntimeCluster("localhost", getNodePort(1, passiveId)).getNodeCount(), is(equalTo(3))); }
Source:
private static void addToMap(long handle, @NonNull C4Replicator repl, @Nullable Object context) { REVERSE_LOOKUP_TABLE.put(handle, repl); CONTEXT_TO_C4_REPLICATOR_MAP.put(context, repl); }

Target:
private static void addToMap(long handle, @NonNull C4Replicator repl, @Nullable Object context) { REVERSE_LOOKUP_TABLE.put(handle, repl); if (context != null) { CONTEXT_TO_C4_REPLICATOR_MAP.put(context, repl); } }
Source:
private void configureRequestLogger() { boolean httpCacheEnabled = jettySettings.getBoolean("http.cache.sizeInMB") != null; boolean structuredLogEnabled = ofNullable(jettySettings.getBoolean("log.requests.structured")).orElse(Boolean.FALSE); server.setRequestLog(structuredLogEnabled ? new StructuredRequestLogger() : httpCacheEnabled ? new RequestWithCacheLogger() : new RequestLogger()); }

Target:
private void configureRequestLogger() { server.setRequestLog(new StructuredRequestLogger()); }
Source:
protected void internalReceiveCommand(String itemName, Command command) { if (logger.isDebugEnabled()) { logger.debug("internalReceiveCommand({},{}) is called!", itemName, command); } SimpleBinaryBindingConfig config = items.get(itemName); if (config != null) { SimpleBinaryGenericDevice device = devices.get(config.device); if (device != null) { try { device.sendData(itemName, command, config); } catch (Exception ex) { logger.error("internalReceiveCommand(): line:" + ex.getStackTrace()[0].getLineNumber() + "|method:" + ex.getStackTrace()[0].getMethodName()); } } else { logger.warn("No device for item: {}", itemName); } } else { logger.warn("No config for item: {}", itemName); } }

Target:
protected void internalReceiveCommand(String itemName, Command command) { if (logger.isDebugEnabled()) { logger.debug("internalReceiveCommand({},{}) is called!", itemName, command); } SimpleBinaryBindingConfig config = items.get(itemName); if (config == null) { logger.warn("No config for item: {}", itemName); return; } if (logger.isDebugEnabled()) { logger.debug("Config: {}", config); } updateState(config, command); }
Source:
public Token match(int ttype) throws RecognitionException { Token t = getCurrentToken(); if ( t.getType()==ttype ) { if ( t.getType()==Token.EOF ) { matchedEOF = true; } _errHandler.reportMatch(this); consume(); } else { t = _errHandler.recoverInline(this); if ( _buildParseTrees && t.getTokenIndex()==-1 ) { _ctx.addErrorNode(t); } } return t; }

Target:
public Token match(int ttype) throws RecognitionException { Token t = getCurrentToken(); if ( t.getType()==ttype ) { if ( ttype==Token.EOF ) { matchedEOF = true; } _errHandler.reportMatch(this); consume(); } else { t = _errHandler.recoverInline(this); if ( _buildParseTrees && t.getTokenIndex()==-1 ) { _ctx.addErrorNode(t); } } return t; }
Source:
public String getMessage() { final StringBuilder sb = new StringBuilder(super.getMessage()); for (final Throwable e : this.causes) { sb.append(String.format("\n %s(%s)", e.getClass().getName(), e.getMessage())); } return sb.toString(); }

Target:
public String getMessage() { return super.getMessage() + this.causes.stream() .map(e -> String.format(" %s(%s)", e.getClass().getName(), e.getMessage())) .collect(Collectors.joining("\n", "\n", "")); }
Source:
public static void main(String... args) throws IOException, InterruptedException, ExecutionException { final String clientId = "your client id"; final String clientSecret = "your client secret"; final OAuth20Service service = new ServiceBuilder(clientId) .apiSecret(clientSecret) .defaultScope("read_all") .callback("http://localhost/callback") .build(StravaApi.instance()); final Scanner in = new Scanner(System.in); System.out.println("=== " + NETWORK_NAME + "'s OAuth Workflow ==="); System.out.println(); System.out.println("Fetching the Authorization URL..."); final String secretState = "secret" + new Random().nextInt(999_999); final String authorizationUrl = service.getAuthorizationUrl(secretState); System.out.println("Got the Authorization URL!"); System.out.println("Now go and authorize ScribeJava here:"); System.out.println(authorizationUrl); System.out.println("And paste the authorization code here"); System.out.print(">>"); final String code = in.nextLine(); System.out.println(); System.out.println("Trading the Authorization Code for an Access Token..."); final OAuth2AccessToken accessToken = service.getAccessToken(code); System.out.println("Got the Access Token!"); System.out.println("(The raw response looks like this: " + accessToken.getRawResponse() + "')"); System.out.println(); }

Target:
public static void main(String... args) throws IOException, InterruptedException, ExecutionException { final String clientId = "your client id"; final String clientSecret = "your client secret"; final OAuth20Service service = new ServiceBuilder(clientId) .apiSecret(clientSecret) .defaultScope("read_all") .callback("http://localhost/callback") .build(StravaApi.instance()); final Scanner in = new Scanner(System.in); System.out.println("=== " + NETWORK_NAME + "'s OAuth Workflow ==="); System.out.println(); System.out.println("Fetching the Authorization URL..."); final String secretState = "secret" + new Random().nextInt(999_999); final String authorizationUrl = service.getAuthorizationUrl(secretState); System.out.println("Got the Authorization URL!"); System.out.println("Now go and authorize ScribeJava here:"); System.out.println(authorizationUrl); System.out.println("And paste the authorization code here"); System.out.print(">>"); final String code = in.nextLine(); System.out.println(); System.out.println("Trading the Authorization Code for an Access Token..."); final OAuth2AccessToken accessToken = service.getAccessToken(code); System.out.println("Got the Access Token!"); System.out.println("(The raw response looks like this: " + accessToken.getRawResponse() + "')"); System.out.println(); System.out.println("Now we're going to access a protected resource..."); final OAuthRequest request = new OAuthRequest(Verb.GET, ATHLETE_INFO); service.signRequest(accessToken, request); try (Response response = service.execute(request)) { System.out.println("Got it! Lets see what we found..."); System.out.println(); System.out.println(response.getCode()); System.out.println(response.getBody()); } System.out.println(); System.out.println("That's it man! Go and build something awesome with ScribeJava! :)"); }
Source:
public void cloneForRevision_shouldSetAllTheRelevantFields() throws Exception { Order newOrder = new Order(); OrderGroup orderGroup = new OrderGroup(); newOrder.setOrderGroup(orderGroup); Order revisedOrder = newOrder.cloneForRevision(); assertThatAllFieldsAreCopied(revisedOrder, "cloneForRevision", "creator", "dateCreated", "action", "changedBy", "dateChanged", "voided", "dateVoided", "voidedBy", "voidReason", "encounter", "orderNumber", "orderer", "previousOrder", "dateActivated", "dateStopped", "accessionNumber", "orderGroup", "sortWeight"); assertNull("Revised order should not have orderGroup", revisedOrder.getOrderGroup()); assertNull("Revised order should not have sortWeight", revisedOrder.getSortWeight()); }

Target:
public void cloneForRevision_shouldSetAllTheRelevantFields() throws Exception { Order newOrder = new Order(); OrderGroup orderGroup = new OrderGroup(); newOrder.setOrderGroup(orderGroup); Order revisedOrder = newOrder.cloneForRevision(); assertThatAllFieldsAreCopied(revisedOrder, "cloneForRevision", "creator", "dateCreated", "action", "changedBy", "dateChanged", "voided", "dateVoided", "voidedBy", "voidReason", "encounter", "orderNumber", "orderer", "previousOrder", "dateActivated", "dateStopped", "accessionNumber"); }
Source:
private ServiceInfo getAssertionConsumerServiceInfoByIndex(Integer index) { return assertionConsumerServices .values() .stream() .filter(serviceInfo -> index.equals(serviceInfo.getIndex())) .filter(serviceInfo -> serviceInfo.getBinding() != null) .filter(serviceInfo -> !serviceInfo.getBinding().equals(Binding.HTTP_REDIRECT)) .filter(serviceInfo -> supportedBindings.contains(serviceInfo.getBinding())) .filter(serviceInfo -> IDP_SUPPORTED_BINDINGS.contains(serviceInfo.getBinding())) .findFirst() .orElse(null); }

Target:
private ServiceInfo getAssertionConsumerServiceInfoByIndex(Integer index) { return getACS(s -> index.equals(s.getIndex())); }
Source:
public Block getBlock(int[] positions, int positionCount) { checkArgument(outputPositionCount > 0, "outputPositionCount must be greater than zero"); checkState(outputRequired, "This stream reader doesn't produce output"); checkState(positionCount <= outputPositionCount, "Not enough values"); if (positionCount == outputPositionCount) { if (allNulls) { return new RunLengthEncodedBlock(BOOLEAN.createBlockBuilder(null, 1).appendNull().build(), positionCount); } Block block = new ByteArrayBlock(positionCount, Optional.ofNullable(nulls), values); nulls = null; values = null; return block; } byte[] values = new byte[positionCount]; boolean[] nulls = null; if (this.nulls != null) { nulls = new boolean[positionCount]; } int positionIndex = 0; int nextPosition = positions[positionIndex]; for (int i = 0; i < outputPositionCount; i++) { if (outputPositions[i] < nextPosition) { continue; } assert outputPositions[i] == nextPosition; values[positionIndex] = this.values[i]; if (this.nulls != null) { nulls[positionIndex] = this.nulls[i]; } positionIndex++; if (positionIndex >= positionCount) { break; } nextPosition = positions[positionIndex]; } return new ByteArrayBlock(positionCount, Optional.ofNullable(nulls), values); }

Target:
public Block getBlock(int[] positions, int positionCount) { checkArgument(outputPositionCount > 0, "outputPositionCount must be greater than zero"); checkState(outputRequired, "This stream reader doesn't produce output"); checkState(positionCount <= outputPositionCount, "Not enough values"); if (allNulls) { return new RunLengthEncodedBlock(BOOLEAN.createBlockBuilder(null, 1).appendNull().build(), outputPositionCount); } if (positionCount == outputPositionCount) { Block block = new ByteArrayBlock(positionCount, Optional.ofNullable(nulls), values); nulls = null; values = null; return block; } byte[] valuesCopy = new byte[positionCount]; boolean[] nullsCopy = null; if (nullsAllowed && presentStream != null) { nullsCopy = new boolean[positionCount]; } int positionIndex = 0; int nextPosition = positions[positionIndex]; for (int i = 0; i < outputPositionCount; i++) { if (outputPositions[i] < nextPosition) { continue; } assert outputPositions[i] == nextPosition; valuesCopy[positionIndex] = this.values[i]; if (nullsCopy != null) { nullsCopy[positionIndex] = this.nulls[i]; } positionIndex++; if (positionIndex >= positionCount) { break; } nextPosition = positions[positionIndex]; } return new ByteArrayBlock(positionCount, Optional.ofNullable(nullsCopy), valuesCopy); }
Source:
public void chunkReceived(Request request, byte[] bs) { chunksReceived++; try { fos.write(bs) ; } catch (IOException e) { e.printStackTrace(); } outstanding.remove(request); }

Target:
public void chunkReceived(Request request, byte[] bs) { chunksReceived++; try { raf.seek( request.start ); raf.write(bs) ; } catch (IOException e) { e.printStackTrace(); } outstanding.remove(request); }
Source:
public Void visit(TermCons node, Void _void) { if (cache.containsKey(node)) return null; for (int i = 0, j = 0; i < node.getProduction().getItems().size(); i++) { if (node.getProduction().getItems().get(i) instanceof NonTerminal) { Term t = node.getContents().get(j); try { new CollectVariablesVisitor2(context, ((NonTerminal) node.getProduction().getItems().get(i)).getSort()).visitNode(t); } catch (ParseFailedException e) { e.printStackTrace(); } this.visitNode(t); j++; } else if (node.getProduction().getItems().get(i) instanceof UserList) { if (!node.isListTerminator()) { UserList ul = (UserList) node.getProduction().getItems().get(i); Term t1 = node.getContents().get(0); Term t2 = node.getContents().get(1); try { new CollectVariablesVisitor2(context, ul.getSort()).visitNode(t1); new CollectVariablesVisitor2(context, node.getProduction().getSort()).visitNode(t2); } catch (ParseFailedException e) { e.printStackTrace(); } this.visitNode(t1); this.visitNode(t2); } } } return super.visit(node, _void); }

Target:
public Void visit(TermCons node, Void _void) { if (cache.containsKey(node)) return null; for (int i = 0, j = 0; i < node.getProduction().getItems().size(); i++) { if (node.getProduction().getItems().get(i) instanceof NonTerminal) { Term t = node.getContents().get(j); try { new CollectVariablesVisitor2(context, ((NonTerminal) node.getProduction().getItems().get(i)).getSort()).visitNode(t); } catch (ParseFailedException e) { e.printStackTrace(); } this.visitNode(t); j++; } else if (node.getProduction().getItems().get(i) instanceof UserList) { if (!node.isListTerminator()) { UserList ul = (UserList) node.getProduction().getItems().get(i); Term t1 = node.getContents().get(0); Term t2 = node.getContents().get(1); new CollectVariablesVisitor2(context, ul.getSort()).visitNode(t1); new CollectVariablesVisitor2(context, node.getProduction().getSort()).visitNode(t2); this.visitNode(t1); this.visitNode(t2); } } } return super.visit(node, _void); }
Source:
public FactionDisplay(SolGame game, FactionInfo factionInfo) { dimensions = SolApplication.displayDimensions; cam = game.getCam(); info = factionInfo; }

Target:
public FactionDisplay(SolGame game, FactionInfo factionInfo) { cam = game.getCam(); info = factionInfo; }
Source:
public RecoveryManager(Master master, long timeToCacheExistsInMillis) { this.master = master; existenceCache = CacheBuilder.newBuilder().expireAfterWrite(timeToCacheExistsInMillis, TimeUnit.MILLISECONDS) .maximumWeight(10000000).weigher(new Weigher<Path,Boolean>() { @Override public int weigh(Path path, Boolean exist) { return path.toString().length(); } }).build(); executor = Executors.newScheduledThreadPool(4, new NamingThreadFactory("Walog sort starter ")); zooCache = new ZooCache(); try { AccumuloConfiguration aconf = master.getConfiguration(); List<String> workIDs = new DistributedWorkQueue(ZooUtil.getRoot(master.getInstance()) + Constants.ZRECOVERY, aconf).getWorkQueued(); sortsQueued.addAll(workIDs); } catch (Exception e) { log.warn("{}", e.getMessage(), e); } }

Target:
public RecoveryManager(Master master, long timeToCacheExistsInMillis) { this.master = master; existenceCache = CacheBuilder.newBuilder().expireAfterWrite(timeToCacheExistsInMillis, TimeUnit.MILLISECONDS) .maximumWeight(10_000_000).weigher(new Weigher<Path,Boolean>() { @Override public int weigh(Path path, Boolean exist) { return path.toString().length(); } }).build(); executor = Executors.newScheduledThreadPool(4, new NamingThreadFactory("Walog sort starter ")); zooCache = new ZooCache(); try { AccumuloConfiguration aconf = master.getConfiguration(); List<String> workIDs = new DistributedWorkQueue(ZooUtil.getRoot(master.getInstance()) + Constants.ZRECOVERY, aconf).getWorkQueued(); sortsQueued.addAll(workIDs); } catch (Exception e) { log.warn("{}", e.getMessage(), e); } }