auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public CtfIterator <START> getIterator(final <END> CtfTmfContext context) { CtfIterator iter = fMap.get(context); if (iter == null) { fAccessLock.lock(); try { if (fRandomAccess.size() < MAX_SIZE) { iter = (CtfIterator) fTrace.createIterator(); if (iter == null) { return null; } addElement(context, iter); } else { iter = replaceRandomElement(context); } if (context.getLocation() != null) { final CtfLocationInfo location = (CtfLocationInfo) context.getLocation().getLocationInfo(); iter.seek(location); } } finally { fAccessLock.unlock(); } } return iter; }</code><technical_language>this @Nullable well? This method is in CtfTmfTrace.init() is a potential NPE if returns null</technical_language>

Target:
public @Nullable CtfIterator getIterator(final CtfTmfContext context) { CtfIterator iter = fMap.get(context); if (iter == null) { fAccessLock.lock(); try { if (fRandomAccess.size() < MAX_SIZE) { iter = (CtfIterator) fTrace.createIterator(); if (iter == null) { return null; } addElement(context, iter); } else { iter = replaceRandomElement(context); } if (context.getLocation() != null) { final CtfLocationInfo location = (CtfLocationInfo) context.getLocation().getLocationInfo(); iter.seek(location); } } finally { fAccessLock.unlock(); } } return iter; }
Source:
<code>public UserDevfileSearchQueryBuilder withFilter(List<Pair<String, String>> filter) { if (filter == null || filter.isEmpty()) { this.filter = ""; return this; } final StringJoiner matcher = new StringJoiner(" AND ", " WHERE ", " "); int i = 0; for (Pair<String, String> attribute : filter) { final String parameterName = "parameterName" + i++; if (attribute.second.startsWith("like:")) { params.put(parameterName, attribute.second.substring(5)); matcher.add("userdevfile." + attribute.first + " LIKE :" + parameterName); } else { params.put(parameterName, attribute.second); <START> matcher.add("userdevfile." + attribute.first + " = :" + parameterName); <END> } } this.filter = matcher.toString(); return this; }</code><technical_language>do validation of attributes upfront noted attribute.first is put query unsanitized. If fail remember in future allow for "arbitrary" keys, run in risk of SQL injection</technical_language>

Target:
public UserDevfileSearchQueryBuilder withFilter(List<Pair<String, String>> filter) { if (filter == null || filter.isEmpty()) { return this; } final StringJoiner matcher = new StringJoiner(" AND ", " WHERE ", " "); int i = 0; for (Pair<String, String> attribute : filter) { if (!VALID_SEARCH_FIELDS.contains(attribute.first.toLowerCase())) { throw new IllegalArgumentException( "Filtering allowed only by " + VALID_SEARCH_FIELDS + " but got: " + attribute.first); } final String parameterName = "parameterName" + i++; if (attribute.second.startsWith("like:")) { params.put(parameterName, attribute.second.substring(5)); matcher.add("userdevfile." + attribute.first + " LIKE :" + parameterName); } else { params.put(parameterName, attribute.second); matcher.add("userdevfile." + attribute.first + " = :" + parameterName); } } this.filter = matcher.toString(); return this; }
Source:
<code>private boolean isInStudy(StudyIdentifier studyId, Survey survey) { if (studyId == null || survey == null || survey.getStudyIdentifier() == null) { return true; } return survey.getStudyIdentifier().equals("shared") || <START> survey.getStudyIdentifier().equals(studyId.getIdentifier()); <END> }</code><technical_language>This allows non-Sage developers modify, update, delete surveys in shared study, is want allow. Shared modules managed Sage</technical_language>

Target:
private boolean isInStudy(StudyIdentifier studyId, Survey survey) { return isInStudy(ImmutableSet.of(), studyId, survey); }
Source:
<code>private boolean mustCheckPasswordValidity() { <START> return Framework.getService(ConfigurationService.class).getBoolean(VALIDATE_PASSWORD_PARAM, true); <END> }</code><technical_language>Default false</technical_language>

Target:
private boolean mustCheckPasswordValidity() { return Framework.getService(ConfigurationService.class).isBooleanTrue(VALIDATE_PASSWORD_PARAM); }
Source:
<code>protected void doDelivery(ResourceDeliveryMessage theMsg, CanonicalSubscription theSubscription, IChannelProducer theChannelProducer, IBaseResource thePayloadResource) { <START> ResourceModifiedMessage payload = new ResourceModifiedMessage(myFhirContext, thePayloadResource, theMsg.getOperationType()); <END> payload.setParentTransactionGuid(theMsg.getParentTransactionGuid()); ResourceModifiedJsonMessage message = new ResourceModifiedJsonMessage(payload); theChannelProducer.send(message); ourLog.debug("Delivering message payload for {}", theMsg.getOperationType(), theMsg.getPayloadId(), theSubscription.getIdElement(myFhirContext).toUnqualifiedVersionless().getValue()); }</code><technical_language>subscription id useful recipient. I leave in populate if possible</technical_language>

Target:
protected void doDelivery(ResourceDeliveryMessage theMsg, CanonicalSubscription theSubscription, IChannelProducer theChannelProducer, IBaseResource thePayloadResource) { ResourceModifiedMessage payload = new ResourceModifiedMessage(myFhirContext, thePayloadResource, theMsg.getOperationType()); payload.setTransactionId(theMsg.getTransactionId()); ResourceModifiedJsonMessage message = new ResourceModifiedJsonMessage(payload); theChannelProducer.send(message); ourLog.debug("Delivering message payload for {}", theMsg.getOperationType(), theMsg.getPayloadId(), theSubscription.getIdElement(myFhirContext).toUnqualifiedVersionless().getValue()); }
Source:
<code>protected TokenTaskResult doInBackground(Void... empty) { Oauth2 oauthRequest = new Oauth2(mAuthRequest, mWebRequestHandler); TokenTaskResult result = new TokenTaskResult(); try { result.taskResult = oauthRequest.getToken(mUrl); Logger.v(TAG, "TokenTask processed the result. " + mAuthRequest.getLogInfo()); } catch (Exception exc) { Logger.e(TAG, <START> "Error in processing code to get a token. " + mAuthRequest.getLogInfo(), <END> "", ADALError.AUTHORIZATION_CODE_NOT_EXCHANGED_FOR_TOKEN, exc); result.taskException = exc; } if (result != null && result.taskResult != null && result.taskResult.getAccessToken() != null) { Logger.v(TAG, "Setting account:" + mAuthRequest.getLogInfo()); try { setAccount(result); } catch (Exception exc) { Logger.e(TAG, "Error in setting the account" + mAuthRequest.getLogInfo(), "", ADALError.BROKER_ACCOUNT_SAVE_FAILED, exc); result.taskException = exc; } } return result; }</code><technical_language>helpful include 'mUrl' in log, if is included in mAuthRequest.getLogInfo()</technical_language>

