auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public RemoteOperationResult(Exception e) { mException = e; if (e instanceof OperationCancelledException) { mCode = ResultCode.CANCELLED; } else if (e instanceof SocketException) { mCode = ResultCode.WRONG_CONNECTION; } else if (e instanceof SocketTimeoutException) { mCode = ResultCode.TIMEOUT; } else if (e instanceof ConnectTimeoutException) { mCode = ResultCode.TIMEOUT; } else if (e instanceof MalformedURLException) { mCode = ResultCode.INCORRECT_ADDRESS; } else if (e instanceof UnknownHostException) { mCode = ResultCode.HOST_NOT_AVAILABLE; } else if (e instanceof AccountNotFoundException) { mCode = ResultCode.ACCOUNT_NOT_FOUND; } else if (e instanceof AccountsException) { mCode = ResultCode.ACCOUNT_EXCEPTION; } else if (e instanceof SSLException || e instanceof RuntimeException) { CertificateCombinedException se = getCertificateCombinedException(e); if (se != null) { mException = se; if (se.isRecoverable()) { mCode = ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED; } } else if (e instanceof RuntimeException) { mCode = ResultCode.HOST_NOT_AVAILABLE; } else { mCode = ResultCode.SSL_ERROR; } } else if (e instanceof JSONException) { <START> mCode = ResultCode.JSON_EXCEPTION; <END> } else { mCode = ResultCode.UNKNOWN_ERROR; } }</code><technical_language>Creating a specific JSON_EXCEPTION is unnecessary. result codes oriented provide error messages user of app (at some point in future). This is technical for a regular user. UNKNOWN_ERROR code do job here, a new code BAD_RESPONSE_FROM_SERVER ; this technical for users</technical_language>

Target:
public RemoteOperationResult(Exception e) { mException = e; if (e instanceof OperationCancelledException) { mCode = ResultCode.CANCELLED; } else if (e instanceof SocketException) { mCode = ResultCode.WRONG_CONNECTION; } else if (e instanceof SocketTimeoutException) { mCode = ResultCode.TIMEOUT; } else if (e instanceof ConnectTimeoutException) { mCode = ResultCode.TIMEOUT; } else if (e instanceof MalformedURLException) { mCode = ResultCode.INCORRECT_ADDRESS; } else if (e instanceof UnknownHostException) { mCode = ResultCode.HOST_NOT_AVAILABLE; } else if (e instanceof AccountNotFoundException) { mCode = ResultCode.ACCOUNT_NOT_FOUND; } else if (e instanceof AccountsException) { mCode = ResultCode.ACCOUNT_EXCEPTION; } else if (e instanceof SSLException || e instanceof RuntimeException) { CertificateCombinedException se = getCertificateCombinedException(e); if (se != null) { mException = se; if (se.isRecoverable()) { mCode = ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED; } } else if (e instanceof RuntimeException) { mCode = ResultCode.HOST_NOT_AVAILABLE; } else { mCode = ResultCode.SSL_ERROR; } } else { mCode = ResultCode.UNKNOWN_ERROR; } }
Source:
<code>private ShowSourceForm(String action, boolean showReloadButton) { $$$setupUI$$$(); this.action = action; this.showReloadButton = showReloadButton; resetButton.addActionListener(__ -> onResetCallbacks.forEach(Runnable::run)); reloadButton.addActionListener(__ -> onReloadCallbacks.forEach(Runnable::run)); onReloadCallbacks.add(() -> { reloadButton.setEnabled(false); TimerTask task = new TimerTask() { public void run() { reloadButton.setEnabled(true); } }; Timer timer = new Timer(); long delayMillis = 5000L; timer.schedule(task, delayMillis); }); <START> if (!showReloadButton) <END> reloadButton.setVisible(false); }</code><technical_language>If *were* a timer here, a javax.swing.Timer instead advantages. <img width="1639" alt="screen shot 2018-08-26 3 38 28 pm" src="<LINK_0>"> <LINK_1></technical_language>

Target:
private ShowSourceForm(String action, boolean showReloadButton) { $$$setupUI$$$(); this.action = action; this.showReloadButton = showReloadButton; resetButton.addActionListener(__ -> onResetCallbacks.forEach(Runnable::run)); reloadButton.addActionListener(__ -> onReloadCallbacks.forEach(Runnable::run)); onReloadCallbacks.add(() -> { reloadButton.setEnabled(false); reloadTimerElapsed = false; reloadOperationCompleted = false; Timer t = new Timer(5000, (e) -> markReloadTimerElapsed()); t.setRepeats(false); t.start(); }); if (!showReloadButton) reloadButton.setVisible(false); }
Source:
<code>private synchronized void scheduleUpdate() { <START> schedExecutor.schedule(() -> updatePartitionInfo(), 0, TimeUnit.MILLISECONDS); <END> }</code><technical_language>this::updatePartionInfo</technical_language>

Target:
private synchronized void scheduleUpdate() { schedExecutor.schedule(this::updatePartitionInfo, 0, TimeUnit.MILLISECONDS); }
Source:
<code>public void testChronologizeWithStartTimestampAndEndTimestampBeforeAnyValuesChangeInKeyInRecord() { long record = Variables.register("record", client.create()); String key = Variables.register("key", TestData.getString()); int testSize = Variables.register("testSize", 5); Set<Object> initValues = Variables.register("initValues", Sets.newHashSet()); Timestamp startTimestamp = Variables.register("startTimestamp", Timestamp.now()); <START> for (int i = 0; i < 100000000; i++); <END> Timestamp endTimestamp = Variables.register("endTimestamp", Timestamp.now()); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Map<Timestamp, Set<Object>> result = client.chronologize( key, record, startTimestamp, endTimestamp); assertTrue(result.isEmpty()); }</code><technical_language>StandardActions.wait(int, TimeUnit) introduce a delay in tests</technical_language>

