auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Object start(IApplicationContext context) throws Exception { String[] arguments = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS); List<String> asList = Arrays.asList(arguments); if (asList.contains("-help") || Arrays.asList(arguments).contains("--help")) { System.out.println(Messages.bind(Messages.CommandLineUsage)); return IApplication.EXIT_OK; } try { ResourcesPlugin.getWorkspace(); } catch (NoClassDefFoundError noClassError) { if (noClassError.getCause() instanceof ClassNotFoundException) { ClassNotFoundException classNotFoundException = (ClassNotFoundException) noClassError.getCause(); if (classNotFoundException.getException() instanceof BundleException) { BundleException bundleException = (BundleException) classNotFoundException.getException(); if (bundleException.getCause() instanceof IllegalStateException) { <START> System.out.println(Messages.bind(Messages.WorkspaceRequired)); return IApplication.EXIT_OK; <END> } } } throw noClassError; } return new CodeFormatterApplication().start(context); }</code><technical_language>This OK case</technical_language>

Target:
public Object start(IApplicationContext context) throws Exception { String[] arguments = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS); List<String> asList = Arrays.asList(arguments); if (asList.contains("-help") || Arrays.asList(arguments).contains("--help")) { System.out.println(Messages.bind(Messages.CommandLineUsage)); return IApplication.EXIT_OK; } try { ResourcesPlugin.getWorkspace(); } catch (NoClassDefFoundError noClassError) { if (noClassError.getCause() instanceof ClassNotFoundException) { ClassNotFoundException classNotFoundException = (ClassNotFoundException) noClassError.getCause(); if (classNotFoundException.getException() instanceof BundleException) { BundleException bundleException = (BundleException) classNotFoundException.getException(); if (bundleException.getCause() instanceof IllegalStateException) { System.out.println(Messages.bind(Messages.WorkspaceRequired)); return 1; } } } throw noClassError; } return new CodeFormatterApplication().start(context); }
Source:
<code>private static Optional<Long> timestampSeed(TimelockService timelockService) { try { return Optional.of(timelockService.getFreshTimestamp()); } catch (Exception e) { <START> return Optional.empty(); <END> } }</code><technical_language>suggest logging exception here, useful for debugging. include a message indicating consequences (the punch table updated user transaction)</technical_language>

Target:
private static Optional<Long> timestampSeed(TimelockService timelockService) { try { return Optional.of(timelockService.getFreshTimestamp()); } catch (Exception e) { log.info("On node startup quorum not present", e); return Optional.empty(); } }
Source:
<code>private static String getFailMessage(ProcessStatus result) { <START> if (result instanceof ProcessStatusImpl) { <END> ProcessStatus firstFail = getFirstFail(result.getChildren()); if (firstFail != null) return result.getMessage() + ": " + getFailMessage(firstFail); } return result.getMessage(); }</code><technical_language>check for Impl instance of for EMF models. check for interface (ProcessStatus here)</technical_language>

Target:
private static String getFailMessage(ProcessStatus result) { if (result instanceof ProcessStatus) { ProcessStatus firstFail = getFirstFail(result.getChildren()); if (firstFail != null) return result.getMessage() + ": " + getFailMessage(firstFail); } return result.getMessage(); }
Source:
<code>void highlightView(View view) { super.highlightView(view); setBounds(0, 0, view.getWidth(), view.getHeight()); <START> view.getOverlay().add(this); <END> }</code><technical_language>This line of code, view.getOverlay().add(this); is repeated in single HighlightDrawable. For symmetry ViewHighlightOverlaysJellybeanMR2.removeHighlight(), put this ViewHighlightOverlaysJellybeanMR2.highlightView() method</technical_language>

Target:
void highlightView(View view) { super.highlightView(view); setBounds(0, 0, view.getWidth(), view.getHeight()); }
Source:
<code>public void streamAllEvents() throws IOException, InterruptedException { List<ServerSentEvent<String>> events = getServerSentEvents(ACTUATOR_STREAM_CIRCUITBREAKER_EVENTS); CircuitBreakerEventsEndpointResponse circuitBreakerEventsBefore = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS); try { dummyService.doSomething(true); } catch (IOException ex) { } Thread.sleep(1000); dummyService.doSomething(false); CircuitBreakerEventsEndpointResponse circuitBreakerEventsAfter = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS); <START> assert (circuitBreakerEventsBefore.getCircuitBreakerEvents().size() < circuitBreakerEventsAfter.getCircuitBreakerEvents().size()); <END> assert circuitBreakerEventsAfter.getCircuitBreakerEvents().size() > 0; Thread.sleep(1000); assert (events.size() == 2); }</code><technical_language>Please AssertJ</technical_language>

Target:
public void streamAllEvents() throws IOException, InterruptedException { List<ServerSentEvent<String>> events = getServerSentEvents(ACTUATOR_STREAM_CIRCUITBREAKER_EVENTS); CircuitBreakerEventsEndpointResponse circuitBreakerEventsBefore = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS); publishEvents(); CircuitBreakerEventsEndpointResponse circuitBreakerEventsAfter = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS); assertThat(circuitBreakerEventsBefore.getCircuitBreakerEvents().size()).isLessThan(circuitBreakerEventsAfter.getCircuitBreakerEvents().size()); assertThat(circuitBreakerEventsAfter.getCircuitBreakerEvents().size()).isGreaterThan(0); Thread.sleep(1000); assertThat(events.size()).isEqualTo(2); }
Source:
<code>public void testSingleDeletionDeletesMetacard() throws SourceUnavailableException, IngestException { <START> cmd = new SearchFormsManageCommand(); <END> cmd.setEndpointUtil(endpointUtil); cmd.setCatalogFramework(catalogFramework); cmd.singleDeletion = "1"; cmd.executeWithSubject(); List<String> idToDelete = Collections.singletonList("1"); DeleteRequest mockDeleteReq = new DeleteRequestImpl(idToDelete.toArray(new String[0])); verify(catalogFramework).delete(refEq(mockDeleteReq)); assertThat(this.getOutput(), containsString("[93mDeleted: \u001B[32m1\u001B[m")); }</code><technical_language>question this setup needs done again</technical_language>