Target:
protected TokenTaskResult doInBackground(Void... empty) { Oauth2 oauthRequest = new Oauth2(mAuthRequest, mWebRequestHandler); TokenTaskResult result = new TokenTaskResult(); try { result.taskResult = oauthRequest.getToken(mUrl); Logger.v(TAG, "TokenTask processed the result. " + mAuthRequest.getLogInfo()); } catch (Exception exc) { Logger.e(TAG, "Error in processing code to get a token. " + mAuthRequest.getLogInfo(), "Request url:" + mUrl, ADALError.AUTHORIZATION_CODE_NOT_EXCHANGED_FOR_TOKEN, exc); result.taskException = exc; } if (result != null && result.taskResult != null && result.taskResult.getAccessToken() != null) { Logger.v(TAG, "Setting account:" + mAuthRequest.getLogInfo()); try { setAccount(result); } catch (Exception exc) { Logger.e(TAG, "Error in setting the account" + mAuthRequest.getLogInfo(), "", ADALError.BROKER_ACCOUNT_SAVE_FAILED, exc); result.taskException = exc; } } return result; }
Source:
<code><START> private void executeBatchUpdateAssociation(Map<DBCollection, BatchInsertionTask> inserts, UpdateAssociationOperation updateOp) { <END> AssociationKey associationKey = updateOp.getAssociationKey(); AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( associationKey, updateOp.getContext() ); if ( AssociationStorageStrategy.IN_ENTITY == storageStrategy ) { DBCollection collection = getCollection( associationKey.getEntityKey() ); if ( inserts.containsKey( collection ) ) { BatchInsertionTask insertionTask = inserts.get( collection ); if ( insertionTask.containsKey( associationKey.getEntityKey() ) ) { WriteConcern writeConcern = getWriteConcern( updateOp.getContext() ); BatchInsertionTask batchInsertionTask = getOrCreateBatchInsertionTask( inserts, collection, writeConcern ); DBObject currentDocument = batchInsertionTask.get( associationKey.getEntityKey() ); List<?> rows = getAssociationRows( updateOp.getAssociation(), updateOp.getAssociationKey() ); MongoHelpers.setValue( currentDocument, associationKey.getMetadata().getCollectionRole(), rows ); return; } } } insertOrUpdateAssociation( updateOp.getAssociationKey(), updateOp.getAssociation(), updateOp.getContext() ); }</code><technical_language>is ensured updateTuple() written datastore? missing working</technical_language>

Target:
private void executeBatchUpdateAssociation(Map<DBCollection, BatchInsertionTask> inserts, UpdateAssociationOperation updateOp) { AssociationKey associationKey = updateOp.getAssociationKey(); AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( associationKey, updateOp.getContext() ); if ( AssociationStorageStrategy.IN_ENTITY == storageStrategy ) { DBCollection collection = getCollection( associationKey.getEntityKey() ); if ( inserts.containsKey( collection ) ) { BatchInsertionTask insertionTask = inserts.get( collection ); if ( insertionTask.containsKey( associationKey.getEntityKey() ) ) { updateDocumentWithAssociationRows( inserts, updateOp, associationKey, collection ); return; } } } insertOrUpdateAssociation( updateOp.getAssociationKey(), updateOp.getAssociation(), updateOp.getContext() ); }
Source:
<code>public void buildBasicImage() throws Exception { final String rule = "rultor-on-commit"; final ButtonRs res = new ButtonRs( new ButtonRs.Build() { @Override public String info(final URI uri, final String stand) { return String.format( "<page><widgets><widget class=\"com.rultor.widget.BuildHealth\"><builds><build>" + " <coordinates><rule>%s</rule></coordinates>" + " <duration>1212602</duration>" + " <code>0</code>" + " <health>0.6153846153846154</health>" + "</build></builds></widget></widgets></page>", rule ); } } ); res.setUriInfo(new UriInfoMocker().mock()); res.setHttpHeaders(new HttpHeadersMocker().mock()); res.setSecurityContext(Mockito.mock(SecurityContext.class)); res.setStand("stand"); res.setRule(rule); final ServletContext context = Mockito.mock(ServletContext.class); Mockito.when(context.getResourceAsStream(Mockito.anyString())) .thenReturn( this.getClass().getResourceAsStream( <START> "/com/rultor/web/button.xsl" <END> ) ); res.setServletContext(context); MatcherAssert.assertThat( URLConnection.guessContentTypeFromStream( new ByteArrayInputStream((byte[]) res.button().getEntity()) ), Matchers.equalTo(MediaType.PNG.toString()) ); }</code><technical_language>here, "button.xsl" is enough</technical_language>

