auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public static Boolean getBriefcaseTrackingConsentProperty() { <END> return Boolean.valueOf( Preference.APPLICATION_SCOPED.get(BriefcasePreferences.BRIEFCASE_TRACKING_CONSENT_PROPERTY, Boolean.FALSE.toString()) ); }</code><technical_language>This return boolean (primitive, reference). need complicate return type suggesting null</technical_language>

Target:
public static boolean getBriefcaseTrackingConsentProperty() { return Boolean.valueOf( Preference.APPLICATION_SCOPED.get(BriefcasePreferences.BRIEFCASE_TRACKING_CONSENT_PROPERTY, Boolean.FALSE.toString()) ).booleanValue(); }
Source:
<code><START> public BuildResult build( final Project project ) { <END> return oldBehaviour(project); }</code><technical_language>dicussed early today.. changes in this class removed PR</technical_language>

Target:
public BuildResult build( final Project project ) { try { cache.invalidateCache( project ); Builder builder = cache.assertBuilder( project ); final BuildResults results = builder.build( ); BuildMessage infoMsg = new BuildMessage( ); infoMsg.setLevel( Level.INFO ); infoMsg.setText( buildResultMessage( project, results ).toString( ) ); results.addBuildMessage( 0, infoMsg ); return new BuildResult( builder, results ); } catch ( Exception e ) { logger.error( e.getMessage( ), e ); return new BuildResult( null, buildExceptionResults( e, project.getPom( ).getGav( ) ) ); } }
Source:
<code>private static boolean shouldServiceVersionBeTested(SecretServiceVersion serviceVersion) { if (Configuration.getGlobalConfiguration().get(AZURE_TEST_SERVICE_VERSIONS) == null) { return SecretServiceVersion.getLatest().equals(serviceVersion); } <START> return true; <END> }</code><technical_language>check env variable returning true</technical_language>

Target:
private static boolean shouldServiceVersionBeTested(SecretServiceVersion serviceVersion) { if (CoreUtils.isNullOrEmpty(SERVICE_VERSION_FROM_ENV)) { return SecretServiceVersion.getLatest().equals(serviceVersion); } if (AZURE_TEST_SERVICE_VERSIONS_VALUE_ALL.equalsIgnoreCase(SERVICE_VERSION_FROM_ENV)) { return true; } String[] configuredServiceVersionList = SERVICE_VERSION_FROM_ENV.split(","); return Arrays.stream(configuredServiceVersionList).anyMatch(configuredServiceVersion -> serviceVersion.toString().equals(configuredServiceVersion.trim())); }
Source:
<code>private InterpreterResult runWithOutput(String code, InterpreterOutput out) { this.out.setInterpreterOutput(out); PrintStream oldOut = System.out; PrintStream newOut = (out != null) ? new PrintStream(out) : null; System.setOut(newOut); InterpreterResult res = interpreter.eval(code); <START> System.setOut(oldOut); <END> return res; }</code><technical_language>in try catch finally</technical_language>

Target:
private InterpreterResult runWithOutput(String code, InterpreterOutput out) { this.out.setInterpreterOutput(out); PrintStream oldOut = System.out; PrintStream newOut = (out != null) ? new PrintStream(out) : null; try { System.setOut(newOut); return interpreter.eval(code); } finally { System.setOut(oldOut); } }
Source:
<code><START> public static String genOutputStringForTest(String filePath, int line, String classification, String msg) { <END> return filePath + ":" + line + ": " + classification + ": " + msg; }</code><technical_language>ViolationMessage for test methods</technical_language>

Target:
public static String genOutputStringForTest(String filePath, int line, String classification, String msg) { return new ViolationMessage(filePath, line, 0, classification, msg).toString(); }
Source:
<code>public void reportIssue(JavaCheck javaCheck, Tree syntaxNode, String message, List<Location> secondary, @Nullable Integer cost) { <START> throwIfCrossFileScanner(javaCheck); <END> List<List<Location>> flows = secondary.stream().map(Collections::singletonList).collect(Collectors.toList()); reportIssueWithFlow(javaCheck, syntaxNode, message, flows, cost); }</code><technical_language>I throwing everywhere, of reportIssue message calling line 123/127</technical_language>

Target:
public void reportIssue(JavaCheck javaCheck, Tree syntaxNode, String message, List<Location> secondary, @Nullable Integer cost) { List<List<Location>> flows = secondary.stream().map(Collections::singletonList).collect(Collectors.toList()); reportIssueWithFlow(javaCheck, syntaxNode, message, flows, cost); }
Source:
<code>if (s2 == null) return -1; CacheTopology t1 = s1.getCacheTopology(); CacheTopology t2 = s2.getCacheTopology(); int topologyId = ((Integer)t1.getTopologyId()).compareTo(t2.getTopologyId()); if (topologyId != 0) return topologyId; <START> String rt1 = t1.getCurrentCH().getRoutingTableAsString(); <END> String rt2 = t2.getCurrentCH().getRoutingTableAsString(); return rt1.compareTo(rt2); }; private static final Log log = LogFactory.getLog(PreferAvailabilityStrategy.class); private final EventLogManager eventLogManager; private final PersistentUUIDManager persistentUUIDManager; private final boolean resolveConflictsOnMerge; public PreferAvailabilityStrategy(EventLogManager eventLogManager, PersistentUUIDManager persistentUUIDManager, boolean resolveConflictsOnMerge) { this.eventLogManager = eventLogManager; this.persistentUUIDManager = persistentUUIDManager; this.resolveConflictsOnMerge = resolveConflictsOnMerge; }</code><technical_language>getRoutingTableAsString is for debugging/logging</technical_language>

