auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void should_fail_when_build_settlement_if_user_does_not_have_resources_in_main_stage() { startNewGame(12, 1); playPreparationStage() .nextRandomDiceValues(asList(6, 6)) .THROW_DICE(1) <START> .BUILD_CITY(1).atNode(1, -1, "top").failsWithError("ERROR"); <END> }</code><technical_language>I check quantity of resources this step</technical_language>

Target:
public void should_fail_when_build_settlement_if_user_does_not_have_resources_in_main_stage() { startNewGame(12, 1); playPreparationStage() .nextRandomDiceValues(asList(6, 6)) .THROW_DICE(1) .getGameDetails(1).gameUser(1).check("resources.wheat", is(0)) .getGameDetails(1).gameUser(1).check("resources.stone", is(0)) .getGameDetails(1).gameUser(1).doesntHaveAvailableAction("BUILD_CITY") .BUILD_CITY(1).atNode(1, -1, "top").failsWithError("ERROR"); }
Source:
<code>public void reconnectPolicy() <START> throws ConfigurationException, MqttException, InterruptedException, ConfigurationException { <END> MqttBrokerConnectionEx a = spy( new MqttBrokerConnectionEx("123.123.123.123", null, false, "MqttBrokerConnectionTests")); a.setConnectionCallback(a, mock(IMqttToken.class)); a.setReconnectStrategy(new PeriodicReconnectStrategy()); assertThat(a.getReconnectStrategy().getBrokerConnection(), equalTo(a)); PeriodicReconnectStrategy mockPolicy = spy(new PeriodicReconnectStrategy(10000, 0)); doNothing().when(a).start(); mockPolicy.start(); a.setReconnectStrategy(mockPolicy); doReturn(MqttConnectionState.DISCONNECTED).when(a).connectionState(); IMqttToken token = mock(IMqttToken.class); when(token.getException()).thenReturn(new org.eclipse.paho.client.mqttv3.MqttException(1)); a.isConnecting = true; a.connectionCallbacks.onFailure(token, null); verify(mockPolicy).lostConnection(); Thread.sleep(10); verify(a).start(); assertTrue(mockPolicy.isReconnecting()); a.connectionCallbacks.onSuccess(token); assertFalse(mockPolicy.isReconnecting()); }</code><technical_language>ConfigurationException is doubled</technical_language>

Target:
public void reconnectPolicy() throws ConfigurationException, MqttException, InterruptedException, ConfigurationException { MqttBrokerConnectionEx connection = spy( new MqttBrokerConnectionEx("123.123.123.123", null, false, "MqttBrokerConnectionTests")); connection.setConnectionCallback(connection, mock(IMqttToken.class)); connection.setReconnectStrategy(new PeriodicReconnectStrategy()); assertThat(connection.getReconnectStrategy().getBrokerConnection(), equalTo(connection)); PeriodicReconnectStrategy mockPolicy = spy(new PeriodicReconnectStrategy(10000, 0)); doNothing().when(connection).start(); mockPolicy.start(); connection.setReconnectStrategy(mockPolicy); doReturn(MqttConnectionState.DISCONNECTED).when(connection).connectionState(); IMqttToken token = mock(IMqttToken.class); when(token.getException()).thenReturn(new org.eclipse.paho.client.mqttv3.MqttException(1)); connection.isConnecting = true; connection.connectionCallbacks.onFailure(token, null); verify(mockPolicy).lostConnection(); Thread.sleep(10); verify(connection).start(); assertTrue(mockPolicy.isReconnecting()); connection.connectionCallbacks.onSuccess(token); assertFalse(mockPolicy.isReconnecting()); }
Source:
<code>public BitVector<BigInteger> sdiv(BitVector<BigInteger> bitVector) { <START> if (!bitVector.signedValue().equals(BigInteger.ZERO) <END> && !(signedValue().equals(signedMin()) && bitVector.signedValue().equals(BigInteger.valueOf(-1)))) { return BigIntegerBitVector.of( signedValue().divide(bitVector.signedValue()), bitwidth); } else { return null; } }</code><technical_language>feel if this naively divide integers throw exception if divide zero over/underflow</technical_language>

Target:
public BuiltinList sdiv(BitVector<BigInteger> bitVector) { if (!bitVector.signedValue().equals(BigInteger.ZERO)) { BigInteger result = signedValue().divide(bitVector.signedValue()); return getBuiltinList(result, checkSignedOverflow(result)); } else { return null; } }
Source:
<code>public static boolean preValidate(String path) throws CTFException { String metadataPath = path + Utils.SEPARATOR + METADATA_FILENAME; File metadataFile = new File(metadataPath); if (metadataFile.exists() && metadataFile.length() > PREVALIDATION_SIZE) { <START> if(CTFTrace.isCTFPacketBasedFile(metadataFile)!= null){ <END> return true; } try(BufferedReader br = new BufferedReader(new FileReader(metadataFile))){ String text = br.readLine(); return text.startsWith(TEXT_ONLY_METADATA_HEADER_PREFIX); } catch (IOException e) { throw new CTFException(e.getMessage(), e); } } return false; }</code><technical_language>_</technical_language>

Target:
public static boolean preValidate(String path) throws CTFException { String metadataPath = path + Utils.SEPARATOR + METADATA_FILENAME; File metadataFile = new File(metadataPath); if (metadataFile.exists() && metadataFile.length() > PREVALIDATION_SIZE) { if (CTFTrace.startsWithMagicNumber(metadataFile, Utils.TSDL_MAGIC) != null) { return true; } try (BufferedReader br = new BufferedReader(new FileReader(metadataFile))) { String text = br.readLine(); return text.startsWith(TEXT_ONLY_METADATA_HEADER_PREFIX); } catch (IOException e) { throw new CTFException(e.getMessage(), e); } } return false; }
Source:
<code>protected int runWithJob(final Namespace options, final HeliosClient client, final PrintStream out, final boolean json, final Job job, final BufferedReader stdin) throws ExecutionException, InterruptedException { final JobId jobId = job.getId(); final List<String> hosts = options.getList(hostsArg.getDest()); final Deployment deployment = Deployment.of(jobId, options.getBoolean(noStartArg.getDest()) ? STOP : START); if (!json) { out.printf("Deploying %s on %s%n", deployment, hosts); } int code = 0; final HostResolver resolver = HostResolver.create(client); final List<String> resolvedHosts = Lists.newArrayList(); for (final String candidateHost : hosts) { final String host = resolver.resolveName(candidateHost); resolvedHosts.add(host); if (!json) { out.printf("%s: ", host); } final String token = options.getString(tokenArg.getDest()); final JobDeployResponse result = client.deploy(deployment, host, token).get(); if (result.getStatus() == JobDeployResponse.Status.OK) { if (!json) { out.printf("done%n"); } else { out.print(result.toJsonString()); } } else { if (!json) { out.printf("failed: %s%n", result); } else { out.print(result.toJsonString()); } code = 1; } } if (code == 0 && options.getBoolean(watchArg.getDest())) { <START> JobWatchCommand.watchJobsOnHosts(out, true, resolvedHosts, singletonList(jobId), <END> options.getInt(intervalArg.getDest()), client); } return code; }</code><technical_language>curious, change this</technical_language>