Target:
public void buildBasicImage() throws Exception { final String rule = "rultor-on-commit"; final ButtonRs res = new ButtonRs( new ButtonRs.Build() { @Override public String info(final URI uri, final String stand) { return String.format( "<page><widgets><widget class=\"com.rultor.widget.BuildHealth\"><builds><build>" + " <coordinates><rule>%s</rule></coordinates>" + " <duration>1212602</duration>" + " <code>0</code>" + " <health>0.6153846153846154</health>" + "</build></builds></widget></widgets></page>", rule ); } } ); res.setUriInfo(new UriInfoMocker().mock()); res.setHttpHeaders(new HttpHeadersMocker().mock()); res.setSecurityContext(Mockito.mock(SecurityContext.class)); res.setStand("stand"); res.setRule(rule); final ServletContext context = Mockito.mock(ServletContext.class); Mockito.when(context.getResourceAsStream(Mockito.anyString())) .thenReturn( this.getClass().getResourceAsStream( "button.xsl" ) ); res.setServletContext(context); MatcherAssert.assertThat( URLConnection.guessContentTypeFromStream( new ByteArrayInputStream((byte[]) res.button().getEntity()) ), Matchers.equalTo(MediaType.PNG.toString()) ); }
Source:
<code>private void createResourceSelectionComposite(Composite parent) { resourceSelectionComposite = new ResourceSelectionComposite( parent, SWT.BORDER | SWT.V_SCROLL, PlatformUI.getPreferenceStore() .getBoolean(EclipsePreferenceConstants.PROJECTSELECTION_FILTERCLOSEDPROJECTS)); final Runnable takeOverPerspectiveSelection = new Runnable() { @Override public void run() { final List<IResource> selectedResources = new ArrayList<IResource>(); resourceSelectionComposite.addResourceSelectionListener(resourceSelectionListener); if (preselectedResources != null && preselectedResources.size() > 0) { selectedResources.addAll(preselectedResources); resourceSelectionComposite.setSelectedResources(selectedResources); } preselectedResources = null; <START> List<IProject> displayedProjects = resourceSelectionComposite.getDisplayedProjects(); <END> if (selectedResources.size() == 0 && displayedProjects.size() == 1) { selectedResources.addAll(displayedProjects); resourceSelectionComposite.setSelectedResources(selectedResources); } resourceSelectionComposite.rememberSelection(); if (selectedResources.size() > 0) { setPageComplete(true); } else { setErrorMessage(Messages.ProjectSelectionWizardPage_selected_no_project); setPageComplete(false); } } }; SWTUtils.runSafeSWTAsync( log, new Runnable() { @Override public void run() { final Shell shell = ResourceSelectionWizardPage.this.getShell(); if (shell == null || shell.isDisposed()) return; BusyIndicator.showWhile(shell.getDisplay(), takeOverPerspectiveSelection); } }); }</code><technical_language>this is a relict Saros share projects this behavior sense. reason throw</technical_language>

Target:
private void createResourceSelectionComposite(Composite parent) { resourceSelectionComposite = new ResourceSelectionComposite( parent, SWT.BORDER | SWT.V_SCROLL, PlatformUI.getPreferenceStore() .getBoolean(EclipsePreferenceConstants.PROJECTSELECTION_FILTERCLOSEDPROJECTS)); final Runnable takeOverPerspectiveSelection = new Runnable() { @Override public void run() { resourceSelectionComposite.addResourceSelectionListener(resourceSelectionListener); if (preselectedResources != null && !preselectedResources.isEmpty()) { resourceSelectionComposite.setSelectedResources( new ArrayList<>(preselectedResources)); } preselectedResources = null; if (!resourceSelectionComposite.getSelectedBaseContainers().isEmpty()) { resourceSelectionComposite.rememberSelection(); setPageComplete(true); } else { setPageComplete(false); } } }; SWTUtils.runSafeSWTAsync( log, new Runnable() { @Override public void run() { final Shell shell = ResourceSelectionWizardPage.this.getShell(); if (shell == null || shell.isDisposed()) return; BusyIndicator.showWhile(shell.getDisplay(), takeOverPerspectiveSelection); } }); }
Source:
<code>public static TimeDistanceMatrix provideMatrix(Config config) { if (config.getBoolean(Keys.MATRIX_ENABLE)) { String type = config.getString(Keys.MATRIX_TYPE, "locationiq"); String url = config.getString(Keys.MATRIX_URL); String key = config.getString(Keys.MATRIX_KEY); switch (type) { case "openrouteservice": return new OpenRouteServiceTimeDistance(url, key); case "locationiq": default: <START> return new LocationIQTimeDistance(url, key); <END> } } return null; }</code><technical_language>Incorrect naming convention again. camel-case</technical_language>