Target:
if (s2 == null) return -1; CacheTopology t1 = s1.getCacheTopology(); CacheTopology t2 = s2.getCacheTopology(); int topologyId = ((Integer)t1.getTopologyId()).compareTo(t2.getTopologyId()); if (topologyId != 0) return topologyId; int rebalanceId = ((Integer)t1.getRebalanceId()).compareTo(t2.getRebalanceId()); if (rebalanceId != 0) return topologyId; List<Address> m1 = t1.getMembers(); List<Address> m2 = t2.getMembers(); if (m1.size() == m2.size()) { int compareAddress = m1.get(0).compareTo(m2.get(0)); if (compareAddress == 0) return ((Integer)t1.hashCode()).compareTo(t2.hashCode()); }
Source:
<code>public int getLineIndex(int y) { checkWidget(); y -= topMargin; if (isFixedLineHeight()) { int lineHeight = renderer.getLineHeight(); int lineIndex = (y + getVerticalScrollOffset()) / lineHeight; int lineCount = content.getLineCount(); lineIndex = Math.max(0, Math.min(lineCount - 1, lineIndex)); return lineIndex; } if (y == topIndexY) return topIndex; int line = topIndex; if (y < topIndexY) { while (y < topIndexY && line > 0) { y += renderer.getCachedLineHeight(--line); } } else { int lineCount = content.getLineCount(); int lineHeight = renderer.getLineHeight(line); while (y - lineHeight >= topIndexY && line < lineCount - 1) { y -= lineHeight; <START> lineHeight = renderer.getCachedLineHeight(++line); <END> } } return line; }</code><technical_language>thing, public API return incorrect values</technical_language>

Target:
public int getLineIndex(int y) { checkWidget(); y -= topMargin; if (isFixedLineHeight()) { int lineHeight = renderer.getLineHeight(); int lineIndex = (y + getVerticalScrollOffset()) / lineHeight; int lineCount = content.getLineCount(); lineIndex = Math.max(0, Math.min(lineCount - 1, lineIndex)); return lineIndex; } if (y == topIndexY) return topIndex; int line = topIndex; if (y < topIndexY) { while (y < topIndexY && line > 0) { y += renderer.getLineHeight(--line); } } else { int lineCount = content.getLineCount(); int lineHeight = renderer.getLineHeight(line); while (y - lineHeight >= topIndexY && line < lineCount - 1) { y -= lineHeight; lineHeight = renderer.getLineHeight(++line); } } return line; }
Source:
<code>public Object caseEnumeration(Enumeration enumeration) { org.eclipse.uml2.uml.Package package_ = enumeration .getNearestPackage(); if (package_ != null) { EEnum eEnum = EcoreFactory.eINSTANCE.createEEnum(); elementToEModelElementMap.put(enumeration, eEnum); EPackage ePackage = (EPackage) doSwitch(package_); ePackage.getEClassifiers().add(eEnum); setName(eEnum, enumeration); if (options != null && OPTION__PROCESS .equals(options.get(OPTION__NULLABLE_ENUM_ATTRIBUTES))) { EDataType enumType = EcoreFactory.eINSTANCE.createEDataType(); enumToDataType.put(eEnum, enumType); ePackage.getEClassifiers().add(enumType); enumType.setName(eEnum.getName()+"_Optional"); UML2Util.getEAnnotation( enumType, UMLUtil.UML2_UML_PACKAGE_2_0_NS_URI, <START> true).getReferences().add(enumeration); <END> enumType.setInstanceTypeName(Enumerator.class.getName()); ExtendedMetaData.INSTANCE.setBaseType(enumType, eEnum); } defaultCase(enumeration); return eEnum; } return super.caseEnumeration(enumeration); }</code><technical_language>add reference UML element</technical_language>

Target:
public Object caseEnumeration(Enumeration enumeration) { org.eclipse.uml2.uml.Package package_ = enumeration .getNearestPackage(); if (package_ != null) { EEnum eEnum = EcoreFactory.eINSTANCE.createEEnum(); elementToEModelElementMap.put(enumeration, eEnum); EPackage ePackage = (EPackage) doSwitch(package_); ePackage.getEClassifiers().add(eEnum); setName(eEnum, enumeration); if (options != null && OPTION__PROCESS .equals(options.get(OPTION__NULLABLE_ENUM_ATTRIBUTES))) { EDataType enumType = EcoreFactory.eINSTANCE.createEDataType(); enumToDataType.put(eEnum, enumType); ePackage.getEClassifiers().add(enumType); enumType.setName(eEnum.getName()+"_Optional"); enumType.setInstanceTypeName(Enumerator.class.getName()); ExtendedMetaData.INSTANCE.setBaseType(enumType, eEnum); } defaultCase(enumeration); return eEnum; } return super.caseEnumeration(enumeration); }
Source:
<code><START> public void optionsChanged(OptionsParam optionsParam) { <END> this.restartServer(); }</code><technical_language>This listener is added ZAP</technical_language>

Target:
public void optionsChanged(OptionsParam optionsParam) { if (!currentConfigLocalAddress.equals(this.getCallbackParam() .getLocalAddress()) || currentConfigPort != this.getCallbackParam().getPort()) { int port = actualPort; if (currentConfigPort != this.getCallbackParam().getPort()) { port = this.getCallbackParam().getPort(); } this.restartServer(port); currentConfigLocalAddress = this.getCallbackParam() .getLocalAddress(); currentConfigPort = this.getCallbackParam().getPort(); } }
Source:
<code>public static CloudBigtableScanConfiguration BuildExportConfig(ExportOptions opts) { ValueProvider<ReadRowsRequest> request = new RequestWithScanValueProvider( opts.getBigtableStartRow(), opts.getBigtableStopRow(), opts.getBigtableMaxVersions(), opts.getBigtableFilter()); CloudBigtableScanConfiguration.Builder configBuilder = new CloudBigtableScanConfiguration.Builder() .withProjectId(opts.getBigtableProject()) .withInstanceId(opts.getBigtableInstanceId()) .withTableId(opts.getBigtableTableId()) .withRequest(request); <START> if (opts.getBigtableAppProfileId() != null) { <END> configBuilder.withAppProfileId(opts.getBigtableAppProfileId()); } return configBuilder.build(); }</code><technical_language>app profile id is a provider, null check sense</technical_language>

Target:
public static CloudBigtableScanConfiguration BuildExportConfig(ExportOptions opts) { ValueProvider<ReadRowsRequest> request = new RequestValueProvider( opts.getBigtableStartRow(), opts.getBigtableStopRow(), opts.getBigtableMaxVersions(), opts.getBigtableFilter()); CloudBigtableScanConfiguration.Builder configBuilder = new CloudBigtableScanConfiguration.Builder() .withProjectId(opts.getBigtableProject()) .withInstanceId(opts.getBigtableInstanceId()) .withTableId(opts.getBigtableTableId()) .withAppProfileId(opts.getBigtableAppProfileId()) .withRequest(request); return configBuilder.build(); }
Source:
<code>private double toDouble(BigFraction fraction) { double d = fraction.doubleValue(); if (Double.isInfinite(d) || Double.isNaN(d)) { throw new RuntimeException("Encountered a value which can not be represented as a double value"); } if (fraction.subtract(new BigFraction(d)).abs().compareTo(new BigFraction(Math.ulp(d))) > 0) { <START> throw new RuntimeException("Encountered a value with sufficient precision"); <END> } return d; }</code><technical_language>*in*sufficient</technical_language>