Target:
public void testSingleDeletionDeletesMetacard() throws SourceUnavailableException, IngestException { cmd.singleDeletion = "1"; cmd.executeWithSubject(); List<String> idToDelete = Collections.singletonList("1"); DeleteRequest mockDeleteReq = new DeleteRequestImpl(idToDelete.toArray(new String[0])); verify(catalogFramework).delete(refEq(mockDeleteReq)); assertThat(this.getOutput(), containsString("[93mDeleted: \u001B[32m1\u001B[m")); }
Source:
<code><START> public Optional<TextColor> getTeamColor() { <END> return Optional.ofNullable(TextColorRegistryModule.enumChatColor.get(this.format)); }</code><technical_language>This implements @Interface, prefix in annotation - criterion$</technical_language>

Target:
public Optional<TextColor> criterion$getTeamColor() { return Optional.empty(); }
Source:
<code>private boolean compareDistance(Point point) { double calculatedDistance = calculateDistance(point.getX(), point.getY(), this.queryPoint.getX(), this.queryPoint.getY(), this.distance.getMetric()); <START> final boolean withinRange = calculatedDistance < this.distance.getValue(); return withinRange; <END> }</code><technical_language>suggestion return calculatedDistance < this.distance.getValue();</technical_language>

Target:
private boolean compareDistance(Point point) { double calculatedDistance = calculateDistance(point.getX(), point.getY(), this.queryPoint.getX(), this.queryPoint.getY(), this.distance.getMetric()); return calculatedDistance < this.distance.getValue(); }
Source:
<code>private void processDynamicElements(Menu menu, final MMenu menuModel) { if (!menu.isDisposed()) { menu.getDisplay().asyncExec(new Runnable() { public void run() { MMenuElement[] ml = menuModel.getChildren().toArray( new MMenuElement[menuModel.getChildren().size()]); for (int i = 0; i < ml.length; i++) { MMenuElement currentMenuElement = ml[i]; if (currentMenuElement instanceof MDynamicMenuContribution) { Object contribution = ((MDynamicMenuContribution) currentMenuElement) .getObject(); IEclipseContext dynamicMenuContext = EclipseContextFactory .create(); <START> dynamicMenuContext.setParent(modelService <END> .getContainingContext(currentMenuElement)); @SuppressWarnings("unchecked") ArrayList<MMenuElement> mel = (ArrayList<MMenuElement>) currentMenuElement .getTransientData() .get(MenuManagerShowProcessor.DYNAMIC_ELEMENT_STORAGE_KEY); dynamicMenuContext.set(List.class, mel); ContextInjectionFactory.invoke(contribution, AboutToHide.class, dynamicMenuContext); } } } }); } }</code><technical_language>get context modelService, please 2 IEclipseContext form of invoke: org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(Object, Class<? extends Annotation>, IEclipseContext, IEclipseContext, Object)</technical_language>

Target:
private void processDynamicElements(Menu menu, final MMenu menuModel) { if (!menu.isDisposed()) { menu.getDisplay().asyncExec(new Runnable() { public void run() { MMenuElement[] ml = menuModel.getChildren().toArray( new MMenuElement[menuModel.getChildren().size()]); for (int i = 0; i < ml.length; i++) { MMenuElement currentMenuElement = ml[i]; if (currentMenuElement instanceof MDynamicMenuContribution) { Object contribution = ((MDynamicMenuContribution) currentMenuElement) .getObject(); IEclipseContext dynamicMenuContext = EclipseContextFactory .create(); @SuppressWarnings("unchecked") ArrayList<MMenuElement> mel = (ArrayList<MMenuElement>) currentMenuElement .getTransientData() .get(MenuManagerShowProcessor.DYNAMIC_ELEMENT_STORAGE_KEY); dynamicMenuContext.set(List.class, mel); IEclipseContext parentContext = modelService .getContainingContext(currentMenuElement); ContextInjectionFactory.invoke(contribution, AboutToHide.class, dynamicMenuContext, parentContext, null); } } } }); } }
Source:
<code>private Map<ByteArray, PersistableNetworkPayload> getMapForDataRequest() { Map<ByteArray, PersistableNetworkPayload> map = new HashMap<>(); appendOnlyDataStoreService.getServices() .forEach(service -> { Map<ByteArray, PersistableNetworkPayload> serviceMap; if (service instanceof HistoricalDataStoreService) { var historicalDataStoreService = (HistoricalDataStoreService<? extends PersistableNetworkPayloadStore>) service; serviceMap = historicalDataStoreService.getMapOfLiveData(); <START> map.putAll(serviceMap); } else { serviceMap = service.getMap(); map.putAll(serviceMap); } <END> log.info("We added entries from to the excluded key set of our request", serviceMap.size(), service.getClass().getSimpleName()); }); return map; }</code><technical_language>suggestion } else { serviceMap = service.getMap(); } map.putAll(serviceMap);</technical_language>

Target:
private Map<ByteArray, PersistableNetworkPayload> getMapForDataRequest() { Map<ByteArray, PersistableNetworkPayload> map = new HashMap<>(); appendOnlyDataStoreService.getServices() .forEach(service -> { Map<ByteArray, PersistableNetworkPayload> serviceMap; if (service instanceof HistoricalDataStoreService) { var historicalDataStoreService = (HistoricalDataStoreService<? extends PersistableNetworkPayloadStore>) service; serviceMap = historicalDataStoreService.getMapOfLiveData(); } else { serviceMap = service.getMap(); } map.putAll(serviceMap); log.info("We added entries from to the excluded key set of our request", serviceMap.size(), service.getClass().getSimpleName()); }); return map; }
Source:
<code>public static VibrationElement scale(VibrationElement element, float gamma, int maxAmplitude) { return new VibrationElement(element.duration, IntStream.of(element.channels) <START> .map(a -> (int) (MathUtils.pow(a / (float) VibrationEffect.MAX_AMPLITUDE, gamma) <END> * maxAmplitude)).toArray()); }</code><technical_language>Consider moving expression a separate line a separate named function improve readability</technical_language>

Target:
public static VibrationElement scale(VibrationElement element, float gamma, int maxAmplitude) { int[] scaledChannels = IntStream.of(element.channels) .map(a -> scale(a, gamma, maxAmplitude)).toArray(); return new VibrationElement(element.duration, scaledChannels); }
Source:
<code>public void testAsSet_returnsSameObjects() { <START> assertTrue("set objects must be cached and reused", <END> asSet(new MetricTarget[]{MANAGEMENT_CENTER}) == asSet(new MetricTarget[]{MANAGEMENT_CENTER})); }</code><technical_language>assertSame here</technical_language>

Target:
public void testAsSet_returnsSameObjects() { assertSame( MetricTarget.asSet(new MetricTarget[]{MANAGEMENT_CENTER}), MetricTarget.asSet(new MetricTarget[]{MANAGEMENT_CENTER}) ); }
Source:
<code>private MergeTDigestFunction() { <START> super(NAME, TDIGEST, StatisticalDigestStateFactory.createTDigestFactory()); <END> }</code><technical_language>nits: static import</technical_language>