Target:
public void testChronologizeWithStartTimestampAndEndTimestampBeforeAnyValuesChangeInKeyInRecord() { long record = Variables.register("record", client.create()); String key = Variables.register("key", TestData.getString()); int testSize = Variables.register("testSize", 5); Set<Object> initValues = Variables.register("initValues", Sets.newHashSet()); Timestamp startTimestamp = Variables.register("startTimestamp", Timestamp.now()); StandardActions.wait(200, TimeUnit.MILLISECONDS); Timestamp endTimestamp = Variables.register("endTimestamp", Timestamp.now()); StandardActions.wait(200, TimeUnit.MILLISECONDS); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Map<Timestamp, Set<Object>> result = client.chronologize(key, record, startTimestamp, endTimestamp); result = Variables.register("result", result); assertTrue(result.isEmpty()); }
Source:
<code>public int build(OutputStream out, OutputStream err, IProgressMonitor monitor) { int status = STATUS_ERROR_LAUNCH; try { SubMonitor progress = SubMonitor.convert(monitor, ManagedMakeMessages.getResourceString("MakeBuilder.Invoking_Command") + getCommandLine(), getNumCommands()); ICommandLauncher launcher = createLauncher(); launcher.showCommand(true); <START> fProcess = launcher.execute(fCmd.getCommand(), fCmd.getArgs(), mapToStringArray(fCmd.getEnvironment()), fCmd.getCWD(), progress); <END> if (fProcess != null) { try { fProcess.getOutputStream().close(); } catch (IOException e) { } int st = launcher.waitAndRead(wrap(out), wrap(err), progress.split(getNumCommands())); switch (st) { case ICommandLauncher.OK: status = fProcess.exitValue() == 0 ? STATUS_OK : STATUS_ERROR_BUILD; break; case ICommandLauncher.COMMAND_CANCELED: status = STATUS_CANCELLED; break; case ICommandLauncher.ILLEGAL_COMMAND: default: status = STATUS_ERROR_LAUNCH; break; } } fErrMsg = launcher.getErrorMessage(); if (fErrMsg != null && !fErrMsg.isEmpty()) { printMessage(fErrMsg, err); } } catch (CoreException e) { ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error launching command [" + fCmd.getCommand() + "]", e)); status = STATUS_ERROR_LAUNCH; } finally { monitor.done(); } return status; }</code><technical_language>"progress" in line 114 give strange effects. I bulk of work (from Java side) happens, in waitAndRead in line 114. If so, about: * init getNumCommands() + 1 ticks * do a progress.split(1) here</technical_language>

Target:
public int build(OutputStream out, OutputStream err, IProgressMonitor monitor) { int status = STATUS_ERROR_LAUNCH; SubMonitor progress = SubMonitor.convert(monitor, ManagedMakeMessages.getResourceString("MakeBuilder.Invoking_Command") + getCommandLine(), getNumCommands() + 1); try { ICommandLauncher launcher = createLauncher(); launcher.showCommand(true); fProcess = launcher.execute(fCmd.getCommand(), fCmd.getArgs(), mapToStringArray(fCmd.getEnvironment()), fCmd.getCWD(), progress.split(1)); if (fProcess != null) { try { fProcess.getOutputStream().close(); } catch (IOException e) { } int st = launcher.waitAndRead(wrap(out), wrap(err), progress.split(getNumCommands())); switch (st) { case ICommandLauncher.OK: status = fProcess.exitValue() == 0 ? STATUS_OK : STATUS_ERROR_BUILD; break; case ICommandLauncher.COMMAND_CANCELED: status = STATUS_CANCELLED; break; case ICommandLauncher.ILLEGAL_COMMAND: default: status = STATUS_ERROR_LAUNCH; break; } } fErrMsg = launcher.getErrorMessage(); if (fErrMsg != null && !fErrMsg.isEmpty()) { printMessage(fErrMsg, err); } } catch (CoreException e) { ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error launching command [" + fCmd.getCommand() + "]", e)); status = STATUS_ERROR_LAUNCH; } finally { progress.done(); } return status; }
Source:
<code><START> protected <T, I> List<I> getServices(Class<T> clazz, Class<I> implementationClass) { <END> final ServiceReference<@Nullable T> serviceReferences[] = getServices(clazz); if (serviceReferences == null) { new MissingServiceAnalyzer(System.out, bundleContext).printMissingServiceDetails(clazz); return Collections.emptyList(); } return Arrays .stream(serviceReferences) .map(this::unrefService) .filter(implementationClass::isInstance) .map(implementationClass::cast) .collect(Collectors.toList()) ; }</code><technical_language>for correctness, this declared protected <T, I extends T> List<I> getServices(Class<T> clazz, Class<I> implementationClass)</technical_language>

Target:
protected <T, I extends T> List<I> getServices(Class<T> clazz, Class<I> implementationClass) { final ServiceReference<@Nullable T> serviceReferences[] = getServices(clazz); if (serviceReferences == null) { new MissingServiceAnalyzer(System.out, bundleContext).printMissingServiceDetails(clazz); return Collections.emptyList(); } return Arrays .stream(serviceReferences) .map(this::unrefService) .filter(implementationClass::isInstance) .map(implementationClass::cast) .collect(Collectors.toList()) ; }
Source:
<code>ConjureTimelockService getConjureTimelockService() { <START> Preconditions.checkState(isDialogue(ConjureTimelockServiceBlocking.class), <END> "Dialogue service provider attempted to provide a non-Dialogue class." + " This is an AtlasDB bug."); ConjureTimelockServiceBlocking longTimeoutService = dialogueClientFactory.get(ConjureTimelockServiceBlocking.class, TIMELOCK_LONG_TIMEOUT); ConjureTimelockServiceBlocking shortTimeoutService = dialogueClientFactory.get(ConjureTimelockServiceBlocking.class, TIMELOCK_SHORT_TIMEOUT); ShortAndLongTimeoutServices<ConjureTimelockService> shortAndLongTimeoutServices = ImmutableShortAndLongTimeoutServices.<ConjureTimelockServiceBlocking>builder() .longTimeout(longTimeoutService) .shortTimeout(shortTimeoutService) .build() .map(proxy -> FastFailoverProxy.newProxyInstance(ConjureTimelockServiceBlocking.class, () -> proxy)) .map(DialogueAdaptingConjureTimelockService::new); return new TimeoutSensitiveConjureTimelockService(shortAndLongTimeoutServices); }</code><technical_language>kill this check hacky currently needed (and way)</technical_language>

Target:
ConjureTimelockService getConjureTimelockService() { ConjureTimelockServiceBlocking longTimeoutService = dialogueClientFactory.get(ConjureTimelockServiceBlocking.class, TIMELOCK_LONG_TIMEOUT); ConjureTimelockServiceBlocking shortTimeoutService = dialogueClientFactory.get(ConjureTimelockServiceBlocking.class, TIMELOCK_SHORT_TIMEOUT); ShortAndLongTimeoutServices<ConjureTimelockService> shortAndLongTimeoutServices = ImmutableShortAndLongTimeoutServices.<ConjureTimelockServiceBlocking>builder() .longTimeout(longTimeoutService) .shortTimeout(shortTimeoutService) .build() .map(proxy -> FastFailoverProxy.newProxyInstance(ConjureTimelockServiceBlocking.class, () -> proxy)) .map(DialogueAdaptingConjureTimelockService::new); return new TimeoutSensitiveConjureTimelockService(shortAndLongTimeoutServices); }
Source:
<code>private void hotUnplugMemory(VM newVm) { <START> final VM vmFromDb = getVm(); <END> final List<VmDevice> vmMemoryDevices = vmDeviceDao.getVmDeviceByVmIdTypeAndDevice( getVmId(), VmDeviceGeneralType.MEMORY, VmDeviceType.MEMORY); final int oldMemoryMb = vmFromDb.getMemSizeMb(); final int oldMinMemoryMb = vmFromDb.getMinAllocatedMem(); final List<VmDevice> memoryDevicesToUnplug = MemoryUtils.computeMemoryDevicesToHotUnplug( vmMemoryDevices, oldMemoryMb, getParameters().getVm().getMemSizeMb()); if (memoryDevicesToUnplug.isEmpty()) { logNoDeviceToHotUnplug(vmMemoryDevices); if (!vmFromDb.isHostedEngine()) { newVmStatic.setMemSizeMb(oldMemoryMb); newVmStatic.setMinAllocatedMem(oldMinMemoryMb); } return; } final int totalHotUnpluggedMemoryMb = memoryDevicesToUnplug.stream() .mapToInt(deviceToHotUnplug -> { final ActionReturnValue hotUnplugReturnValue = runInternalAction( ActionType.HotUnplugMemoryWithoutVmUpdate, new HotUnplugMemoryWithoutVmUpdateParameters( deviceToHotUnplug.getId(), newVm.getMinAllocatedMem()), cloneContextAndDetachFromParent()); return hotUnplugReturnValue.getSucceeded() ? VmDeviceCommonUtils.getSizeOfMemoryDeviceMb(deviceToHotUnplug).get() : 0; }) .sum(); if (!vmFromDb.isHostedEngine()) { newVmStatic.setMemSizeMb(oldMemoryMb - totalHotUnpluggedMemoryMb); newVmStatic.setMinAllocatedMem(totalHotUnpluggedMemoryMb > 0 ? newVm.getMinAllocatedMem() : oldMinMemoryMb); } }</code><technical_language>'oldVm' member instead line 521,522 nicer old* oldVm :)</technical_language>

Target:
private void hotUnplugMemory(VM newVm) { final List<VmDevice> vmMemoryDevices = vmDeviceDao.getVmDeviceByVmIdTypeAndDevice( getVmId(), VmDeviceGeneralType.MEMORY, VmDeviceType.MEMORY); final int oldMemoryMb = oldVm.getMemSizeMb(); final int oldMinMemoryMb = oldVm.getMinAllocatedMem(); final List<VmDevice> memoryDevicesToUnplug = MemoryUtils.computeMemoryDevicesToHotUnplug( vmMemoryDevices, oldMemoryMb, getParameters().getVm().getMemSizeMb()); if (memoryDevicesToUnplug.isEmpty()) { logNoDeviceToHotUnplug(vmMemoryDevices); if (!oldVm.isHostedEngine()) { newVmStatic.setMemSizeMb(oldMemoryMb); newVmStatic.setMinAllocatedMem(oldMinMemoryMb); } return; } final int totalHotUnpluggedMemoryMb = memoryDevicesToUnplug.stream() .mapToInt(deviceToHotUnplug -> { final ActionReturnValue hotUnplugReturnValue = runInternalAction( ActionType.HotUnplugMemoryWithoutVmUpdate, new HotUnplugMemoryWithoutVmUpdateParameters( deviceToHotUnplug.getId(), newVm.getMinAllocatedMem()), cloneContextAndDetachFromParent()); return hotUnplugReturnValue.getSucceeded() ? VmDeviceCommonUtils.getSizeOfMemoryDeviceMb(deviceToHotUnplug).get() : 0; }) .sum(); if (!oldVm.isHostedEngine()) { newVmStatic.setMemSizeMb(oldMemoryMb - totalHotUnpluggedMemoryMb); newVmStatic.setMinAllocatedMem(totalHotUnpluggedMemoryMb > 0 ? newVm.getMinAllocatedMem() : oldMinMemoryMb); } }
Source:
<code>public Long toLong(Timestamp value, Schema schema, LogicalType type) { if (value.getNanos() - (value.getNanos() / 1000000 * 1000000) > 0) { throw new UnsupportedOperationException("micros-precise is unsupported"); } <START> return value.getSeconds() * 1000 + value.getNanos() / 1000000; <END> }</code><technical_language>move 1000 1000000 constants</technical_language>

Target:
public Long toLong(Timestamp value, Schema schema, LogicalType type) { return ProtoConversions.toLong(value, TimestampPrecise.Micros); }
Source:
<code>public CommandResult runCommand(String script) throws IOException { if (script == null) { return null; } KitodoServiceLoader<CommandInterface> serviceLoader = new KitodoServiceLoader<>(CommandInterface.class, ConfigCore.getParameter("moduleFolder")); CommandInterface commandInterface = serviceLoader.loadModule(); CommandResult commandResult = commandInterface.runCommand(generateId(), script); if (commandResult.getMessages().get(0).contains("IOException")) { <START> throw new IOException(); <END> } return commandResult; }</code><technical_language>Throwing exception message is a bad programming style</technical_language>

Target:
public CommandResult runCommand(String script) throws IOException { if (script == null) { return null; } KitodoServiceLoader<CommandInterface> serviceLoader = new KitodoServiceLoader<>(CommandInterface.class, ConfigCore.getParameter("moduleFolder")); CommandInterface commandInterface = serviceLoader.loadModule(); CommandResult commandResult = commandInterface.runCommand(generateId(), script); if (commandResult.getMessages().get(0).contains("IOException")) { throw new IOException(commandResult.getMessages().get(1)); } return commandResult; }
Source:
<code>public static ArrayList<SerialPortInfo> listSerialPortsInfo() { ArrayList<SerialPortInfo> ports = new ArrayList<SerialPortInfo>(); <START> Enumeration<CommPortIdentifier> comPorts = CommPortIdentifier.getPortIdentifiers(); <END> while (comPorts.hasMoreElements()) { CommPortIdentifier identifier = (CommPortIdentifier)comPorts.nextElement(); ports.add(new SerialPortInfo(identifier.getName())); } return ports; }</code><technical_language>Check comPorts identifier null</technical_language>

Target:
public static ArrayList<SerialPortInfo> listSerialPortsInfo() { ArrayList<SerialPortInfo> ports = new ArrayList<SerialPortInfo>(); @SuppressWarnings("unchecked") Enumeration<CommPortIdentifier> comPorts = CommPortIdentifier.getPortIdentifiers(); if (comPorts == null) return ports; while (comPorts.hasMoreElements()) { CommPortIdentifier identifier = (CommPortIdentifier)comPorts.nextElement(); if (identifier == null) continue; ports.add(new SerialPortInfo(identifier.getName())); } return ports; }
Source:
<code>public AsyncResult<Void> waitForLocks(UUID requestId, Set<LockDescriptor> lockDescriptors, TimeLimit timeout) { AsyncResult<Void> result = waitRequests.computeIfAbsent(requestId, ignored -> { OrderedLocks orderedLocks = locks.getAll(lockDescriptors); return lockAcquirer.waitForLocks(requestId, orderedLocks, timeout); }); result.onComplete(() -> { waitRequests.remove(requestId); }); <START> return result; <END> }</code><technical_language>switching AwaitedLocksCollection, this read this? java return awaitedLocks.getExistingOrAwait(requestId, () -> { OrderedLocks orderedLocks = locks.getAll(lockDescriptors); return lockAcquirer.waitForLocks(requestId, orderedLocks, timeout); });</technical_language>

Target:
public AsyncResult<Void> waitForLocks(UUID requestId, Set<LockDescriptor> lockDescriptors, TimeLimit timeout) { return awaitedLocks.getExistingOrAwait( requestId, () -> awaitLocks(requestId, lockDescriptors, timeout)); }
Source:
<code>void idIsGeneratedUUID() { class Entity { @GeneratedValue(strategy = GenerationStrategy.UNIQUE) @Id UUID id; } Entity entity = new Entity(); CouchbaseDocument converted = new CouchbaseDocument(); converter.write(entity, converted); assertThat(converted.getId()).isEqualTo(entity.id.toString()); <START> System.out.println(entity.id); <END> }</code><technical_language>leftover printlns in addition assertions</technical_language>

Target:
void idIsGeneratedUUID() { class Entity { @GeneratedValue(strategy = GenerationStrategy.UNIQUE) @Id UUID id; } Entity entity = new Entity(); CouchbaseDocument converted = new CouchbaseDocument(); converter.write(entity, converted); assertThat(converted.getId()).isEqualTo(entity.id.toString()); }
Source:
<code>public void seal() throws IOException { <START> LOGGER.info("Sealing the segment for column: " + _fstIndexFile.getAbsolutePath()); <END> FST<Long> fst = _fstBuilder.done(); FileOutputStream fileOutputStream = new FileOutputStream(_fstIndexFile); OutputStreamDataOutput d = new OutputStreamDataOutput(fileOutputStream); fst.save(d); fileOutputStream.close(); }</code><technical_language>message misleading</technical_language>

Target:
public void seal() throws IOException { LOGGER.info("Sealing FST index: " + _fstIndexFile.getAbsolutePath()); FileOutputStream fileOutputStream = null; try { fileOutputStream = new FileOutputStream(_fstIndexFile); FST<Long> fst = _fstBuilder.done(); OutputStreamDataOutput d = new OutputStreamDataOutput(fileOutputStream); fst.save(d); } finally { if (fileOutputStream != null) { fileOutputStream.close(); } } }
Source:
<code>protected boolean validatePage() { boolean validProjectName = true; if <START> (resourceExistsInWorkspace()) { <END> validProjectName = false; } if (!StringUtil.isEmpty(getProjectName()) && validProjectName && isMacOrWindowsOS()) { if (resourceExistsOnDisk()) { validProjectName = false; } } if (validProjectName) { return super.validatePage(); } else { return false; } }</code><technical_language>test this for Mac Windows</technical_language>

Target:
protected boolean validatePage() { boolean validProjectName = true; if (isMacOrWindowsOS() && resourceExistsInWorkspace()) { validProjectName = false; } if (!StringUtil.isEmpty(getProjectName()) && validProjectName && isMacOrWindowsOS()) { if (resourceExistsOnDisk()) { validProjectName = false; } } if (validProjectName) { return super.validatePage(); } else { return false; } }
Source:
<code>@Test void testJoinWithHints() { final RelHint noHashJoinHint = RelHint.builder("NO_HASH_JOIN").build(); final RelBuilder builder = RelBuilder.create(config().build()); final RelNode original = builder.scan("EMP") .scan("DEPT") <START> .join(JoinRelType.INNER, <END> builder.equals( builder.field(2, 0, "DEPTNO"), builder.field(2, 1, "DEPTNO"))) .hints(noHashJoinHint) .project( builder.field("ENAME"), builder.field("DNAME")) .build(); final RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder); final RelNode trimmed = fieldTrimmer.trim(original); final String expected = "" + "LogicalProject(ENAME=[$1], DNAME=[$4])\n" + " LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n" + " LogicalProject(EMPNO=[$0], ENAME=[$1], DEPTNO=[$7])\n" + " LogicalTableScan(table=[[scott, EMP]])\n" + " LogicalProject(DEPTNO=[$0], DNAME=[$1])\n" + " LogicalTableScan(table=[[scott, DEPT]])\n"; assertThat(trimmed, hasTree(expected)); assertTrue(original.getInput(0) instanceof Join); final Join originalJoin = (Join) original.getInput(0); assertTrue(originalJoin.getHints().contains(noHashJoinHint)); assertTrue(trimmed.getInput(0) instanceof Join); final Join join = (Join) trimmed.getInput(0); assertTrue(join.getHints().contains(noHashJoinHint)); }</code><technical_language>promote RelBuilder#hints i in JIRA</technical_language>

Target:
@Test void testJoinWithHints() { final RelHint noHashJoinHint = RelHint.builder("no_hash_join").build(); final RelBuilder builder = RelBuilder.create(config().build()); builder.getCluster().setHintStrategies( HintStrategyTable.builder() .hintStrategy("no_hash_join", HintPredicates.JOIN) .build()); final RelNode original = builder.scan("EMP") .scan("DEPT") .join(JoinRelType.INNER, builder.equals( builder.field(2, 0, "DEPTNO"), builder.field(2, 1, "DEPTNO"))) .hints(noHashJoinHint) .project( builder.field("ENAME"), builder.field("DNAME")) .build(); final RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder); final RelNode trimmed = fieldTrimmer.trim(original); final String expected = "" + "LogicalProject(ENAME=[$1], DNAME=[$4])\n" + " LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n" + " LogicalProject(EMPNO=[$0], ENAME=[$1], DEPTNO=[$7])\n" + " LogicalTableScan(table=[[scott, EMP]])\n" + " LogicalProject(DEPTNO=[$0], DNAME=[$1])\n" + " LogicalTableScan(table=[[scott, DEPT]])\n"; assertThat(trimmed, hasTree(expected)); assertTrue(original.getInput(0) instanceof Join); final Join originalJoin = (Join) original.getInput(0); assertTrue(originalJoin.getHints().contains(noHashJoinHint)); assertTrue(trimmed.getInput(0) instanceof Join); final Join join = (Join) trimmed.getInput(0); assertTrue(join.getHints().contains(noHashJoinHint)); }
Source:
<code>public void removeBotForce(int x) { <START> BotForce botToRemove = botForces.get(x); <END> botForceTemplates.remove(botToRemove); super.removeBotForce(x); }</code><technical_language>want validate x (is this ID index?) and/or botToRemove</technical_language>

Target:
public void removeBotForce(int x) { if((x >= 0) && (x < botForces.size())) { BotForce botToRemove = botForces.get(x); botForceTemplates.remove(botToRemove); } super.removeBotForce(x); }
Source:
<code>private void printStatistics() { final String messagePrefix; if (isPutCommand) { messagePrefix = "Putting"; } else { messagePrefix = "Getting"; } <START> System.out.print(String.format("\r%s Statistics: (%d/%d MB), files (%d/%d), Time (%.03f sec), MBps (%.03f), Highest MBps (%.03f sec)", <END> messagePrefix, content, numberOfMB, numberOfFiles, totalNumberOfFiles, time, mbps, highestMbps)); }</code><technical_language>Highest MBps need sec is printed</technical_language>

Target:
private void printStatistics() { final String messagePrefix; if (isPutCommand) { messagePrefix = "Putting"; } else { messagePrefix = "Getting"; } System.out.print(String.format("\r%s Statistics: (%d/%d MB), files (%d/%d), Time (%.03f sec), MBps (%.03f), Highest MBps (%.03f)", messagePrefix, content, numberOfMB, numberOfFiles, totalNumberOfFiles, time, mbps, highestMbps)); }
Source:
<code><START> public ITmfStateSystem getStateSystem() { <END> return fSS; }</code><technical_language>public @NonNull ITmfStateSystem (that's new quick-fix in Luna puts it, more sense overall)</technical_language>

Target:
public @NonNull ITmfStateSystem getStateSystem() { return fSS; }
Source:
<code>public RTPEncodingDesc( MediaStreamTrackDesc track, long primarySSRC, long rtxSSRC) { <START> this(track, 0, primarySSRC, rtxSSRC, -1 , <END> -1 , -1 , null ); }</code><technical_language>if -1 is base/invalid resolution, i a constant nice</technical_language>

Target:
public RTPEncodingDesc( MediaStreamTrackDesc track, long primarySSRC, long rtxSSRC) { this(track, 0, primarySSRC, rtxSSRC, NO_HEIGHT , -1 , -1 , null ); }
Source:
<code>private DashboardData buildDashboardData(String baseRequestId) { LOGGER.info("build dashboard data for {}", baseRequestId); DashboardData data = new DashboardData(); PreparedStatement pst = null; ResultSet rs = null; try { pst = db.getConnection().prepareStatement(RESPONSE_QUERY); pst.setString(1, "%" + baseRequestId + "%"); rs = pst.executeQuery(); while (rs.next()) { String requestId = rs.getString(1); String requestDate = rs.getString(2); String response = naivelyFormatXML(rs.getString(3)); if (requestId.endsWith("OUTPUT")) { <START> LOGGER.info("setting outputXML {}", response); <END> data.setOutputXML(response); data.setCompletedTimestamp(requestDate); } else if (requestId.startsWith("REQ_")) { LOGGER.info("setting requestXML {}", response); data.setRequestXML(response); } else { LOGGER.info("setting responseXML {}", response); data.setResponseXML(response); } } } catch (SQLException ex) { LOGGER.error("failed to select responses for request ids like " + baseRequestId, ex); } finally { closeStatement(pst); closeResultSet(rs); } return data; }</code><technical_language>consider making this a debug statement. logging set INFO default, this fill logs fast</technical_language>

Target:
private DashboardData buildDashboardData(String baseRequestId) { LOGGER.debug("build dashboard data for {}", baseRequestId); DashboardData data = new DashboardData(); PreparedStatement pst = null; ResultSet rs = null; try { pst = db.getConnection().prepareStatement(RESPONSE_QUERY); pst.setString(1, "%" + baseRequestId + "%"); rs = pst.executeQuery(); while (rs.next()) { String requestId = rs.getString(1); String requestDate = rs.getString(2); String response = rs.getString(3); if (requestId.endsWith("OUTPUT")) { LOGGER.debug("setting outputXML {}", response); data.setOutputXML(response); data.setCompletedTimestamp(requestDate); } else if (requestId.startsWith("REQ_")) { LOGGER.debug("setting requestXML {}", response); data.setRequestXML(response); } else { LOGGER.debug("setting responseXML {}", response); data.setResponseXML(response); } } } catch (SQLException ex) { LOGGER.error("failed to select responses for request ids like " + baseRequestId, ex); } finally { closeStatement(pst); closeResultSet(rs); } return data; }
Source:
<code>protected void endSuccessfullySynchronous() { VM vm = getVm(); <START> if (vm != null) { <END> VmHandler.UnLockVm(vm.getId()); this.endDefaultOps(vm); setSucceeded(true); } else { setCommandShouldBeLogged(false); log.warn("ExportVmCommand::EndSuccessfullySynchronous: Vm is null - not performing full EndAction"); } }</code><technical_language>if vm null, is checked in CDA</technical_language>

Target:
protected void endSuccessfullySynchronous() { VM vm = getVm(); VmHandler.UnLockVm(vm.getId()); this.endDefaultOps(vm); setSucceeded(true); }
Source:
<code><START> protected TextBuilder(Text text) { <END> checkNotNull(text, "text"); this.color = text.color; this.style = text.style; this.children = Lists.newArrayList(text.children); this.clickAction = text.clickAction.orNull(); this.hoverAction = text.hoverAction.orNull(); this.shiftClickAction = text.shiftClickAction.orNull(); }</code><technical_language>is Text.builder() for this, I guess a big problem this public.</technical_language>

Target:
public TextBuilder(Text text) { checkNotNull(text, "text"); this.color = text.color; this.style = text.style; this.children = Lists.newArrayList(text.children); this.clickAction = text.clickAction.orNull(); this.hoverAction = text.hoverAction.orNull(); this.shiftClickAction = text.shiftClickAction.orNull(); }
Source:
<code>public Blob watermarkWithImage(Blob inBlob, int x, int y, float scale) throws NuxeoException { Blob result = null; PDDocument pdfDoc = null; PDPageContentStream contentStream = null; scale = (scale <= 0f) ? 1.0f : scale; <START> try { <END> BufferedImage tmp_image = ImageIO.read(inBlob.getStream()); pdfDoc = PDDocument.load(blob.getStream()); PDXObjectImage ximage = new PDPixelMap(pdfDoc, tmp_image); List allPages = pdfDoc.getDocumentCatalog().getAllPages(); for (Object allPage : allPages) { PDPage page = (PDPage) allPage; contentStream = new PDPageContentStream(pdfDoc, page, true, true); contentStream.endMarkedContentSequence(); contentStream.drawXObject(ximage, x, y, ximage.getWidth() * scale, ximage.getHeight() * scale); contentStream.close(); contentStream = null; } result = PDFUtils.saveInTempFile(pdfDoc); } catch (IOException | COSVisitorException e) { throw new NuxeoException(e); } finally { if (contentStream != null) { try { contentStream.close(); } catch (IOException e) { } } PDFUtils.closeSilently(pdfDoc); } return result; }</code><technical_language>try resource</technical_language>

Target:
public Blob watermarkWithImage(Blob inBlob, int x, int y, float scale) throws NuxeoException { Blob result; PDPageContentStream contentStream; scale = (scale <= 0f) ? 1.0f : scale; try (PDDocument pdfDoc = PDDocument.load(blob.getStream())) { BufferedImage tmp_image = ImageIO.read(inBlob.getStream()); PDXObjectImage ximage = new PDPixelMap(pdfDoc, tmp_image); List allPages = pdfDoc.getDocumentCatalog().getAllPages(); for (Object allPage : allPages) { PDPage page = (PDPage) allPage; contentStream = new PDPageContentStream(pdfDoc, page, true, true); contentStream.endMarkedContentSequence(); contentStream.drawXObject(ximage, x, y, ximage.getWidth() * scale, ximage.getHeight() * scale); contentStream.close(); } result = PDFUtils.saveInTempFile(pdfDoc); } catch (IOException | COSVisitorException e) { throw new NuxeoException(e); } return result; }
Source:
<code>private void updateChargers() { WirelessChargerController wcc = WirelessChargerController.instance; chargers.clear(); lastChangeCount = wcc.getChangeCount(); final BlockCoord bc = new BlockCoord(te); wcc.getChargers(te.getWorldObj(), bc, chargers); Collections.sort(chargers, new Comparator<IWirelessCharger>() { @Override public int compare(IWirelessCharger o1, IWirelessCharger o2) { int dist1 = o1.getLocation().distance(bc); <START> int dist2 = o2.getLocation().distance(bc); <END> return dist1 - dist2; } }); }</code><technical_language>actual distance is irrelevant, this distanceSq save performance</technical_language>

Target:
private void updateChargers() { WirelessChargerController wcc = WirelessChargerController.instance; chargers.clear(); lastChangeCount = wcc.getChangeCount(); final BlockCoord bc = new BlockCoord(te); wcc.getChargers(te.getWorldObj(), bc, chargers); Collections.sort(chargers, new Comparator<IWirelessCharger>() { @Override public int compare(IWirelessCharger o1, IWirelessCharger o2) { int dist1 = o1.getLocation().distanceSquared(bc); int dist2 = o2.getLocation().distanceSquared(bc); return dist1 - dist2; } }); }
Source:
<code>public void testGetAllForVMFilteredWithPermissions() { <START> List<DiskImage> disks = dao.getAllForVm(EXISTING_VM_ID, PRIVILEGED_USER_ID, true); <END> assertEquals("VM should have two disks", 2, disks.size()); }</code><technical_language>In general extract this repetitive code "run & check" private method parameters, test send correct parameters</technical_language>

Target:
public void testGetAllForVMFilteredWithPermissions() { List<DiskImage> disks = dao.getAllForVm(EXISTING_VM_ID, PRIVILEGED_USER_ID, true); assertFullGetAllForVMResult(disks); }
Source:
<code><START> public List<RichGroup> getAllRichGroupsWithAttributesByNames(PerunSession sess, Vo vo, List<String> attrNames)throws InternalErrorException, VoNotExistsException{ <END> Utils.checkPerunSession(sess); this.getPerunBl().getVosManagerBl().checkVoExists(sess, vo); return this.getGroupsManagerBl().getAllRichGroupsWithAttributesByNames(sess, vo, attrNames); }</code><technical_language>methods newline please. is for human reading</technical_language>

Target:
public List<RichGroup> getAllRichGroupsWithAttributesByNames(PerunSession sess, Vo vo, List<String> attrNames) throws InternalErrorException, VoNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); this.getPerunBl().getVosManagerBl().checkVoExists(sess, vo); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.VOOBSERVER, vo) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN)) { throw new PrivilegeException(sess, "getAllRichGroupsWithAttributesByNames"); } List<RichGroup> richGroups = getGroupsManagerBl().getAllRichGroupsWithAttributesByNames(sess, vo, attrNames); if (AuthzResolver.hasRole(sess.getPerunPrincipal(), Role.GROUPADMIN)) { Iterator<RichGroup> i = richGroups.iterator(); while (i.hasNext()) { if (!AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, i.next())) { i.remove(); } } } return getGroupsManagerBl().filterOnlyAllowedAttributes(sess, richGroups); }
Source:
<code><START> private void updateRelevantVms() { <END> List<VM> vms = getVmsDiskPluggedTo(); for (VM vm : vms) { if (vm.getStatus().isUpOrPaused() || vms.size() == 1) { try { VDSReturnValue ret = extendVmDiskSize(vm, getParameters().getNewSize()); if (!ret.getSucceeded()) { updateAuditLogFailedToUpdateVM(vm.getName()); } } catch (VdcBLLException e) { log.warnFormat("Failed to update VM '{0}' with the new volume size due to error: {1}." + "VM should be restarted to detect the new size.", vm.getName(), ExceptionUtils.getMessage(e)); updateAuditLogFailedToUpdateVM(vm.getName()); } } } }</code><technical_language>I get this method, is disk plugged VM moment? if more 1 vm disk is plugged DOWN? executed.. need sync qcow header metadata then? clear</technical_language>