Target:
protected int runWithJob(final Namespace options, final HeliosClient client, final PrintStream out, final boolean json, final Job job, final BufferedReader stdin) throws ExecutionException, InterruptedException { final JobId jobId = job.getId(); final List<String> hosts = options.getList(hostsArg.getDest()); final Deployment deployment = Deployment.of(jobId, options.getBoolean(noStartArg.getDest()) ? STOP : START); if (!json) { out.printf("Deploying %s on %s%n", deployment, hosts); } int code = 0; final HostResolver resolver = HostResolver.create(client); final List<String> resolvedHosts = Lists.newArrayList(); for (final String candidateHost : hosts) { final String host = resolver.resolveName(candidateHost); resolvedHosts.add(host); if (!json) { out.printf("%s: ", host); } final String token = options.getString(tokenArg.getDest()); final JobDeployResponse result = client.deploy(deployment, host, token).get(); if (result.getStatus() == JobDeployResponse.Status.OK) { if (!json) { out.printf("done%n"); } else { out.print(result.toJsonString()); } } else { if (!json) { out.printf("failed: %s%n", result); } else { out.print(result.toJsonString()); } code = 1; } } if (code == 0 && options.getBoolean(watchArg.getDest())) { JobWatchCommand.watchJobsOnHosts(out, true, resolvedHosts, ImmutableList.of(jobId), options.getInt(intervalArg.getDest()), client); } return code; }
Source:
<code>protected IManageablePage getPersistedPage(String sessionIdentifier, int id) { <START> String type = (String) client.get(makeKey(sessionIdentifier, id, PAGE_TYPE)); <END> byte[] data = (byte[]) client.get(makeKey(sessionIdentifier, id, PAGE_DATA)); if (data != null) { if (LOG.isDebugEnabled()) { LOG.debug("Got page for session '{}' and page id '{}'", sessionIdentifier, id); } return new SerializedPage(id, type, data); } return null; }</code><technical_language>This line moved if. is need network call if is data</technical_language>

Target:
protected IManageablePage getPersistedPage(String sessionIdentifier, int id) { byte[] data = (byte[]) client.get(makeKey(sessionIdentifier, id, PAGE_DATA)); if (data != null) { String type = (String) client.get(makeKey(sessionIdentifier, id, PAGE_TYPE)); LOG.debug("Got page for session '{}' and page id '{}'", sessionIdentifier, id); return new SerializedPage(id, type, data); } return null; }
Source:
<code>void startCommonServices(Configuration conf, HAContext haContext) throws IOException { this.registerMBean(); writeLock(); this.haContext = haContext; try { nnResourceChecker = new NameNodeResourceChecker(conf); checkAvailableResources(); assert !blockManager.isPopulatingReplQueues(); StartupProgress prog = NameNode.getStartupProgress(); prog.beginPhase(Phase.SAFEMODE); long completeBlocksTotal = getCompleteBlocksTotal(); prog.setTotal(Phase.SAFEMODE, STEP_AWAITING_REPORTED_BLOCKS, completeBlocksTotal); blockManager.activate(conf, completeBlocksTotal); } finally { writeUnlock("startCommonServices"); } registerMXBean(); DefaultMetricsSystem.instance().register(this); if (inodeAttributeProvider != null) { inodeAttributeProvider.start(); dir.setINodeAttributeProvider(inodeAttributeProvider); } snapshotManager.registerMXBean(); <START> snapshotDeletionGc.schedule(); <END> InetSocketAddress serviceAddress = NameNode.getServiceAddress(conf, true); this.nameNodeHostName = (serviceAddress != null) ? serviceAddress.getHostName() : ""; }</code><technical_language>I start gc work in FSNameSystem#startActiveServices() quota setup initialization is done startActiveServices() // Initialize quota. dir.updateCountForQuota(); // Enable quota checks. dir.enableQuotaChecks();</technical_language>

Target:
void startCommonServices(Configuration conf, HAContext haContext) throws IOException { this.registerMBean(); writeLock(); this.haContext = haContext; try { nnResourceChecker = new NameNodeResourceChecker(conf); checkAvailableResources(); assert !blockManager.isPopulatingReplQueues(); StartupProgress prog = NameNode.getStartupProgress(); prog.beginPhase(Phase.SAFEMODE); long completeBlocksTotal = getCompleteBlocksTotal(); prog.setTotal(Phase.SAFEMODE, STEP_AWAITING_REPORTED_BLOCKS, completeBlocksTotal); blockManager.activate(conf, completeBlocksTotal); } finally { writeUnlock("startCommonServices"); } registerMXBean(); DefaultMetricsSystem.instance().register(this); if (inodeAttributeProvider != null) { inodeAttributeProvider.start(); dir.setINodeAttributeProvider(inodeAttributeProvider); } snapshotManager.registerMXBean(); InetSocketAddress serviceAddress = NameNode.getServiceAddress(conf, true); this.nameNodeHostName = (serviceAddress != null) ? serviceAddress.getHostName() : ""; }
Source:
<code>public void close(IProgressMonitor monitor) throws CoreException { if (!isOpen()) return; try { String msg = Messages.resources_closing_0; int rootCount = tree.getChildCount(Path.ROOT); SubMonitor <START> subMonitor = <END> SubMonitor.convert(monitor, msg, rootCount + 3); subMonitor.subTask(msg); try { stringPoolJob.cancel(); saveManager.shutdown(null); saveManager.reportSnapshotRequestor(); prepareOperation(getRoot(), subMonitor.newChild(1)); notificationManager.shutdown(null); beginOperation(true); IProject[] projects = getRoot().getProjects(IContainer.INCLUDE_HIDDEN); for (int i = 0; i < projects.length; i++) { broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_PROJECT_CLOSE, projects[i])); subMonitor.worked(1); } deleteResource(getRoot()); openFlag = false; } finally { shutdown(subMonitor.newChild(2, SubMonitor.SUPPRESS_SUBTASK)); } } finally { Job.getJobManager().endRule(getRoot()); } }</code><technical_language>Suggest avoiding (slow?) call getChildCount(...) instead setWorkRemaining redistribute ticks fetch actual IProjects, below</technical_language>