Target:
private double toDouble(BigFraction fraction) { double d = fraction.doubleValue(); if (Double.isInfinite(d) || Double.isNaN(d)) { throw new RuntimeException("Encountered a value which can not be represented as a double"); } if (fraction.subtract(new BigFraction(d)).abs().compareTo(new BigFraction(Math.ulp(d))) > 0) { throw new RuntimeException("Encountered a value with insufficient precision"); } return d; }
Source:
<code><START> public void tearDown() { <END> HotRodClientTestingUtil.killServers(hotRodServer); HotRodClientTestingUtil.killRemoteCacheManager(remoteCacheManager); }</code><technical_language>Cache manager is leaked here. HR server stop cache manager... avoid leaks, extend existing classes, e.g. SingleHotRodServerTest</technical_language>

Target:
public void tearDown() { HotRodClientTestingUtil.killServers(hotRodServer); HotRodClientTestingUtil.killRemoteCacheManager(remoteCacheManager); TestingUtil.killCacheManagers(cacheManager); }
Source:
<code>private static Future<Response> addElementToBatch( CoalescingBatchingEventHandler<Request, Response> handler, Request request, boolean endBatch) { TestBatchElement element = ImmutableTestBatchElement.of(request); <START> handler.onEvent(element, new Random().nextLong(), endBatch); <END> return element.result(); }</code><technical_language>Is new Random().nextLong() ok for sequence numbers? I expected increasing - guess this works for testing</technical_language>

Target:
private static Future<Response> addElementToBatch( CoalescingBatchingEventHandler<Request, Response> handler, Request request, boolean endBatch) { TestBatchElement element = ImmutableTestBatchElement.of(request); handler.onEvent(element, COUNTER.getAndIncrement(), endBatch); return element.result(); }
Source:
<code>public void shouldContainNumericConstantsForMessageTypes() throws Exception { <START> assertEquals(HEARTBEAT_TYPE, getField(constants, "MSG_HEARTBEAT")); <END> }</code><technical_language>Again, constant renames, do do FixT</technical_language>

Target:
public void shouldContainNumericConstantsForMessageTypes() throws Exception { assertEquals(HEARTBEAT_TYPE, getField(constants, "HEARTBEAT_MESSAGE")); }
Source:
<code>public boolean isSupporting(Capabilities capabilities) { return BrowserType.EDGE.equals(capabilities.getBrowserName()) || <START> capabilities.getCapability("chromeOptions") != null || <END> capabilities.getCapability("goog:chromeOptions") != null; }</code><technical_language>This seen</technical_language>

Target:
public boolean isSupporting(Capabilities capabilities) { return BrowserType.EDGE.equals(capabilities.getBrowserName()); }
Source:
<code>public void close(boolean needWait) { try { if (needWait && !currentWatchers.isEmpty()) { LOG.debug("Waiting '{}ms' before closing all log watchers.", WAIT_TIMEOUT * 2); Thread.sleep(WAIT_TIMEOUT * 2); } else { <START> LOG.debug("Just close it now!"); <END> } } catch (InterruptedException e) { LOG.error("Interrupted waiting for the logs. This should not happen.", e); } finally { currentWatchers.forEach(LogWatch::close); currentWatchers.clear(); } }</code><technical_language>This weird in logs :smile:</technical_language>

Target:
public void close(boolean needWait) { try { if (needWait && !currentContainerWatchers.isEmpty()) { int waitBeforeClose = WAIT_TIMEOUT * 2; LOG.debug( "Waiting '{}ms' before closing all log watchers for workspace '{}'.", waitBeforeClose, workspaceId); Thread.sleep(waitBeforeClose); } } catch (InterruptedException e) { LOG.error( "Interrupted while waiting before closing the log watch for workspace '{}'.", workspaceId, e); } finally { LOG.debug("Closing all log watchers for '{}'", workspaceId); currentContainerWatchers.forEach((k, v) -> v.close()); currentContainerWatchers.clear(); } }
Source:
<code>private void updateMemoryUsage(boolean useRevocableMemory) { if (useRevocableMemory) { if (!spillEnabled) { <START> throw new IllegalStateException("Revocable memory requested when spill to disk is not enabled"); <END> } localRevocableMemoryContext.setBytes(pageIndex.getEstimatedSize().toBytes()); } else { if (!localUserMemoryContext.trySetBytes(pageIndex.getEstimatedSize().toBytes())) { pageIndex.compact(); localUserMemoryContext.setBytes(pageIndex.getEstimatedSize().toBytes()); } } }</code><technical_language>checkState(spillEnabled, "Revocable memory requested spill disk is enabled");</technical_language>

Target:
private void updateMemoryUsage(boolean useRevocableMemory) { if (useRevocableMemory) { if (!spillEnabled) { throw new IllegalStateException("Revocable memory requested when spill to disk is not enabled"); } pagesIndexRevocableMemoryContext.setBytes(pageIndex.getEstimatedSize().toBytes()); } else { if (!pagesIndexUserMemoryContext.trySetBytes(pageIndex.getEstimatedSize().toBytes())) { pageIndex.compact(); pagesIndexUserMemoryContext.setBytes(pageIndex.getEstimatedSize().toBytes()); } } }
Source:
<code>public JRDataSource getDataSource(String testId) { if (plots == null) { plots = createTaskPlots(); } if (plots.size() == 0) { return null; } String testIdParent = getParentId(testId); if (plots.containsKey(testId)){ <START> plots.get(testId).getMetricPlotDTOs().addAll(plots.get(testIdParent).getMetricPlotDTOs()); <END> return new JRBeanCollectionDataSource(Collections.singleton(plots.get(testId))); } else return new JRBeanCollectionDataSource(Collections.singleton(plots.get(testIdParent))); }</code><technical_language>NPE if metrics in test group</technical_language>