Target:
private MergeTDigestFunction() { super(NAME, TDIGEST, createTDigestFactory(), true); }
Source:
<code>public String register(SocketChannel channel, PortType portType) throws IOException { Socket socket = channel.socket(); String connectionId = generateConnectionId(channel); SelectionKey key = channel.register(nioSelector, SelectionKey.OP_READ); Transmission transmission = TransmissionFactory <START> .getChannelWrapper(connectionId, channel, key, socket.getInetAddress().getHostAddress(), socket.getPort(), time, <END> metrics, logger, portType, sslFactory, SSLFactory.Mode.SERVER); key.attach(transmission); this.keyMap.put(connectionId, key); activeConnections.set(this.keyMap.size()); return connectionId; }</code><technical_language>I suggest get socket.getInetAddress().getHostAddress(), socket.getPort() channel</technical_language>

Target:
public String register(SocketChannel channel, PortType portType) throws IOException { Socket socket = channel.socket(); String connectionId = generateConnectionId(channel); SelectionKey key = channel.register(nioSelector, SelectionKey.OP_READ); Transmission transmission = TransmissionFactory .getTransmission(connectionId, channel, key, socket.getInetAddress().getHostAddress(), socket.getPort(), time, metrics, portType, sslFactory, SSLFactory.Mode.SERVER); key.attach(transmission); this.keyMap.put(connectionId, key); activeConnections.set(this.keyMap.size()); return connectionId; }
Source:
<code>public void testDeadlock() { final ISchedulingRule rule = new TestRule(); final boolean[] blocked = new boolean[] {false}; final boolean[] lockAcquired = new boolean[] {false}; final SubMonitor beginRuleMonitor = SubMonitor.convert(null); Thread locking = new Thread("SyncExecWhileUIThreadWaitsForRuleTest") { @Override public void run() { try { Job.getJobManager().beginRule(rule, null); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { blocked[0] = true; try { Job.getJobManager().beginRule(rule, beginRuleMonitor); } finally { Job.getJobManager().endRule(rule); } blocked[0] = false; } }); while (!blocked[0]) { try { Thread.sleep(100); } catch (InterruptedException e) { <START> e.printStackTrace(); <END> } } Display.getDefault().syncExec(new Runnable() { @Override public void run() { Job.getJobManager().beginRule(rule, null); lockAcquired[0] = true; Job.getJobManager().endRule(rule); } }); } finally { Job.getJobManager().endRule(rule); } } }; locking.start(); final long waitStart = System.currentTimeMillis(); Thread canceler = new Thread("Canceler") { @Override public void run() { while (true) { if (System.currentTimeMillis() - waitStart > 60000) { beginRuleMonitor.setCanceled(true); break; } } } }; canceler.start(); Display display = Display.getDefault(); while (!lockAcquired[0]) { try { if (!display.readAndDispatch()) { display.sleep(); } } catch (SWTException e) { fail("Deadlock occurred"); } } assertFalse("deadlock occurred", beginRuleMonitor.isCanceled()); boolean interrupted = Thread.interrupted(); if (interrupted) { } }</code><technical_language>This line removed converted a fail call</technical_language>

Target:
public void testDeadlock() { final ISchedulingRule rule = new TestRule(); final boolean[] blocked = new boolean[] {false}; final boolean[] lockAcquired = new boolean[] {false}; final SubMonitor beginRuleMonitor = SubMonitor.convert(null); Thread locking = new Thread("SyncExecWhileUIThreadWaitsForRuleTest") { @Override public void run() { try { Job.getJobManager().beginRule(rule, null); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { blocked[0] = true; try { Job.getJobManager().beginRule(rule, beginRuleMonitor); } finally { Job.getJobManager().endRule(rule); } blocked[0] = false; } }); while (!blocked[0]) { try { Thread.sleep(100); } catch (InterruptedException e) { } } Display.getDefault().syncExec(new Runnable() { @Override public void run() { Job.getJobManager().beginRule(rule, null); lockAcquired[0] = true; Job.getJobManager().endRule(rule); } }); } finally { Job.getJobManager().endRule(rule); } } }; locking.start(); final long waitStart = System.currentTimeMillis(); Thread canceler = new Thread("Canceler") { @Override public void run() { while (true) { if (System.currentTimeMillis() - waitStart > 60000) { beginRuleMonitor.setCanceled(true); break; } } } }; canceler.start(); Display display = Display.getDefault(); while (!lockAcquired[0]) { try { if (!display.readAndDispatch()) { display.sleep(); } } catch (SWTException e) { fail("Deadlock occurred"); } } assertFalse("deadlock occurred", beginRuleMonitor.isCanceled()); if (Thread.interrupted()) { } }
Source:
<code>public FunctionSignature[] getFunctionSignatures() { return new FunctionSignature[]{ <START> new BasicFunctionSignature(getType(null), ScalarArgument.GEOMETRY) <END> }; }</code><technical_language>Suspicious null here. Instead of getType(null), Type.STRING</technical_language>

Target:
public FunctionSignature[] getFunctionSignatures() { return new FunctionSignature[]{ new BasicFunctionSignature(Type.STRING, ScalarArgument.GEOMETRY) }; }
Source:
<code>public void init() { <START> this.pager = new Pager(); <END> this.videosByUser = session.prepare( "SELECT videoid, title, added FROM examples.random_paging_rest_ui WHERE userid = ?"); }</code><technical_language>related this PR I need add some examples Spring WebFlux reactive result sets. Created JAVA-2639 for that</technical_language>