Target:
public void close(IProgressMonitor monitor) throws CoreException { if (!isOpen()) return; try { String msg = Messages.resources_closing_0; SubMonitor subMonitor = SubMonitor.convert(monitor, msg, 20); subMonitor.subTask(msg); try { stringPoolJob.cancel(); saveManager.shutdown(null); saveManager.reportSnapshotRequestor(); prepareOperation(getRoot(), subMonitor.newChild(1)); notificationManager.shutdown(null); beginOperation(true); IProject[] projects = getRoot().getProjects(IContainer.INCLUDE_HIDDEN); subMonitor.setWorkRemaining(projects.length + 2); for (int i = 0; i < projects.length; i++) { broadcastEvent(LifecycleEvent.newEvent(LifecycleEvent.PRE_PROJECT_CLOSE, projects[i])); subMonitor.worked(1); } deleteResource(getRoot()); openFlag = false; } finally { shutdown(subMonitor.newChild(2, SubMonitor.SUPPRESS_SUBTASK)); } } finally { Job.getJobManager().endRule(getRoot()); } }
Source:
<code>private int instrumentZip(final InputStream input, final OutputStream output, final String name) throws IOException { final ZipInputStream zipin = new ZipInputStream(input); final ZipOutputStream zipout = new ZipOutputStream(output); ZipEntry entry; int count = 0; while ((entry = nextEntry(zipin, name)) != null) { final String entryName = entry.getName(); if (signatureRemover.removeEntry(entryName)) { continue; } final ZipEntry newEntry = new ZipEntry(entryName); if (entry.getMethod() == ZipEntry.DEFLATED) { newEntry.setMethod(ZipEntry.DEFLATED); zipout.putNextEntry(newEntry); count += filterOrInstrument(zipin, zipout, name, entryName); } else { newEntry.setMethod(ZipEntry.STORED); final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); <START> count += filterOrInstrument(zipin, buffer, name, entryName); final byte[] bytes = buffer.toByteArray(); count += filterOrInstrument(zipin, buffer, name, entryName); <END> newEntry.setSize(bytes.length); newEntry.setCompressedSize(bytes.length); final CRC32 crc = new CRC32(); crc.update(bytes); newEntry.setCrc(crc.getValue()); zipout.putNextEntry(newEntry); zipout.write(bytes); } zipout.closeEntry(); } zipout.finish(); return count; }</code><technical_language>@marchof I published review a seconds published commit fix</technical_language>

Target:
private int instrumentZip(final InputStream input, final OutputStream output, final String name) throws IOException { final ZipInputStream zipin = new ZipInputStream(input); final ZipOutputStream zipout = new ZipOutputStream(output); ZipEntry entry; int count = 0; while ((entry = nextEntry(zipin, name)) != null) { final String entryName = entry.getName(); if (signatureRemover.removeEntry(entryName)) { continue; } final ZipEntry newEntry = new ZipEntry(entryName); newEntry.setMethod(entry.getMethod()); switch (entry.getMethod()) { case ZipEntry.DEFLATED: zipout.putNextEntry(newEntry); count += filterOrInstrument(zipin, zipout, name, entryName); break; case ZipEntry.STORED: final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); count += filterOrInstrument(zipin, buffer, name, entryName); final byte[] bytes = buffer.toByteArray(); newEntry.setSize(bytes.length); newEntry.setCompressedSize(bytes.length); newEntry.setCrc(crc(bytes)); zipout.putNextEntry(newEntry); zipout.write(bytes); break; default: throw new AssertionError(entry.getMethod()); } zipout.closeEntry(); } zipout.finish(); return count; }
Source:
<code>public void addTemplateChange(ChangeType type, int ordinal) { Timber.d("addTemplateChange() type %s for ordinal %s", type, ordinal); if (mTemplateChanges == null) { <START> mTemplateChanges = new ArrayList<>(); <END> } Object[] change = new Object[] {ordinal, type}; if (type == ChangeType.DELETE) { int ordinalAdjustment = 0; for (int i = mTemplateChanges.size() - 1; i >= 0; i--) { Object[] oldChange = mTemplateChanges.get(i ); switch ((ChangeType)oldChange[1]) { case DELETE: { if ((Integer)oldChange[0] - ordinalAdjustment <= ordinal) { ordinalAdjustment++; continue; } break; } case ADD: if (ordinal == (Integer)oldChange[0] - ordinalAdjustment) { compactTemplateChanges((Integer)oldChange[0]); return; } break; default: break; } } } Timber.d("addTemplateChange() added ord/type: %s/%s", change[0], change[1]); mTemplateChanges.add(change); dumpChanges(); }</code><technical_language>nit: consider calling getTemplateChanges() encapsulate null check/assign</technical_language>

Target:
public void addTemplateChange(ChangeType type, int ordinal) { Timber.d("addTemplateChange() type %s for ordinal %s", type, ordinal); ArrayList<Object[]> templateChanges = getTemplateChanges(); Object[] change = new Object[] {ordinal, type}; if (type == ChangeType.DELETE) { int ordinalAdjustment = 0; for (int i = templateChanges.size() - 1; i >= 0; i--) { Object[] oldChange = templateChanges.get(i ); switch ((ChangeType)oldChange[1]) { case DELETE: { if ((Integer)oldChange[0] - ordinalAdjustment <= ordinal) { ordinalAdjustment++; continue; } break; } case ADD: if (ordinal == (Integer)oldChange[0] - ordinalAdjustment) { compactTemplateChanges((Integer)oldChange[0]); return; } break; default: break; } } } Timber.d("addTemplateChange() added ord/type: %s/%s", change[0], change[1]); templateChanges.add(change); dumpChanges(); }
Source:
<code>protected void onResume() { super.onResume(); <START> Log.d("Niels", "onResume called: queue=" + ESM_Queue.getQueueSize(this)); <END> try { FragmentManager fragmentManager = getSupportFragmentManager(); Cursor current_esm; if (ESM.isESMVisible(getApplicationContext())) { current_esm = getContentResolver().query(ESM_Data.CONTENT_URI, null, ESM_Data.STATUS + "=" + ESM.STATUS_VISIBLE, null, ESM_Data.TIMESTAMP + " ASC LIMIT 1"); } else { current_esm = getContentResolver().query(ESM_Data.CONTENT_URI, null, ESM_Data.STATUS + "=" + ESM.STATUS_NEW, null, ESM_Data.TIMESTAMP + " ASC LIMIT 1"); } if (current_esm != null && current_esm.moveToFirst()) { int _id = current_esm.getInt(current_esm.getColumnIndex(ESM_Data._ID)); ContentValues update_state = new ContentValues(); update_state.put(ESM_Data.STATUS, ESM.STATUS_VISIBLE); getContentResolver().update(ESM_Data.CONTENT_URI, update_state, ESM_Data._ID + "=" + _id, null); JSONObject esm_question = new JSONObject(current_esm.getString(current_esm.getColumnIndex(ESM_Data.JSON))); ESM_Question esm = esmFactory.getESM(esm_question.getInt(ESM_Question.esm_type), esm_question, current_esm.getInt(current_esm.getColumnIndex(ESM_Data._ID))); if (esm != null) { esm.show(fragmentManager, TAG); } } if (current_esm != null && !current_esm.isClosed()) current_esm.close(); } catch (JSONException e) { e.printStackTrace(); } }</code><technical_language>Remove this</technical_language>