Target:
public JRDataSource getDataSource(String testId) { sessionId = getSessionIdProvider().getSessionId(); String testIdParent = getParentId(testId); if (plots == null) { plots = createTaskPlots(); } if (plots.size() == 0) { return null; } MetricPlotDTOs result = new MetricPlotDTOs(); if (plots.containsKey(testId)) { if (plots.get(testId).getMetricPlotDTOs() != null) { plots.get(testId).sortingByMetricName(); result.getMetricPlotDTOs().addAll(plots.get(testId).getMetricPlotDTOs()); } } if (plots.containsKey(testIdParent)) { if (plots.get(testIdParent).getMetricPlotDTOs() != null) { plots.get(testIdParent).sortingByMetricName(); result.getMetricPlotDTOs().addAll(plots.get(testIdParent).getMetricPlotDTOs()); } } return new JRBeanCollectionDataSource(Collections.singleton(result)); }
Source:
<code>public static void main(String... args) throws Exception { if (args.length > 0 && args[0].equals("-extract")) { extract(args); return; } ClassLoader cl = EmbeddedLauncher.class.getClassLoader(); Enumeration<URL> manifests = cl.getResources("META-INF/MANIFEST.MF"); while (manifests.hasMoreElements()) { URL murl = manifests.nextElement(); Manifest m = new Manifest(murl.openStream()); String runpath = m.getMainAttributes() .getValue(EMBEDDED_RUNPATH); if (runpath != null) { try (ModifiableURLClassLoader ml = new ModifiableURLClassLoader(cl)) { for (String path : runpath.split("\\s*,\\s*")) { URL url = toFileURL(cl.getResource(path)); ml.addURL(url); } <START> Class<?> embeddedLauncher = ml.loadClass("aQute.launcher.pre.EmbeddedLauncher"); <END> embeddedLauncher.getField("MANIFEST") .set(null, m); Class<?> launcher = ml.loadClass("aQute.launcher.Launcher"); MethodHandle mh = MethodHandles.publicLookup() .findStatic(launcher, "main", MethodType.methodType(void.class, String[].class)); try { mh.invoke(args); } catch (Error | Exception e) { throw e; } catch (Throwable e) { throw new InvocationTargetException(e); } } } } }</code><technical_language>loading this class new class loader setting MANIFEST? necessary of earlier concern ModifiableURLClassLoader delegating parent first, ModifiableURLClassLoader loads a new EmbeddedLauncher Launcher want access MANIFEST field. parent first</technical_language>

Target:
public static void main(String... args) throws Throwable { boolean isVerbose = isTrace(); if (args.length > 0 && args[0].equals("-extract")) { if (isVerbose) log("running in extraction mode"); extract(args); return; } findAndExecute(isVerbose, "main", void.class, args); }
Source:
<code>public Response getCustomizedStateAggregationConfig(@PathParam("clusterId") String clusterId) { HelixZkClient zkClient = getHelixZkClient(); if (!ZKUtil.isClusterSetup(clusterId, zkClient)) { <START> return notFound(); <END> } ConfigAccessor configAccessor = getConfigAccessor(); CustomizedStateAggregationConfig customizedStateAggregationConfig = configAccessor.getCustomizedStateAggregationConfig(clusterId); if (customizedStateAggregationConfig != null) { return JSONRepresentation(customizedStateAggregationConfig.getRecord()); } return notFound(); }</code><technical_language>I suggest adding error message response</technical_language>

Target:
public Response getCustomizedStateAggregationConfig(@PathParam("clusterId") String clusterId) { if (!doesClusterExist(clusterId)) { return notFound(String.format("Cluster %s does not exist", clusterId)); } ConfigAccessor configAccessor = getConfigAccessor(); CustomizedStateAggregationConfig customizedStateAggregationConfig = configAccessor.getCustomizedStateAggregationConfig(clusterId); if (customizedStateAggregationConfig != null) { return JSONRepresentation(customizedStateAggregationConfig.getRecord()); } return notFound(); }
Source:
<code>private RemoteCacheManager createExecClient() { org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = super.createHotRodClientConfigurationBuilder(servers.get(0).getPort()); clientBuilder.marshaller(new UTF8StringMarshaller()); <START> clientBuilder.protocolVersion(getProtocolVersion()); <END> return new InternalRemoteCacheManager(clientBuilder.build()); }</code><technical_language>Method deprecated. clientBuilder.version() instead</technical_language>

Target:
private RemoteCacheManager createExecClient() { org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = super.createHotRodClientConfigurationBuilder(servers.get(0).getPort()); clientBuilder.marshaller(new UTF8StringMarshaller()); clientBuilder.version(getProtocolVersion()); return new InternalRemoteCacheManager(clientBuilder.build()); }
Source:
<code>private void discoverHueBridges() { List<BridgeJsonParameters> bridgeList = getBridgeList(); if (bridgeList != null) { for (BridgeJsonParameters bridge : bridgeList) { if (bridge.getId() != null && bridge.getInternalipaddress() != null) { if (isHueBridge(bridge.getInternalipaddress()) && bridge.getId().substring(6, 10).equals("fffe")) { <START> ThingUID uid = new ThingUID(THING_TYPE_BRIDGE, <END> bridge.getId().substring(0, 6) + bridge.getId().substring(10)); if (uid != null) { Map<String, Object> properties = new HashMap<>(2); properties.put(HOST, bridge.getInternalipaddress()); properties.put(SERIAL_NUMBER, bridge.getId().replace("fffe", "")); DiscoveryResult result = DiscoveryResultBuilder.create(uid).withProperties(properties) .withLabel("Philips hue (" + bridge.getInternalipaddress() + ")") .withRepresentationProperty(SERIAL_NUMBER).build(); thingDiscovered(result); } } } } } }</code><technical_language>bridge.getId().replace("fffe", "") below? Get once, store in a serial number reuse below</technical_language>