Target:
private void updateRelevantVms() { List<VM> vms = getVmsDiskPluggedTo(); for (VM vm : vms) { try { VDSReturnValue ret = extendVmDiskSize(vm, getParameters().getNewSize()); if (!ret.getSucceeded()) { updateAuditLogFailedToUpdateVM(vm.getName()); } } catch (VdcBLLException e) { log.warnFormat("Failed to update VM '{0}' with the new volume size due to error: {1}." + "VM should be restarted to detect the new size.", vm.getName(), ExceptionUtils.getMessage(e)); updateAuditLogFailedToUpdateVM(vm.getName()); } } }
Source:
<code>private ClassLoaderLookupPolicy getApplicationClassLoaderLookupPolicy(ArtifactClassLoader parent, DomainDescriptor descriptor) { <START> final Map<String, LookupStrategy> pluginsLookupStrategies = new SmallMap<>(); <END> for (ArtifactPluginDescriptor artifactPluginDescriptor : descriptor.getPlugins()) { artifactPluginDescriptor.getClassLoaderModel().getExportedPackages() .forEach(p -> pluginsLookupStrategies.put(p, PARENT_FIRST)); } return parent.getClassLoaderLookupPolicy().extend(pluginsLookupStrategies); }</code><technical_language>hell</technical_language>