Target:
public void init() { this.pager = new OffsetPager(ITEMS_PER_PAGE); this.videosByUser = session.prepare( "SELECT videoid, title, added FROM examples.random_paging_rest_ui WHERE userid = ?"); }
Source:
<code><START> public void testSubmitLocal() { <END> TestQueryOperationHandler operationHandler = new TestQueryOperationHandler(); pool = createPool(operationHandler); QueryOperation operation = new QueryExecuteOperation(); int repeatCount = 10; for (int i = 0; i < repeatCount; i++) { pool.submit(500, QueryOperationExecutable.local(operation)); } assertTrueEventually(() -> { List<ExecuteInfo> infos = operationHandler.tryPollExecuteInfos(repeatCount); assertNotNull(infos); Set<String> threadNames = new HashSet<>(); for (int i = 1; i < infos.size(); i++) { assertSame(operation, infos.get(i).getOperation()); threadNames.add(infos.get(i).getThreadName()); } assertEquals(1, threadNames.size()); }); for (int i = 0; i < repeatCount; i++) { pool.submit(QueryOperation.PARTITION_ANY, QueryOperationExecutable.local(operation)); } assertTrueEventually(() -> { List<ExecuteInfo> infos = operationHandler.tryPollExecuteInfos(repeatCount); assertNotNull(infos); Set<String> threadNames = new HashSet<>(); for (ExecuteInfo info : infos) { assertSame(operation, info.getOperation()); threadNames.add(info.getThreadName()); } assertTrue(threadNames.size() > 0); }); }</code><technical_language>100% sure, test assert order of operations, asserts executed thread. order guarantee is essential for pool, sense verify directly</technical_language>

Target:
public void testSubmitLocal() { TestQueryOperationHandler operationHandler = new TestQueryOperationHandler(); pool = createPool(operationHandler); List<QueryOperation> operations = new ArrayList<>(); int repeatCount = 10; for (int i = 0; i < repeatCount; i++) { QueryExecuteOperation operation = new QueryExecuteOperation(); operations.add(operation); pool.submit(500, QueryOperationExecutable.local(operation)); } assertTrueEventually(() -> { List<ExecuteInfo> infos = operationHandler.tryPollExecuteInfos(repeatCount); assertNotNull(infos); Set<String> threadNames = new HashSet<>(); for (int i = 1; i < infos.size(); i++) { assertSame(operations.get(i), infos.get(i).getOperation()); threadNames.add(infos.get(i).getThreadName()); } assertEquals(1, threadNames.size()); }); for (int i = 0; i < repeatCount; i++) { pool.submit(QueryOperation.PARTITION_ANY, QueryOperationExecutable.local(operations.get(i))); } assertTrueEventually(() -> { List<ExecuteInfo> infos = operationHandler.tryPollExecuteInfos(repeatCount); assertNotNull(infos); Set<String> threadNames = new HashSet<>(); for (int i = 1; i < infos.size(); i++) { assertTrue(operations.contains(infos.get(i).getOperation())); threadNames.add(infos.get(i).getThreadName()); } assertTrue(threadNames.size() > 0); }); }
Source:
<code><START> public DataSketchesFunctions() { <END> this.sketchClasses = new ArrayList<SketchDescriptor>(); registerHll(); registerCpc(); registerKll(); registerTheta(); registerTuple(); registerQuantiles(); registerFrequencies(); }</code><technical_language>This private prevent instantiation. If sketch classes loaded statically, empty</technical_language>

Target:
private DataSketchesFunctions() { this.sketchClasses = new ArrayList<SketchDescriptor>(); this.descriptors = new ArrayList<HiveUDFPlugin.UDFDescriptor>(); registerHll(); registerCpc(); registerKll(); registerTheta(); registerTuple(); registerQuantiles(); registerFrequencies(); buildCalciteFns(); buildDescritors(); }
Source:
<code>public String getLocalizedMessage() { <START> return "stormpath.cookie.insecure.error"; <END> }</code><technical_language>Please create static constant for this hardcoded key</technical_language>

Target:
public String getLocalizedMessage() { return I8N_MESSAGE_KEY; }
Source:
<code><START> public Integer getSkipHeaderRows() <END> { return skipHeaderRows; }</code><technical_language>a primitive int</technical_language>

Target:
public int getSkipHeaderRows() { return skipHeaderRows; }
Source:
<code>EncryptionCosmosAsyncContainer(String id, CosmosAsyncDatabase database, Encryptor encryptor) { this.container = BridgeInternal.createCosmosAsyncContainer(id, database); this.encryptor = encryptor; <START> this.encryptionScheduler = Schedulers.elastic(); <END> }</code><technical_language>capturing Schedulers.elastic() in instance variable, Scheduler async API. a heads this behave. Also, Schedulers.boundedElastic() is preferred for wrapping I/O calls. Please too</technical_language>

Target:
EncryptionCosmosAsyncContainer(String id, CosmosAsyncDatabase database, Encryptor encryptor) { this.container = BridgeInternal.createCosmosAsyncContainer(id, database); this.encryptor = encryptor; this.encryptionScheduler = Schedulers.boundedElastic(); }
Source:
<code>private void testGetForExistingBlobs(List<BlobId> blobIds, Map<BlobId, ByteBuffer> blobIdToUploadedDataMap) throws Exception { StoreInfo storeInfo = store.get(blobIds, EnumSet.noneOf(StoreGetOptions.class)); assertTrue( "Number of records returned by get should be " + blobIds.size() + " found " + storeInfo.getMessageReadSetInfo() .size(), storeInfo.getMessageReadSetInfo().size() == blobIds.size()); for (int i = 0; i < storeInfo.getMessageReadSetInfo().size(); i++) { if (blobIdToUploadedDataMap.containsKey(storeInfo.getMessageReadSetInfo().get(i).getStoreKey())) { ByteBuffer uploadedData = blobIdToUploadedDataMap.get(storeInfo.getMessageReadSetInfo().get(i).getStoreKey()); ByteBuffer downloadedData = ByteBuffer.allocate((int) storeInfo.getMessageReadSetInfo().get(i).getSize()); WritableByteChannel writableByteChannel = Channels.newChannel(new ByteBufferOutputStream(downloadedData)); storeInfo.getMessageReadSet().writeTo(i, writableByteChannel, -1, -1); downloadedData.flip(); <START> assertTrue(uploadedData.equals(downloadedData)); <END> break; } } }</code><technical_language>places call assertTrue(expected.equals(actual)), assertEquals("error message", expected, actual)</technical_language>

