auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected EditPart getPartForElement(EditPart context, Object modelElement) { if (modelElement instanceof FBNetwork) { <START> CompositeNetworkEditPart compositeNetEP = new CompositeNetworkEditPart() { @Override protected void createEditPolicies() { installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy()); installEditPolicy(EditPolicy.LAYOUT_ROLE, new SubAppTypeFBNetworkLayoutEditPolicy()); } }; return compositeNetEP; <END> } if (modelElement instanceof SubApp) { return new SubAppForFBNetworkEditPart(zoomManager); } return super.getPartForElement(context, modelElement); }</code><technical_language>return a TypedSubAppNetowrkEditPart here</technical_language>

Target:
protected EditPart getPartForElement(EditPart context, Object modelElement) { if (modelElement instanceof FBNetwork) { TypedSubAppNetworkEditPart compositeNetEP = new TypedSubAppNetworkEditPart(); return compositeNetEP; } if (modelElement instanceof SubApp) { return new SubAppForFBNetworkEditPart(zoomManager); } return super.getPartForElement(context, modelElement); }
Source:
<code>public void run() { while (!isShutdown) { if (Thread.currentThread().isInterrupted()) { log.warn("Prefetch thread was interrupted."); callShutdownOnStrategy(); break; } if (prefetchCounters.shouldGetNewRecords()) { try { sleepBeforeNextCall(); GetRecordsResult getRecordsResult = getRecordsRetrievalStrategy.getRecords(maxRecordsPerCall); lastSuccessfulCall = Instant.now(); ProcessRecordsInput processRecordsInput = new ProcessRecordsInput() .withRecords(getRecordsResult.getRecords()) .withMillisBehindLatest(getRecordsResult.getMillisBehindLatest()) .withCacheEntryTime(lastSuccessfulCall); getRecordsResultQueue.put(processRecordsInput); prefetchCounters.added(processRecordsInput); } catch (InterruptedException e) { log.info("Thread was interrupted, indicating shutdown was called on the cache."); <START> callShutdownOnStrategy(); <END> } catch (Throwable e) { log.error("Error was thrown while getting records, please check for the error", e); } } } }</code><technical_language>This moved while loop</technical_language>

Target:
public void run() { while (!isShutdown) { if (Thread.currentThread().isInterrupted()) { log.warn("Prefetch thread was interrupted."); break; } if (prefetchCounters.shouldGetNewRecords()) { try { sleepBeforeNextCall(); GetRecordsResult getRecordsResult = getRecordsRetrievalStrategy.getRecords(maxRecordsPerCall); lastSuccessfulCall = Instant.now(); ProcessRecordsInput processRecordsInput = new ProcessRecordsInput() .withRecords(getRecordsResult.getRecords()) .withMillisBehindLatest(getRecordsResult.getMillisBehindLatest()) .withCacheEntryTime(lastSuccessfulCall); getRecordsResultQueue.put(processRecordsInput); prefetchCounters.added(processRecordsInput); } catch (InterruptedException e) { log.info("Thread was interrupted, indicating shutdown was called on the cache."); } catch (SdkClientException e) { log.error("Exception thrown while fetching records from Kinesis", e); } catch (Throwable e) { log.error("Unexpected exception was thrown. This could probably be an issue or a bug." + " Please search for the exception/error online to check what is going on. If the " + "issue persists or is a recurring problem, feel free to open an issue on, " + "<LINK_0>", e); } } } callShutdownOnStrategy(); }
Source:
<code>public void onStart(SourceCallback<TestTransactionalConnection, Object> sourceCallback) throws MuleException { connectExecutor = newFixedThreadPool(1, new NamedThreadFactory(TransactionalSource.class.getName())); connectExecutor.execute(() -> { SourceCallbackContext ctx = sourceCallback.createContext(); TransactionHandle txHandle = null; try { TestTransactionalConnection connection = connectionProvider.connect(); boolean isXa = false; if (connection instanceof XATransactionalConnection) { isXa = true; xaResource = (DummyXaResource) ((XATransactionalConnection) connection).getXAResource(); } ctx.addVariable(IS_XA, isXa); txHandle = ctx.bindConnection(connection); sourceCallback.handle(Result.<TestTransactionalConnection, Object>builder().output(connection).build(), ctx); } catch (ConnectionException e) { sourceCallback.onConnectionException(e); } catch (Exception e) { throw new RuntimeException(e); } finally { try { if (txHandle != null) { txHandle.commit(); } } catch (TransactionException e) { <START> throw new RuntimeException(e); <END> } } }); }</code><technical_language>rollback here</technical_language>