Target:
private void discoverHueBridges() { for (BridgeJsonParameters bridge : getBridgeList()) { if (isReachableAndValidHueBridge(bridge)) { String host = bridge.getInternalIpAddress(); String serialNumber = bridge.getId().substring(0, 6) + bridge.getId().substring(10); ThingUID uid = new ThingUID(THING_TYPE_BRIDGE, serialNumber); DiscoveryResult result = DiscoveryResultBuilder.create(uid) .withProperties(buildProperties(host, serialNumber)) .withLabel(LABEL_PATTERN.replace("IP", host)).withRepresentationProperty(SERIAL_NUMBER).build(); thingDiscovered(result); } } }
Source:
<code>public boolean performOk() { <START> setColorsAndFontsTheme(getSelectedColorsAndFontsTheme()); <END> ITheme theme = getSelectedTheme(); if (theme != null) { engine.setTheme(getSelectedTheme(), true); } boolean themeChanged = theme != null && !theme.equals(currentTheme); boolean colorsAndFontsThemeChanged = !PlatformUI.getWorkbench().getThemeManager() .getCurrentTheme().getId().equals(currentColorsAndFontsTheme.getId()); if (themeChanged || colorsAndFontsThemeChanged) { MessageDialog.openWarning(getShell(), WorkbenchMessages.ThemeChangeWarningTitle, WorkbenchMessages.ThemeChangeWarningText); } IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore(); apiStore.setValue(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS, enableAnimations.getSelection()); apiStore.setValue(IWorkbenchPreferenceConstants.USE_COLORED_LABELS, useColoredLabels.getSelection()); ((PreferencePageEnhancer) Tweaklets.get(PreferencePageEnhancer.KEY)).performOK(); return super.performOk(); }</code><technical_language>this set based set changing combo user deliberately switched combo? is this set true change system, getSelectedColorsAndFontsTheme() reflects combo</technical_language>

Target:
public boolean performOk() { ITheme theme = getSelectedTheme(); if (theme != null) { engine.setTheme(getSelectedTheme(), true); } boolean themeChanged = theme != null && !theme.equals(currentTheme); boolean colorsAndFontsThemeChanged = !PlatformUI.getWorkbench().getThemeManager() .getCurrentTheme().getId().equals(currentColorsAndFontsTheme.getId()); if (themeChanged || colorsAndFontsThemeChanged) { MessageDialog.openWarning(getShell(), WorkbenchMessages.ThemeChangeWarningTitle, WorkbenchMessages.ThemeChangeWarningText); } IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore(); apiStore.setValue(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS, enableAnimations.getSelection()); apiStore.setValue(IWorkbenchPreferenceConstants.USE_COLORED_LABELS, useColoredLabels.getSelection()); ((PreferencePageEnhancer) Tweaklets.get(PreferencePageEnhancer.KEY)).performOK(); return super.performOk(); }
Source:
<code><START> public TableSpecJson buildTableJson(TableSpec tableSpec) { <END> TableSpecJson tableSpecJson = new TableSpecJson(); tableSpecJson.id = tableSpec.getId(); tableSpecJson.tableProviderFactory = tableSpec.getTableProviderFactory(); tableSpecJson.config = tableSpec.getConfig(); return tableSpecJson; }</code><technical_language>This private method</technical_language>

Target:
private TableSpecJson buildTableJson(TableSpec tableSpec) { TableSpecJson tableSpecJson = new TableSpecJson(); tableSpecJson.id = tableSpec.getId(); tableSpecJson.tableProviderFactory = tableSpec.getTableProviderFactoryClassName(); tableSpecJson.config = tableSpec.getConfig(); return tableSpecJson; }
Source:
<code>public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); if (args.length == 0) { new FormValidator().show(); } else { List<String> paths = new ArrayList<>(); boolean failFast = false; for (String arg : args) { <START> if (arg.equals("--failFast") || arg.equals("--fail-fast")) { <END> failFast = true; } else { paths.add(arg); } } new FormValidator().validateAndExitWithErrorCode( paths.toArray(new String[paths.size()]), failFast); } } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } }</code><technical_language>I enough complain if :D</technical_language>

Target:
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); if (args.length == 0) { new FormValidator().show(); } else { List<String> paths = new ArrayList<>(); boolean failFast = false; for (String arg : args) { if (arg.equals("--failFast") || arg.equals("--fail-fast")) { failFast = true; } else { paths.add(arg); } } new FormValidator().validateAndExitWithErrorCode( paths, failFast); } } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } }
Source:
<code>public ListTabbedPage(WebDriver driver) { <START> super(driver); <END> PageFactory.initElements(driver, this); waitWithTimeout().until(ExpectedConditions.visibilityOf(selectedTab)); tablesElements.forEach(table -> { tables.add(new DataTable(table, table.getAttribute("id"))); }); setSelectedTable(); }</code><technical_language>static Strings enum for list targets helpful</technical_language>