Target:
private void testGetForExistingBlobs(List<BlobId> blobIds, Map<BlobId, ByteBuffer> blobIdToUploadedDataMap) throws Exception { StoreInfo storeInfo = store.get(blobIds, EnumSet.noneOf(StoreGetOptions.class)); assertEquals("Number of records returned by get should be same as uploaded", storeInfo.getMessageReadSetInfo().size(), blobIds.size()); for (int i = 0; i < storeInfo.getMessageReadSetInfo().size(); i++) { if (blobIdToUploadedDataMap.containsKey(storeInfo.getMessageReadSetInfo().get(i).getStoreKey())) { ByteBuffer uploadedData = blobIdToUploadedDataMap.get(storeInfo.getMessageReadSetInfo().get(i).getStoreKey()); ByteBuffer downloadedData = ByteBuffer.allocate((int) storeInfo.getMessageReadSetInfo().get(i).getSize()); WritableByteChannel writableByteChannel = Channels.newChannel(new ByteBufferOutputStream(downloadedData)); storeInfo.getMessageReadSet().writeTo(i, writableByteChannel, -1, -1); downloadedData.flip(); assertEquals(uploadedData, downloadedData); break; } } }
Source:
<code>public void testCascadedValidationMultiThreaded() throws Exception { CountDownLatch startLatch = new CountDownLatch( 1 ); <START> ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool( SIZE_OF_THREAD_POOL ); <END> for ( int i = 0; i <= NUMBER_OF_RUNNABLES; i++ ) { Runnable run = new TestRunner( startLatch ); executor.execute( run ); } executor.shutdown(); startLatch.countDown(); executor.awaitTermination( 600, TimeUnit.SECONDS ); }</code><technical_language>Is down-cast required</technical_language>

Target:
public void testCascadedValidationMultiThreaded() throws Exception { CountDownLatch startLatch = new CountDownLatch( 1 ); ExecutorService executor = Executors.newFixedThreadPool( SIZE_OF_THREAD_POOL ); for ( int i = 0; i <= NUMBER_OF_RUNNABLES; i++ ) { Runnable run = new TestRunner( startLatch ); executor.execute( run ); } executor.shutdown(); startLatch.countDown(); executor.awaitTermination( 600, TimeUnit.SECONDS ); }
Source:
<code>public static org.kframework.definition.Definition from(String definitionText) { <START> Pattern pattern = Pattern.compile("module ([A-Z_]*)"); <END> Matcher m = pattern.matcher(definitionText); if(!m.find()) { throw new RuntimeException("Could not find any module in the definition"); } String nameOfLastModule = m.group(m.groupCount()); return from(definitionText, nameOfLastModule, Source.apply("generated")); }</code><technical_language>this interfere in unexpected ways contents of module, e.g. some syntax names foo_module</technical_language>

Target:
public static org.kframework.definition.Definition from(String definitionText) { Pattern pattern = Pattern.compile("(?:^|\\s)module ([A-Z][A-Z\\-]*)"); Matcher m = pattern.matcher(definitionText); if(!m.find()) { throw new RuntimeException("Could not find any module in the definition"); } String nameOfLastModule = m.group(m.groupCount()); return from(definitionText, nameOfLastModule, Source.apply("generated")); }
Source:
<code>public void drawItems(Rectangle bounds, ITimeDataProvider timeProvider, Item[] items, int topIndex, int nameSpace, GC gc) { int bottomIndex = Integer.min(topIndex + countPerPage() + 1, items.length); for (int i = topIndex; i < bottomIndex; i++) { Item item = items[i]; drawItem(item, bounds, timeProvider, i, nameSpace, gc); } TraceCompassLogUtils.traceCounter(LOGGER, Level.FINER, fDrawItemsCountLabel, bottomIndex - topIndex); for (DeferredEntry entry : fPostDrawEntries) { entry.draw(fTimeGraphProvider, gc); } for (DeferredLine line : fLines) { line.draw(gc); } Color prev = gc.getForeground(); Color black = COLOR_REGISTRY.get(BLACK.toString()); if (black == null) { COLOR_REGISTRY.put(BLACK.toString(), RGBAUtil.fromInt(BLACK.toInt()).rgb); black = COLOR_REGISTRY.get(BLACK.toString()); <START> } <END> gc.setForeground(black); int prevAA = gc.getAntialias(); gc.setAntialias(SWT.OFF); int prevLineWidth = gc.getLineWidth(); gc.setLineWidth(1); for (DeferredSegment seg : fPoints) { seg.draw(gc); } gc.setLineWidth(prevLineWidth); gc.setAntialias(prevAA); for (Rectangle rectangle : fSelectedRectangles) { int arc = Math.min(rectangle.height + 1, rectangle.width) / 2; gc.drawRoundRectangle(rectangle.x - 1, rectangle.y - 1, rectangle.width, rectangle.height + 1, arc, arc); } gc.setForeground(prev); }</code><technical_language>This is getColor(int), getSystemColor(SWT.COLOR_BLACK)? a constant</technical_language>

Target:
public void drawItems(Rectangle bounds, ITimeDataProvider timeProvider, Item[] items, int topIndex, int nameSpace, GC gc) { int bottomIndex = Integer.min(topIndex + countPerPage() + 1, items.length); for (int i = topIndex; i < bottomIndex; i++) { Item item = items[i]; drawItem(item, bounds, timeProvider, i, nameSpace, gc); } TraceCompassLogUtils.traceCounter(LOGGER, Level.FINER, fDrawItemsCountLabel, bottomIndex - topIndex); for (DeferredEntry entry : fPostDrawEntries) { entry.draw(fTimeGraphProvider, gc); } for (DeferredLine line : fLines) { line.draw(gc); } Color prev = gc.getForeground(); Color black = getColor(BLACK.toInt()); gc.setForeground(black); int prevAA = gc.getAntialias(); gc.setAntialias(SWT.OFF); int prevLineWidth = gc.getLineWidth(); gc.setLineWidth(1); for (DeferredSegment seg : fPoints) { seg.draw(gc); } gc.setLineWidth(prevLineWidth); gc.setAntialias(prevAA); for (Rectangle rectangle : fSelectedRectangles) { int arc = Math.min(rectangle.height + 1, rectangle.width) / 2; gc.drawRoundRectangle(rectangle.x - 1, rectangle.y - 1, rectangle.width, rectangle.height + 1, arc, arc); } gc.setForeground(prev); }
Source:
<code>public void eventHandle(ITmfEvent event, DataDrivenScenarioInfo scenarioInfo, IAnalysisDataContainer container) { if (container instanceof XmlPatternStateProvider) { for (Entry<String, String> entry : <START> ((XmlPatternStateProvider) container).getStoredFields().entrySet()) <END> { ((XmlPatternStateProvider) container).getHistoryBuilder().resetStoredFields((XmlPatternStateProvider) container, entry.getValue(), (TmfXmlScenarioInfo) scenarioInfo, event); } } }</code><technical_language>extract</technical_language>

