auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private synchronized void startBuild(BuildDefinition definition, Build queued, Optional<Build> previous) throws Exception { CommitInfo commitInfo = commitInfo(definition.getGitInfo(), commit(previous)); BuildConfig buildConfig = configAtSha(definition, commitInfo.getCurrent().getId()); BuildConfig resolvedConfig = resolveConfig(buildConfig, definition); Build launching = queued.withStartTimestamp(System.currentTimeMillis()) .withState(State.LAUNCHING) .withCommitInfo(commitInfo) .withBuildConfig(buildConfig) .withResolvedConfig(resolvedConfig); LOG.info("Updating status of build to {}", launching.getId().get(), launching.getState()); buildService.begin(launching); LOG.info("About to launch build {}", launching.getId().get()); SingularityRunNowRequest runNowRequest = new SingularityRunNowRequest( Optional.of(String.format("Build %d", launching.getId().get())), <START> Optional.of(false), <END> Optional.of("blazar-executor"), Optional.of(buildRunArgs(definition, launching))); try { singularityClient.runSingularityRequest("blazar-executor", Optional.of(runNowRequest)); } catch (SingularityClientException e) { LOG.warn(String.format("Launch of %d resulted in SingularityClientException", launching.getId().get()), e); return; } LOG.info("Launch of was successful", launching.getId().get()); }</code><technical_language>This absent()</technical_language>

Target:
private synchronized void startBuild(BuildDefinition definition, Build queued, Optional<Build> previous) throws Exception { CommitInfo commitInfo = commitInfo(definition.getGitInfo(), commit(previous)); BuildConfig buildConfig = configAtSha(definition, commitInfo.getCurrent().getId()); BuildConfig resolvedConfig = resolveConfig(buildConfig, definition); Build launching = queued.withStartTimestamp(System.currentTimeMillis()) .withState(State.LAUNCHING) .withCommitInfo(commitInfo) .withBuildConfig(buildConfig) .withResolvedConfig(resolvedConfig); LOG.info("Updating status of build to {}", launching.getId().get(), launching.getState()); buildService.begin(launching); LOG.info("About to launch build {}", launching.getId().get()); SingularityRunNowRequest runNowRequest = new SingularityRunNowRequest( Optional.of(String.format("Build %d", launching.getId().get())), Optional.<Boolean>absent(), Optional.of("blazar-executor"), Optional.of(buildRunArgs(definition, launching))); try { singularityClient.runSingularityRequest("blazar-executor", Optional.of(runNowRequest)); } catch (SingularityClientException e) { LOG.warn(String.format("Launch of %d resulted in SingularityClientException", launching.getId().get()), e); return; } LOG.info("Launch of was successful", launching.getId().get()); }
Source:
<code>public JobRequestMetadata( @Nullable final ApiClientMetadata apiClientMetadata, @Nullable final AgentClientMetadata agentClientMetadata, final int numAttachments, final long totalSizeOfAttachments ) throws IllegalArgumentException { if (apiClientMetadata == null && agentClientMetadata == null) { throw new IllegalArgumentException( "Both apiClientMetadata and agentClientMetadata are missing. One is required." ); } if (apiClientMetadata != null && agentClientMetadata != null) { <START> throw new IllegalArgumentException( <END> "Both apiClientMetadata and agentClientMetadata are present. Only one should be present" ); } this.apiClientMetadata = apiClientMetadata; this.agentClientMetadata = agentClientMetadata; this.numAttachments = Math.max(numAttachments, 0); this.totalSizeOfAttachments = Math.max(totalSizeOfAttachments, 0L); }</code><technical_language>this? In future a job submitted API executed agent. nice metadata for both</technical_language>

Target:
public JobRequestMetadata( @Nullable final ApiClientMetadata apiClientMetadata, @Nullable final AgentClientMetadata agentClientMetadata, final int numAttachments, final long totalSizeOfAttachments ) throws IllegalArgumentException { if (apiClientMetadata == null && agentClientMetadata == null) { throw new IllegalArgumentException( "Both apiClientMetadata and agentClientMetadata are missing. One is required." ); } if (apiClientMetadata != null && agentClientMetadata != null) { throw new IllegalArgumentException( "Both apiClientMetadata and agentClientMetadata are present. Only one should be present" ); } this.api = apiClientMetadata != null; this.apiClientMetadata = apiClientMetadata; this.agentClientMetadata = agentClientMetadata; this.numAttachments = Math.max(numAttachments, 0); this.totalSizeOfAttachments = Math.max(totalSizeOfAttachments, 0L); }
Source:
<code>public void publishDiagnostics(PublishDiagnosticsParams diagnostics) { String uri = diagnostics.getUri(); for (Observer observer : fObservers) { observer.diagnostic(uri, diagnostics.getDiagnostics()); } System.out.println(uri); TextDocumentIdentifier filterBoxId = new TextDocumentIdentifier(uri); Runnable completionTask = () -> { Position position = new Position(); position.setLine(0); position.setCharacter(fCursor); CompletionParams completionParams = new CompletionParams(filterBoxId, position); try { Either<List<CompletionItem>, CompletionList> completion = fServerProxy.getTextDocumentService().completion(completionParams).get(); for (Observer observer : fObservers) { observer.completion(uri, completion); } } catch (Exception e) { Activator.getInstance().logError(e.getMessage()); } }; Runnable syntaxHighlightingTask = () -> { DocumentColorParams colorParams = new DocumentColorParams(filterBoxId); try { List<ColorInformation> colors = fServerProxy.getTextDocumentService().documentColor(colorParams).get(); for (Observer observer : fObservers) { observer.syntaxHighlighting(uri, colors); } } catch (Exception e) { Activator.getInstance().logError(e.getMessage()); } }; <START> fThreadPoolExecutor.execute(completionTask); fThreadPoolExecutor.execute(syntaxHighlightingTask); <END> }</code><technical_language>run concurrently in order. Is this fine? result erased other one? asking</technical_language>