Target:
public void onStart(SourceCallback<TestTransactionalConnection, Object> sourceCallback) throws MuleException { connectExecutor = newFixedThreadPool(1, new NamedThreadFactory(TransactionalSource.class.getName())); connectExecutor.execute(() -> { SourceCallbackContext ctx = sourceCallback.createContext(); TransactionHandle txHandle = null; try { TestTransactionalConnection connection = connectionProvider.connect(); boolean isXa = false; if (connection instanceof XATransactionalConnection) { isXa = true; xaResource = (DummyXaResource) ((XATransactionalConnection) connection).getXAResource(); } ctx.addVariable(IS_XA, isXa); txHandle = ctx.bindConnection(connection); sourceCallback.handle(Result.<TestTransactionalConnection, Object>builder().output(connection).build(), ctx); } catch (ConnectionException e) { sourceCallback.onConnectionException(e); } catch (Exception e) { throw new RuntimeException(e); } finally { try { if (txHandle != null) { txHandle.commit(); } } catch (TransactionException e) { try { txHandle.rollback(); } catch (TransactionException e1) { final RuntimeException rollbackException = new RuntimeException(e1); rollbackException.addSuppressed(e); throw rollbackException; } throw new RuntimeException(e); } } }); }
Source:
<code>protected final boolean invariant() { for (Square[] aBoard : board) { for (Square anABoard : aBoard) { <START> if (anABoard == null) { <END> return false; } } } return true; }</code><technical_language>board[x][y] approach bad me. OK proposed alternative, variable names better. For example for (Square[] row : board) { for (Square square : row) { if (square == null) ..</technical_language>

Target:
protected final boolean invariant() { for (Square[] row : board) { for (Square square : row) { if (square == null) { return false; } } } return true; }
Source:
<code>public Set<SecurityGroup> listSecurityGroupsForNode(String id) { RegionAndId regionAndId = RegionAndId.fromSlashEncoded(checkNotNull(id, "id")); String region = regionAndId.getRegion(); String instanceId = regionAndId.getId(); Optional<? extends ServerWithSecurityGroupsApi> serverApi = api.getServerWithSecurityGroupsApi(region); SecurityGroupApi securityGroupApi = getSecurityGroupApi(region); <START> ServerWithSecurityGroups instance = serverApi.get().get(instanceId); <END> if (instance == null) { return ImmutableSet.of(); } final FluentIterable<org.jclouds.openstack.neutron.v2.domain.SecurityGroup> allGroups = securityGroupApi.listSecurityGroups().concat(); Location location = locationIndex.get().get(region); return ImmutableSet.copyOf(transform(filter(allGroups, notNull()), neutronSecurityGroupToSecurityGroup.create(location))); }</code><technical_language>This is later. returning security groups</technical_language>

Target:
public Set<SecurityGroup> listSecurityGroupsForNode(String id) { RegionAndId regionAndId = RegionAndId.fromSlashEncoded(checkNotNull(id, "id")); String region = regionAndId.getRegion(); Location location = locationIndex.get().get(region); Set<org.jclouds.openstack.nova.v2_0.domain.SecurityGroup> allGroups = api.getServerApi(region).listSecurityGroupForServer(regionAndId.getId()); return ImmutableSet.copyOf(transform(filter(allGroups, notNull()), novaSecurityGroupToSecurityGroup.create(location))); }
Source:
<code><START> public AsyncHBaseAsyncKijiBufferedWriter(AsyncHBaseKijiTable table) throws IOException { <END> mTable = table; mHBClient = table.getHBClient(); mTableName = KijiManagedHBaseTableName .getKijiTableName(mTable.getURI().getInstance(), mTable.getURI().getTable()).toBytes(); try { mHBClient.ensureTableExists(mTableName).join(); } catch (TableNotFoundException e) { throw new KijiTableNotFoundException(table.getURI()); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } mLayoutConsumerRegistration = mTable.registerLayoutConsumer(new InnerLayoutUpdater()); Preconditions.checkState( mWriterLayoutCapsule != null, "AsyncHBaseKijiBufferedWriter for table: %s failed to initialize.", mTable.getURI()); mTable.retain(); synchronized (mInternalLock) { Preconditions.checkState(mState == State.UNINITIALIZED, "Cannot open AsyncHBaseKijiBufferedWriter instance in state %s.", mState); mState = State.OPEN; } }</code><technical_language>a habit favor static factory methods private constructors. This a lot more flexibility want change objects created</technical_language>

Target:
private AsyncHBaseAsyncKijiBufferedWriter(AsyncHBaseKijiTable table) throws IOException { mTable = table; mHBClient = table.getHBClient(); mTableName = KijiManagedHBaseTableName .getKijiTableName(mTable.getURI().getInstance(), mTable.getURI().getTable()).toBytes(); try { mHBClient.ensureTableExists(mTableName).join(); } catch (TableNotFoundException e) { throw new KijiTableNotFoundException(table.getURI()); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } mLayoutConsumerRegistration = mTable.registerLayoutConsumer(new InnerLayoutUpdater()); Preconditions.checkState( mWriterLayoutCapsule != null, "AsyncHBaseKijiBufferedWriter for table: %s failed to initialize.", mTable.getURI()); mTable.retain(); synchronized (mInternalLock) { Preconditions.checkState(mState == State.UNINITIALIZED, "Cannot open AsyncHBaseKijiBufferedWriter instance in state %s.", mState); mState = State.OPEN; } DebugResourceTracker.get().registerResource(this); }
Source:
<code>private void checkTimeTypeArgument(MethodInvocationTree mit, Type argType) { if (!(argType.isNumerical() <START> || isOneOf(argType, "java.lang.Long", "java.time.LocalDate") <END> || argType.isSubtypeOf("java.util.Date") || argType.isSubtypeOf("java.util.Calendar"))) { reportIssue(mit, "Time argument is expected (long, Long, LocalDate, Date or Calendar)."); } }</code><technical_language>rename this method isTypeOfAny introduce isSubtypeOfAny for lines. I tend !(a || b || c) long, !a && !b && !c instead</technical_language>

Target:
private void checkTimeTypeArgument(MethodInvocationTree mit, Type argType) { if (!(argType.isNumerical() || isTypeOfAny(argType, "java.lang.Long", "java.time.LocalDate") || isSubtypeOfAny(argType, "java.util.Date", "java.util.Calendar"))) { reportIssue(mit, "Time argument is expected (long, Long, LocalDate, Date or Calendar)."); } }
Source:
<code>public void should_create_sonar_way_profile() { ValidationMessages validation = ValidationMessages.create(); SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(7, 3), SonarQubeSide.SERVER); BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context(); PHPProfileDefinition definition = new PHPProfileDefinition(sonarRuntime); definition.define(context); BuiltInQualityProfilesDefinition.BuiltInQualityProfile profile = context.profile("php", "Sonar way"); assertThat(profile.language()).isEqualTo(Php.KEY); assertThat(profile.name()).isEqualTo(PHPProfileDefinition.SONAR_WAY_PROFILE); <START> assertThat(profile.rules().size()).isGreaterThan(51); <END> assertThat(profile.rules().size()).isLessThan(CheckList.getAllChecks().size()); assertThat(profile.rules()).extracting("ruleKey").contains("DuplicatedBlocks"); assertThat(validation.hasErrors()).isFalse(); }</code><technical_language>I this change is required. intended test profile is empty</technical_language>

Target:
public void should_create_sonar_way_profile() { ValidationMessages validation = ValidationMessages.create(); SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(7, 3), SonarQubeSide.SERVER); BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context(); PHPProfileDefinition definition = new PHPProfileDefinition(sonarRuntime); definition.define(context); BuiltInQualityProfilesDefinition.BuiltInQualityProfile profile = context.profile("php", "Sonar way"); assertThat(profile.language()).isEqualTo(Php.KEY); assertThat(profile.name()).isEqualTo(PHPProfileDefinition.SONAR_WAY_PROFILE); assertThat(profile.rules().size()).isGreaterThan(50); assertThat(profile.rules().size()).isLessThan(CheckList.getAllChecks().size()); assertThat(profile.rules()).extracting("ruleKey").contains("DuplicatedBlocks"); assertThat(validation.hasErrors()).isFalse(); }
Source:
<code><START> public PhysicalPlanProvider(SchedulerStateManagerAdaptor stateManagerAdaptor, <END> EventManager eventManager, @Named(CONF_TOPOLOGY_NAME) String topologyName) { this.stateManagerAdaptor = stateManagerAdaptor; this.topologyName = topologyName; eventManager.addEventListener(TopologyUpdate.class, new EventHandler<TopologyUpdate>() { @Override public synchronized void onEvent(TopologyUpdate event) { LOG.info("Received topology update event, invalidating cached PhysicalPlan: " + event); physicalPlan = null; } }); eventManager.addEventListener(ContainerRestart.class, new EventHandler<ContainerRestart>() { @Override public synchronized void onEvent(ContainerRestart event) { LOG.info("Received conatiner restart event, invalidating cached PhysicalPlan: " + event); physicalPlan = null; } }); }</code><technical_language>scheduler implements a command restart a container. is scheduler here</technical_language>