Target:
public static TimeDistanceMatrix provideMatrix(Config config) { if (config.getBoolean(Keys.TIMEDISTANCEMATRIX_ENABLE)) { String type = config.getString(Keys.TIMEDISTANCEMATRIX_TYPE, "locationiq"); String url = config.getString(Keys.TIMEDISTANCEMATRIX_URL); String key = config.getString(Keys.TIMEDISTANCEMATRIX_KEY); switch (type) { case "openrouteservice": return new OpenRouteServiceTimeDistance(url, key); case "locationiq": default: return new LocationIqTimeDistance(url, key); } } return null; }
Source:
<code>public static void main(String... args) throws IOException { final Main main = new Main(); final CommandLine commandLine = new CommandLine(main); commandLine.setUsageHelpWidth(HELP_WIDTH); commandLine.setCaseInsensitiveEnumValuesAllowed(true); int exitStatus = 0; int errorCounter = 0; try { final ParseResult parseResult = commandLine.parseArgs(args); <START> final boolean helpWasRequested = CommandLine.printHelpIfRequested(parseResult); <END> if (!helpWasRequested) { exitStatus = main.call(); if (exitStatus > 0) { errorCounter = exitStatus; } } } catch (ParameterException ex) { System.err.println(ex.getMessage()); ex.getCommandLine().usage(System.err); exitStatus = EXIT_WITH_INVALID_USER_INPUT_CODE; } catch (CheckstyleException ex) { exitStatus = EXIT_WITH_CHECKSTYLE_EXCEPTION_CODE; errorCounter = 1; ex.printStackTrace(); } finally { if (errorCounter > 0) { final LocalizedMessage errorCounterMessage = new LocalizedMessage(1, Definitions.CHECKSTYLE_BUNDLE, ERROR_COUNTER, new String[] {String.valueOf(errorCounter)}, null, Main.class, null); System.out.println(errorCounterMessage.getMessage()); } if (exitStatus != 0) { System.exit(exitStatus); } } }</code><technical_language>do in API methods isHelpRequested ? code like: if (CommandLine.isHelpRequested) { CommandLine.printHelp } esle { // do smth } mind is more readable code</technical_language>

Target:
public static void main(String... args) throws IOException { final CliOptions cliOptions = new CliOptions(); final CommandLine commandLine = new CommandLine(cliOptions); commandLine.setUsageHelpWidth(CliOptions.HELP_WIDTH); commandLine.setCaseInsensitiveEnumValuesAllowed(true); int exitStatus = 0; int errorCounter = 0; try { final ParseResult parseResult = commandLine.parseArgs(args); if (parseResult.isVersionHelpRequested()) { System.out.println(getVersionString()); } else if (parseResult.isUsageHelpRequested()) { commandLine.usage(System.out); } else { exitStatus = execute(parseResult, cliOptions); errorCounter = exitStatus; } } catch (ParameterException ex) { exitStatus = EXIT_WITH_INVALID_USER_INPUT_CODE; System.err.println(ex.getMessage()); System.err.println("Usage: checkstyle [OPTIONS]... FILES..."); System.err.println("Try 'checkstyle --help' for more information."); } catch (CheckstyleException ex) { exitStatus = EXIT_WITH_CHECKSTYLE_EXCEPTION_CODE; errorCounter = 1; ex.printStackTrace(); } finally { if (errorCounter > 0) { final LocalizedMessage errorCounterMessage = new LocalizedMessage(1, Definitions.CHECKSTYLE_BUNDLE, ERROR_COUNTER, new String[] {String.valueOf(errorCounter)}, null, Main.class, null); System.out.println(errorCounterMessage.getMessage()); } if (exitStatus != 0) { System.exit(exitStatus); } } }
Source:
<code>private long updateInstanceId() { long nextInstanceId = 0L; <START> boolean transactionAborted = false; <END> do { try { runtime.getObjectsView().TXBuild() .type(TransactionType.OPTIMISTIC) .build() .begin(); nextInstanceId = distributedCounter.getOrDefault(GUID_STREAM_KEY, 1L) + 1; distributedCounter.put(GUID_STREAM_KEY, nextInstanceId); runtime.getObjectsView().TXEnd(); transactionAborted = false; } catch (TransactionAbortedException e) { log.error("Transaction aborted while trying to update GUID counter", e); transactionAborted = true; } } while (transactionAborted); instanceId = nextInstanceId; return nextInstanceId; }</code><technical_language>Instead of tracking extra variable, while(true) break</technical_language>

Target:
private long updateInstanceId() { long nextInstanceId = 0L; while(true) { try { runtime.getObjectsView().TXBuild() .type(TransactionType.OPTIMISTIC) .build() .begin(); nextInstanceId = distributedCounter.getOrDefault(GUID_STREAM_KEY, 1L) + 1; distributedCounter.put(GUID_STREAM_KEY, nextInstanceId); runtime.getObjectsView().TXEnd(); break; } catch (TransactionAbortedException e) { log.error("updateInstanceId: Transaction aborted while updating GUID counter", e); } } instanceId = nextInstanceId; return nextInstanceId; }
Source:
<code>public void runAppAndBasicTest() throws InterruptedException, ExecutionException { <START> <END> assertThat(rest.get("http://localhost:8080/binder/test"), is("hello world!")); }</code><technical_language>whitespace also</technical_language>

Target:
public void runAppAndBasicTest() throws InterruptedException, ExecutionException { assertThat(rest.get("http://localhost:8080/binder/test/myEndPoint"), is("hello world!")); }
Source:
<code>private void loadData() { progressBar.setVisibility(View.VISIBLE); disposable = Observable.fromCallable(DBReader::getNavDrawerData) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(result -> { navDrawerData = result; updateSelection(); navAdapter.notifyDataSetChanged(); <START> progressBar.setVisibility(View.GONE); <END> }, error -> Log.e(TAG, Log.getStackTraceString(error))); }</code><technical_language>Please set view is error (line below)</technical_language>

Target:
private void loadData() { progressBar.setVisibility(View.VISIBLE); disposable = Observable.fromCallable(DBReader::getNavDrawerData) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe( result -> { navDrawerData = result; updateSelection(); navAdapter.notifyDataSetChanged(); progressBar.setVisibility(View.GONE); }, error -> { Log.e(TAG, Log.getStackTraceString(error)); progressBar.setVisibility(View.GONE); }); }
Source:
<code>private int executeStatement(boolean silent, String user, String pw, String sql, String... args) { Connection connection = null; Statement statement = null; try { String replacedSql = sql; if (wizardModel.databaseConnection.contains("mysql")) { Class.forName("com.mysql.jdbc.Driver").newInstance(); } else { replacedSql = replacedSql.replaceAll("`", "\""); } String tempDatabaseConnection = ""; if (sql.contains("create database")) { tempDatabaseConnection = wizardModel.databaseConnection.replace("@DBNAME@", ""); } else { tempDatabaseConnection = wizardModel.databaseConnection.replace("@DBNAME@", wizardModel.databaseName); } connection = DriverManager.getConnection(tempDatabaseConnection, user, pw); for (String arg : args) { arg = arg.replace(";", "&#094"); replacedSql = replacedSql.replaceFirst("\\?", arg); } statement = connection.createStatement(); int updateDelta = statement.executeUpdate(replacedSql); statement.close(); return updateDelta; } catch (SQLException sqlex) { if (!silent) { log.warn("error executing sql: " + sql, sqlex); errors.put("Error executing sql: " + sql + " - " + sqlex.getMessage(), null); } } catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) { log.error("Error generated", e); } finally { try { <START> if (statement != null) { <END> statement.close(); } } catch (SQLException e) { log.warn("Error while closing statement"); } try { if (connection != null) { connection.close(); } } catch (Exception e) { log.warn("Error while closing connection", e); } } return -1; }</code><technical_language>this statement.isClosed() is useless</technical_language>

Target:
private int executeStatement(boolean silent, String user, String pw, String sql, String... args) { Connection connection = null; Statement statement = null; try { String replacedSql = sql; if (wizardModel.databaseConnection.contains("mysql")) { Class.forName("com.mysql.jdbc.Driver").newInstance(); } else { replacedSql = replacedSql.replaceAll("`", "\""); } String tempDatabaseConnection = ""; if (sql.contains("create database")) { tempDatabaseConnection = wizardModel.databaseConnection.replace("@DBNAME@", ""); } else { tempDatabaseConnection = wizardModel.databaseConnection.replace("@DBNAME@", wizardModel.databaseName); } connection = DriverManager.getConnection(tempDatabaseConnection, user, pw); for (String arg : args) { arg = arg.replace(";", "&#094"); replacedSql = replacedSql.replaceFirst("\\?", arg); } statement = connection.createStatement(); return statement.executeUpdate(replacedSql); } catch (SQLException sqlex) { if (!silent) { log.warn("error executing sql: " + sql, sqlex); errors.put("Error executing sql: " + sql + " - " + sqlex.getMessage(), null); } } catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) { log.error("Error generated", e); } finally { try { if (statement != null) { statement.close(); } } catch (SQLException e) { log.warn("Error while closing statement"); } try { if (connection != null) { connection.close(); } } catch (Exception e) { log.warn("Error while closing connection", e); } } return -1; }
Source:
<code>public void jenkinsCoreTooOld() throws Exception { PluginWrapper pw = pluginWrapper("fake").requiredCoreVersion("3.0").buildLoaded(); try { pw.resolvePluginDependencies(); fail(); } catch (IOException ex) { assertContains(ex, "Failed to load: fake (42)", "Jenkins (3.0) or higher required"); } <START> Locale.setDefault(loc); <END> }</code><technical_language>here? after() run right</technical_language>