Target:
private ClassLoaderLookupPolicy getApplicationClassLoaderLookupPolicy(ArtifactClassLoader parent, DomainDescriptor descriptor) { final Map<String, LookupStrategy> pluginsLookupStrategies = new HashMap<>(); for (ArtifactPluginDescriptor artifactPluginDescriptor : descriptor.getPlugins()) { artifactPluginDescriptor.getClassLoaderModel().getExportedPackages() .forEach(p -> pluginsLookupStrategies.put(p, PARENT_FIRST)); } return parent.getClassLoaderLookupPolicy().extend(pluginsLookupStrategies); }
Source:
<code>public void updateModel(final @Nullable ISegmentStore<ISegment> dataInput) { final TableViewer tableViewer = getTableViewer(); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (!tableViewer.getTable().isDisposed()) { tableViewer.getTable().setTopIndex(0); tableViewer.setSelection(StructuredSelection.EMPTY); if (dataInput == null) { tableViewer.setInput(null); tableViewer.setItemCount(0); return; } tableViewer.setInput(dataInput); SegmentStoreContentProvider contentProvider = (SegmentStoreContentProvider) getTableViewer().getContentProvider(); tableViewer.setItemCount(contentProvider.getSegmentCount()); <START> addPackListener(); <END> } } }); }</code><technical_language>this done set input? miss SWT.SetData if another thread UI thread</technical_language>