Target:
public PhysicalPlanProvider(SchedulerStateManagerAdaptor stateManagerAdaptor, EventManager eventManager, @Named(CONF_TOPOLOGY_NAME) String topologyName) { this.stateManagerAdaptor = stateManagerAdaptor; this.topologyName = topologyName; eventManager.addEventListener(TopologyUpdate.class, new EventHandler<TopologyUpdate>() { @Override public synchronized void onEvent(TopologyUpdate event) { LOG.info( "Received topology update event, invalidating cached PhysicalPlan: " + event.getName()); physicalPlan = null; } }); eventManager.addEventListener(ContainerRestart.class, new EventHandler<ContainerRestart>() { @Override public synchronized void onEvent(ContainerRestart event) { LOG.info("Received conatiner restart event, invalidating cached PhysicalPlan: " + event.getName()); physicalPlan = null; } }); }
Source:
<code>public static void stopH2O() { if (H2OServerStarted) { H2O.shutdown(0); <START> log.info("H2O Server has shut down"); <END> } else { log.info("H2O Server is not running"); } }</code><technical_language>shut word; i.e. shutdown</technical_language>

Target:
public static void stopH2O() { if (isH2OServerStarted) { H2O.shutdown(0); isH2OServerStarted = false; log.info("H2O Server has shutdown."); } else { log.warn("H2O server is not started, hence cannot be stopped"); } }
Source:
<code>private void exit() { enableToolbarCommand(toolbar.getVisitGraphToolbarCommand(), visitGraphToolbarCommandEnabled); enableToolbarCommand(toolbar.getClearToolbarCommand(), clearToolbarCommandEnabled); enableToolbarCommand(toolbar.getClearStatesToolbarCommand(), clearStatesToolbarCommandEnabled); enableToolbarCommand(toolbar.getDeleteSelectionToolbarCommand(), deleteSelectionToolbarCommandEnabled); enableToolbarCommand(toolbar.getSwitchGridToolbarCommand(), switchGridToolbarCommandEnabled); enableToolbarCommand(toolbar.getUndoToolbarCommand(), undoToolbarCommandEnabled); enableToolbarCommand(toolbar.getRedoToolbarCommand(), redoToolbarCommandEnabled); enableToolbarCommand(toolbar.getValidateToolbarCommand(), validateToolbarCommandEnabled); enableToolbarCommand(toolbar.getExportToPngToolbarCommand(), exportToPngToolbarCommandEnabled); enableToolbarCommand(toolbar.getExportToJpgToolbarCommand(), exportToJpgToolbarCommandEnabled); enableToolbarCommand(toolbar.getExportToSvgToolbarCommand(), <START> exportToJpgToolbarCommandEnabled); <END> enableToolbarCommand(toolbar.getExportToPdfToolbarCommand(), exportToPdfToolbarCommandEnabled); enableToolbarCommand(toolbar.getCopyToolbarCommand(), copyCommandEnabled); enableToolbarCommand(toolbar.getCutToolbarCommand(), cutCommandEnabled); enableToolbarCommand(toolbar.getPasteToolbarCommand(), pasteCommandEnabled); }</code><technical_language>This be: java enableToolbarCommand(toolbar.getExportToSvgToolbarCommand(), exportToSvgToolbarCommandEnabled); java enableToolbarCommand(toolbar.getExportToSvgToolbarCommand(), exportToJpgToolbarCommandEnabled);</technical_language>

Target:
private void exit() { enableToolbarCommand(toolbar.getVisitGraphToolbarCommand(), visitGraphToolbarCommandEnabled); enableToolbarCommand(toolbar.getClearToolbarCommand(), clearToolbarCommandEnabled); enableToolbarCommand(toolbar.getClearStatesToolbarCommand(), clearStatesToolbarCommandEnabled); enableToolbarCommand(toolbar.getDeleteSelectionToolbarCommand(), deleteSelectionToolbarCommandEnabled); enableToolbarCommand(toolbar.getSwitchGridToolbarCommand(), switchGridToolbarCommandEnabled); enableToolbarCommand(toolbar.getUndoToolbarCommand(), undoToolbarCommandEnabled); enableToolbarCommand(toolbar.getRedoToolbarCommand(), redoToolbarCommandEnabled); enableToolbarCommand(toolbar.getValidateToolbarCommand(), validateToolbarCommandEnabled); enableToolbarCommand(toolbar.getExportToPngToolbarCommand(), exportToPngToolbarCommandEnabled); enableToolbarCommand(toolbar.getExportToJpgToolbarCommand(), exportToJpgToolbarCommandEnabled); enableToolbarCommand(toolbar.getExportToSvgToolbarCommand(), exportToSvgToolbarCommandEnabled); enableToolbarCommand(toolbar.getExportToPdfToolbarCommand(), exportToPdfToolbarCommandEnabled); enableToolbarCommand(toolbar.getCopyToolbarCommand(), copyCommandEnabled); enableToolbarCommand(toolbar.getCutToolbarCommand(), cutCommandEnabled); enableToolbarCommand(toolbar.getPasteToolbarCommand(), pasteCommandEnabled); }
Source:
<code>public String upload(String name, InputStream inputStream, long size) { GcsOutputChannel outputChannel; GcsFileOptions options = new GcsFileOptions.Builder() <START> .mimeType("image/jpeg") <END> .acl("full-control") .build(); GcsFilename fileName = getFileName(name); try { outputChannel = gcsService.createOrReplace(fileName, options); copy(inputStream, Channels.newOutputStream(outputChannel)); } catch (IOException e) { throw new RuntimeException(e); } return getServingUrl(fileName); }</code><technical_language>Needs set file filename</technical_language>