Target:
public void publishDiagnostics(PublishDiagnosticsParams diagnostics) { String uri = diagnostics.getUri(); for (LspObserver observer : fObservers) { observer.diagnostic(uri, diagnostics.getDiagnostics()); } TextDocumentIdentifier textDocumentIdentifier = new TextDocumentIdentifier(uri); fThreadPoolExecutor.execute(completionTask(uri, textDocumentIdentifier)); fThreadPoolExecutor.execute(syntaxHighlightingTask(uri, textDocumentIdentifier)); }
Source:
<code>public static List<String> validateParameters(Object obj, ParametersMap paramsMap) { List<String> messages = new ArrayList<String>(); if (paramsMap.size() > 0) { Map<Boolean, List<Parameter>> cmdParams = getCommandParameters(obj, messages); if (messages.isEmpty()) { List<Parameter> params = new ArrayList<Parameter>(paramsMap.keySet()); if (!params.containsAll(cmdParams.get(false))) { List<Parameter> copy = new ArrayList(cmdParams.get(false)); copy.removeAll(params); log.warnFormat("Required parameters {0} not found in command.", getParameterNames(copy)); <START> messages.add(VdcBllMessages.REQUIRED_PARAMETER_MISSING.name()); <END> } else { params.removeAll(cmdParams.get(false)); params.removeAll(cmdParams.get(true)); if (params.size() > 0) { log.warnFormat("Unknown parameters {0} found in command.", getParameterNames(params)); } } } } return messages; }</code><technical_language>this added dependency this module BLL, enable reuse for generic proposes. I suggest raise exception handle bll messages top level module if is part of bll</technical_language>

Target:
public static void validateParameters(Object obj, ParametersMap paramsMap) { if (paramsMap.size() > 0) { Map<Boolean, List<Parameter>> cmdParams = getCommandParameters(obj); List<Parameter> params = new ArrayList<Parameter>(paramsMap.keySet()); if (!params.containsAll(cmdParams.get(false))) { List<Parameter> copy = new ArrayList(cmdParams.get(false)); copy.removeAll(params); log.warnFormat("Required parameters {0} not found in command.", getParameterNames(copy)); throw new RequiredParametersMissingException(obj.getClass().getName(), getParameterNames(copy)); } else { params.removeAll(cmdParams.get(false)); params.removeAll(cmdParams.get(true)); if (params.size() > 0) { log.warnFormat("Unknown parameters {0} found in command.", getParameterNames(params)); } } } }
Source:
<code>public void addSettings(String workspace, GeoServer geoServer) { WorkspaceInfo ws = workspace != null ? geoServer.getCatalog().getWorkspaceByName(workspace) : null; GeoServerInfo global = geoServer.getGlobal(); SettingsInfo settings = ws != null ? geoServer.getSettings(ws) : global.getSettings(); if (settings == null) { settings = geoServer.getFactory().createSettings(); } settings.setWorkspace(ws); settings.getContact().setContactPerson("Andrea Aime"); settings.setNumDecimals(8); settings.setOnlineResource("<LINK_0>"); settings.setVerbose(false); settings.setVerboseExceptions(false); <START> settings.setLocalWorkspaceIncludesPrefix(true); <END> if (ws != null) { if (settings.getId() != null) { geoServer.save(settings); } else { geoServer.add(settings); } } else { geoServer.save(global); } }</code><technical_language>confused this line. SystemTestData default, is included prefix? I expect this break existing tests, i misunderstanding something</technical_language>

Target:
public void addSettings(String workspace, GeoServer geoServer) { WorkspaceInfo ws = workspace != null ? geoServer.getCatalog().getWorkspaceByName(workspace) : null; GeoServerInfo global = geoServer.getGlobal(); SettingsInfo settings = ws != null ? geoServer.getSettings(ws) : global.getSettings(); if (settings == null) { settings = geoServer.getFactory().createSettings(); } settings.setWorkspace(ws); settings.getContact().setContactPerson("Andrea Aime"); settings.setNumDecimals(8); settings.setOnlineResource("<LINK_0>"); settings.setVerbose(false); settings.setVerboseExceptions(false); settings.setLocalWorkspaceIncludesPrefix(false); if (ws != null) { if (settings.getId() != null) { geoServer.save(settings); } else { geoServer.add(settings); } } else { geoServer.save(global); } }
Source:
<code>public void testOptionalRequirements() { TmfAnalysisRequirement req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1), ImmutableSet.of(EVENT1_FIELD1)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1, EVENT2), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); <START> req = new TmfAnalysisEventFieldRequirement(checkNotNull(Collections.EMPTY_LIST), checkNotNull(Collections.EMPTY_LIST)); <END> assertTrue(req.isFulfilled(trace)); }</code><technical_language>if put fields, event names? does/should do? Also, if put fields, event names? behave EventRequirement? tested optional mandatory requirements</technical_language>