Target:
public void updateModel(final @Nullable ISegmentStore<ISegment> dataInput) { final TableViewer tableViewer = getTableViewer(); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (!tableViewer.getTable().isDisposed()) { tableViewer.getTable().setTopIndex(0); tableViewer.setSelection(StructuredSelection.EMPTY); if (dataInput == null) { tableViewer.setInput(null); tableViewer.setItemCount(0); return; } addPackListener(); tableViewer.setInput(dataInput); SegmentStoreContentProvider contentProvider = (SegmentStoreContentProvider) getTableViewer().getContentProvider(); tableViewer.setItemCount(contentProvider.getSegmentCount()); } } }); }
Source:
<code>private void handleTabOffset(byte cc2) { if (captionStringBuilder.length() == 0) { <START> switch (cc2) { <END> case CTRL_TAB_OFFSET_1: tabOffset++; break; case CTRL_TAB_OFFSET_2: tabOffset += 2; break; case CTRL_TAB_OFFSET_3: tabOffset += 3; break; } } }</code><technical_language>This entire block simplified a single line: tabOffset = cc2 - 0x20;</technical_language>

Target:
private void handleTabOffset(byte cc2) { currentCue.tab(cc2 - 0x20); }
Source:
<code>public boolean onBlockDestroyed(ItemStack stack, World worldIn, BlockState state, BlockPos pos, LivingEntity entityLiving) { <START> if((state.getBlock() instanceof CropsBlock && ((CropsBlock) state.getBlock()).isMaxAge(state)) || state.getBlock() instanceof PumpkinBlock) <END> { CropsBlock.spawnDrops(state,worldIn,pos); } return super.onBlockDestroyed(stack, worldIn, state, pos, entityLiving); }</code><technical_language>this pumpkins easily duplicated</technical_language>