Target:
protected void onResume() { super.onResume(); try { FragmentManager fragmentManager = getSupportFragmentManager(); Cursor current_esm; if (ESM.isESMVisible(getApplicationContext())) { current_esm = getContentResolver().query(ESM_Data.CONTENT_URI, null, ESM_Data.STATUS + "=" + ESM.STATUS_VISIBLE, null, ESM_Data.TIMESTAMP + " ASC LIMIT 1"); } else { current_esm = getContentResolver().query(ESM_Data.CONTENT_URI, null, ESM_Data.STATUS + "=" + ESM.STATUS_NEW, null, ESM_Data.TIMESTAMP + " ASC LIMIT 1"); } if (current_esm != null && current_esm.moveToFirst()) { int _id = current_esm.getInt(current_esm.getColumnIndex(ESM_Data._ID)); ContentValues update_state = new ContentValues(); update_state.put(ESM_Data.STATUS, ESM.STATUS_VISIBLE); getContentResolver().update(ESM_Data.CONTENT_URI, update_state, ESM_Data._ID + "=" + _id, null); JSONObject esm_question = new JSONObject(current_esm.getString(current_esm.getColumnIndex(ESM_Data.JSON))); ESM_Question esm = esmFactory.getESM(esm_question.getInt(ESM_Question.esm_type), esm_question, current_esm.getInt(current_esm.getColumnIndex(ESM_Data._ID))); if (esm != null) { esm.show(fragmentManager, TAG); } } if (current_esm != null && !current_esm.isClosed()) current_esm.close(); } catch (JSONException e) { e.printStackTrace(); } }
Source:
<code>public void should_fail_requests_when_session_is_closed() throws Exception { simulacronRule .cluster() .prime(when(QUERY_STRING).then(noRows()).delay(20, TimeUnit.MILLISECONDS)); CqlSession session = SessionUtils.newSession(simulacronRule); Set<String> unexpectedErrors = new ConcurrentSkipListSet<>(); ExecutorService requestExecutor = Executors.newFixedThreadPool(4); Semaphore semaphore = new Semaphore(1024); CountDownLatch gotSessionClosedError = new CountDownLatch(1); for (int i = 0; i < 4; i++) { requestExecutor.execute( () -> { try { while (!Thread.currentThread().isInterrupted()) { semaphore.acquire(); session .executeAsync(QUERY_STRING) .whenComplete( (ignoredResult, error) -> { semaphore.release(); if (error instanceof IllegalStateException && "Session is closed".equals(error.getMessage())) { gotSessionClosedError.countDown(); } else if (error != null && !(error instanceof ClosedConnectionException || error instanceof NoNodeAvailableException)) { unexpectedErrors.add(error.toString()); } }); } } catch (InterruptedException e) { } }); } TimeUnit.MILLISECONDS.sleep(100); session.forceCloseAsync(); assertThat(gotSessionClosedError.await(1, TimeUnit.SECONDS)) <START> .as("Expected to get the 'Session was closed' error shortly after shutting down") <END> .isTrue(); requestExecutor.shutdownNow(); assertThat(unexpectedErrors).isEmpty(); }</code><technical_language>Small nit: 'Session is closed'</technical_language>

Target:
public void should_fail_requests_when_session_is_closed() throws Exception { simulacronRule .cluster() .prime(when(QUERY_STRING).then(noRows()).delay(20, TimeUnit.MILLISECONDS)); CqlSession session = SessionUtils.newSession(simulacronRule); Set<String> unexpectedErrors = new ConcurrentSkipListSet<>(); ExecutorService requestExecutor = Executors.newFixedThreadPool(4); int maxConcurrentRequests = session .getContext() .getConfig() .getDefaultProfile() .getInt(DefaultDriverOption.CONNECTION_MAX_REQUESTS); Semaphore semaphore = new Semaphore(maxConcurrentRequests); CountDownLatch gotSessionClosedError = new CountDownLatch(1); for (int i = 0; i < 4; i++) { requestExecutor.execute( () -> { try { while (!Thread.currentThread().isInterrupted()) { semaphore.acquire(); session .executeAsync(QUERY_STRING) .whenComplete( (ignoredResult, error) -> { semaphore.release(); if (error instanceof IllegalStateException && "Session is closed".equals(error.getMessage())) { gotSessionClosedError.countDown(); } else if (error != null && !(error instanceof ClosedConnectionException || error instanceof NoNodeAvailableException)) { unexpectedErrors.add(error.toString()); } }); } } catch (InterruptedException e) { } }); } TimeUnit.MILLISECONDS.sleep(100); session.forceCloseAsync(); assertThat(gotSessionClosedError.await(1, TimeUnit.SECONDS)) .as("Expected to get the 'Session is closed' error shortly after shutting down") .isTrue(); requestExecutor.shutdownNow(); assertThat(unexpectedErrors).isEmpty(); }
Source:
<code>public void assessEmptyFile() { <START> getAssert("file3.js").isFalse(); <END> }</code><technical_language>@ivandalbosco "empty.js" more a meaningful name "file3.js"</technical_language>