Target:
public void testOptionalRequirements() { TmfAnalysisRequirement req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1), ImmutableSet.of(EVENT1_FIELD1)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1, EVENT2), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(checkNotNull(Collections.EMPTY_LIST), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(checkNotNull(ImmutableSet.of(EVENT1)), checkNotNull(Collections.EMPTY_LIST)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(checkNotNull(Collections.EMPTY_LIST), checkNotNull(Collections.EMPTY_LIST)); assertTrue(req.isFulfilled(trace)); }
Source:
<code>public void status() throws RocksDBException { <START> throw new UnsupportedOperationException("status"); <END> }</code><technical_language>checkStatus() status() behave same. implementation of this interface restrictive, required throw RocksDBException, allowing merge methods</technical_language>

Target:
public void status() { try { iterator.status(); } catch (RocksDBException e) { throw new UnrecoverableCorfuError("Iterator is in an invalid state", e); } }
Source:
<code>public boolean isFinished() { try { return inputStream.available() == 0; <START> } catch (IOException e) { <END> LOG.error("Error occurred when reading request input stream", e); return false; } }</code><technical_language>final</technical_language>

Target:
public boolean isFinished() { try { return inputStream.available() == 0; } catch (final IOException e) { LOG.error("Error occurred when reading request input stream", e); return false; } }
Source:
<code>public void createPartControl(Composite parent) { this.parentControl = parent; if (error != null) { <START> new StatusPart(getSite(), parent, error); <END> } }</code><technical_language>Is this related, this done in a separate commit</technical_language>

Target:
public void createPartControl(Composite parent) { this.parentControl = parent; if (error != null) { new StatusPart(parent, error); } }
Source:
<code>private Map<Locator, MetricData> getStringBooleanDataForRange( List<Locator> locators, Range range, boolean isBoolean ) { Map<Locator, MetricData> metrics = new HashMap<Locator, MetricData>(); Map<Locator, ResultSetFuture> futures = new HashMap<Locator, ResultSetFuture>(); for( Locator locator : locators ) { futures.put( locator, rawIO.getStringAsync( locator, range ) ); } for( Map.Entry<Locator, ResultSetFuture> future : futures.entrySet() ) { Points points = new Points<String>(); try { for ( Row row : future.getValue().getUninterruptibly().all() ) { Object value = isBoolean ? Boolean.valueOf( row.getString( VALUE ) ) : row.getString( VALUE ); <START> points.add( new Points.Point( row.getLong( COLUMN1 ), value ) ); <END> } MetricData.Type type = isBoolean ? MetricData.Type.BOOLEAN : MetricData.Type.BOOLEAN; metrics.put( future.getKey(), new MetricData( points, getUnitString( future.getKey() ), type ) ); } catch (Exception e ) { LOG.error( String.format( "error writing metric %s, metrics_string", future.getKey() ), e ); } } return metrics; }</code><technical_language>in wrong layer. *RW classes supposed interact ColumnFamily's COLUMN VALUE. job of *IO classes. Is reasons put in DStringIO DBooleanIO, inherit DAbstractMetricIO.selectForLocatorAndRange()</technical_language>

Target:
private Map<Locator, MetricData> getStringBooleanDataForRange( List<Locator> locators, Range range, boolean isBoolean ) { Timer.Context ctx = Instrumentation.getReadTimerContext( CassandraModel.CF_METRICS_STRING_NAME ); try { Map<Locator, MetricData> metrics = new HashMap<Locator, MetricData>(); Map<Locator, ResultSetFuture> futures = new HashMap<Locator, ResultSetFuture>(); for( Locator locator : locators ) { futures.put( locator, rawIO.getStringAsync( locator, range ) ); } for( Map.Entry<Locator, ResultSetFuture> future : futures.entrySet() ) { try { metrics.put( future.getKey(), rawIO.createMetricDataStringBoolean( future.getValue(), isBoolean, getUnitString( future.getKey() ) ) ); } catch (Exception e ) { Instrumentation.markReadError(); LOG.error( String.format( "error reading metric %s, metrics_string", future.getKey() ), e ); } } return metrics; } finally { ctx.stop(); } }
Source:
<code>protected boolean bootProtocolDhcp() { Boolean dhcp = (Boolean) entry.get("dhcpv4"); <START> return dhcp != null && dhcp; <END> }</code><technical_language>2 lines simplified a single statement: return Boolean.TRUE.equals(entry.get("dhcpv4")); reduces need for cast. (no big issue)</technical_language>

Target:
protected boolean bootProtocolDhcp() { return Boolean.TRUE.equals(entry.get("dhcpv4")); }
Source:
<code>public static final TeamBuildingFragment newInstance(PokemonTeam team) { TeamBuildingFragment fragment = new TeamBuildingFragment(); Bundle bundle = new Bundle(); <START> bundle.putSerializable("team", team); <END> fragment.setArguments(bundle); return fragment; }</code><technical_language>I moving hard coding TAG string. TAG string public final static String declared top of class</technical_language>

Target:
public static final TeamBuildingFragment newInstance(PokemonTeam team) { TeamBuildingFragment fragment = new TeamBuildingFragment(); Bundle bundle = new Bundle(); bundle.putSerializable(TEAMTAG, team); fragment.setArguments(bundle); return fragment; }
Source:
<code>private boolean hasCnxSASLAuthenticated(ServerCnxn cnxn) { return cnxn.getAuthInfo().stream().filter(id -> id.getScheme().equals(SASL_AUTH_SCHEME)).count() > 0; <START> } <END></code><technical_language>return cnxn.getAuthInfo().stream().anyMatch(id -> id.getScheme().equals(SASL_AUTH_SCHEME)); is better</technical_language>

Target:
private boolean hasCnxSASLAuthenticated(ServerCnxn cnxn) { return cnxn.getAuthInfo().stream().anyMatch(id -> id.getScheme().equals(SASL_AUTH_SCHEME)); }
Source:
<code>private void updateText(Text text) { if (text == null || text.isDisposed()) { return; } <START> text.setMessage(NLS.bind(QuickAccessMessages.QuickAccess_EnterSearch, getQuickAccessTriggerSequenceFormat())); <END> GC gc = new GC(text); if (Util.isWin32() || Util.isGtk()) { FontMetrics fm = gc.getFontMetrics(); int wHint = QuickAccessMessages.QuickAccess_EnterSearch.length() * fm.getAverageCharWidth(); int hHint = fm.getHeight(); gc.dispose(); text.setSize(text.computeSize(wHint, hHint)); } else { Point p = gc.textExtent(QuickAccessMessages.QuickAccess_EnterSearch); Rectangle r = text.computeTrim(0, 0, p.x, p.y); gc.dispose(); GridDataFactory.fillDefaults().hint(r.width - r.x, SWT.DEFAULT).applyTo(text); } }</code><technical_language>I "Quick Access ()" right binding is Lars' commit for 491312 introduced a new message for "Quick Access ({0})" replace text for QuickAccessMessages.QuickAccess_EnterSearch text translated keybinding location. please restore QuickAccessMessages.QuickAccess_EnterSearch in case is keybinding, create a new message for case a keybinding</technical_language>

Target:
private void updateText(Text text) { if (text == null || text.isDisposed()) { return; } if (triggerSequence != null) { text.setMessage(NLS.bind(QuickAccessMessages.QuickAccess_EnterSearch, triggerSequence.format())); } else { text.setMessage(QuickAccessMessages.QuickAccess_EnterSearch_Empty); } GC gc = new GC(text); if (Util.isWin32() || Util.isGtk()) { FontMetrics fm = gc.getFontMetrics(); int wHint = QuickAccessMessages.QuickAccess_EnterSearch.length() * fm.getAverageCharWidth(); int hHint = fm.getHeight(); gc.dispose(); text.setSize(text.computeSize(wHint, hHint)); } else { Point p = gc.textExtent(QuickAccessMessages.QuickAccess_EnterSearch); Rectangle r = text.computeTrim(0, 0, p.x, p.y); gc.dispose(); GridDataFactory.fillDefaults().hint(r.width - r.x, SWT.DEFAULT).applyTo(text); } }
Source:
<code>private boolean handleOrphan(XAResource xares, Xid xid) { XAResourceOrphanFilter.Vote votingOutcome = XAResourceOrphanFilter.Vote.LEAVE_ALONE; for(XAResourceOrphanFilter filter : _xaResourceOrphanFilters) { XAResourceOrphanFilter.Vote vote = filter.checkXid(xid); if(jtaLogger.logger.isDebugEnabled()) { jtaLogger.logger.debug("XAResourceOrphanFilter " + filter.getClass().getName() + " voted " + vote); } if(vote == XAResourceOrphanFilter.Vote.LEAVE_ALONE) { return false; } else if(vote == XAResourceOrphanFilter.Vote.ROLLBACK) { votingOutcome = vote; } } try { if(votingOutcome == XAResourceOrphanFilter.Vote.ROLLBACK) { jtaLogger.i18NLogger.info_recovery_rollingback(XAHelper.xidToString(xid)); xares.rollback(xid); } } catch (XAException e1) { if(e1.errorCode == XAException.XAER_NOTA) { if(jtaLogger.logger.isDebugEnabled()) { <START> jtaLogger.logger.debug("XAER_NOTA received while rolling back " + XAHelper.xidToString(xid)); <END> } } else { jtaLogger.i18NLogger.warn_recovery_xarecovery1(_logName+".xaRecovery", XAHelper.printXAErrorCode(e1), e1); } switch (e1.errorCode) { case XAException.XAER_RMERR: break; case XAException.XA_HEURHAZ: case XAException.XA_HEURCOM: case XAException.XA_HEURMIX: case XAException.XA_HEURRB: case XAException.XA_RBROLLBACK: { return true; } default: break; } } catch (Exception e2) { jtaLogger.i18NLogger.warn_recovery_xarecovery2(_logName+".xaRecovery", e2); } return false; }</code><technical_language>fully here... good retain exception stacktrace in output kind of expected exception</technical_language>

Target:
private boolean handleOrphan(XAResource xares, Xid xid) { XAResourceOrphanFilter.Vote votingOutcome = XAResourceOrphanFilter.Vote.LEAVE_ALONE; for(XAResourceOrphanFilter filter : _xaResourceOrphanFilters) { XAResourceOrphanFilter.Vote vote = filter.checkXid(xid); if(jtaLogger.logger.isDebugEnabled()) { jtaLogger.logger.debug("XAResourceOrphanFilter " + filter.getClass().getName() + " voted " + vote); } if(vote == XAResourceOrphanFilter.Vote.LEAVE_ALONE) { return false; } else if(vote == XAResourceOrphanFilter.Vote.ROLLBACK) { votingOutcome = vote; } } try { if(votingOutcome == XAResourceOrphanFilter.Vote.ROLLBACK) { jtaLogger.i18NLogger.info_recovery_rollingback(XAHelper.xidToString(xid)); xares.rollback(xid); } } catch (XAException e1) { if(e1.errorCode == XAException.XAER_NOTA) { if(jtaLogger.logger.isDebugEnabled()) { jtaLogger.logger.debug(_logName+".xaRecovery: XAER_NOTA received while rolling back " + XAHelper.xidToString(xid)); } } else { jtaLogger.i18NLogger.warn_recovery_xarecovery1(_logName+".xaRecovery", XAHelper.printXAErrorCode(e1), e1); } switch (e1.errorCode) { case XAException.XAER_RMERR: break; case XAException.XA_HEURHAZ: case XAException.XA_HEURCOM: case XAException.XA_HEURMIX: case XAException.XA_HEURRB: case XAException.XA_RBROLLBACK: { return true; } default: break; } } catch (Exception e2) { jtaLogger.i18NLogger.warn_recovery_xarecovery2(_logName+".xaRecovery", e2); } return false; }
Source:
<code>public void task() { try { LOG.info("Starting ExchangeSceduleTask"); ExchangeInfoType exInfo = getExchangeDAO().loadExchangeInfo(); if (null != exInfo && exInfo.isRefreshActive()) { for (ExchangeType ex : exInfo.getExchanges().getExchange()) { if (EXCHANGE_TYPE.UDDI.toString().equalsIgnoreCase(ex.getType()) <START> && StringUtils.isNotEmpty(ex.getUrl())) { <END> LOG.info("Starting UDDI download"); ExchangeTransforms<BusinessDetail> transformer = new UDDITransform(); ex.setOrganizationList(transformer.transform(getUDDIManager(). forceRefreshUDDIFile(ex.getUrl()))); } } createFileBackupByRenaming(exInfo.getMaxNumberOfBackups()); exInfo.setLastUpdated(getTimestamp()); getExchangeDAO().saveExchangeInfo(exInfo); } } catch (ExchangeManagerException | UDDIAccessorException | DatatypeConfigurationException ex) { LOG.error("Unable to download from Exchange {}", ex.getLocalizedMessage(), ex); } }</code><technical_language>For debug purpose, put log.info display ex.getUrl url try hit</technical_language>

Target:
public void task() { try { LOG.info("Starting ExchangeSceduleTask"); ExchangeInfoType exInfo = getExchangeDAO().loadExchangeInfo(); if (null != exInfo && exInfo.isRefreshActive()) { for (ExchangeType ex : exInfo.getExchanges().getExchange()) { if (EXCHANGE_TYPE.UDDI.toString().equalsIgnoreCase(ex.getType()) && StringUtils.isNotEmpty(ex.getUrl())) { LOG.info("Starting UDDI download from {}", ex.getUrl()); ExchangeTransforms<BusinessDetail> transformer = new UDDITransform(); ex.setOrganizationList(transformer.transform(getUDDIManager(). forceRefreshUDDIFile(ex.getUrl()))); } } createFileBackupByRenaming(exInfo.getMaxNumberOfBackups()); exInfo.setLastUpdated(getTimestamp()); getExchangeDAO().saveExchangeInfo(exInfo); } } catch (ExchangeManagerException | UDDIAccessorException | DatatypeConfigurationException ex) { LOG.error("Unable to download from Exchange {}", ex.getLocalizedMessage(), ex); } }
Source:
<code>private void close(final boolean clean) { if (state() == State.CREATED) { transitionTo(State.CLOSING); } else { if (state() == State.RUNNING) { if (clean) commit(); transitionTo(State.CLOSING); } if (state() == State.CLOSING) { <START> StateManagerUtil.closeStateManager(log, logPrefix, clean, false, stateMgr, stateDirectory, "standby"); <END> } else { throw new IllegalStateException("Illegal state " + state() + " while closing standby task " + id); } } closeTaskSensor.record(); transitionTo(State.CLOSED); }</code><technical_language>TaskType.STANDBY</technical_language>

Target:
private void close(final boolean clean) { if (state() == State.CREATED) { transitionTo(State.CLOSING); } else { if (state() == State.RUNNING) { if (clean) commit(); transitionTo(State.CLOSING); } if (state() == State.CLOSING) { StateManagerUtil.closeStateManager(log, logPrefix, clean, false, stateMgr, stateDirectory, TaskType.STANDBY); } else { throw new IllegalStateException("Illegal state " + state() + " while closing standby task " + id); } } closeTaskSensor.record(); transitionTo(State.CLOSED); }
Source:
<code>public Converter createConverter(Class<?> source, Class<?> target, Hints hints) { if (byte[].class.equals(target) && Blob.class.isAssignableFrom(source)) { return new Converter() { @Override public <T> T convert(Object source, Class<T> target) throws Exception { if (source == null) { <START> throw new IllegalArgumentException(); <END> } Blob blob = (Blob) source; long length = blob.length(); if (length == 0) { return target.cast(new byte[0]); } if (length > Integer.MAX_VALUE) { return null; } int clength = (int) length; byte[] data = blob.getBytes(1, clength); return target.cast(data); } }; } return null; }</code><technical_language>Suggestion, I add some basic message argument invalid</technical_language>

Target:
public Converter createConverter(Class<?> source, Class<?> target, Hints hints) { if (byte[].class.equals(target) && Blob.class.isAssignableFrom(source)) { return new Converter() { @Override public <T> T convert(Object source, Class<T> target) throws Exception { if (source == null) { throw new IllegalArgumentException("source must not be null"); } Blob blob = (Blob) source; long length = blob.length(); if (length == 0) { return target.cast(new byte[0]); } if (length > Integer.MAX_VALUE) { return null; } int clength = (int) length; byte[] data = blob.getBytes(1, clength); return target.cast(data); } }; } return null; }
Source:
<code>public void addChars(StringBuilder toAddTo, char toAdd, int countOfChar) { if(countOfChar != 1) { toAddTo.append(countOfChar); } <START> countOfChar.append(toAdd); <END> }</code><technical_language>This is build is failing. toAddTo.append(toAdd). I spot before</technical_language>

Target:
public void addChars(StringBuilder toAddTo, char toAdd, int countOfChar) { if(countOfChar != 1) { toAddTo.append(countOfChar); } toAddTo.append(toAdd); }
Source:
<code>public static void scheduleQueueSyncJob(Context context) { if (context != null) { Configuration config = Blueshift.getInstance(context).getConfiguration(); if (config != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); if (jobScheduler != null) { ComponentName componentName = new ComponentName(context, RequestQueueJobService.class); int jobId = config.getNetworkChangeListenerJobId(); Log.d(LOG_TAG, "Job Id: " + jobId); JobInfo.Builder builder = new JobInfo.Builder(jobId, componentName); builder .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY) .setPeriodic(30 * 60 * 1000); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { builder.setRequiresBatteryNotLow(true); } JobInfo jobInfo = builder.build(); if (JobScheduler.RESULT_SUCCESS == jobScheduler.schedule(jobInfo)) { Log.i(LOG_TAG, "Successfully scheduled request queue sync job on network change"); } else { Log.w(LOG_TAG, "Could not schedule request queue sync job on network change"); } } } } else { <START> SdkLog.e(LOG_TAG, "Please initialize the SDK. Call initialize() method with a valid configuration object."); <END> } } }</code><technical_language>fix logging</technical_language>