Target:
public String upload(String name, InputStream inputStream, long size) { GcsOutputChannel outputChannel; GcsFileOptions options = new GcsFileOptions.Builder() .acl("public-read") .build(); GcsFilename fileName = getFileName(name); verifyFileExtension(name); try { outputChannel = gcsService.createOrReplace(fileName, options); copy(inputStream, Channels.newOutputStream(outputChannel)); } catch (IOException e) { throw new RuntimeException(e); } return getServingUrl(fileName); }
Source:
<code><START> private List<MethodMatcher> createMethodMatchers(String rule) { <END> if (rule.length() > 0) { return ImmutableList.of(new MethodMatcher(rule)); } else { return ImmutableList.of(); } }</code><technical_language>fixed</technical_language>

Target:
private static MethodInvocationMatcherCollection createMethodMatchers(String rule) { if (rule.length() > 0) { return MethodInvocationMatcherCollection.create(MethodMatcherFactory.methodMatcher(rule)); } else { return MethodInvocationMatcherCollection.create(); } }
Source:
<code>public void printHelp(){ logger.info("-------------------"); logger.info("FarmJob help:"); logger.info("-------------------"); logger.info("FarmJob accepts the following parameters:"); logger.info(""); logger.info(" Mandatory:"); logger.info(" -pdbFilePath (mandatory) Path to the directory in your file system that contains the PDB files."); logger.info(" provide either -time or -nrAlignments. If both are provided the job stops as soon as any of the criteria has been reached."); logger.info(" -time maximum number of time to run (in seconds). -1 means no time limit, but run -nrAlignment arguments. Default: " + FarmJobParameters.DEFAULT_JOB_TIME ); logger.info(" -nrAlignments number of alignments to calculate. Default: " + FarmJobParameters.DEFAULT_NR_ALIGNMENTS) ; logger.info(""); logger.info(" Optional: "); logger.info(" -threads number of parallel threads to calculate alignments. Should be nr. of available CPUs. Default: " + FarmJobParameters.DEFAULT_NR_THREADS); logger.info(" -server the location of the server URL to talk to. Default : " + FarmJobParameters.DEFAULT_SERVER_URL); logger.info(" -username a unique name that can be given to this client. Can be used to give credit for who is doing the calculations. Default: IP and a random id"); <START> logger.info(" -stepSize the number of pairs to be requsted from server. Default: " + FarmJobParameters.DEFAULT_BATCH_SIZE); <END> }</code><technical_language>This a string is intended stdout</technical_language>

Target:
public void printHelp(){ System.out.println("-------------------"); System.out.println("FarmJob help:"); System.out.println("-------------------"); System.out.println("FarmJob accepts the following parameters:"); System.out.println(""); System.out.println(" Mandatory:"); System.out.println(" -pdbFilePath (mandatory) Path to the directory in your file system that contains the PDB files."); System.out.println(" provide either -time or -nrAlignments. If both are provided the job stops as soon as any of the criteria has been reached."); System.out.println(" -time maximum number of time to run (in seconds). -1 means no time limit, but run -nrAlignment arguments. Default: " + FarmJobParameters.DEFAULT_JOB_TIME ); System.out.println(" -nrAlignments number of alignments to calculate. Default: " + FarmJobParameters.DEFAULT_NR_ALIGNMENTS) ; System.out.println(""); System.out.println(" Optional: "); System.out.println(" -threads number of parallel threads to calculate alignments. Should be nr. of available CPUs. Default: " + FarmJobParameters.DEFAULT_NR_THREADS); System.out.println(" -server the location of the server URL to talk to. Default : " + FarmJobParameters.DEFAULT_SERVER_URL); System.out.println(" -username a unique name that can be given to this client. Can be used to give credit for who is doing the calculations. Default: IP and a random id"); System.out.println(" -stepSize the number of pairs to be requsted from server. Default: " + FarmJobParameters.DEFAULT_BATCH_SIZE); }
Source:
<code>public boolean onClusterClick(Cluster<TiClusterMarker> cluster) { LatLngBounds.Builder builder = LatLngBounds.builder(); for (TiClusterMarker item : cluster.getItems()) { builder.include(item.getPosition()); } final LatLngBounds bounds = builder.build(); if (map != null) { try { map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 100)); <START> } catch (Exception e) <END> } return true; }</code><technical_language>I adding e.printStackTrace() useful for debugging potential issues this code</technical_language>

Target:
public boolean onClusterClick(Cluster<TiClusterMarker> cluster) { LatLngBounds.Builder builder = LatLngBounds.builder(); for (TiClusterMarker item : cluster.getItems()) { builder.include(item.getPosition()); } final LatLngBounds bounds = builder.build(); if (map != null) { try { map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 100)); } catch (Exception e) { e.printStackTrace(); } } return true; }
Source:
<code>public Response<CommentInfo> apply(RevisionResource rsrc, Input in) throws AuthException, BadRequestException, ResourceConflictException, OrmException { if (Strings.isNullOrEmpty(in.path)) { throw new BadRequestException("path must be non-empty"); } else if (in.message == null || in.message.trim().isEmpty()) { throw new BadRequestException("message must be non-empty"); } else if (in.line != null && in.line <= 0) { throw new BadRequestException("line must be > 0"); } PatchLineComment c = new PatchLineComment( new PatchLineComment.Key( new Patch.Key(rsrc.getPatchSet().getId(), in.path), ChangeUtil.messageUUID(db.get())), <START> in.line != null ? in.line : 0, <END> rsrc.getAccountId(), Url.decode(in.inReplyTo)); c.setSide(in.side == Side.PARENT ? (short) 0 : (short) 1); c.setMessage(in.message.trim()); c.setRange(in.range); db.get().patchComments().insert(Collections.singleton(c)); return Response.created(new CommentInfo(c, null)); }</code><technical_language>Assert in.range in.line sense</technical_language>