Target:
public ListTabbedPage(WebDriver driver) { super(driver); PageFactory.initElements(driver, this); tabs = driver.findElements(By.xpath(" waitWithTimeout().until(ExpectedConditions.visibilityOf(selectedTab)); tablesElements.forEach(table -> { tables.add(new DataTable(table)); }); setSelectedTable(getTabNumber()); }
Source:
<code><START> public PagedFlux<QueueMessageItem> receiveMessage() { <END> try { return receiveMessagesWithOptionalTimeout(1, null, null, Context.NONE); } catch (RuntimeException ex) { return pagedFluxError(logger, ex); } }</code><technical_language>this return a PagedFlux if return a single (first) message</technical_language>

Target:
public Mono<QueueMessageItem> receiveMessage() { try { return receiveMessagesWithOptionalTimeout(1, null, null, Context.NONE) .single(); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
<code>public int crawlNewDockerfiles(int number) { int crawledDockerfilesCount = 0; try { while (crawledDockerfilesCount < number) { List<Dockerfile> newDockerfiles = crawlerInstance.crawlDockerfiles(); crawledDockerfilesCount += newDockerfiles.size(); synchronized (crawledDockerfiles) { crawledDockerfiles.addAll(newDockerfiles); } for (Dockerfile dockerfile : newDockerfiles) { String filePath = dockerfile.getRepoName() + "." + dockerfile.getPath(); filePath = filePath.replace("/", "."); <START> filePath = System.getProperty("user.home") + "/Dockerfiles/" + filePath; <END> BufferedWriter writer = new BufferedWriter(new FileWriter(filePath)); writer.write(dockerfile.getRepoName() + "\n"); writer.write(dockerfile.getPath() + "\n"); writer.write(dockerfile.getContent()); writer.close(); } } } catch (IOException e) { LOGGER.error("Failed to write dockerfile to the file system", e); } return crawledDockerfilesCount; }</code><technical_language>writing dockerfiles user's home directory</technical_language>

Target:
public int crawlNewDockerfiles(int number) { int crawledDockerfilesCount = 0; try { while (crawledDockerfilesCount < number) { List<Dockerfile> newDockerfiles = crawlerInstance.crawlDockerfiles(); crawledDockerfilesCount += newDockerfiles.size(); synchronized (crawledDockerfiles) { crawledDockerfiles.addAll(newDockerfiles); } if (!localCopyPath.isEmpty()) { for (Dockerfile dockerfile : newDockerfiles) { String filePath = dockerfile.getRepoName() + "." + dockerfile.getPath(); filePath = filePath.replace("/", "."); filePath = localCopyPath + filePath; BufferedWriter writer = new BufferedWriter(new FileWriter(filePath)); writer.write(dockerfile.getRepoName() + "\n"); writer.write(dockerfile.getPath() + "\n"); writer.write(dockerfile.getContent()); writer.close(); } } } } catch (IOException e) { LOGGER.error("Failed to write dockerfile to the file system", e); } return crawledDockerfilesCount; }
Source:
<code><START> public Log getLog(String type) { <END> return logs.get(type); }</code><technical_language>Add a method getAndClearLogEntries(type), call handled, deal nonexistent types in method handler. handler business logic preferably</technical_language>

Target:
public List<LogEntry> getLog(String type) { WebDriverLog log = (WebDriverLog) logs.get(type); return (log == null ? (Collections.<LogEntry>emptyList()) : log.getAndClearEntries()); }
Source:
<code>public JwtProxyProvisioner( SignatureKeyManager signatureKeyManager, JwtProxyConfigBuilderFactory jwtProxyConfigBuilderFactory, @Named("che.server.secure_exposer.jwtproxy.image") String jwtProxyImage, @Named("che.server.secure_exposer.jwtproxy.memory_limit") String memoryLimitBytes, @Assisted RuntimeIdentity identity) { this.signatureKeyManager = signatureKeyManager; this.jwtProxyImage = jwtProxyImage; this.proxyConfigBuilder = jwtProxyConfigBuilderFactory.create(identity.getWorkspaceId()); this.identity = identity; this.serviceName = generate(SERVER_PREFIX, SERVER_UNIQUE_PART_SIZE) + "-jwtproxy"; this.availablePort = FIRST_AVAILABLE_PORT; <START> long memoryLimitLong = Size.parseSizeToMegabytes(memoryLimitBytes) * MEGABYTES_TO_BYTES_DEVIDER; <END> this.attributes = ImmutableMap.of( MEMORY_LIMIT_ATTRIBUTE, Long.toString(memoryLimitLong), MEMORY_REQUEST_ATTRIBUTE, Long.toString(memoryLimitLong)); }</code><technical_language>Call ..._DIVIDER please :)</technical_language>

Target:
public JwtProxyProvisioner( SignatureKeyManager signatureKeyManager, JwtProxyConfigBuilderFactory jwtProxyConfigBuilderFactory, @Named("che.server.secure_exposer.jwtproxy.image") String jwtProxyImage, @Named("che.server.secure_exposer.jwtproxy.memory_limit") String memoryLimitBytes, @Assisted RuntimeIdentity identity) { this.signatureKeyManager = signatureKeyManager; this.jwtProxyImage = jwtProxyImage; this.proxyConfigBuilder = jwtProxyConfigBuilderFactory.create(identity.getWorkspaceId()); this.identity = identity; this.serviceName = generate(SERVER_PREFIX, SERVER_UNIQUE_PART_SIZE) + "-jwtproxy"; this.availablePort = FIRST_AVAILABLE_PORT; long memoryLimitLong = Size.parseSizeToMegabytes(memoryLimitBytes) * MEGABYTES_TO_BYTES_DIVIDER; this.attributes = ImmutableMap.of( MEMORY_LIMIT_ATTRIBUTE, Long.toString(memoryLimitLong), MEMORY_REQUEST_ATTRIBUTE, Long.toString(memoryLimitLong)); }
Source:
<code>public void attachView(@NonNull final ViewInterface view) { super.attachView(view); view.setUsername(username); view.setEditProfileMenuButtonVisible(isViewingOwnProfile); view.showLoadingIndicator(); observeOnView(userProfileInteractor.observeAccount()).subscribe(new Observer<Account>() { @Override public void onData(@NonNull Account account) { <START> if (account.requiresParentalConsent() || account.getAccountPrivacy() == Account.Privacy.PRIVATE) { <END> view.showLimitedHeader(isViewingOwnProfile); } else { String languageName = null; if (!account.getLanguageProficiencies().isEmpty()) { try { languageName = LocaleUtils.getLanguageNameFromCode(account.getLanguageProficiencies().get(0).getCode()); } catch (InvalidLocaleException e) { logger.error(e, true); } } String countryName = null; if (!TextUtils.isEmpty(account.getCountry())) { try { countryName = LocaleUtils.getCountryNameFromCode(account.getCountry()); } catch (InvalidLocaleException e) { logger.error(e, true); } } view.showFullHeader(languageName, countryName); } if (isViewingOwnProfile && account.requiresParentalConsent()) { view.showParentalConsentRequiredContent(); } else if (isViewingOwnProfile && TextUtils.isEmpty(account.getBio()) && account.getAccountPrivacy() != Account.Privacy.ALL_USERS) { view.showIncompleteContent(); } else if (account.getAccountPrivacy() != Account.Privacy.PRIVATE) { if (TextUtils.isEmpty(account.getBio())) { view.showNoAboutMeContent(); } else { view.showAboutMeContent(account.getBio()); } } else { view.showNoContent(); } } @Override public void onError(@NonNull Throwable error) { view.showError(error); } }); observeOnView(userProfileInteractor.observeProfilePhoto()).subscribe(new Observer<UserProfileInteractor.ImageResource>() { @Override public void onData(@NonNull UserProfileInteractor.ImageResource data) { view.setPhotoUri(data); } @Override public void onError(@NonNull Throwable error) { } }); }</code><technical_language>@aleffert I prefer more methods a concrete "ViewModel". I gave a try. Is this imagining? <LINK_0></technical_language>

Target:
public void attachView(@NonNull final ViewInterface view) { super.attachView(view); view.setName(userProfileInteractor.getUsername()); view.setEditProfileMenuButtonVisible(userProfileInteractor.isViewingOwnProfile()); view.showLoading(); observeOnView(userProfileInteractor.observeProfile()).subscribe(new Observer<UserProfileViewModel>() { @Override public void onData(@NonNull UserProfileViewModel account) { view.showProfile(account); } @Override public void onError(@NonNull Throwable error) { view.showError(error); } }); observeOnView(userProfileInteractor.observeProfileImage()).subscribe(new Observer<UserProfileImageViewModel>() { @Override public void onData(@NonNull UserProfileImageViewModel data) { view.setPhotoImage(data); } @Override public void onError(@NonNull Throwable error) { } }); }
Source:
<code>private static TestWithParameters createTestWithParameters( TestClass testClass, String pattern, int index, Object[] parameters) { String finalPattern = pattern; <START> Pattern indexMatcherPattern = Pattern.compile("(\\{)index([^\\}]*\\})"); <END> Matcher matcher = indexMatcherPattern.matcher(pattern); if (matcher.find()) { String idxPattern = matcher.group(1) + 0 + matcher.group(2); finalPattern = pattern.replace(matcher.group(), MessageFormat.format(idxPattern, index)); } String name = MessageFormat.format(finalPattern, parameters); return new TestWithParameters("[" + name + "]", testClass, Arrays.asList(parameters)); }</code><technical_language>extract a constant for this Pattern</technical_language>

Target:
private static TestWithParameters createTestWithParameters( TestClass testClass, String pattern, int index, Object[] parameters) { String finalPattern = pattern; Matcher matcher = INDEX_MATCHER_PATTERN.matcher(pattern); while (matcher.find()) { String idxPattern = matcher.group(1) + "0" + matcher.group(2); finalPattern = finalPattern.replace(matcher.group(), MessageFormat.format(idxPattern, index)); } String name = MessageFormat.format(finalPattern, parameters); return new TestWithParameters("[" + name + "]", testClass, Arrays.asList(parameters)); }
Source:
<code>public boolean isValid(ChangeRequestValidationContext context) { ChangeRequest crToTest = null; if (context.getChangeRequest() != null && context.getChangeRequest().getId() != null) { try { crToTest = context.getChangeRequestDAO().get(context.getChangeRequest().getId()); } catch (EntityRetrievalException e) { return true; } } else { <START> getMessages().add(getErrorMessage("changeRequest.developer.notActive")); <END> crToTest = context.getChangeRequest(); } DeveloperDTO devDTO; try { devDTO = context.getDeveloperDAO().getById(crToTest.getDeveloper().getDeveloperId()); } catch (Exception e) { return true; } if (!devDTO.getStatus().getStatus().getStatusName().equals(DeveloperStatusType.Active.toString())) { getMessages().add(getErrorMessage("changeRequest.developer.notActive")); return false; } return true; }</code><technical_language>Is this right error message for context.getChangeRequest is null? "if" part do status of developer, I missing something</technical_language>

Target:
public boolean isValid(ChangeRequestValidationContext context) { ChangeRequest crToTest = null; if (context.getChangeRequest() != null && context.getChangeRequest().getId() != null) { try { crToTest = context.getChangeRequestDAO().get(context.getChangeRequest().getId()); } catch (EntityRetrievalException e) { return true; } } else { crToTest = context.getChangeRequest(); } DeveloperDTO devDTO; try { devDTO = context.getDeveloperDAO().getById(crToTest.getDeveloper().getDeveloperId()); } catch (Exception e) { return true; } if (!devDTO.getStatus().getStatus().getStatusName().equals(DeveloperStatusType.Active.toString())) { getMessages().add(getErrorMessage("changeRequest.developer.notActive")); return false; } return true; }
Source:
<code><START> GammaIntegerCodec(final BitInputStream coreBlockInputStream, <END> final BitOutputStream coreBlockOutputStream, final int offset) { super(coreBlockInputStream, coreBlockOutputStream); this.offset = offset; }</code><technical_language>Some of codec constructors public some package-protected. access, is some specific reason for</technical_language>

Target:
public GammaIntegerCodec(final BitInputStream coreBlockInputStream, final BitOutputStream coreBlockOutputStream, final int offset) { super(coreBlockInputStream, coreBlockOutputStream); this.offset = offset; }
Source:
<code>protected void executeDue() { if (executorsSemaphore.availablePermits() <= 0) { return; } Instant now = clock.now(); List<Execution> dueExecutions = taskRepository.getDue(now, pollingLimit); int pickedExecutionCount = 0; int availableExecutorCount = executorsSemaphore.availablePermits(); lastPollAcquiredAllAvailableExecutors = false; LOG.trace("Found taskinstances due for execution", dueExecutions.size()); for (Execution e : dueExecutions) { if (schedulerState.isShuttingDown()) { LOG.info("Scheduler has been shutdown. Skipping due executions.", dueExecutions.size() - pickedExecutionCount); return; } final Optional<Execution> pickedExecution; try { pickedExecution = aquireExecutorAndPickExecution(e); } catch (NoAvailableExecutors ex) { LOG.debug("No available executors. Skipping due executions.", dueExecutions.size() - pickedExecutionCount); lastPollAcquiredAllAvailableExecutors = true; return; } if (pickedExecution.isPresent()) { CompletableFuture .runAsync(new ExecuteTask(pickedExecution.get()), executorService) .thenRun(() -> releaseExecutor(pickedExecution.get())); } else { LOG.debug("Execution picked by another scheduler. Continuing to next due execution."); } pickedExecutionCount++; } <START> lastPollAcquiredAllAvailableExecutors = pickedExecutionCount >= availableExecutorCount; <END> }</code><technical_language>this line wondering if is needed, is sufficient check for NoAvailableExecutors exception? Also, pickedExecutionCount include executions picked another Scheduler-instance, i.e. running in this executor-pool</technical_language>

Target:
protected void executeDue() { if (executorsSemaphore.availablePermits() <= 0) { return; } Instant now = clock.now(); List<Execution> dueExecutions = taskRepository.getDue(now, pollingLimit); int pickedExecutionCount = 0; lastPollAcquiredAllAvailableExecutors = false; LOG.trace("Found taskinstances due for execution", dueExecutions.size()); for (Execution e : dueExecutions) { if (schedulerState.isShuttingDown()) { LOG.info("Scheduler has been shutdown. Skipping due executions.", dueExecutions.size() - pickedExecutionCount); return; } final Optional<Execution> pickedExecution; try { pickedExecution = aquireExecutorAndPickExecution(e); } catch (NoAvailableExecutors ex) { LOG.debug("No available executors. Skipping due executions.", dueExecutions.size() - pickedExecutionCount); lastPollAcquiredAllAvailableExecutors = true; return; } if (pickedExecution.isPresent()) { CompletableFuture .runAsync(new ExecuteTask(pickedExecution.get()), executorService) .thenRun(() -> releaseExecutor(pickedExecution.get())); } else { LOG.debug("Execution picked by another scheduler. Continuing to next due execution."); } pickedExecutionCount++; } }
Source:
<code>public static void loadAuthenticatorsClasses() { File authenticatorsDirectory = null; try { <START> authenticatorsDirectory = ConfigurationResourceResolver.getConfigurationResource("lib.authentication", <END> "lib/authentication").getFile(); } catch (FileNotFoundException e) { logger.debug(e.getMessage(), e); return; } catch (IOException e) { throw Throwables.propagate(e); } if (!authenticatorsDirectory.exists()) { logger.debug(authenticatorsDirectory + " does not exist."); return; } if (!authenticatorsDirectory.isDirectory()) { logger.error(authenticatorsDirectory + " is not a directory."); return; } final File[] authenticatorsJars = authenticatorsDirectory.listFiles(name -> name.getName().endsWith(".jar")); if (ArrayUtils.isEmpty(authenticatorsJars)) { logger.debug(authenticatorsDirectory + "contains 0 authenticators jar files."); return; } Stream.of(authenticatorsJars).forEach(jarFile -> { try { JarFileClassLoader.loadClasses( Thread.currentThread().getContextClassLoader(), jarFile.getAbsolutePath()); } catch (IOException | ClassNotFoundException e) { throw Throwables.propagate(e); } }); }</code><technical_language>I get need this. please explain</technical_language>

Target:
public static void loadAuthenticatorsClasses() { File authenticatorsDirectory = null; try { authenticatorsDirectory = ConfigurationResourceResolver.getConfigurationResource("authentication.lib", "authentication-lib").getFile(); } catch (FileNotFoundException e) { logger.debug(e.getMessage(), e); return; } catch (IOException e) { throw Throwables.propagate(e); } if (!authenticatorsDirectory.exists()) { logger.debug(authenticatorsDirectory + " does not exist."); return; } if (!authenticatorsDirectory.isDirectory()) { logger.error(authenticatorsDirectory + " is not a directory."); return; } final File[] authenticatorsJars = authenticatorsDirectory.listFiles(name -> name.getName().endsWith(".jar")); if (ArrayUtils.isEmpty(authenticatorsJars)) { logger.debug(authenticatorsDirectory + "contains 0 authenticators jar files."); return; } Stream.of(authenticatorsJars).forEach(jarFile -> { try { JarFileClassLoader.loadClasses( Thread.currentThread().getContextClassLoader(), jarFile.getAbsolutePath()); } catch (IOException | ClassNotFoundException e) { throw Throwables.propagate(e); } }); }
Source:
<code>public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { try { scrolledComposite = new ScrolledComposite(null, 0); fail("No exception thrown"); } catch (IllegalArgumentException e) { } int[] cases = {SWT.H_SCROLL, SWT.V_SCROLL, SWT.BORDER, SWT.LEFT_TO_RIGHT, SWT.RIGHT_TO_LEFT}; <START> for (int i = 0; i < cases.length; i++) <END> scrolledComposite = new ScrolledComposite(shell, cases[i]); }</code><technical_language>Please for blocks</technical_language>

Target:
public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { try { scrolledComposite = new ScrolledComposite(null, 0); fail("No exception thrown"); } catch (IllegalArgumentException e) { } int[] cases = {SWT.H_SCROLL, SWT.V_SCROLL, SWT.BORDER, SWT.LEFT_TO_RIGHT, SWT.RIGHT_TO_LEFT}; for (int i = 0; i < cases.length; i++){ scrolledComposite = new ScrolledComposite(shell, cases[i]); } }
Source:
<code>public RuleStatus getRuleStatus(String ruleUID) { <START> if (ruleManager != null) { <END> RuleStatusInfo rsi = ruleManager.getStatusInfo(ruleUID); return rsi != null ? rsi.getStatus() : null; } else { return null; } }</code><technical_language>rule manager is a mandatory reference, null if component is active</technical_language>

Target:
public RuleStatus getRuleStatus(String ruleUID) { RuleStatusInfo rsi = ruleManager.getStatusInfo(ruleUID); return rsi != null ? rsi.getStatus() : null; }
Source:
<code>public void waitForCompletion(long timeoutMillis) { if(!(this.wrappedCommand instanceof BaseCommand)) { log.error("waitForCompletion called on command which doesn't inherit from BaseCommand!" + " Unable to wait for command to complete."); return; } ScriptedCommandCompletionLock lock = new ScriptedCommandCompletionLock((BaseCommand)wrappedCommand); parentCommand.addCompletionLock(lock); try { long startTime = System.currentTimeMillis(); synchronized (lock) { if(timeoutMillis <= 0) { log.debug("Waiting indefinitely for lock notification"); lock.wait(); } else { log.debug("Waiting with a timeout of " + timeoutMillis + "ms"); lock.wait(timeoutMillis); } } <START> log.debug("Wait completed (waited " + (System.currentTimeMillis() - startTime) + "millis)"); <END> } catch (InterruptedException e) { log.error("Scripted command wait unexpectedly interrupted!"); } }</code><technical_language>I feel callers want if completed successfully timed out</technical_language>

Target:
public void waitForCompletion(long timeoutMillis) { if(!(this.wrappedCommand instanceof BaseCommand)) { log.error("waitForCompletion called on command which doesn't inherit from BaseCommand!" + " Unable to wait for command to complete."); return; } ScriptedCommandCompletionLock lock = new ScriptedCommandCompletionLock((BaseCommand)wrappedCommand); parentCommand.addCompletionLock(lock); try { long startTime = System.currentTimeMillis(); synchronized (lock) { log.debug("Waiting with a timeout of " + timeoutMillis + "ms"); lock.wait(timeoutMillis); } log.debug("Wait completed (waited " + (System.currentTimeMillis() - startTime) + "millis)"); } catch (InterruptedException e) { log.error("Scripted command wait unexpectedly interrupted!"); } }