Target:
public static void scheduleQueueSyncJob(Context context) { if (context != null) { Configuration config = Blueshift.getInstance(context).getConfiguration(); if (config != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); if (jobScheduler != null) { @SuppressLint("JobSchedulerService") ComponentName componentName = new ComponentName(context, RequestQueueJobService.class); int jobId = config.getNetworkChangeListenerJobId(); Log.d(LOG_TAG, "Job Id: " + jobId); JobInfo.Builder builder = new JobInfo.Builder(jobId, componentName); builder .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY) .setPeriodic(30 * 60 * 1000); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { builder.setRequiresBatteryNotLow(true); } JobInfo jobInfo = builder.build(); if (JobScheduler.RESULT_SUCCESS == jobScheduler.schedule(jobInfo)) { SdkLog.i(LOG_TAG, "Successfully scheduled request queue " + "sync job on network change"); } else { SdkLog.w(LOG_TAG, "Could not schedule request queue sync " + "job on network change"); } } } } else { Log.e(LOG_TAG, "Please initialize the SDK. Call initialize() method with " + "a valid configuration object."); } } }
Source:
<code>public void isLeader() { synchronized (lock) { if (running) { <START> leaderElectionEventHandler.onGrantLeadership(); <END> } } }</code><technical_language>triggering callbacks lock deadlocks implementation try obtain outer lock. If time user of this class wants close this component, user try acquire lock a deadlock</technical_language>