Target:
public void assessEmptyFile() { getAssert("empty.js").isFalse(); }
Source:
<code>public org.codice.solr.client.solrj.SolrClient newClient(String core) { String solrUrl = StringUtils.defaultIfBlank( AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SOLR_HTTP_URL)), getDefaultHttpsAddress()); final String coreUrl = solrUrl + "/" + core; final String solrDataDir = AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SOLR_DATA_DIR)); if (solrDataDir != null) { ConfigurationStore.getInstance().setDataDirectoryPath(solrDataDir); } LOGGER.debug("Solr({}): Creating an HTTP Solr client using url [{}]", core, coreUrl); <START> SolrClientAdapter adaptor = new SolrClientAdapter(core, () -> createSolrHttpClient(solrUrl, core, coreUrl)); try { if (!adaptor.isAvailable(30, 5, TimeUnit.SECONDS)) { LOGGER.warn("Solr Client is not available after 30 seconds", core); } } catch (InterruptedException e) { LOGGER.error("Unable to connect to solr client {}: ", core, e.getStackTrace()); Thread.currentThread().interrupt(); } return adaptor; <END> }</code><technical_language>changes separate bug fixes? related split provider work</technical_language>

Target:
public org.codice.solr.client.solrj.SolrClient newClient(String core) { String solrUrl = StringUtils.defaultIfBlank( AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SOLR_HTTP_URL)), getDefaultHttpsAddress()); final String coreUrl = solrUrl + "/" + core; final String solrDataDir = AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SOLR_DATA_DIR)); if (solrDataDir != null) { ConfigurationStore.getInstance().setDataDirectoryPath(solrDataDir); } LOGGER.debug("Solr({}): Creating an HTTP Solr client using url [{}]", core, coreUrl); return new SolrClientAdapter(core, () -> createSolrHttpClient(solrUrl, core, coreUrl)); }
Source:
<code>public void testDateParsingWithoutReaderVersion() throws ParseException { AbstractNitfSegmentParser parser = Mockito.mock(AbstractNitfSegmentParser.class, Mockito.CALLS_REAL_METHODS); NitfReader mockReader = Mockito.mock(NitfReader.class); parser.reader = mockReader; <START> Mockito.when(mockReader.getFileType()).thenReturn(FileType.UNKNOWN); <END> exception.expect(ParseException.class); exception.expectMessage("Need to set NITF file type prior to reading dates"); NitfDateTime date = parser.readNitfDateTime(); }</code><technical_language>In of other tests (except AbstractParserTest), a static import of Mockito.when, Mockito.verify, etc. typical usage of methods consistent it</technical_language>

Target:
public void testDateParsingWithoutReaderVersion() throws ParseException { AbstractNitfSegmentParser parser = mock(AbstractNitfSegmentParser.class, CALLS_REAL_METHODS); NitfReader mockReader = mock(NitfReader.class); parser.reader = mockReader; when(mockReader.getFileType()).thenReturn(FileType.UNKNOWN); exception.expect(ParseException.class); exception.expectMessage("Need to set NITF file type prior to reading dates"); NitfDateTime date = parser.readNitfDateTime(); }
Source:
<code>Dataset<Row> withPairedQueriesAndReformulations(Dataset<Row> df) { <START> return df <END> .withColumn("query", explode(col("queries"))) .withColumn("sugg", explode(col("queries"))) .drop("queries"); }</code><technical_language>generate pairs possibly comparing queries? I intent of previous patch is generate "forward" pairs timestamp order queries. I this captured here? a method similar filterMaxTimestampDiff do trick</technical_language>

Target:
Dataset<Row> withPairedQueriesAndReformulations(Dataset<Row> df) { return df .withColumn("query", explode(col("queries"))) .withColumn("sugg", explode(col("queries"))) .where(col("sugg.ts").gt(col("query.ts"))) .select("wikiid", "query", "sugg"); }
Source:
<code><START> protected void setDisplayDecimalValueFromModel() { <END> Double d = getDoubleAnswerValue(); if (d != null) { NumberFormat nf = NumberFormat.getNumberInstance(Locale.US); nf.setMaximumFractionDigits(15); nf.setMaximumIntegerDigits(15); nf.setGroupingUsed(false); answerText.setText(nf.format(d)); Selection.setSelection(answerText.getText(), answerText.getText().length()); } }</code><technical_language>Ok, uncomfortable type-specific behavior ends in base class! polymorphism here? is, setDisplayValueFromModel abstract introduce a common base class for of string, integer decimal class pairs share setDisplayValueFromModel implementation two</technical_language>

Target:
private void setDisplayDecimalValueFromModel() { Double d = getDoubleAnswerValue(); if (d != null) { NumberFormat nf = NumberFormat.getNumberInstance(Locale.US); nf.setMaximumFractionDigits(15); nf.setMaximumIntegerDigits(15); nf.setGroupingUsed(false); answerText.setText(nf.format(d)); } }
Source:
<code>public FunctionRequirements requirements(IborFutureTrade trade) { <START> IborFuture fra = trade.getProduct(); <END> QuoteKey quoteKey = QuoteKey.of(trade.getSecurity().getStandardId()); IborIndexRatesKey indexForwardCurveKey = IborIndexRatesKey.of(fra.getIndex()); DiscountFactorsKey discountFactorsKey = DiscountFactorsKey.of(fra.getCurrency()); IndexRateKey indexTimeSeriesKey = IndexRateKey.of(fra.getIndex()); return FunctionRequirements.builder() .singleValueRequirements(quoteKey, indexForwardCurveKey, discountFactorsKey) .timeSeriesRequirements(indexTimeSeriesKey) .outputCurrencies(fra.getCurrency()) .build(); }</code><technical_language>fra right name for product var</technical_language>

Target:
public FunctionRequirements requirements(IborFutureTrade trade) { IborFuture product = trade.getProduct(); QuoteKey quoteKey = QuoteKey.of(trade.getSecurity().getStandardId()); IborIndexRatesKey indexForwardCurveKey = IborIndexRatesKey.of(product.getIndex()); DiscountFactorsKey discountFactorsKey = DiscountFactorsKey.of(product.getCurrency()); IndexRateKey indexTimeSeriesKey = IndexRateKey.of(product.getIndex()); return FunctionRequirements.builder() .singleValueRequirements(quoteKey, indexForwardCurveKey, discountFactorsKey) .timeSeriesRequirements(indexTimeSeriesKey) .outputCurrencies(product.getCurrency()) .build(); }
Source:
<code>void putBlob(BlobId blobId, BlobProperties properties, byte[] encryptionKey, byte[] usermetadata, byte[] data, ConnectedChannel channel) throws IOException { PutRequest putRequest0 = new PutRequest(1, "client1", blobId, properties, ByteBuffer.wrap(usermetadata), Unpooled.wrappedBuffer(data), properties.getBlobSize(), BlobType.DataBlob, encryptionKey == null ? null : ByteBuffer.wrap(encryptionKey)); <START> channel.send(putRequest0); DataInputStream putResponseStream = channel.receive().getInputStream(); PutResponse response0 = PutResponse.readFrom(putResponseStream); <END> Assert.assertEquals(ServerErrorCode.No_Error, response0.getError()); }</code><technical_language>Minor: simplified PutResponse response0 = PutResponse.readFrom(channel.sendAndReceive(putRequest0).getInputStream());</technical_language>