Target:
public boolean onBlockDestroyed(ItemStack stack, World worldIn, BlockState state, BlockPos pos, LivingEntity entityLiving) { if((state.getBlock() instanceof CropsBlock && ((CropsBlock) state.getBlock()).isMaxAge(state))) { CropsBlock.spawnDrops(state,worldIn,pos); } return super.onBlockDestroyed(stack, worldIn, state, pos, entityLiving); }
Source:
<code>public boolean tryAdvance(Consumer<? super Map<Address, CacheEntry<K, V>>> action) { while (!iterator.hasNext()) { if (nextSegment < totalSegments) { try { if (trace) log.tracef("Attempting to receive all replicas for segment %s with topology %s", nextSegment, topology); List<Map<Address, CacheEntry<K, V>>> segmentEntries = stateReceiver.getAllReplicasForSegment(nextSegment, topology).get(); if (trace && !segmentEntries.isEmpty()) log.tracef("Segment %s entries received: %s", nextSegment, segmentEntries); iterator = segmentEntries.iterator(); nextSegment++; } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new CacheException(e); } catch (ExecutionException | CancellationException e) { stateReceiver.stop(); throw new CacheException(e.getMessage(), e.getCause()); } } else { return false; <START> } <END> } action.accept(iterator.next()); return true; }</code><technical_language>staterReceiver.stop(), too</technical_language>