Target:
public void eventHandle(ITmfEvent event, DataDrivenScenarioInfo scenarioInfo, IAnalysisDataContainer container) { if (container instanceof XmlPatternStateProvider && scenarioInfo instanceof TmfXmlScenarioInfo) { XmlPatternStateProvider provider = (XmlPatternStateProvider) container; for (Entry<String, String> entry : provider.getStoredFields().entrySet()) { provider.getHistoryBuilder().resetStoredFields(provider, entry.getValue(), (TmfXmlScenarioInfo) scenarioInfo, event); } } }
Source:
<code>private void trimExternal(int offset, int limit) { ResultExternal temp = external; external = null; temp.reset(); while (--offset >= 0) { temp.next(); <START> } <END> while (--limit >= 0) { rows.add(temp.next()); if (rows.size() > maxMemoryRows) { if (external == null) { createExternalResult(); } addRowsToDisk(); } } if (external != null) { addRowsToDisk(); } temp.close(); }</code><technical_language>idea for optimisation - add a skip(int) method ResultExternal here</technical_language>

Target:
private void trimExternal(int offset, int limit) { ResultExternal temp = external; external = null; temp.reset(); while (--offset >= 0) { temp.next(); } while (--limit >= 0) { rows.add(temp.next()); if (rows.size() > maxMemoryRows) { addRowsToDisk(); } } if (external != null) { addRowsToDisk(); } temp.close(); }
Source:
<code>protected AgentIdentifier agentIdentifier() { <START> return new AgentIdentifier(SystemUtil.getLocalhostNameOrRandomNameIfNotFound(), SystemUtil.getClientIp(systemEnvironment.getServiceUrl()), agentRegistry.uuid()); <END> }</code><technical_language>Hostname IP computations inlined here. this method is called ping loop call, sense determine this reuse thereafter</technical_language>

Target:
protected AgentIdentifier agentIdentifier() { return new AgentIdentifier(hostName, ipAddress, agentRegistry.uuid()); }
Source:
<code>protected boolean canDoAction() { if (!isVmExist() || !acquireLockInternal()) { return false; } Disk diskInfo = getParameters().getDiskInfo(); if (diskInfo.getDiskStorageType() == DiskStorageType.IMAGE) { getDiskImageInfo().setDiskSnapshot(false); } VM vm = getVm(); if (vm != null) { if (!canRunActionOnNonManagedVm()) { return false; } updateDisksFromDb(); if (!isDiskCanBeAddedToVm(getParameters().getDiskInfo(), vm) || !isDiskPassPciAndIdeLimit(getParameters().getDiskInfo())) { return false; } } else if (Boolean.TRUE.equals(getParameters().getPlugDiskToVm())) { return failCanDoAction(VdcBllMessages.CANNOT_ADD_FLOATING_DISK_WITH_PLUG_VM_SET); } DiskValidator diskValidator = getDiskValidator(getParameters().getDiskInfo()); if (!validate(diskValidator.isReadOnlyPropertyCompatibleWithInterface())) { return false; } <START> if (!setAndValidateDiskProfiles()) { <END> return false; } if (DiskStorageType.IMAGE == getParameters().getDiskInfo().getDiskStorageType()) { return checkIfImageDiskCanBeAdded(vm, diskValidator); } if (DiskStorageType.LUN == getParameters().getDiskInfo().getDiskStorageType()) { return checkIfLunDiskCanBeAdded(diskValidator); } return true; }</code><technical_language>move this if in line 119</technical_language>

Target:
protected boolean canDoAction() { if (!isVmExist() || !acquireLockInternal()) { return false; } Disk diskInfo = getParameters().getDiskInfo(); if (diskInfo.getDiskStorageType() == DiskStorageType.IMAGE) { getDiskImageInfo().setDiskSnapshot(false); } VM vm = getVm(); if (vm != null) { if (!canRunActionOnNonManagedVm()) { return false; } updateDisksFromDb(); if (!isDiskCanBeAddedToVm(getParameters().getDiskInfo(), vm) || !isDiskPassPciAndIdeLimit(getParameters().getDiskInfo())) { return false; } } else if (Boolean.TRUE.equals(getParameters().getPlugDiskToVm())) { return failCanDoAction(VdcBllMessages.CANNOT_ADD_FLOATING_DISK_WITH_PLUG_VM_SET); } DiskValidator diskValidator = getDiskValidator(getParameters().getDiskInfo()); if (!validate(diskValidator.isReadOnlyPropertyCompatibleWithInterface())) { return false; } if (DiskStorageType.IMAGE == getParameters().getDiskInfo().getDiskStorageType()) { if (!setAndValidateDiskProfiles()) { return false; } return checkIfImageDiskCanBeAdded(vm, diskValidator); } if (DiskStorageType.LUN == getParameters().getDiskInfo().getDiskStorageType()) { return checkIfLunDiskCanBeAdded(diskValidator); } return true; }
Source:
<code>private boolean milestoneSatisfies(IModel model, TurboIssue issue) { if (!content.isPresent()) return false; Optional<TurboMilestone> milestone = model.getMilestoneOfIssue(issue); if (!milestone.isPresent()) return false; String contents = content.get().toLowerCase(); String title = milestone.get().getTitle().toLowerCase(); List<TurboMilestone> allMilestones = model.getMilestones(); Collections.sort(allMilestones, new TurboMilestoneDueDateComparator()); int currentIndex = -1; for (TurboMilestone checker : allMilestones) { if (checker.isOpen()) { if (checker.getDueDate().isPresent() && checker.getDueDate().get().isBefore(LocalDate.now()) && checker.getOpenIssues() == 0) { continue; } currentIndex = allMilestones.indexOf(checker); break; } } if (currentIndex == -1 && allMilestones.size() > 0) { currentIndex = allMilestones.size() - 1; } String alias = contents; if (alias.equalsIgnoreCase("current") || alias.equalsIgnoreCase("curr")) { contents = allMilestones.get(currentIndex).getTitle(); } else if (alias.equalsIgnoreCase("previous") || alias.equalsIgnoreCase("prev")) { if (currentIndex - 1 >= 0) { contents = allMilestones.get(currentIndex - 1).getTitle(); } } else if (alias.equalsIgnoreCase("next")) { if (currentIndex + 1 < allMilestones.size()) { contents = allMilestones.get(currentIndex + 1).getTitle(); } } else if (alias.startsWith("previous-") || alias.startsWith("prev-")) { int offsetPos = alias.indexOf('-') + 1; int offset = Integer.parseInt(alias.substring(offsetPos).trim()); if (currentIndex - 1 - offset >= 0) { contents = allMilestones.get(currentIndex - 1 - offset).getTitle(); } } else if (alias.startsWith("next+")) { int offsetPos = alias.indexOf('+') + 1; int offset = Integer.parseInt(alias.substring(offsetPos).trim()); if (currentIndex + 1 + offset < allMilestones.size()) { contents = allMilestones.get(currentIndex + 1 + offset).getTitle(); } } contents = contents.toLowerCase(); <START> <END> return title.contains(contents); }</code><technical_language>this method is more advertised</technical_language>