Target:
public void isLeader() { leaderElectionEventHandler.onGrantLeadership(); }
Source:
<code>public static String userToUri(String userName){ String uriString = ""; try { uriString = URIUtil.encodeQuery(userName, "UTF-8"); <START> System.out.println(uriString); <END> } catch (URIException e) { e.printStackTrace(); } uriString = uriString.replaceAll("!", toHex("!")); uriString = uriString.replaceAll("\\?", toHex("?")); uriString = uriString.replaceAll("\\+",toHex("+")); uriString = uriString.replaceAll("=", toHex("=")); return uriString; }</code><technical_language>missed a debug output :)</technical_language>

Target:
public static String userToUri(String userName){ String uriString = ""; try { uriString = URIUtil.encodeQuery(userName, "UTF-8"); } catch (URIException e) { e.printStackTrace(); } uriString = uriString.replaceAll("!", toHex("!")); uriString = uriString.replaceAll("\\?", toHex("?")); uriString = uriString.replaceAll("\\+", toHex("+")); uriString = uriString.replaceAll("=", toHex("=")); return uriString; }
Source:
<code>public void testAddingWorkflowForumUrl() throws ApiException { ApiClient webClient = WorkflowIT.getWebClient(USER_2_USERNAME, testingPostgres); WorkflowsApi workflowsApi = new WorkflowsApi(webClient); UsersApi usersApi = new UsersApi(webClient); usersApi.getUser(); Workflow workflow = workflowsApi .manualRegister("github", "DockstoreTestUser2/test_lastmodified", "/Dockstore.cwl", "test-update-workflow", "cwl", "/test.json"); workflow.setForumUrl("hello.com"); workflowsApi.updateWorkflow(workflow.getId(), workflow); <START> workflowsApi.refresh(workflow.getId()); <END> final String updatedForumUrl = testingPostgres .runSelectStatement("select forumurl from workflow where workflowname = 'test-update-workflow'", String.class); assertEquals("forumUrl should be updated, it is " + updatedForumUrl, "hello.com", updatedForumUrl); }</code><technical_language>Do need this? forumUrl in DB line 522? verify sticks refresh</technical_language>