Target:
public boolean tryAdvance(Consumer<? super Map<Address, CacheEntry<K, V>>> action) { while (!iterator.hasNext()) { if (nextSegment < totalSegments) { try { if (trace) log.tracef("Attempting to receive all replicas for segment %s with topology %s", nextSegment, topology); List<Map<Address, CacheEntry<K, V>>> segmentEntries = stateReceiver.getAllReplicasForSegment(nextSegment, topology).get(); if (trace && !segmentEntries.isEmpty()) log.tracef("Segment %s entries received: %s", nextSegment, segmentEntries); iterator = segmentEntries.iterator(); nextSegment++; } catch (InterruptedException e) { stateReceiver.stop(); Thread.currentThread().interrupt(); throw new CacheException(e); } catch (ExecutionException | CancellationException e) { stateReceiver.stop(); throw new CacheException(e.getMessage(), e.getCause()); } } else { streamInProgress.compareAndSet(true, false); return false; } } action.accept(iterator.next()); return true; }
Source:
<code>public static boolean isAdminUser(DbUser user) { List<Role> userRoles = <START> getRoleDAO().getAnyAdminRoleForUserAndGroups(user.getId(), StringUtils.join(user.getGroupIds(), ",")); <END> if (userRoles.size() > 0) { log.debug("LoginAdminUser: User logged to admin using role '{}'", userRoles.get(0).getname()); return true; } return false; }</code><technical_language>Please move conversion List comma separated string DAO. IMHO type conversion moment places needed</technical_language>