Target:
public Response<CommentInfo> apply(RevisionResource rsrc, Input in) throws AuthException, BadRequestException, ResourceConflictException, OrmException { if (Strings.isNullOrEmpty(in.path)) { throw new BadRequestException("path must be non-empty"); } else if (in.message == null || in.message.trim().isEmpty()) { throw new BadRequestException("message must be non-empty"); } else if (in.line != null && in.line <= 0) { throw new BadRequestException("line must be > 0"); } else if (in.line != null && in.range != null && in.line != in.range.getEndLine()) { throw new BadRequestException("range endLine must be on the same line as the comment"); } PatchLineComment c = new PatchLineComment( new PatchLineComment.Key( new Patch.Key(rsrc.getPatchSet().getId(), in.path), ChangeUtil.messageUUID(db.get())), in.line != null ? in.line : 0, rsrc.getAccountId(), Url.decode(in.inReplyTo)); c.setSide(in.side == Side.PARENT ? (short) 0 : (short) 1); c.setMessage(in.message.trim()); c.setRange(in.range); db.get().patchComments().insert(Collections.singleton(c)); return Response.created(new CommentInfo(c, null)); }
Source:
<code>public int[] getActiveTransactionCount() { int[] count = new int[3]; count[0] = 0; count[1] = 0; <START> count[2] = _txns.size(); <END> for (TransactionLegacy txn : _txns.values()) { if (txn.getStack().size() > 0) { count[0]++; } if (txn.getCurrentConnection() != null) { count[1]++; } } return count; }</code><technical_language>change getTransactionCount()</technical_language>

Target:
public int[] getActiveTransactionCount() { int[] count = new int[2]; count[0] = 0; count[1] = 0; for (TransactionLegacy txn : _txns.values()) { if (txn.getStack().size() > 0) { count[0]++; } if (txn.getCurrentConnection() != null) { count[1]++; } } return count; }
Source:
<code>private boolean getUids(InputObjectState aa_uids) { synchronized (this) { try { return _recoveryStore.allObjUids(_transactionType, aa_uids); } catch (ObjectStoreException e) { if (LRALogger.logger.isTraceEnabled()) { <START> LRALogger.logger.tracef( <END> "LRARecoverModule: Exception %s while unpacking records of type %s", e.getMessage(), _transactionType, e); } else if (LRALogger.logger.isInfoEnabled()) { LRALogger.logger.infof("LRARecoverModule: Exception %s while unpacking records of type : %s", e.getMessage()); } return false; } } }</code><technical_language>above, please tracef(Throwable t, String format, Object... params)</technical_language>

Target:
private boolean getUids(InputObjectState aa_uids) { synchronized (this) { try { return _recoveryStore.allObjUids(_transactionType, aa_uids); } catch (ObjectStoreException e) { if (LRALogger.logger.isTraceEnabled()) { LRALogger.logger.tracef(e, "LRARecoverModule: Object store exception %s while unpacking records of type %s", e.getMessage(), _transactionType); } else if (LRALogger.logger.isInfoEnabled()) { LRALogger.logger.infof( "LRARecoverModule: Object store exception %s while unpacking records of type %s", e.getMessage(), _transactionType); } return false; } } }
Source:
<code>public User(String userID, String username, String preferredUsername) { super.setId(userID); super.setName(username); <START> this.preferredUsername = preferredUsername; <END> }</code><technical_language>super(userId, username)</technical_language>

Target:
public User(String userID, String username, String preferredUsername) { super(userID, username); this.preferredUsername = preferredUsername; }
Source:
<code>protected DataCenter postPopulate(DataCenter model) { <START> model.setLocal(new Random().nextBoolean()); <END> model.setStorageFormat(MappingTestHelper.shuffle(StorageFormat.class).value()); return model; }</code><technical_language>This needed. model is randomly populated in "populate" method. Enum types need this special treatment, booleans</technical_language>

Target:
protected DataCenter postPopulate(DataCenter model) { model.setStorageFormat(MappingTestHelper.shuffle(StorageFormat.class).value()); return model; }
Source:
<code>protected void configureServlets() { Map<String, String> loggingFilterConfig = new HashMap<String, String>(); loggingFilterConfig.put("header.name", "x-candlepin-request-uuid"); String regex = ".*"; String noStatusResource = "/(?!status).*"; if (config.getBoolean(ConfigProperties.SWAGGER_ENABLED)) { regex = "^(?!/docs).*"; } filterRegex(regex).through(CandlepinScopeFilter.class); filterRegex(regex).through(CandlepinPersistFilter.class); <START> filterRegex(noStatusResource).through(CandlepinSuspendModeFilter.class); <END> filterRegex(regex).through(LoggingFilter.class, loggingFilterConfig); filterRegex(regex).through(ContentTypeHackFilter.class); filterRegex(regex).through(EventFilter.class); serveRegex(regex).with(HttpServletDispatcher.class); }</code><technical_language>want throw unifrom Candlepin exception filter, I approach create JAX-RS PreMatching filter ServletFilter here. SuspendException handled ExceptionMapper</technical_language>

Target:
protected void configureServlets() { Map<String, String> loggingFilterConfig = new HashMap<String, String>(); loggingFilterConfig.put("header.name", "x-candlepin-request-uuid"); String regex = ".*"; if (config.getBoolean(ConfigProperties.SWAGGER_ENABLED)) { regex = "^(?!/docs).*"; } filterRegex(regex).through(CandlepinScopeFilter.class); filterRegex(regex).through(CandlepinPersistFilter.class); filterRegex(regex).through(LoggingFilter.class, loggingFilterConfig); filterRegex(regex).through(ContentTypeHackFilter.class); filterRegex(regex).through(EventFilter.class); serveRegex(regex).with(HttpServletDispatcher.class); }
Source:
<code>public InputStream wrapInputStream(final InputStream inputStream) { try { return new SnappyInputStream(inputStream); } <START> catch (Exception e) { throw new SAMException("Error instantiating SnappyInputStream", e); } <END> }</code><technical_language>I this checkisSnappyAvailable throw if false. check implicitly a NullPointerException if constructor initialized. this is snappy.disable command line end snappy unintentionally if guard in code</technical_language>