Target:
private boolean milestoneSatisfies(IModel model, TurboIssue issue) { if (!content.isPresent()) return false; Optional<TurboMilestone> milestone = model.getMilestoneOfIssue(issue); if (!milestone.isPresent()) return false; String contents = content.get().toLowerCase(); String title = milestone.get().getTitle().toLowerCase(); return title.contains(contents); }
Source:
<code>public void testFew() { WeightedDoubleReservoirSample reservoir = new WeightedDoubleReservoirSample(200); reservoir.add(1.0, 1.0); reservoir.add(2.0, 1.0); reservoir.add(3.0, 0.5); Set<Double> samples = new HashSet<>(); for (double sample : reservoir.getSamples()) { <START> samples.add(sample); <END> } assertEquals(samples.size(), 3); assertTrue(samples.contains(Double.valueOf(1))); assertTrue(samples.contains(Double.valueOf(2))); assertTrue(samples.contains(Double.valueOf(3))); }</code><technical_language>simplify assertEquals(Arrays.stream(reservoir.getSamples()).sorted().toArray(), new double[] {1.0, 2.0, 3.0});</technical_language>

Target:
public void testFew() { WeightedDoubleReservoirSample reservoir = new WeightedDoubleReservoirSample(200); reservoir.add(1.0, 1.0); reservoir.add(2.0, 1.0); reservoir.add(3.0, 0.5); assertEquals(Arrays.stream(reservoir.getSamples()).sorted().toArray(), new double[] {1.0, 2.0, 3.0}); }
Source:
<code><START> public QuotaBalanceVO() { <END> super(); }</code><technical_language>This public constructor is unnecessary compiler generate it</technical_language>

Target:
public QuotaBalanceVO() { }
Source:
<code>public void testImportWithPadding() throws IOException { if(failWithPadding){ thrown.expect(IOException.class); thrown.expectMessage("Failure during job; return status 1"); <START> NumericTypesTestUtils.configureJunitToExpectFailure(thrown); <END> } ArgumentArrayBuilder builder = getArgsBuilder(); NumericTypesTestUtils.addPadding(builder); runImport(builder.build()); if (!failWithPadding) { verify(); } }</code><technical_language>This method previous line</technical_language>

Target:
public void testImportWithPadding() throws IOException { if(failWithPadding){ NumericTypesTestUtils.configureJunitToExpectFailure(thrown); } ArgumentArrayBuilder builder = getArgsBuilder(); NumericTypesTestUtils.addPadding(builder); runImport(builder.build()); if (!failWithPadding) { verify(); } }
Source:
<code><START> public synchronized Text getCurrentProxyDelegationToken() { <END> return delegationTokenService; }</code><technical_language>This synchronized removed set constructor</technical_language>

Target:
public Text getCurrentProxyDelegationToken() { return delegationTokenService; }
Source:
<code>public synchronized void onError(Throwable t) { if(lastAsyncOperation != null) { <START> lastAsyncOperation.future.completeExceptionally(t); <END> lastAsyncOperation = null; } }</code><technical_language>Do need complete full queue here</technical_language>

Target:
public synchronized void onError(Throwable t) { if(lastAsyncOperation != null) { lastAsyncOperation.future.completeExceptionally(t); lastAsyncOperation = null; } while(!asyncQueue.isEmpty()) { AsyncOperation op = asyncQueue.poll(); if(!op.future.isDone()) op.future.completeExceptionally(t); } }
Source:
<code>public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<>(); if (isDiskImage()) { DiskImage oldDiskImage = (DiskImage) getOldDisk(); DiskImage newDiskImage = (DiskImage) getNewDisk(); boolean doesNewDiskHaveQuota = isDiskImageHasQuota(newDiskImage); <START> boolean doesOldDiskHadQuota = isDiskImageHasQuota(oldDiskImage); <END> boolean isQuotaChanged = !oldDiskImage.getQuotaId().equals(newDiskImage.getQuotaId()); long diskExtendingDiff = newDiskImage.getSizeInGigabytes() - oldDiskImage.getSizeInGigabytes(); if (doesNewDiskHaveQuota) { if (isQuotaChanged) { list.add(generateQuotaRequestParameters(newDiskImage, QuotaConsumptionParameter.QuotaAction.CONSUME, newDiskImage.getSizeInGigabytes())); } else if (diskExtendingDiff > 0L) { list.add(generateQuotaRequestParameters(newDiskImage, QuotaConsumptionParameter.QuotaAction.CONSUME, diskExtendingDiff)); } } if (doesOldDiskHadQuota && isQuotaChanged) { list.add(generateQuotaRequestParameters(oldDiskImage, QuotaConsumptionParameter.QuotaAction.RELEASE, oldDiskImage.getSizeInGigabytes())); } } return list; }</code><technical_language>redundant - below</technical_language>

Target:
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<>(); if (isDiskImage()) { DiskImage oldDiskImage = (DiskImage) getOldDisk(); DiskImage newDiskImage = (DiskImage) getNewDisk(); boolean doesOldDiskHadQuota = isDiskImageHasQuota(oldDiskImage); boolean isQuotaChanged = !Objects.equals(oldDiskImage.getQuotaId(), newDiskImage.getQuotaId()); long diskExtendingDiff = 0L; if (oldDiskImage != null) { diskExtendingDiff = newDiskImage.getSizeInGigabytes() - oldDiskImage.getSizeInGigabytes(); } if (isQuotaChanged) { list.add(generateQuotaRequestParameters(newDiskImage, QuotaConsumptionParameter.QuotaAction.CONSUME, newDiskImage.getSizeInGigabytes())); } else if (diskExtendingDiff > 0L) { list.add(generateQuotaRequestParameters(newDiskImage, QuotaConsumptionParameter.QuotaAction.CONSUME, diskExtendingDiff)); } if (doesOldDiskHadQuota && isQuotaChanged) { list.add(generateQuotaRequestParameters(oldDiskImage, QuotaConsumptionParameter.QuotaAction.RELEASE, oldDiskImage.getSizeInGigabytes())); } } return list; }
Source:
<code>public void bindingChanged(BindingProvider prov, String itemName) { if (prov.getItemNames().contains(itemName)) { try { createItem(itemName, prov); } catch (Ipx800UnknownDeviceException e) { <START> logger.error("Item " + itemName + " will be ignored"); <END> e.printStackTrace(); } } else { logger.debug("Removing item {}", itemName); for (String deviceName : devices.keySet()) { for (Ipx800Port slot : devices.get(deviceName).getAllPorts()) { slot.destroyItem(itemName); } } } }</code><technical_language>parameterised logging</technical_language>