Target:
public void jenkinsCoreTooOld() throws Exception { PluginWrapper pw = pluginWrapper("fake").requiredCoreVersion("3.0").buildLoaded(); try { pw.resolvePluginDependencies(); fail(); } catch (IOException ex) { assertContains(ex, "Failed to load: fake (42)", "Jenkins (3.0) or higher required"); } }
Source:
<code>private void setCovariance(Object cov) { if (cov instanceof MatrixSpec) { cov = ((MatrixSpec) cov).getValueIfNonRandom(); } if (!((cov instanceof MatrixLib) && (((MatrixLib) cov).rowLen() == d) && (((MatrixLib) cov) .colLen() == d))) { throw new IllegalArgumentException("The covariance matrix of a " + d + "-dimensional Gaussian " + "distribution must be a " + d + "-by-" + d + " Matrix, " + "not " + cov + " of " + cov.getClass()); } sigma = (MatrixLib) cov; for (int i = 0; i < sigma.rowLen(); i++) { for (int j = 0; j < sigma.colLen(); j++) { double ratio = sigma.elementAt(i, j) / sigma.elementAt(j, i); if (Math.abs(ratio - 1) > 1e-6) throw new IllegalArgumentException( "Invalid covariance matrix (not symmetric): " + sigma); } } normConst = Math.sqrt(sigma.det()) * dimFactor; <START> double logDet = 0.0; <END> for (double val : sigma.eigenvals()) { logDet += Math.log(val); } logNormConst = 0.5 * logDet + logDimFactor; sigmaInverse = sigma.inverse(); sqrtSigma = sigma.choleskyFactor(); }</code><technical_language>place put code. part of "setMean". create a separate private function, including in line 272 well</technical_language>

Target:
private void setCovariance(Object cov) { if (cov instanceof MatrixSpec) { cov = ((MatrixSpec) cov).getValueIfNonRandom(); } if (!((cov instanceof MatrixLib) && (((MatrixLib) cov).rowLen() == d) && (((MatrixLib) cov) .colLen() == d))) { throw new IllegalArgumentException("The covariance matrix of a " + d + "-dimensional Gaussian " + "distribution must be a " + d + "-by-" + d + " Matrix, " + "not " + cov + " of " + cov.getClass()); } sigma = (MatrixLib) cov; for (int i = 0; i < sigma.rowLen(); i++) { for (int j = 0; j < sigma.colLen(); j++) { double ratio = sigma.elementAt(i, j) / sigma.elementAt(j, i); if (Math.abs(ratio - 1) > 1e-6) throw new IllegalArgumentException( "Invalid covariance matrix (not symmetric): " + sigma); } } normConst = Math.sqrt(sigma.det()) * dimFactor; logNormConst = 0.5 * sigma.logDet() + logDimFactor; sigmaInverse = sigma.inverse(); sqrtSigma = sigma.choleskyFactor(); }
Source:
<code>private GridCoverage2D loadRaster(File location) throws IOException { LOGGER.info(String.format(LOG_LOADING_SOURCE_RASTER, location.toString())); try { ArcGridReader reader = new ArcGridReader(location.toURI().toURL()); return reader.read(null); } catch (Exception e) { <START> LOGGER.error(String.format(LOG_FAILED_TO_READ_SOURCE_RASTER, location.toString()), e); <END> throw new IOException(String.format(LOG_FAILED_TO_READ_SOURCE_RASTER, location.toString()), e); } }</code><technical_language>Tiny thing, pull out String.format(...) a variable avoid duplication</technical_language>

Target:
private GridCoverage2D loadRaster(File location) throws IOException { LOGGER.info(String.format(LOG_LOADING_SOURCE_RASTER, location.toString())); try { ArcGridReader reader = new ArcGridReader(location.toURI().toURL()); return reader.read(null); } catch (Exception e) { final String message = String.format(LOG_FAILED_TO_READ_SOURCE_RASTER, location.toString()); LOGGER.error(message, e); throw new IOException(message, e); } }
Source:
<code>public IStatus validate(final IProject project, final String path) { IStatus validTrace = Status.OK_STATUS; try { final CTFTrace temp = new CTFTrace(path); boolean valid = temp.majortIsSet(); temp.dispose(); if (!valid) { <START> validTrace = new Status(IStatus.ERROR, Messages.CtfTmfTrace_FormatName, Messages.CtfTmfTrace_MajorNotSet); <END> } } catch (final CTFReaderException e) { validTrace = new Status(IStatus.ERROR, "CTF", Messages.CtfTmfTrace_ReadingError + e.toString()); } return validTrace; }</code><technical_language>arguments correct? pluginId</technical_language>

Target:
public IStatus validate(final IProject project, final String path) { IStatus validTrace = Status.OK_STATUS; try { final CTFTrace temp = new CTFTrace(path); boolean valid = temp.majortIsSet(); temp.dispose(); if (!valid) { validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_MajorNotSet); } } catch (final CTFReaderException e) { validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError +": " + e.toString()); } return validTrace; }
Source:
<code>protected boolean canDoAction() { VDS vds = getVds(); if (vds == null) { addCanDoActionMessage(VdcBllMessages.VDS_INVALID_SERVER_ID); return false; } if (!ObjectIdentityChecker.CanUpdateField(vds, "vds_group_id", vds.getstatus())) { addCanDoActionMessage(VdcBllMessages.VDS_STATUS_NOT_VALID_FOR_UPDATE); return false; } VDSGroup targetCluster = DbFacade.getInstance().getVdsGroupDAO().get(getParameters().getClusterId()); if (targetCluster == null) { addCanDoActionMessage(VdcBllMessages.VDS_CLUSTER_IS_NOT_VALID); return false; } targetStoragePool = DbFacade.getInstance().getStoragePoolDAO().getForVdsGroup(targetCluster.getId()); if (targetStoragePool != null && targetStoragePool.getstorage_pool_type() == StorageType.LOCALFS) { if (!DbFacade.getInstance().getVdsStaticDAO().getAllForVdsGroup(getParameters().getClusterId()).isEmpty()) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_ADD_MORE_THEN_ONE_HOST_TO_LOCAL_STORAGE); return false; } } if (getVdsGroup().supportsGlusterService()) { if (getGlusterUtils().hasBricks(getVdsId())) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_REMOVE_HOST_HAVING_GLUSTER_VOLUME); return false; } if (!hasUpServer(getSourceClusterId())) { return false; } } <START> if (getVdsGroup(getTargetClusterId()).supportsGlusterService() <END> && !hasUpServer(getTargetClusterId())) { return false; } return true; }</code><technical_language>local targetCluster instead of db is needed in execute save a member of command reuse then, getVdsGroup method needed</technical_language>