Target:
public InputStream wrapInputStream(final InputStream inputStream) { if (isSnappyAvailable()) { try { return new SnappyInputStream(inputStream); } catch (Exception e) { throw new SAMException("Error instantiating SnappyInputStream", e); } } else { throw new SAMException("Snappy not available"); } }
Source:
<code><START> private ZKHelixAdmin(Builder builder) throws IOException, InvalidRoutingDataException { <END> switch (builder.realmMode) { case MULTI_REALM: _zkClient = new FederatedZkClient(builder.realmAwareZkConnectionConfig, builder.realmAwareZkClientConfig); break; case SINGLE_REALM: _zkClient = SharedZkClientFactory.getInstance() .buildZkClient(builder.realmAwareZkConnectionConfig.createZkConnectionConfig(), builder.realmAwareZkClientConfig.createHelixZkClientConfig()); break; default: throw new HelixException("Invalid RealmMode given: " + builder.realmMode); } _configAccessor = new ConfigAccessor(_zkClient); _usesExternalZkClient = false; }</code><technical_language>is constructor throwing sorts of exceptions? discussed, this is catch checked exceptions</technical_language>

Target:
private ZKHelixAdmin(Builder builder) { RealmAwareZkClient zkClient; switch (builder.realmMode) { case MULTI_REALM: try { zkClient = new FederatedZkClient(builder.realmAwareZkConnectionConfig, builder.realmAwareZkClientConfig); } catch (IOException | InvalidRoutingDataException | IllegalStateException e) { throw new HelixException("Not able to connect on multi-realm mode.", e); } break; case SINGLE_REALM: zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(builder.zkAddress), builder.realmAwareZkClientConfig.createHelixZkClientConfig()); break; default: throw new HelixException("Invalid RealmMode given: " + builder.realmMode); } _zkClient = zkClient; _configAccessor = new ConfigAccessor(_zkClient); _usesExternalZkClient = false; }
Source:
<code>public double getTotalPopulationWeight() { <START> return (double) reservoir.getTotalPopulationCount(); <END> }</code><technical_language>need cast double</technical_language>

Target:
public double getTotalPopulationWeight() { return reservoir.getTotalPopulationCount(); }
Source:
<code>public String unmaskUrl(String url, TcSessionData tc, String stringToReplaceUser, String stringToReplaceCourse) { <START> if (tc != null){ <END> String uniqname = (String) tc.getCustomValuesMap().get(CUSTOM_CANVAS_USER_LOGIN_ID); String courseId = (String) tc.getCustomValuesMap().get(CUSTOM_CANVAS_COURSE_ID); M_log.debug("uniqname: " + uniqname); String replaceValue = "as_user_id=sis_login_id:" + uniqname; if(url.toLowerCase().contains(stringToReplaceUser.toLowerCase())){ url = url.replace(stringToReplaceUser.toLowerCase(), replaceValue); } if(url.toLowerCase().contains(stringToReplaceCourse.toLowerCase())){ url = url.replace(stringToReplaceCourse.toLowerCase(), courseId); } M_log.debug("New URL: " + url); } return url; }</code><technical_language>Return early if tc == null</technical_language>

Target:
public String unmaskUrl(String url, TcSessionData tc, String stringToReplaceUser, String stringToReplaceCourse) { if(tc == null){ return url; } String uniqname = (String) tc.getCustomValuesMap().get(CUSTOM_CANVAS_USER_LOGIN_ID); String courseId = (String) tc.getCustomValuesMap().get(CUSTOM_CANVAS_COURSE_ID); M_log.debug("uniqname: " + uniqname); String replaceUserIdValue = "as_user_id=sis_login_id:" + uniqname; if(url.toLowerCase().contains(stringToReplaceUser.toLowerCase())){ url = url.replace(stringToReplaceUser.toLowerCase(), replaceUserIdValue); } if(url.toLowerCase().contains(stringToReplaceCourse.toLowerCase())){ url = url.replace(stringToReplaceCourse.toLowerCase(), courseId); } M_log.debug("New URL: " + url); return url; }
Source:
<code>public void testNullDefaults() throws Exception { MessageSpec testMessageSpec = MessageGenerator.JSON_SERDE.readValue(String.join("", Arrays.asList( "{", " \"type\": \"request\",", " \"name\": \"FooBar\",", " \"validVersions\": \"0-2\",", " \"fields\": [", " { \"name\": \"field1\", \"type\": \"int32\", \"versions\": \"0+\" },", " { \"name\": \"field2\", \"type\": \"[]TestStruct\", \"versions\": \"1+\", ", " \"nullableVersions\": \"1+\", \"default\": \"null\", \"fields\": [", " { \"name\": \"field1\", \"type\": \"int32\", \"versions\": \"0+\" }", " ]},", " { \"name\": \"field3\", \"type\": \"bytes\", \"versions\": \"2+\", ", " \"nullableVersions\": \"2+\", \"default\": \"null\" }", " ]", "}")), MessageSpec.class); <START> new MessageDataGenerator("test").generate(testMessageSpec); <END> }</code><technical_language>This org.apache.kafka.common.message match directory generated source files outputted</technical_language>