Target:
void putBlob(BlobId blobId, BlobProperties properties, byte[] encryptionKey, byte[] usermetadata, byte[] data, ConnectedChannel channel) throws IOException { PutRequest putRequest0 = new PutRequest(1, "client1", blobId, properties, ByteBuffer.wrap(usermetadata), Unpooled.wrappedBuffer(data), properties.getBlobSize(), BlobType.DataBlob, encryptionKey == null ? null : ByteBuffer.wrap(encryptionKey)); PutResponse response0 = PutResponse.readFrom(channel.sendAndReceive(putRequest0).getInputStream()); Assert.assertEquals(ServerErrorCode.No_Error, response0.getError()); }
Source:
<code>public String toString() { return MoreObjects.toStringHelper(this) .add("updateNeighbors", this.updateNeighbors) .add("performBlockPhysics", this.performBlockPhysics) <START> .toString(); <END> }</code><technical_language>other flags</technical_language>

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("rawFlag", this.rawFlag) .add("updateNeighbors", this.updateNeighbors) .add("performBlockPhysics", this.performBlockPhysics) .add("notifyObservers", this.notifyObservers) .add("notifyClients", this.notifyClients) .add("ignoreRender", this.ignoreRender) .add("forceReRender", this.forceReRender) .toString(); }
Source:
<code>public VisualizationAttribute getAttributeFromCollection(final CollectionType type) { return getContent().getBuckets().stream() .filter(bucket -> bucket.getLocalIdentifier().equals(type.getName())) .findFirst() <START> .map(bucket -> bucket.getOnlyAttribute()) <END> .orElse(null); }</code><technical_language>Bucket::getOnlyAttribute</technical_language>

Target:
public VisualizationAttribute getAttributeFromCollection(final CollectionType type) { return getContent().getBuckets().stream() .filter(bucket -> type.isValueOf(bucket.getLocalIdentifier())) .findFirst() .map(Bucket::getOnlyAttribute) .orElse(null); }
Source:
<code>public Set<Long> inventory(AccessToken creds, TransactionToken transaction, String environment) throws TException { checkAccess(creds, transaction); <START> return getEngine(environment).getAllRecords(); <END> }</code><technical_language>this return does, need do getStore(environment, transaction) call getAllRecords</technical_language>

Target:
public Set<Long> inventory(AccessToken creds, TransactionToken transaction, String environment) throws TException { checkAccess(creds, transaction); return getStore(transaction, environment).getAllRecords(); }
Source:
<code><START> private void createSocket() throws X509Exception, IOException { <END> if (self.isSslQuorum()) { if (x509Util == null) { x509Util = new QuorumX509Util(); } sock = x509Util.createSSLSocket(); } else { sock = new Socket(); } sock.setSoTimeout(self.tickTime * self.initLimit); }</code><technical_language>minor style nit: prefer return socket this method assign sock in caller</technical_language>

Target:
private Socket createSocket() throws X509Exception, IOException { Socket sock; if (self.isSslQuorum()) { if (x509Util == null) { x509Util = new QuorumX509Util(); } sock = x509Util.createSSLSocket(); } else { sock = new Socket(); } sock.setSoTimeout(self.tickTime * self.initLimit); return sock; }
Source:
<code>private void encodeStatusCode(Iterator<String> iterator, StringBuilder builder) { <START> String code = (String) (iterator.next()); <END> if (iterator.hasNext()) { builder.append("<StatusCode Value=\"").append(code).append("\">"); encodeStatusCode(iterator, builder); builder.append("</StatusCode>"); } else { builder.append("<StatusCode Value=\"").append(code).append("\"/>"); } }</code><technical_language>this cast redundant right</technical_language>

Target:
private void encodeStatusCode(Iterator<String> iterator, StringBuilder builder) { String code = iterator.next(); if (iterator.hasNext()) { builder.append("<StatusCode Value=\"").append(code).append("\">"); encodeStatusCode(iterator, builder); builder.append("</StatusCode>"); } else { builder.append("<StatusCode Value=\"").append(code).append("\"/>"); } }
Source:
<code>public void testDirectoryHeaders() throws Exception { MockHttpServletResponse response = getAsServletResponse("/rest/resource/mydir?format=xml"); Assert.assertEquals(FORMAT_HEADER.format(myRes.lastmodified()), response.getHeader("Last-modified")); Assert.assertEquals("/", response.getHeader("Resource-parent")); <START> Assert.assertEquals("directory", response.getHeader("Resource-type")); <END> Assert.assertEquals("application/xml", response.getHeader("Content-type")); }</code><technical_language>Conventional capitalisation, please</technical_language>

Target:
public void testDirectoryHeaders() throws Exception { MockHttpServletResponse response = getAsServletResponse("/rest/resource/mydir?format=xml"); Assert.assertEquals(FORMAT_HEADER.format(myRes.lastmodified()), response.getHeader("Last-Modified")); Assert.assertEquals("/", response.getHeader("Resource-Parent")); Assert.assertEquals("directory", response.getHeader("Resource-Type")); Assert.assertEquals("application/xml", response.getHeader("Content-Type")); }
Source:
<code>private Set<String> getProxyBypass(OMElement profile) { Set<String> bypassSet = new HashSet<String>(); QName bypassQName = new QName("bypass"); OMElement bypassEle = profile.getFirstChildWithName(bypassQName); if (bypassEle != null && !bypassEle.getText().equals("")) { String[] bypass = bypassEle.getText().split(","); <START> for (String s : bypass) { <END> bypassSet.add(s.trim()); } } return bypassSet; }</code><technical_language>User variable naming</technical_language>