Target:
protected boolean canDoAction() { VDS vds = getVds(); if (vds == null) { addCanDoActionMessage(VdcBllMessages.VDS_INVALID_SERVER_ID); return false; } if (!ObjectIdentityChecker.CanUpdateField(vds, "vds_group_id", vds.getstatus())) { addCanDoActionMessage(VdcBllMessages.VDS_STATUS_NOT_VALID_FOR_UPDATE); return false; } if (getTargetCluster() == null) { addCanDoActionMessage(VdcBllMessages.VDS_CLUSTER_IS_NOT_VALID); return false; } targetStoragePool = DbFacade.getInstance().getStoragePoolDAO().getForVdsGroup(getTargetCluster().getId()); if (targetStoragePool != null && targetStoragePool.getstorage_pool_type() == StorageType.LOCALFS) { if (!DbFacade.getInstance().getVdsStaticDAO().getAllForVdsGroup(getParameters().getClusterId()).isEmpty()) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_ADD_MORE_THEN_ONE_HOST_TO_LOCAL_STORAGE); return false; } } if (getVdsGroup().supportsGlusterService()) { if (getGlusterUtils().hasBricks(getSourceCluster().getId())) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_REMOVE_HOST_HAVING_GLUSTER_VOLUME); return false; } if (!hasUpServer(getSourceCluster().getId())) { return false; } } if (getTargetCluster().supportsGlusterService() && !hasUpServer(getTargetCluster().getId())) { return false; } return true; }
Source:
<code>static void syncConfig() { maxGeneratedCubesPerTick = configuration.getInt("maxGeneratedCubesPerTick", Configuration.CATEGORY_GENERAL, 49*16, 1, Integer.MAX_VALUE, "The number of cubic chunks to generate per tick."); maxTimeSpentGeneratingCubesPerTick = configuration.getInt("maxTimeSpentGeneratingCubesPerTick", Configuration.CATEGORY_GENERAL, 50, 1, Integer.MAX_VALUE, "The maximum amount of time in milliseconds per tick to spend generating chunks."); verticalCubeLoadDistance = configuration.getInt("verticalCubeLoadDistance", Configuration.CATEGORY_GENERAL, 8, 2, 32, "Similar to Minecraft's view distance, only for vertical chunks."); worldHeightLowerBound = configuration.getInt("worldHeightLowerBound", Configuration.CATEGORY_GENERAL, -4096, -8388608, 0, "The lower boundary on the world. Blocks will not generate or load below this point."); <START> worldHeightUpperBound = configuration.getInt("worldHeightUpperBound", Configuration.CATEGORY_GENERAL, 4096, 256, 8388608, "The upper boundary on the world. Blocks will not generate or load above this point."); <END> if (configuration.hasChanged()) configuration.save(); }</code><technical_language>Replace height constants AddressTools.MIN_BLOCK_Y AddressToold.MAX_BLOCK_Y</technical_language>

Target:
static void syncConfig() { maxGeneratedCubesPerTick = configuration.getInt("maxGeneratedCubesPerTick", Configuration.CATEGORY_GENERAL, 49*16, 1, Integer.MAX_VALUE, "The number of cubic chunks to generate per tick."); lightingTickBudget = configuration.getInt("lightingTickBudget", Configuration.CATEGORY_GENERAL, 10, 1, Integer.MAX_VALUE, "The maximum amount of time in milliseconds per tick to spend performing lighting calculations."); verticalCubeLoadDistance = configuration.getInt("verticalCubeLoadDistance", Configuration.CATEGORY_GENERAL, 8, 2, 32, "Similar to Minecraft's view distance, only for vertical chunks."); worldHeightLowerBound = configuration.getInt("worldHeightLowerBound", Configuration.CATEGORY_GENERAL, -4096, AddressTools.MIN_BLOCK_Y, 0, "The lower boundary on the world. Blocks will not generate or load below this point."); worldHeightUpperBound = configuration.getInt("worldHeightUpperBound", Configuration.CATEGORY_GENERAL, 4096, 256, AddressTools.MAX_BLOCK_Y, "The upper boundary on the world. Blocks will not generate or load above this point."); if (configuration.hasChanged()) configuration.save(); }
Source:
<code><START> protected Optional<Property> computeRemovedProperty(String name) { <END> String schema = getSchema().getName(); String originalXpath = collectPath(new Path("/")).append(name).toString().substring(1); String xpath = originalXpath; if (xpath.indexOf('[') != -1) { xpath = NON_CANON_INDEX.matcher(xpath).replaceAll("*"); } SchemaManager schemaManager = Framework.getService(SchemaManager.class); if (schemaManager.isPropertyRemoved(schema, xpath)) { String fallback = schemaManager.getRemovedPropertyFallback(schema, xpath); Property property; if (fallback == null) { property = new RemovedProperty(this, name); } else { Matcher matcher = NON_CANON_INDEX.matcher(originalXpath); while (matcher.find()) { fallback = fallback.replaceFirst("\\*", matcher.group(0)); } Property fallbackProperty; int i = fallback.lastIndexOf("[-1]"); if (i != -1) { fallbackProperty = get(fallback.substring(i + 5)); } else { fallbackProperty = resolvePath('/' + fallback); } property = new RemovedProperty(this, name, fallbackProperty); } return Optional.of(property); } return Optional.empty(); }</code><technical_language>this is orElse(null) point in Optional here</technical_language>