Target:
public static boolean isAdminUser(DbUser user) { List<Role> userRoles = getRoleDAO().getAnyAdminRoleForUserAndGroups(user.getId(), StringUtils.join(user.getGroupIds(), ",")); if (!userRoles.isEmpty()) { log.debug("LoginAdminUser: User logged to admin using role '{}'", userRoles.get(0).getname()); return true; } return false; }
Source:
<code>public void onLocationChangedSlightly(fr.free.nrw.commons.location.LatLng latLng) { <START> Timber.d("Location significantly changed"); <END> if (isMapBoxReady && latLng != null &&!isUserBrowsing()) { handleLocationUpdate(latLng,LOCATION_SLIGHTLY_CHANGED); } }</code><technical_language>this log is in keeping name of this method, is happening here? Slightly significantly</technical_language>

Target:
public void onLocationChangedSlightly(fr.free.nrw.commons.location.LatLng latLng) { Timber.d("Location slightly changed"); if (isMapBoxReady && latLng != null &&!isUserBrowsing()) { handleLocationUpdate(latLng,LOCATION_SLIGHTLY_CHANGED); } }
Source:
<code>public MicroProfileReactiveMessagingSubsystemDefinition() { super( new SimpleResourceDefinition.Parameters( SUBSYSTEM_PATH, MicroProfileReactiveMessagingExtension.getResourceDescriptionResolver(SUBSYSTEM_NAME)) .setAddHandler(AddHandler.INSTANCE) <START> .setRemoveHandler(new ModelOnlyRemoveStepHandler()) <END> .setCapabilities(REACTIVE_STREAMS_OPERATORS_CAPABILITY) ); }</code><technical_language>I this ReloadRequiredRemoveStepHandler. add handler adds DUPs a remove requires a reload</technical_language>

Target:
public MicroProfileReactiveMessagingSubsystemDefinition() { super( new SimpleResourceDefinition.Parameters( SUBSYSTEM_PATH, MicroProfileReactiveMessagingExtension.getResourceDescriptionResolver(SUBSYSTEM_NAME)) .setAddHandler(AddHandler.INSTANCE) .setRemoveHandler(new ReloadRequiredRemoveStepHandler()) .setCapabilities(REACTIVE_STREAMS_OPERATORS_CAPABILITY) ); }
Source:
<code>public List<StructuredViewer> getViewers() { List<StructuredViewer> viewers = new ArrayList<StructuredViewer>(); ISearchResultPage page = getCurrentPage(); if (page instanceof AbstractTextSearchViewPage) { try { <START> Method getViewer = page.getClass().getDeclaredMethod("getViewer"); END> getViewer.setAccessible(true); StructuredViewer viewer = (StructuredViewer) getViewer.invoke(page); viewers.add(viewer); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { } } return viewers; }</code><technical_language>this work for pages implement getViewer. call AbstractTextSearchView.class.getDeclaredMethod("getViewer") instead work want</technical_language>

Target:
public List<StructuredViewer> getViewers() { List<StructuredViewer> viewers = new ArrayList<StructuredViewer>(); ISearchResultPage page = getCurrentPage(); if (page instanceof AbstractTextSearchViewPage) { try { Method getViewer = AbstractTextSearchViewPage.class.getDeclaredMethod("getViewer"); getViewer.setAccessible(true); StructuredViewer viewer = (StructuredViewer) getViewer.invoke(page); viewers.add(viewer); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { } } return viewers; }
Source:
<code>protected void onInit() throws Exception { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory()); <START> this.evaluationContext.setTypeConverter(new StandardTypeConverter(new DefaultConversionService())); <END> if (this.mongoTemplate == null) { this.mongoTemplate = new MongoTemplate(this.mongoDbFactory, this.mongoConverter); } this.initialized = true; }</code><technical_language>No, this good. this lose customization provided common shared config for EvaluationContext. hurt evaluate Object check supported String BasicQuery types. of convert String appropriately. pursue compatibility flexibility. Thank for update way! a tomorrow closely. Right, pretty backport feature 4.3.x</technical_language>

Target:
protected void onInit() throws Exception { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory()); TypeLocator typeLocator = this.evaluationContext.getTypeLocator(); if (typeLocator instanceof StandardTypeLocator) { ((StandardTypeLocator) typeLocator).registerImport("org.springframework.data.mongodb.core.query"); } if (this.mongoTemplate == null) { this.mongoTemplate = new MongoTemplate(this.mongoDbFactory, this.mongoConverter); } this.initialized = true; }
Source:
<code>public void clockSkew(String server, long skew) { if (skew > WARN_SKEW_THRESHOLD_NANOS && skew < ERROR_SKEW_THRESHOLD_NANOS) { log.warn("Skew (in nanos) greater than expected", skew); } else if (skew >= ERROR_SKEW_THRESHOLD_NANOS) { log.error("Skew (in nanos) much greater than expected", skew); } <START> metricRegistry.histogram(String.format("clock-skew-%s-histogram", server)) <END> .update(skew); metricRegistry.counter(String.format("clock-skew-%s-counter", server)).inc(); }</code><technical_language>hmm, i if care distinguishing server. easier metrics graph. do think</technical_language>

Target:
public void clockSkew(String server, long skew) { if (skew > WARN_SKEW_THRESHOLD_NANOS && skew < ERROR_SKEW_THRESHOLD_NANOS) { log.warn("Skew (in nanos) greater than expected on server {}", SafeArg.of("skew", skew), SafeArg.of("server", server)); } else if (skew >= ERROR_SKEW_THRESHOLD_NANOS) { log.error("Skew (in nanos) much greater than expected on server {}", SafeArg.of("skew", skew), SafeArg.of("server", server)); } metricRegistry.histogram("clock-skew").update(skew); }