Target:
public void testAddingWorkflowForumUrl() throws ApiException { ApiClient webClient = WorkflowIT.getWebClient(USER_2_USERNAME, testingPostgres); WorkflowsApi workflowsApi = new WorkflowsApi(webClient); Workflow workflow = workflowsApi .manualRegister(SourceControl.GITHUB.getFriendlyName(), "DockstoreTestUser2/test_lastmodified", "/Dockstore.cwl", "test-update-workflow", DescriptorLanguage.CWL.toString(), "/test.json"); workflow.setForumUrl("hello.com"); workflowsApi.updateWorkflow(workflow.getId(), workflow); workflowsApi.refresh(workflow.getId(), false); final String updatedForumUrl = testingPostgres .runSelectStatement("select forumurl from workflow where workflowname = 'test-update-workflow'", String.class); assertEquals("forumUrl should be updated, it is " + updatedForumUrl, "hello.com", updatedForumUrl); }
Source:
<code><START> public BytesValues(byte[][] values, boolean nullAllowed) <END> { super(nullAllowed); requireNonNull(values, "values is null"); checkArgument(values.length > 1, "values must contain at least 2 entries"); this.values = values; int hashTableSize = Integer.highestOneBit(values.length * 5); hashTableSizeMask = hashTableSize - 1; hashTable = new byte[hashTableSize][]; bloomSize = Math.max(1, hashTableSize / 8); bloom = new long[bloomSize]; for (byte[] value : values) { long hashCode = hash(value, 0, value.length); addBloom(hashCode); int position = (int) (hashCode & hashTableSizeMask); for (int i = position; i <= position + hashTableSizeMask; i++) { int index = i & hashTableSizeMask; if (hashTable[index] == null) { hashTable[index] = value; break; } if (compareRanges(value, 0, value.length, hashTable[index], 0, hashTable[index].length) == 0) { break; } } } }</code><technical_language>BytesValues constructor needs private</technical_language>

Target:
private BytesValues(byte[][] values, boolean nullAllowed) { super(nullAllowed); requireNonNull(values, "values is null"); checkArgument(values.length > 1, "values must contain at least 2 entries"); this.values = values; int hashTableSize = Integer.highestOneBit(values.length * 4); hashTableSizeMask = hashTableSize - 1; hashTable = new byte[hashTableSize][]; bloomSize = Math.max(1, hashTableSize / 8); bloom = new long[bloomSize]; for (byte[] value : values) { long hashCode = hash(value, 0, value.length); bloom[bloomIndex(hashCode)] |= bloomMask(hashCode); int position = (int) (hashCode & hashTableSizeMask); for (int i = position; i <= position + hashTableSizeMask; i++) { int index = i & hashTableSizeMask; if (hashTable[index] == null) { hashTable[index] = value; break; } if (compareRanges(value, 0, value.length, hashTable[index], 0, hashTable[index].length) == 0) { break; } } } }
Source:
<code>public ITmfStateSystem getSS() { <START> return fSS; <END> }</code><technical_language>mark @NonNull</technical_language>

Target:
public @NonNull ITmfStateSystem getSS() { return fSS; }
Source:
<code>public synchronized void close() throws IOException { <START> this.isOpen = false; <END> Collections.reverse(methodsToClose); for (Closeable toClose : methodsToClose) { toClose.close(); } }</code><technical_language>consequence of this is isOpen false **before** Closeables closed. I assume this is design? In case, covered a test case</technical_language>

Target:
public void close() throws IOException { if (state.compareAndSet(AVAILABLE, PROCESSING)) { Collections.reverse(methodsToClose); for (Closeable toClose : methodsToClose) { toClose.close(); } state.set(DONE); } }
Source:
<code>public boolean equals(Object o) { BeanPathMetaConstraintProcessedUnit that = (BeanPathMetaConstraintProcessedUnit) o; if ( bean != that.bean ) { return false; } if ( metaConstraint != that.metaConstraint ) { return false; } if ( !path.equals( that.path ) ) { return false; } <START> <END> return true; }</code><technical_language>top? avoid cast if can</technical_language>