Target:
protected Property computeRemovedProperty(String name) { String schema = getSchema().getName(); String originalXpath = collectPath(new Path("/")).append(name).toString().substring(1); String xpath; if (originalXpath.indexOf('[') != -1) { xpath = NON_CANON_INDEX.matcher(originalXpath).replaceAll("*"); } else { xpath = originalXpath; } SchemaManager schemaManager = Framework.getService(SchemaManager.class); PropertyDeprecationHandler removedProperties = schemaManager.getRemovedProperties(); if (!removedProperties.isMarked(schema, xpath)) { return null; } String fallback = removedProperties.getFallback(schema, xpath); if (fallback == null) { return new RemovedProperty(this, name); } Matcher matcher = NON_CANON_INDEX.matcher(originalXpath); while (matcher.find()) { fallback = fallback.replaceFirst("\\*", matcher.group(0)); } Property fallbackProperty; int i = fallback.lastIndexOf("[-1]"); if (i != -1) { fallbackProperty = get(fallback.substring(i + 5)); } else { fallbackProperty = resolvePath('/' + fallback); } return new RemovedProperty(this, name, fallbackProperty); }
Source:
<code>private HtmlForm addAxis(String axis) throws Exception { HtmlPage page = wc.getPage(p, "configure"); HtmlForm form = page.getFormByName("config"); j.getButtonByCaption(form, "Add axis").click(); page.getAnchorByText(axis).click(); <START> Thread.sleep(300); <END> return form; }</code><technical_language>Uh</technical_language>

Target:
private HtmlForm addAxis(String axis) throws Exception { HtmlPage page = wc.getPage(p, "configure"); HtmlForm form = page.getFormByName("config"); j.getButtonByCaption(form, "Add axis").click(); page.getAnchorByText(axis).click(); waitForInput(form); return form; }
Source:
<code>public ConsumerDTO setFacts(Map<String, String> facts) { <START> this.facts = facts; <END> return this; }</code><technical_language>proper encapsulation techniques here. facts collection this object holds shared other objects, hotswappable this</technical_language>

Target:
public ConsumerDTO setFacts(Map<String, String> facts) { if (facts != null) { if (this.facts == null) { this.facts = new HashMap<String, String>(); } else { this.facts.clear(); } this.facts.putAll(facts); } else { this.facts = null; } return this; }
Source:
<code>public void findAll() throws Exception { List<AuthEntry> expexted = Lists.newArrayList(new AuthEntry(CREDENTIAL_TYPE, SIM_1, USIM_2)); List<AuthEntry> items = catalog.findAll(); <START> assertThat(items, deepEquals(expexted)); <END> }</code><technical_language>want /</technical_language>

Target:
public void findAll() throws Exception { List<AuthEntry> want = Lists.newArrayList(new AuthEntry(CREDENTIAL_TYPE, SIM_1, USIM_2)); List<AuthEntry> items = catalog.findAll(); assertThat(items, deepEquals(want)); }
Source:
<code>private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { hash = in.readInt(); int len = in.readInt(); <START> data = new byte[len]; <END> in.readFully((byte[]) data); }</code><technical_language>safe read bytes assigning data: byte[] d = new byte[len]; IO.readFully(in, d, 0, len); data = d;</technical_language>

Target:
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { hash = in.readInt(); int len = in.readInt(); byte[] d = new byte[len]; IO.readFully(in, d, 0, len); data = d; }
Source:
<code>public void clockProvider() { ValidatorFactory validatorFactory = Validation.byDefaultProvider() .configure() <START> .clockProvider( new FixedClockProvider( ZonedDateTime.now() ) ) <END> .buildValidatorFactory(); Validator validator = validatorFactory.getValidator(); }</code><technical_language>more sense show usage of a fixed date: ZonedDateTime.of("2016-...")</technical_language>

Target:
public void clockProvider() { ValidatorFactory validatorFactory = Validation.byDefaultProvider() .configure() .clockProvider( new FixedClockProvider( ZonedDateTime.of( 2016, 6, 15, 0, 0, 0, 0, ZoneId.of( "Europe/Paris" ) ) ) ) .buildValidatorFactory(); Validator validator = validatorFactory.getValidator(); }
Source:
<code>public void truncate() throws ConnectException { try { String oldLogFile = logFile + ".1"; storage.delete(oldLogFile); storage.commit(logFile, oldLogFile); <START> close(); <END> } catch (IOException e) { throw new ConnectException(e); } finally { close(); } }</code><technical_language>Redundant call, close added in finally block</technical_language>

Target:
public void truncate() throws ConnectException { try { String oldLogFile = logFile + ".1"; storage.delete(oldLogFile); storage.commit(logFile, oldLogFile); } finally { close(); } }
Source:
<code><START> public static Builder of(final File jbossHome) { <END> return new Builder(jbossHome); }</code><technical_language>reading code, jbossHome null, right</technical_language>

Target:
public static Builder of(final File jbossHome) { if (jbossHome == null) { throw EmbeddedLogger.ROOT_LOGGER.nullVar("jbossHome"); } return new Builder(jbossHome); }
Source:
<code>private void logLoadingFromStorageFailed(Resource resource, IStorage storage, Exception e) { <START> EMFCompareIDEPlugin <END> .getDefault() .getLog() .log(new Status( IStatus.ERROR, EMFCompareIDEPlugin.PLUGIN_ID, EMFCompareIDEMessages .getString( "StorageResourceWrapper.failToLoad", resource.getURI().toString(), storage.getName()), e)); }</code><technical_language>Format this properly. Create status loading separate lines</technical_language>

Target:
private void logLoadingFromStorageFailed(Resource resource, IStorage storage, Exception e) { Status errorStatus = new Status(IStatus.ERROR, EMFCompareIDEPlugin.PLUGIN_ID, EMFCompareIDEMessages .getString("StorageResourceWrapper.failToLoad", resource.getURI().toString(), storage .getName()), e); EMFCompareIDEPlugin.getDefault().getLog().log(errorStatus); }
Source:
<code>private static Statement rhsAssignZeroValue(VariableDeclarationExpr vdExpr) { VariableDeclarationExpr exprCopy = (VariableDeclarationExpr) vdExpr.clone(); List<VariableDeclarator> vars = exprCopy.getVars(); if (vars.size() > 1) { return null; } VariableDeclarator vd = vars.get(0); Type type = exprCopy.getType(); <START> if (type instanceof PrimitiveType) { <END> switch (((PrimitiveType) type).getType()) { case Boolean: vd.setInit(new BooleanLiteralExpr(false)); break; case Byte: vd.setInit(new IntegerLiteralExpr("0")); break; case Char: vd.setInit(new CharLiteralExpr("")); break; case Short: vd.setInit(new IntegerLiteralExpr("0")); break; case Int: vd.setInit(new IntegerLiteralExpr("0")); break; case Long: vd.setInit(new LongLiteralExpr("0")); break; case Float: vd.setInit(new DoubleLiteralExpr("0")); break; case Double: vd.setInit(new DoubleLiteralExpr("0")); break; } } else { vd.setInit(new NullLiteralExpr()); } ExpressionStmt newStmt = new ExpressionStmt(exprCopy); exprCopy.setParentNode(newStmt); return newStmt; }</code><technical_language>Refactored methods combined similar bodies</technical_language>