Target:
private Set<String> getProxyBypass(OMElement profile) { Set<String> bypassSet = new HashSet<String>(); OMElement bypassEle = profile.getFirstChildWithName(Q_BYPASS); if (bypassEle != null && !bypassEle.getText().isEmpty()) { String[] bypassHosts = bypassEle.getText().split(","); for (String bypassHost : bypassHosts) { bypassSet.add(bypassHost.trim()); } } return bypassSet; }
Source:
<code>public void loseLife() { lives--; <START> addToLog("The player lost a life, total lives is now: " + lives); <END> }</code><technical_language>Please, logger format of: [CLASS_NAME]\t[Additional Note if applicable]\t<"Message"> In other words add: [PLAYER]\t front of String. <naming,organisation</technical_language>

Target:
public void loseLife() { lives--; addToLog("[PLAYER]\t Player lost a life, total lives is now: " + lives); }
Source:
<code>public BurstableUnlimitedMode getBurstableUnlimitedMode() { if (burstableUnlimitedMode == null) { return t2Unlimited ? BurstableUnlimitedMode.ENABLED : BurstableUnlimitedMode.DEFAULT; } <START> return burstableUnlimitedMode; <END> }</code><technical_language>Yous resolve this bit in readResolve</technical_language>

Target:
public BurstableUnlimitedMode getBurstableUnlimitedMode() { return burstableUnlimitedMode; }
Source:
<code>public Collection<Integer> getSsrcs() { synchronized (critSect) { Collection<Integer> ssrcs = new ArrayList<>(); <START> for (Long ssrcValue : ssrcs_.keySet()) <END> { Number value = ssrcValue; ssrcs.add(value.intValue()); } return ssrcs; } }</code><technical_language>naming of ssrcs_</technical_language>

Target:
public Collection<Integer> getSsrcs() { synchronized (critSect) { Collection<Integer> ssrcValue = new ArrayList<>(); for (Long ssrc : ssrcs.keySet()) { Number value = ssrc; ssrcValue.add(value.intValue()); } return ssrcValue; } }
Source:
<code>GtkBorder getGtkBorderPadding () { if (OS.GTK3) { GtkBorder gtkBorderPadding = new GtkBorder (); long context = OS.gtk_widget_get_style_context (textEntryHandle); if (OS.GTK_VERSION < OS.VERSION(3, 18 , 0)) { OS.gtk_style_context_get_padding (context, OS.GTK_STATE_FLAG_NORMAL, gtkBorderPadding); } else { <START> int styleState = OS.gtk_widget_get_state_flags(textEntryHandle); <END> OS.gtk_style_context_get_padding (context, styleState, gtkBorderPadding); } return gtkBorderPadding; } else { GtkBorder padding = new GtkBorder (); padding.bottom = padding.top = padding.left = padding.right = GTK2_MANUAL_BORDER_PADDING; return padding; } }</code><technical_language>need styleState variable all</technical_language>

Target:
GtkBorder getGtkBorderPadding () { if (OS.GTK3) { GtkBorder gtkBorderPadding = new GtkBorder (); long context = OS.gtk_widget_get_style_context (textEntryHandle); int styleState = OS.gtk_widget_get_state_flags(textEntryHandle); OS.gtk_style_context_get_padding (context, styleState, gtkBorderPadding); return gtkBorderPadding; } else { GtkBorder padding = new GtkBorder (); padding.bottom = padding.top = padding.left = padding.right = GTK2_MANUAL_BORDER_PADDING; return padding; } }
Source:
<code>public void notB(final Sketch<S> skB) { if (empty_ || (skB == null) || skB.isEmpty()) { return; } final long thetaLongB = skB.getThetaLong(); thetaLong_ = Math.min(thetaLong_, thetaLongB); final int countB = skB.getRetainedEntries(); CompactSketch<S> cskB = null; QuickSelectSketch<S> qskB = null; final long[] hashTableB; if (skB instanceof CompactSketch) { cskB = (CompactSketch<S>) skB; hashTableB = convertToHashTable(cskB.getHashArr(), countB, thetaLong_); } else { qskB = (QuickSelectSketch<S>) skB; <START> hashTableB = convertToHashTable(qskB.getHashTable(), countB, thetaLong_); <END> } final long[] tmpHashArrA = new long[count_]; final Class<S> summaryType = (Class<S>) summaryArr_.getClass().getComponentType(); final S[] tmpSummaryArrA = (S[]) Array.newInstance(summaryType, count_); int nonMatches = 0; for (int i = 0; i < count_; i++) { final long hash = hashArr_[i]; if ((hash != 0) && (hash < thetaLong_)) { final int index = HashOperations.hashSearch(hashTableB, simpleIntLog2(hashTableB.length), hash); if (index == -1) { tmpHashArrA[nonMatches] = hash; tmpSummaryArrA[nonMatches] = summaryArr_[i]; nonMatches++; } } } hashArr_ = Arrays.copyOfRange(tmpHashArrA, 0, nonMatches); summaryArr_ = Arrays.copyOfRange(tmpSummaryArrA, 0, nonMatches); count_ = nonMatches; }</code><technical_language>appears quick select sketches' keys in hash table format, this conversion prune out values greater thetaLong_</technical_language>

Target:
public void notB(final Sketch<S> skB) { if (empty_ || (skB == null) || skB.isEmpty()) { return; } final long thetaLongB = skB.getThetaLong(); thetaLong_ = Math.min(thetaLong_, thetaLongB); final int countB = skB.getRetainedEntries(); CompactSketch<S> cskB = null; QuickSelectSketch<S> qskB = null; final long[] hashTableB; if (skB instanceof CompactSketch) { cskB = (CompactSketch<S>) skB; hashTableB = convertToHashTable(cskB.getHashArr(), countB, thetaLong_); } else { qskB = (QuickSelectSketch<S>) skB; hashTableB = (thetaLong_ < thetaLongB) ? convertToHashTable(qskB.getHashTable(), countB, thetaLong_) : qskB.getHashTable(); } final long[] tmpHashArrA = new long[count_]; final Class<S> summaryType = (Class<S>) summaryArr_.getClass().getComponentType(); final S[] tmpSummaryArrA = (S[]) Array.newInstance(summaryType, count_); int nonMatches = 0; for (int i = 0; i < count_; i++) { final long hash = hashArr_[i]; if ((hash != 0) && (hash < thetaLong_)) { final int index = HashOperations.hashSearch(hashTableB, simpleIntLog2(hashTableB.length), hash); if (index == -1) { tmpHashArrA[nonMatches] = hash; tmpSummaryArrA[nonMatches] = summaryArr_[i]; nonMatches++; } } } hashArr_ = Arrays.copyOfRange(tmpHashArrA, 0, nonMatches); summaryArr_ = Arrays.copyOfRange(tmpSummaryArrA, 0, nonMatches); count_ = nonMatches; }
Source:
<code>public GitConnection getConnection(File workDir) throws GitException { final List<Attribute> profileAttributes; try { <START> profileAttributes = userProfileDao.getById(EnvironmentContext.getCurrent().getUser().getId()).getAttributes(); <END> } catch (UserProfileException e) { LOG.warn("Failed to obtain user information.", e); throw new GitException("Failed to obtain user information."); } String firstName = null, lastName = null; for (Attribute attribute : profileAttributes) { if ("firstName".equals(attribute.getName())) { firstName = attribute.getValue(); } else if ("lastName".equals(attribute.getName())) { lastName = attribute.getValue(); } } GitUser gitUser = DtoFactory.getInstance().createDto(GitUser.class); if (firstName != null || lastName != null) { gitUser.withEmail(Strings.join(" ", Strings.nullToEmpty(firstName), Strings.nullToEmpty(lastName))) .withEmail(EnvironmentContext.getCurrent().getUser().getName()); } else { gitUser.withEmail(EnvironmentContext.getCurrent().getUser().getName()); } return getConnection(workDir, gitUser); }</code><technical_language>NPE checking</technical_language>