Target:
public void testNullDefaults() throws Exception { MessageSpec testMessageSpec = MessageGenerator.JSON_SERDE.readValue(String.join("", Arrays.asList( "{", " \"type\": \"request\",", " \"name\": \"FooBar\",", " \"validVersions\": \"0-2\",", " \"fields\": [", " { \"name\": \"field1\", \"type\": \"int32\", \"versions\": \"0+\" },", " { \"name\": \"field2\", \"type\": \"[]TestStruct\", \"versions\": \"1+\", ", " \"nullableVersions\": \"1+\", \"default\": \"null\", \"fields\": [", " { \"name\": \"field1\", \"type\": \"int32\", \"versions\": \"0+\" }", " ]},", " { \"name\": \"field3\", \"type\": \"bytes\", \"versions\": \"2+\", ", " \"nullableVersions\": \"2+\", \"default\": \"null\" }", " ]", "}")), MessageSpec.class); new MessageDataGenerator("org.apache.kafka.common.message").generate(testMessageSpec); }
Source:
<code>private void unstage(IStructuredSelection selection) { if (selection.isEmpty()) return; final DirCacheEditor edit; try { <START> edit = currentRepository.lockDirCache().editor(); <END> } catch (IOException e) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); return; } final RevTree headRevTree; try { final Ref head = currentRepository.getRef(Constants.HEAD); headRevTree = new RevWalk(currentRepository).parseTree(head.getObjectId()); } catch (IOException e1) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); return; } Iterator iterator = selection.iterator(); while (iterator.hasNext()) { StagingEntry entry = (StagingEntry) iterator.next(); switch(entry.getState()) { case ADDED: case CHANGED: case REMOVED: try { final TreeWalk tw = TreeWalk.forPath(currentRepository, entry.getPath(), headRevTree); if (tw != null) { edit.add(new DirCacheEditor.PathEdit(entry.getPath()) { @Override public void apply(DirCacheEntry ent) { ent.setFileMode(tw.getFileMode(0)); ent.setObjectId(tw.getObjectId(0)); } }); } } catch (IOException e) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); } break; default: } } try { edit.commit(); } catch (IOException e) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); } reload(currentRepository); }</code><technical_language>a finally block unlock DirCache in case of error: dirCache = repository.lockDirCache(); try { ... work dirCache } finally { dirCache.unlock(); }</technical_language>

Target:
private void unstage(IStructuredSelection selection) { if (selection.isEmpty()) return; final RevCommit headRev; try { final Ref head = currentRepository.getRef(Constants.HEAD); headRev = new RevWalk(currentRepository).parseCommit(head.getObjectId()); } catch (IOException e1) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); return; } final DirCache dirCache; final DirCacheEditor edit; try { dirCache = currentRepository.lockDirCache(); edit = dirCache.editor(); } catch (IOException e) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); return; } try { updateDirCache(selection, headRev, edit); try { edit.commit(); } catch (IOException e) { MessageDialog.openError(getSite().getShell(), UIText.CommitAction_MergeHeadErrorTitle, UIText.CommitAction_ErrorReadingMergeMsg); } } finally { dirCache.unlock(); } reload(currentRepository); }
Source:
<code>public Optional<Vector3d> getClickedPosition() { <START> return Optional.of(VecHelper.toVector(this.pos).toDouble()); <END> }</code><technical_language>Possibly store this in a field avoid creating 3 objects call</technical_language>

Target:
public Optional<Vector3d> getClickedPosition() { return clickedPosition; }
Source:
<code>public static void main( String[] args ) throws Exception { WebSocketChatClient chatclient = new WebSocketChatClient( new URI( "wss://localhost:8887" ) ); String STORETYPE = "JKS"; <START> String KEYSTORE = String.format("src%1$stest%1$1sjava%1$1sorg%1$1sjava_websocket%1$1skeystore.jks", File.separator); <END> String STOREPASSWORD = "storepassword"; String KEYPASSWORD = "keypassword"; KeyStore ks = KeyStore.getInstance( STORETYPE ); File kf = new File( KEYSTORE ); ks.load( new FileInputStream( kf ), STOREPASSWORD.toCharArray() ); KeyManagerFactory kmf = KeyManagerFactory.getInstance( "SunX509" ); kmf.init( ks, KEYPASSWORD.toCharArray() ); TrustManagerFactory tmf = TrustManagerFactory.getInstance( "SunX509" ); tmf.init( ks ); SSLContext sslContext = null; sslContext = SSLContext.getInstance( "TLS" ); sslContext.init( kmf.getKeyManagers(), tmf.getTrustManagers(), null ); SSLSocketFactory factory = sslContext.getSocketFactory(); chatclient.setSocketFactory( factory ); chatclient.connectBlocking(); BufferedReader reader = new BufferedReader( new InputStreamReader( System.in ) ); while ( true ) { String line = reader.readLine(); if( line.equals( "close" ) ) { chatclient.closeBlocking(); } else if ( line.equals( "open" ) ) { chatclient.reconnect(); } else { chatclient.send( line ); } } }</code><technical_language>String.format calls replaced Paths.get("src", "test", "java", "org", "java_websocket", "keystore.jks").toString(); more readable in opinion chance of accidental bugs</technical_language>

Target:
public static void main( String[] args ) throws Exception { WebSocketChatClient chatclient = new WebSocketChatClient( new URI( "wss://localhost:8887" ) ); String STORETYPE = "JKS"; String KEYSTORE = Paths.get("src", "test", "java", "org", "java_websocket", "keystore.jks").toString(); String STOREPASSWORD = "storepassword"; String KEYPASSWORD = "keypassword"; KeyStore ks = KeyStore.getInstance( STORETYPE ); File kf = new File( KEYSTORE ); ks.load( new FileInputStream( kf ), STOREPASSWORD.toCharArray() ); KeyManagerFactory kmf = KeyManagerFactory.getInstance( "SunX509" ); kmf.init( ks, KEYPASSWORD.toCharArray() ); TrustManagerFactory tmf = TrustManagerFactory.getInstance( "SunX509" ); tmf.init( ks ); SSLContext sslContext = null; sslContext = SSLContext.getInstance( "TLS" ); sslContext.init( kmf.getKeyManagers(), tmf.getTrustManagers(), null ); SSLSocketFactory factory = sslContext.getSocketFactory(); chatclient.setSocketFactory( factory ); chatclient.connectBlocking(); BufferedReader reader = new BufferedReader( new InputStreamReader( System.in ) ); while ( true ) { String line = reader.readLine(); if( line.equals( "close" ) ) { chatclient.closeBlocking(); } else if ( line.equals( "open" ) ) { chatclient.reconnect(); } else { chatclient.send( line ); } } }
Source:
<code>public String toString() { StringBuilder result = new StringBuilder(); if (!getLang().equals("und")) { result.append("Id: ").append(getId()); result.append(", Language Code: ").append(getLang()); } if (isNotBlank(getAudioTrackTitleFromMetadata())) { if (result.length() > 0) { result.append(", "); } result.append("Audio Track Title From Metadata: ").append(getAudioTrackTitleFromMetadata()); } if (result.length() > 0) { result.append(", "); } result.append("Audio Codec: ").append(getAudioCodec()); if (getSampleFrequency() != null) { result.append(", Sample Frequency: ").append(getSampleFrequency()); } if (getBitRate() != 0) { result.append(", Bitrate: ").append(getBitRate()); } <START> if (getBitsperSample() != 0 && getBitsperSample() != 16 ) { <END> result.append(", Bits per Sample: ").append(getBitsperSample()); } if (getAudioProperties() != null) { result.append(", ").append(getAudioProperties()); } if (nrAudioChannels != 0) { result.append(", Deprecated Channels: ").append(nrAudioChannels); } if (delay != 0) { result.append(", Deprecated Delay: ").append(delay); } if (isNotBlank(getArtist())) { result.append(", Artist: ").append(getArtist()); if (isNotBlank(getAlbum())) { result.append(", Album: ").append(getAlbum()); } if (isNotBlank(getSongname())) { result.append(", Track Name: ").append(getSongname()); } if (getYear() != 0) { result.append(", Year: ").append(getYear()); } if (getTrack() != 0) { result.append(", Track: ").append(getTrack()); } if (isNotBlank(getGenre())) { result.append(", Genre: ").append(getGenre()); } } if (isNotBlank(getMuxingModeAudio())) { result.append(", Muxing Mode: ").append(getMuxingModeAudio()); } return result.toString(); }</code><technical_language>@Sami32 I understand meant that..</technical_language>