Target:
public void bindingChanged(BindingProvider prov, String itemName) { if (prov.getItemNames().contains(itemName)) { try { createInternalItem(itemName, prov); } catch (Ipx800UnknownDeviceException e) { logger.error("Item will be ignored", itemName); } } else { logger.debug("Removing item {}", itemName); for (String deviceName : devices.keySet()) { for (Ipx800Port slot : devices.get(deviceName).getAllPorts()) { slot.destroyItem(itemName); } } } }
Source:
<code><START> @OnClick(R.id.reading_list_detail_back_button) protected void onBackPressed(View v) { <END> if (actionListener != null) { actionListener.onBackPressed(); } }</code><technical_language>reason package protected? protected means subclasses override this method supported this class</technical_language>

Target:
@OnClick(R.id.reading_list_detail_back_button) void onBackPressed(View v) { if (actionListener != null) { actionListener.onBackPressed(); } }
Source:
<code>public void testNotifyChanged() { Iterator<CommentAnnotation> iter = model.getAnnotationIterator(); assertEquals(1, getCount(iter)); IComment clone = generateComment(DEFAULT_TEXT, new Timestamp(DEFAULT_TIMESTAMP)); Notification notification = new NotificationImpl(Notification.ADD, null, clone); model.getItem().eNotify(notification); iter = model.getAnnotationIterator(); assertEquals(1, getCount(iter)); IComment newComment = generateComment("Actually, maybe it needs more work.", new Date()); notification = new NotificationImpl(Notification.ADD, null, newComment); model.getItem().eNotify(notification); iter = model.getAnnotationIterator(); assertEquals(2, getCount(iter)); <START> notification = new NotificationImpl(Notification.REMOVE, newComment, null); <END> model.getItem().eNotify(notification); iter = model.getAnnotationIterator(); assertEquals(2, getCount(iter)); }</code><technical_language>I added remove notification i added there, ADD notification</technical_language>

Target:
public void testNotifyChanged() { Iterator<CommentAnnotation> iter = model.getAnnotationIterator(); assertEquals(1, getCount(iter)); IComment clone = generateComment(DEFAULT_TEXT, new Timestamp(DEFAULT_TIMESTAMP)); Notification notification = new NotificationImpl(Notification.ADD, null, clone); model.getItem().eNotify(notification); iter = model.getAnnotationIterator(); assertEquals(1, getCount(iter)); IComment newComment = generateComment("Actually, maybe it needs more work.", new Date()); notification = new NotificationImpl(Notification.ADD, null, newComment); model.getItem().eNotify(notification); iter = model.getAnnotationIterator(); assertEquals(2, getCount(iter)); notification = new NotificationImpl(Notification.REMOVE, newComment, null); model.getItem().eNotify(notification); iter = model.getAnnotationIterator(); assertEquals(1, getCount(iter)); }
Source:
<code>public String getSingular() { if(singular == null) { final Singular fromAnnotation = getClass().getAnnotation(Singular.class); <START> this.singular = (fromAnnotation != null ? fromAnnotation.value().toLowerCase(Locale.ROOT) : getKind()).toLowerCase(Locale.ROOT); <END> } return singular; }</code><technical_language>suggestion this.singular = (fromAnnotation != null ? fromAnnotation.value() : getKind()).toLowerCase(Locale.ROOT);</technical_language>

Target:
public String getSingular() { return singular; }
Source:
<code>public static Configuration getHadoopConfiguration(String hadoopConfDir) { Configuration hadoopConfiguration = new Configuration(); if (new File(hadoopConfDir).exists()) { if (new File(hadoopConfDir + "/core-site.xml").exists()) { hadoopConfiguration.addResource(new Path(hadoopConfDir + "/core-site.xml")); } <START> if (new File(hadoopConfDir + "/hdfs-default.xml").exists()) { <END> hadoopConfiguration.addResource(new Path(hadoopConfDir + "/hdfs-default.xml")); } if (new File(hadoopConfDir + "/hdfs-site.xml").exists()) { hadoopConfiguration.addResource(new Path(hadoopConfDir + "/hdfs-site.xml")); } if (new File(hadoopConfDir + "/mapred-site.xml").exists()) { hadoopConfiguration.addResource(new Path(hadoopConfDir + "/mapred-site.xml")); } } return hadoopConfiguration; }</code><technical_language>do need hdfs-default.xml</technical_language>

Target:
public static Configuration getHadoopConfiguration(String hadoopConfDir) { if (new File(hadoopConfDir).exists()) { Configuration hadoopConfiguration = new Configuration(); File coreSite = new File(hadoopConfDir, "core-site.xml"); if (coreSite.exists()) { hadoopConfiguration.addResource(new Path(coreSite.getAbsolutePath())); } File hdfsSite = new File(hadoopConfDir, "hdfs-site.xml"); if (hdfsSite.exists()) { hadoopConfiguration.addResource(new Path(hdfsSite.getAbsolutePath())); } File yarnSite = new File(hadoopConfDir, "yarn-site.xml"); if (yarnSite.exists()) { hadoopConfiguration.addResource(new Path(yarnSite.getAbsolutePath())); } File mapredSite = new File(hadoopConfDir, "mapred-site.xml"); if (mapredSite.exists()) { hadoopConfiguration.addResource(new Path(mapredSite.getAbsolutePath())); } return hadoopConfiguration; } return null; }
Source:
<code>public void declareVariable(Class type, String name) { <START> if (locals == Collections.EMPTY_MAP) { <END> this.locals = new HashMap<String, Object>(1); } locals.put(name, null); if (types == null || types == Collections.EMPTY_MAP) { types = new HashMap<String, Class>(1); } types.put(name, type); }</code><technical_language>Awkward, fragile accidentally try write it, resulting in UnsupportedOperationException confusing. leave null a request is store in it? need do a null check in a places, deleting getTypes</technical_language>

Target:
public void declareVariable(Class type, String name) { if (locals == Collections.EMPTY_MAP) { this.locals = new HashMap<String, Object>(2); } locals.put(name, null); if (types == null || types == Collections.EMPTY_MAP) { types = new HashMap<String, Class>(2); } types.put(name, type); }