Target:
public GitConnection getConnection(File workDir) throws GitException { final List<Attribute> profileAttributes; try { profileAttributes = userProfileDao.getById(EnvironmentContext.getCurrent().getUser().getId()).getAttributes(); } catch (UserProfileException e) { LOG.warn("Failed to obtain user information.", e); throw new GitException("Failed to obtain user information."); } String firstName = null, lastName = null; if (profileAttributes != null) { for (Attribute attribute : profileAttributes) { if ("firstName".equals(attribute.getName())) { firstName = attribute.getValue(); } else if ("lastName".equals(attribute.getName())) { lastName = attribute.getValue(); } } } GitUser gitUser = DtoFactory.getInstance().createDto(GitUser.class); if (firstName != null || lastName != null) { gitUser.withEmail(Strings.join(" ", Strings.nullToEmpty(firstName), Strings.nullToEmpty(lastName))) .withEmail(EnvironmentContext.getCurrent().getUser().getName()); } else { gitUser.withEmail(EnvironmentContext.getCurrent().getUser().getName()); } return getConnection(workDir, gitUser); }
Source:
<code>public void onCreate(SQLiteDatabase db) { db.execSQL("create table " + "accounts ( id integer primary key autoincrement," + " bib text," + " label text," + " name text," + " password text," + " cached integer," + " pendingFees text," + " validUntil text," + " warning text," + " passwordValid integer" + ");"); db.execSQL( "create table " + "accountdata_lent (" + "id integer primary key autoincrement," + "account integer," + "title text," + "author text," + "format text," + "itemid text," + "status text," + "barcode text," + "deadline text," + "homebranch text," + "lending_branch text," + "prolong_data text," + "renewable integer," + "download_data text," + "ebook integer" + <START> "mediatype text," + "cover text," + ");"); <END> db.execSQL("create table " + "accountdata_reservations (" + "id integer primary key autoincrement," + "account integer," + "title text," + "author text," + "format text," + "itemid text," + "status text," + "ready text," + "expiration text," + "branch text," + "cancel_data text," + "booking_data text," + "mediatype text," + "cover text," + ");"); db.execSQL("create table " + "alarms (" + "id integer primary key autoincrement," + "deadline text," + "media text," + "alarm text," + "notified integer," + "finished integer" + ");"); }</code><technical_language>, end breaks install</technical_language>

Target:
public void onCreate(SQLiteDatabase db) { db.execSQL("create table " + "accounts ( id integer primary key autoincrement," + " bib text," + " label text," + " name text," + " password text," + " cached integer," + " pendingFees text," + " validUntil text," + " warning text," + " passwordValid integer" + ");"); db.execSQL( "create table " + "accountdata_lent (" + "id integer primary key autoincrement," + "account integer," + "title text," + "author text," + "format text," + "itemid text," + "status text," + "barcode text," + "deadline text," + "homebranch text," + "lending_branch text," + "prolong_data text," + "renewable integer," + "download_data text," + "ebook integer," + "mediatype text," + "cover text" + ");"); db.execSQL("create table " + "accountdata_reservations (" + "id integer primary key autoincrement," + "account integer," + "title text," + "author text," + "format text," + "itemid text," + "status text," + "ready text," + "expiration text," + "branch text," + "cancel_data text," + "booking_data text," + "mediatype text," + "cover text" + ");"); db.execSQL("create table " + "alarms (" + "id integer primary key autoincrement," + "deadline text," + "media text," + "alarm text," + "notified integer," + "finished integer" + ");"); }
Source:
<code>public static BrandingManager getInstance(final File etcDir) { if (instance == null) { instance = new BrandingManager(etcDir); <START> } <END> return instance; }</code><technical_language>behalf of Michael Pasternak: [1], consider synchronizing writes getInstance() & getInstance(final File etcDir) creating actual instance instance var. definition</technical_language>

Target:
public static synchronized BrandingManager getInstance(final File etcDir) { if (instance == null) { instance = new BrandingManager(etcDir); } return instance; }
Source:
<code>public void start() throws Exception { Preconditions.checkNotNull(m_businessServiceDao, "businessServiceDao cannot be null"); Preconditions.checkNotNull(m_alarmDao, "alarmDao cannot be null"); Preconditions.checkNotNull(m_eventIpcManager, "eventIpcManager cannot be null"); Preconditions.checkNotNull(m_eventConfDao, "eventConfDao cannot be null"); <START> <END> handleConfigurationChanged(); }</code><technical_language>a note. If Objects.requireNonNull(...) remove dependency guava</technical_language>

Target:
public void start() throws Exception { Objects.requireNonNull(m_businessServiceDao, "businessServiceDao cannot be null"); Objects.requireNonNull(m_alarmDao, "alarmDao cannot be null"); Objects.requireNonNull(m_eventIpcManager, "eventIpcManager cannot be null"); Objects.requireNonNull(m_eventConfDao, "eventConfDao cannot be null"); handleConfigurationChanged(); }
Source:
<code>public <V> Optional<V> getOption(ParticleOption<V> option) { <START> return (Optional) Optional.ofNullable(this.options.get(option)); <END> }</code><technical_language>is extra cast</technical_language>

Target:
public <V> Optional<V> getOption(ParticleOption<V> option) { return Optional.ofNullable((V) this.options.get(option)); }