Target:
public String toString() { StringBuilder result = new StringBuilder(); if (!getLang().equals("und")) { result.append("Id: ").append(getId()); result.append(", Language Code: ").append(getLang()); } if (isNotBlank(getAudioTrackTitleFromMetadata())) { if (result.length() > 0) { result.append(", "); } result.append("Audio Track Title From Metadata: ").append(getAudioTrackTitleFromMetadata()); } if (result.length() > 0) { result.append(", "); } result.append("Audio Codec: ").append(getAudioCodec()); result.append(", Bitrate: ").append(getBitRate()); if (getBitsperSample() != 16) { result.append(", Bits per Sample: ").append(getBitsperSample()); } if (getAudioProperties() != null) { result.append(", ").append(getAudioProperties()); } if (isNotBlank(getArtist())) { result.append(", Artist: ").append(getArtist()); } if (isNotBlank(getAlbum())) { result.append(", Album: ").append(getAlbum()); } if (isNotBlank(getSongname())) { result.append(", Track Name: ").append(getSongname()); } if (getYear() != 0) { result.append(", Year: ").append(getYear()); } if (getTrack() != 0) { result.append(", Track: ").append(getTrack()); } if (isNotBlank(getGenre())) { result.append(", Genre: ").append(getGenre()); } if (isNotBlank(getMuxingModeAudio())) { result.append(", Muxing Mode: ").append(getMuxingModeAudio()); } return result.toString(); }
Source:
<code>public static PropertyDescriptor getPropertyDescriptor(Class<?> beanClass, String propertyName) { if (!beanClass.isInterface()) { BeanInfo beanInfo; try { beanInfo = Introspector.getBeanInfo(beanClass); } catch (IntrospectionException e) { return null; } PropertyDescriptor[] propertyDescriptors = beanInfo .getPropertyDescriptors(); for (PropertyDescriptor descriptor : propertyDescriptors) { if (descriptor.getName().equals(propertyName)) { return descriptor; } } } else { try { PropertyDescriptor propertyDescriptors[]; List<PropertyDescriptor> pds = new ArrayList<PropertyDescriptor>(); getInterfacePropertyDescriptors(pds, beanClass); if (pds.size() > 0) { propertyDescriptors = <START> pds .toArray(new PropertyDescriptor[pds.size()]); <END> PropertyDescriptor descriptor; for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { descriptor = propertyDescriptor; if (descriptor.getName().equals(propertyName)) return descriptor; } } } catch (IntrospectionException e) { return null; } } throw new IllegalArgumentException( "Could not find property with name " + propertyName + " in class " + beanClass); }</code><technical_language>this fit line</technical_language>

Target:
public static PropertyDescriptor getPropertyDescriptor(Class<?> beanClass, String propertyName) { if (!beanClass.isInterface()) { BeanInfo beanInfo; try { beanInfo = Introspector.getBeanInfo(beanClass); } catch (IntrospectionException e) { return null; } PropertyDescriptor[] propertyDescriptors = beanInfo .getPropertyDescriptors(); for (PropertyDescriptor descriptor : propertyDescriptors) { if (descriptor.getName().equals(propertyName)) { return descriptor; } } } else { try { List<PropertyDescriptor> pds = new ArrayList<PropertyDescriptor>(); getInterfacePropertyDescriptors(pds, beanClass); if (pds.size() > 0) { for (PropertyDescriptor descriptor : pds.toArray(new PropertyDescriptor[pds.size()])) { if (descriptor.getName().equals(propertyName)) return descriptor; } } } catch (IntrospectionException e) { return null; } } throw new IllegalArgumentException( "Could not find property with name " + propertyName + " in class " + beanClass); }
Source:
<code>public View getView(int position, View convertView, ViewGroup parent) { View view; if (convertView == null) { view = mInflater.inflate(mResource, parent, false); } else { view = convertView; } DiningTable t = mTables.get(position); TextView table; table = (TextView) view.findViewById(R.id.table_num); table.setText(t.getName()); ImageView background; background = (ImageView) view.findViewById(R.id.table_bg); <START> if (t.isFree() == false) { <END> background.setAlpha(USED_FLAG); } return view; }</code><technical_language>write if (!t.isFree())</technical_language>

Target:
public View getView(int position, View convertView, ViewGroup parent) { View view; if (convertView == null) { view = mInflater.inflate(mResource, parent, false); } else { view = convertView; } DiningTable t = getItem(position); TextView table; table = (TextView) view.findViewById(R.id.table_num); table.setText(t.getName()); ImageView background; background = (ImageView) view.findViewById(R.id.table_bg); if (!t.isFree()) { background.setAlpha(USED_FLAG); } return view; }