Target:
private static Statement rhsAssignZeroValue(VariableDeclarationExpr vdExpr) { Type type = vdExpr.getType(); if (type instanceof PrimitiveType) { switch (((PrimitiveType) type).getType()) { case Boolean: return rhsAssignWithValue(vdExpr, "false"); case Char: return rhsAssignWithValue(vdExpr, ""); default: return rhsAssignWithValue(vdExpr, "0"); } } return rhsAssignWithValue(vdExpr, null); }
Source:
<code>public ILaunchConfiguration[] getApplicableLaunchConfigurations(String[] types, IResource resource) { ArrayList<ILaunchConfiguration> list = new ArrayList<>(); try { if(resource != null) { String[] ctypes = types; if(ctypes == null) { ctypes = getApplicableConfigurationTypes(resource); } HashSet<String> typeset = new HashSet<>(ctypes.length); Collections.addAll(typeset, ctypes); IResource[] resrcs = null; for (ILaunchConfiguration configuration : filterConfigs(getLaunchManager().getLaunchConfigurations())) { if(typeset.contains(configuration.getType().getIdentifier()) && acceptConfiguration(configuration)) { resrcs = configuration.getMappedResources(); if (resrcs != null) { for (IResource <START> resrc : <END> resrcs) { if (resource.equals(resrc) || resource.getFullPath().isPrefixOf(resrc.getFullPath())) { list.add(configuration); break; } } } else { list.add(configuration); } } } } } catch (CoreException e) { list.clear(); DebugPlugin.log(e); } return list.toArray(new ILaunchConfiguration[list.size()]); }</code><technical_language>rename res resource</technical_language>

Target:
public ILaunchConfiguration[] getApplicableLaunchConfigurations(String[] types, IResource resource) { ArrayList<ILaunchConfiguration> list = new ArrayList<>(); try { if(resource != null) { String[] ctypes = types; if(ctypes == null) { ctypes = getApplicableConfigurationTypes(resource); } HashSet<String> typeset = new HashSet<>(ctypes.length); Collections.addAll(typeset, ctypes); for (ILaunchConfiguration configuration : filterConfigs(getLaunchManager().getLaunchConfigurations())) { if(typeset.contains(configuration.getType().getIdentifier()) && acceptConfiguration(configuration)) { IResource[] resrcs = configuration.getMappedResources(); if (resrcs != null) { for (IResource res : resrcs) { if (resource.equals(res) || resource.getFullPath().isPrefixOf(res.getFullPath())) { list.add(configuration); break; } } } else { list.add(configuration); } } } } } catch (CoreException e) { list.clear(); DebugPlugin.log(e); } return list.toArray(new ILaunchConfiguration[list.size()]); }
Source:
<code>public void _onRequestSuggestions(final Request req, final Callback cb) { <START> RpcStatus.hide(new Runnable() { <END> @Override public void run() { AccountApi.suggest(req.getQuery(), req.getLimit(), new GerritCallback<JsArray<AccountInfo>>() { @Override public void onSuccess(JsArray<AccountInfo> in) { List<AccountSuggestion> r = new ArrayList<>(in.length()); for (AccountInfo p : Natives.asList(in)) { r.add(new AccountSuggestion(p)); } cb.onSuggestionsReady(req, new Response(r)); } }); } }); }</code><technical_language>Do need this REST calls style RPCs</technical_language>

Target:
public void _onRequestSuggestions(final Request req, final Callback cb) { AccountApi.suggest(req.getQuery(), req.getLimit(), new GerritCallback<JsArray<AccountInfo>>() { @Override public void onSuccess(JsArray<AccountInfo> in) { List<AccountSuggestion> r = new ArrayList<>(in.length()); for (AccountInfo p : Natives.asList(in)) { r.add(new AccountSuggestion(p)); } cb.onSuggestionsReady(req, new Response(r)); } }); }
Source:
<code>public void draw(int startX, int startY) { if (!slot.getHasStack()) { super.draw(startX, startY); } <START> GlStateManager.pushMatrix(); <END> GlStateManager.disableLighting(); GlStateManager.disableDepth(); GlStateManager.enableBlend(); String directionString = getDirectionString(); if (!directionString.isEmpty()){ FontRenderer fontRenderer = manager.minecraft.fontRenderer; fontRenderer.drawStringWithShadow(getDirectionString(), xPos + startX + 5, yPos + startY + 4, ColourProperties.INSTANCE.get("gui.screen")); } GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F); TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); textureManager.bindTexture(manager.gui.textureFile); manager.gui.drawTexturedModalRect(xPos + startX, yPos + startY, 206, 0, 16, 16); GlStateManager.disableBlend(); GlStateManager.enableDepth(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); }</code><technical_language>pushMatrix popMatrix needed is a GL transform, I in code below</technical_language>

Target:
public void draw(int startX, int startY) { if (!slot.getHasStack()) { super.draw(startX, startY); } GlStateManager.disableLighting(); GlStateManager.disableDepth(); GlStateManager.enableBlend(); String directionString = getDirectionString(); if (!directionString.isEmpty()){ FontRenderer fontRenderer = manager.minecraft.fontRenderer; fontRenderer.drawStringWithShadow(getDirectionString(), xPos + startX + 5, yPos + startY + 4, ColourProperties.INSTANCE.get("gui.screen")); } GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F); TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); textureManager.bindTexture(manager.gui.textureFile); manager.gui.drawTexturedModalRect(xPos + startX, yPos + startY, 206, 0, 16, 16); GlStateManager.disableBlend(); GlStateManager.enableDepth(); GlStateManager.enableLighting(); }