Target:
public boolean equals(Object o) { if ( this == o ) { return true; } BeanPathMetaConstraintProcessedUnit that = (BeanPathMetaConstraintProcessedUnit) o; if ( bean != that.bean ) { return false; } if ( metaConstraint != that.metaConstraint ) { return false; } if ( !path.equals( that.path ) ) { return false; } return true; }
Source:
<code>public MessageGroup addMessageToGroup(Object groupId, Message<?> message) { Lock lock = this.lockRegistry.obtain(groupId); try { lock.lockInterruptibly(); try { SimpleMessageGroup group = this.groupIdToMessageGroup.get(groupId); if (group == null) { group = new SimpleMessageGroup(groupId); this.groupIdToMessageGroup.putIfAbsent(groupId, group); this.groupToUpperBound.putIfAbsent(groupId, new UpperBound(this.groupCapacity)); } <START> if (!this.groupToUpperBound.get(groupId).tryAcquire(this.upperBoundTimeout)) { <END> throw new MessagingException(this.getClass().getSimpleName() + " was out of capacity at for individual group, " + "try constructing it with a larger capacity."); } group.add(message); this.groupIdToMessageGroup.get(groupId).setLastModified(System.currentTimeMillis()); return group; } finally { lock.unlock(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new MessagingException("Interrupted while obtaining lock", e); } }</code><technical_language>need a new catch for InterruptedException here, need fix message in MessagingException in outer catch interrupt lock acquisition</technical_language>

Target:
public MessageGroup addMessageToGroup(Object groupId, Message<?> message) { Lock lock = this.lockRegistry.obtain(groupId); try { lock.lockInterruptibly(); boolean unlocked = false; try { UpperBound upperBound; MessageGroup group = this.groupIdToMessageGroup.get(groupId); if (group == null) { group = getMessageGroupFactory().create(groupId); this.groupIdToMessageGroup.putIfAbsent(groupId, group); upperBound = new UpperBound(this.groupCapacity); upperBound.tryAcquire(-1); this.groupToUpperBound.putIfAbsent(groupId, upperBound); } else { upperBound = this.groupToUpperBound.get(groupId); Assert.state(upperBound != null, "'upperBound' must not be null."); lock.unlock(); if (!upperBound.tryAcquire(this.upperBoundTimeout)) { unlocked = true; throw new MessagingException(this.getClass().getSimpleName() + " was out of capacity (" + this.groupCapacity + ") for group '" + groupId + "', try constructing it with a larger capacity."); } lock.lockInterruptibly(); } group.add(message); group.setLastModified(System.currentTimeMillis()); return group; } finally { if (!unlocked) { lock.unlock(); } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new MessagingException("Interrupted while obtaining lock", e); } }
Source:
<code>public void stop(final BundleContext context) throws Exception { SelectionRepositoryStateCache.INSTANCE.dispose(); if (focusListener != null) { if (PlatformUI.isWorkbenchRunning()) { PlatformUI.getWorkbench().removeWindowListener(focusListener); } focusListener = null; } if (GitTraceLocation.REPOSITORYCHANGESCANNER.isActive()) { GitTraceLocation.getTrace().trace( GitTraceLocation.REPOSITORYCHANGESCANNER.getLocation(), "Trying to cancel " + rcs.getName() + " job"); } <START> getPreferenceStore().removePropertyChangeListener(rcs); rcs.setReschedule(false); rcs.cancel(); refreshJob.cancel(); rcs.join(); refreshJob.join(); <END> if (GitTraceLocation.REPOSITORYCHANGESCANNER.isActive()) { GitTraceLocation.getTrace().trace( GitTraceLocation.REPOSITORYCHANGESCANNER.getLocation(), "Jobs terminated"); } if (resourceManager != null) { resourceManager.dispose(); resourceManager = null; } super.stop(context); plugin = null; }</code><technical_language>I this fail "fast" stop. If is needed new service only, init/dispose done service start/stop hooks</technical_language>

Target:
public void stop(final BundleContext context) throws Exception { SelectionRepositoryStateCache.INSTANCE.dispose(); if (focusListener != null) { if (PlatformUI.isWorkbenchRunning()) { PlatformUI.getWorkbench().removeWindowListener(focusListener); } focusListener = null; } if (GitTraceLocation.REPOSITORYCHANGESCANNER.isActive()) { GitTraceLocation.getTrace().trace( GitTraceLocation.REPOSITORYCHANGESCANNER.getLocation(), "Trying to cancel " + rcs.getName() + " job"); } getPreferenceStore().removePropertyChangeListener(rcs); rcs.setReschedule(false); rcs.cancel(); refreshJob.cancel(); if (GitTraceLocation.REPOSITORYCHANGESCANNER.isActive()) { GitTraceLocation.getTrace().trace( GitTraceLocation.REPOSITORYCHANGESCANNER.getLocation(), "Jobs terminated"); } if (resourceManager != null) { resourceManager.dispose(); resourceManager = null; } super.stop(context); plugin = null; }
Source:
<code>protected String prepareSearchUrl(String type) { URIBuilder url = null; String midUrl = "search/"; try { switch(type) { case "user": midUrl = "profile/"; url = new URIBuilder(this.baseUrl + midUrl + this.query); break; case "question": url = new URIBuilder(this.baseUrl + midUrl); url.addParameter("q", this.query); url.addParameter("type", "question"); break; case "answer": url = new URIBuilder(this.baseUrl + midUrl); url.addParameter("q", this.query); url.addParameter("type", "answer"); break; default: url = new URIBuilder(""); break; } } catch (URISyntaxException e) { DAO.log("Invalid Url: baseUrl = " + this.baseUrl + ", mid-URL = " + midUrl + "query = " + this.query + "type = " + type); <START> return ""; <END> } return url.toString(); }</code><technical_language>null a invalid URL ""</technical_language>

Target:
protected String prepareSearchUrl(String type) { URIBuilder url = null; String midUrl = "search/"; try { switch(type) { case "user": midUrl = "profile/"; url = new URIBuilder(this.baseUrl + midUrl + this.query); break; case "question": url = new URIBuilder(this.baseUrl + midUrl); url.addParameter("q", this.query); url.addParameter("type", "question"); break; case "answer": url = new URIBuilder(this.baseUrl + midUrl); url.addParameter("q", this.query); url.addParameter("type", "answer"); break; default: url = new URIBuilder(""); break; } } catch (URISyntaxException e) { DAO.log("Invalid Url: baseUrl = " + this.baseUrl + ", mid-URL = " + midUrl + "query = " + this.query + "type = " + type); } return url.toString(); }
Source:
<code>protected ValidationResult macAvailable() { VmNic nic = getParameters().getNic(); if (new VmInterfaceManager().tooManyPluggedInterfaceWithSameMac(nic, getMacPool())) { return new ValidationResult(EngineMessage.NETWORK_MAC_ADDRESS_IN_USE, ReplacementUtils.createSetVariableString(VAR_MAC_IN_USE, nic.getMacAddress()), ReplacementUtils.createSetVariableString(VAR_IN_USE_BY, <START> getVm().getName())); <END> } return ValidationResult.VALID; }</code><technical_language>Is this correct VM</technical_language>

Target:
protected ValidationResult macAvailable() { VmNic nic = getParameters().getNic(); Optional<VM> optionalVm = new VmInterfaceManager().getVmWithSameMacAs(nic, getMacPool()); return optionalVm.map(vm -> new ValidationResult(EngineMessage.NETWORK_MAC_ADDRESS_IN_USE, ReplacementUtils.createSetVariableString(MacAddressValidator.VAR_MAC_ADDRESS, nic.getMacAddress()), ReplacementUtils.createSetVariableString(MacAddressValidator.VAR_VM_NAME, vm.getName()))) .orElse(ValidationResult.VALID); }
Source:
<code>void awaitTermination() { if (compactionExecutor != null) { try { compactionThread.join(2000); } catch (InterruptedException e) { <START> logger.error("Compaction thread join wait was interrupted"); <END> } } }</code><technical_language>add mountPath</technical_language>

Target:
void awaitTermination() { if (compactionExecutor != null) { try { compactionThread.join(2000); } catch (InterruptedException e) { logger.error("Compaction thread join wait for was interrupted", mountPath); } } }
Source:
<code>public ClusteringServiceConfiguration(Iterable<InetSocketAddress> servers, String cacheManagerName, Timeouts timeouts, boolean autoCreate, ServerSideConfiguration serverConfig, Properties properties) { this.clusterUri = null; <START> this.servers = StreamSupport.stream(Objects.requireNonNull(servers, "Servers cannot be null").spliterator(), false).collect(toList()); <END> this.cacheMangerName = Objects.requireNonNull(cacheManagerName, "Cache manager name cannot be null"); this.autoCreate = autoCreate; this.serverConfiguration = serverConfig; this.timeouts = Objects.requireNonNull(timeouts, "Operation timeouts cannot be null"); this.properties = (Properties) Objects.requireNonNull(properties, "Properties cannot be null").clone(); }</code><technical_language>This a bit profligate... stream construction a spliterator a bit unusual</technical_language>

Target:
public ClusteringServiceConfiguration(Iterable<InetSocketAddress> servers, String cacheManagerName, Timeouts timeouts, boolean autoCreate, ServerSideConfiguration serverConfig, Properties properties) { this.connectionSource = new ConnectionSource(servers); this.cacheManagerName = Objects.requireNonNull(cacheManagerName, "Cache manager name cannot be null"); this.autoCreate = autoCreate; this.serverConfiguration = serverConfig; this.timeouts = Objects.requireNonNull(timeouts, "Operation timeouts cannot be null"); this.properties = (Properties) Objects.requireNonNull(properties, "Properties cannot be null").clone(); }
Source:
<code>public ParametersBuilder add(int hour, int minute, int second, int nanosecond, ZoneId defaultTimeZone) { if ( isNanosecondPrecisionSupported() ) { <START> nanosecond = 0; <END> } return add( defaultTimeZone, hour, minute, second, nanosecond, 1970, 1, 1 ); }</code><technical_language>if condition be: if ( !isNanosecondPrecisionSupported() )</technical_language>

Target:
public ParametersBuilder add(int hour, int minute, int second, int nanosecond, ZoneId defaultTimeZone) { if ( !isNanosecondPrecisionSupported() ) { nanosecond = 0; } return add( defaultTimeZone, hour, minute, second, nanosecond, 1970, 1, 1 ); }
Source:
<code>public SslHandler newTLSHandler() { SslHandler sslHandler = sslContext.newHandler(PooledByteBufAllocator.DEFAULT); if (protocols != null && protocols.length != 0) { sslHandler.engine().setEnabledProtocols(protocols); } LOG.info("Enabled cipher protocols: ", Arrays.toString(sslHandler.engine().getEnabledProtocols())); <START> <END> if (ciphers != null && ciphers.length != 0) { sslHandler.engine().setEnabledCipherSuites(ciphers); } LOG.info("Enabled cipher suites: ", Arrays.toString(sslHandler.engine().getEnabledCipherSuites())); return sslHandler; }</code><technical_language>Do need this info level</technical_language>

Target:
public SslHandler newTLSHandler() { SslHandler sslHandler = sslContext.newHandler(PooledByteBufAllocator.DEFAULT); if (protocols != null && protocols.length != 0) { sslHandler.engine().setEnabledProtocols(protocols); } if (LOG.isDebugEnabled()) { LOG.debug("Enabled cipher protocols: ", Arrays.toString(sslHandler.engine().getEnabledProtocols())); } if (ciphers != null && ciphers.length != 0) { sslHandler.engine().setEnabledCipherSuites(ciphers); } if (LOG.isDebugEnabled()) { LOG.debug("Enabled cipher suites: ", Arrays.toString(sslHandler.engine().getEnabledCipherSuites())); } return sslHandler; }