auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean execute(BuildCommand command, BuildSession buildSession) { File workingDir = buildSession.resolveRelativeDir(command.getWorkingDirectory()); if (!workingDir.isDirectory()) { String message = "Working directory \"" + workingDir.getAbsolutePath() + "\" is not a directory!"; LOG.error(message); buildSession.println(message); return false; } String cmd = command.getStringArg("command"); String[] args = command.getArrayArg("args"); Map<String, String> secrets = buildSession.getSecretSubstitutions(); Set<String> leftSecrets = new HashSet<>(secrets.keySet()); CommandLine commandLine = createCommandLine(cmd); for (String arg : args) { if(secrets.containsKey(arg)) { leftSecrets.remove(arg); commandLine.withArg(new SubstitutableCommandArgument(arg, secrets.get(arg))); } else { commandLine.withArg(arg); } } for (String secret: leftSecrets) { commandLine.withNonArgSecret(new SecretSubstitution(secret, secrets.get(secret))); } commandLine.withWorkingDir(workingDir); commandLine.withEnv(buildSession.getEnvs()); <START> if (command.getExecInput() == null) { <END> return executeCommandLine(buildSession, commandLine) == 0; } else { return executeCommandLine(buildSession, commandLine, command.getExecInput()) == 0; } }</code><technical_language>I if initializing execInput empty array helps get rid of this null check. like: @Expose private String[] execInput = new String[0]; tests "yes"</technical_language>

Target:
public boolean execute(BuildCommand command, BuildSession buildSession) { File workingDir = buildSession.resolveRelativeDir(command.getWorkingDirectory()); if (!workingDir.isDirectory()) { String message = "Working directory \"" + workingDir.getAbsolutePath() + "\" is not a directory!"; LOG.error(message); buildSession.println(message); return false; } String cmd = command.getStringArg("command"); String[] args = command.getArrayArg("args"); Map<String, String> secrets = buildSession.getSecretSubstitutions(); Set<String> leftSecrets = new HashSet<>(secrets.keySet()); CommandLine commandLine = createCommandLine(cmd); for (String arg : args) { if(secrets.containsKey(arg)) { leftSecrets.remove(arg); commandLine.withArg(new SubstitutableCommandArgument(arg, secrets.get(arg))); } else { commandLine.withArg(arg); } } for (String secret: leftSecrets) { commandLine.withNonArgSecret(new SecretSubstitution(secret, secrets.get(secret))); } commandLine.withWorkingDir(workingDir); commandLine.withEnv(buildSession.getEnvs()); commandLine.withEnv(command.getCommandEnvVars()); return executeCommandLine(buildSession, commandLine, command.getExecInput()) == 0; }
Source:
<code>public NavigationResult getPrerequisiteCommands(UIContext context) { NavigationResultBuilder builder = NavigationResultBuilder.create(); Project project = getSelectedProject(context); if (project != null) { if (!project.hasFacet(CDIFacet.class)) { <START> builder.add(CDISetupCommandImpl.class); <END> } } return builder.build(); }</code><technical_language>CDISetupCommand.class instead</technical_language>

Target:
public NavigationResult getPrerequisiteCommands(UIContext context) { NavigationResultBuilder builder = NavigationResultBuilder.create(); Project project = getSelectedProject(context); if (project != null) { if (!project.hasFacet(CDIFacet.class)) { builder.add(CDISetupCommand.class); } } return builder.build(); }
Source:
<code>public Set<Seat> getSeatsByTeamName(String teamName) { Set<Seat> seats = new HashSet<>(); Team team = teamService.getTeamByTeamname(teamName).orElseThrow(() -> new TeamNotFoundException(teamName)); for (User user : team.getMembers()) { Optional<Seat> seat = seatRespository.findByTicketOwnerUsername(user.getUsername()); if (seat.isPresent()) { <START> seats.add(seat.get()); <END> } } return seats; }</code><technical_language>do: java return team.getMembers().steam() .map(User::getUsername) .map(seatRepository::findByTicketOwnerUsername) .filter(Optional::isPresent) .collect(Collectors.toSet()); Matter of preference. A bit sad is required optional is present, in stream implementations get for free</technical_language>

Target:
public List<Seat> getSeatsByTeamName(String teamName) { Team team = teamService.getTeamByTeamname(teamName).orElseThrow(() -> new TeamNotFoundException(teamName)); return team.getMembers().stream(). map(User::getUsername). map(seatRepository::findByTicketOwnerUsername). flatMap(Collection::stream). collect(Collectors.toList()); }
Source:
<code><START> private void sendMessage(String registrationToken, UUID deviceAnonymizedId, Message firebaseMessage) <END> { try { if (yonaProperties.getFirebase().isEnabled()) { logger.info("Sending Firebase message"); firebaseMessaging.send(firebaseMessage); } else { logger.info("Firebase message not sent because Firebase is disabled"); lastMessageByRegistrationToken.put(registrationToken, MessageData.createInstance(MDC.getCopyOfContextMap(), firebaseMessage)); } } catch (FirebaseMessagingException e) { if (FIREBASE_ID_NOT_REGISTERED.equals(e.getErrorCode())) { handleNotRegisteredDevice(deviceAnonymizedId); return; } throw FirebaseServiceException.couldNotSendMessage(e); } }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') This method 24 lines, is greater 20 lines authorized. Split smaller methods. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private void sendMessage(String registrationToken, UUID deviceAnonymizedId, Message firebaseMessage) { try { if (yonaProperties.getFirebase().isEnabled()) { logger.info("Sending Firebase message"); firebaseMessaging.send(firebaseMessage); } else { logger.info("Firebase message not sent because Firebase is disabled"); storeForTestability(registrationToken, firebaseMessage); } } catch (FirebaseMessagingException e) { if (FIREBASE_ID_NOT_REGISTERED.equals(e.getErrorCode())) { handleNotRegisteredDevice(deviceAnonymizedId); return; } throw FirebaseServiceException.couldNotSendMessage(e); } }
Source:
<code>private String convertToMgdl(String bg) { <START> int i; <END> String new_bg = new String[bg.length]; for (i=0; i < bg.length; i++) { new_bg[i] = Float.toString(18 * Float.parseFloat(bg[i])); } return new_bg; }</code><technical_language>move of for loop</technical_language>

Target:
private String convertToMgdl(String bg) { String new_bg = new String[bg.length]; for (int i = 0; i < bg.length; i++) { new_bg[i] = Float.toString(18 * Float.parseFloat(bg[i])); } return new_bg; }
Source:
<code>private void createMultipleValuedReferenceWidget(EEFWidgetFactory widgetFactory) { ScrolledComposite scrolledComposite = widgetFactory.createScrolledComposite(reference, SWT.NONE); GridData gridData = new GridData(); gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = SWT.FILL; scrolledComposite.setLayoutData(gridData); final int clientWidth = scrolledComposite.getClientArea().width; this.tableViewer = new TableViewer(scrolledComposite, SWT.READ_ONLY | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI); this.table = tableViewer.getTable(); this.table.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); this.tableViewer.setContentProvider(ArrayContentProvider.getInstance()); this.tableViewer.setLabelProvider(new EEFTableReferencesLabelProvider()); scrolledComposite.setContent(table); int defaultHeight = DEFAULT_HEIGHT; List<EEFWidgetAction> actions = description.getActions(); if (actions != null && actions.size() > 0) { defaultHeight = defaultHeight * (actions.size() + 1); } table.setSize(clientWidth, defaultHeight); <START> scrolledComposite.setExpandHorizontal(true); <END> scrolledComposite.setAlwaysShowScrollBars(true); }</code><technical_language>I add a scrolledComposite.setExpandVertical(true); actual list widget (at recognizable such) multiple values</technical_language>

Target:
private void createMultipleValuedReferenceWidget(EEFWidgetFactory widgetFactory) { ScrolledComposite scrolledComposite = widgetFactory.createScrolledComposite(reference, SWT.NONE); GridData gridData = new GridData(); gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = SWT.FILL; scrolledComposite.setLayoutData(gridData); final int clientWidth = scrolledComposite.getClientArea().width; this.tableViewer = new TableViewer(scrolledComposite, SWT.READ_ONLY | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI); this.table = tableViewer.getTable(); this.table.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); this.tableViewer.setContentProvider(ArrayContentProvider.getInstance()); this.tableViewer.setLabelProvider(new EEFTableReferencesLabelProvider()); scrolledComposite.setContent(table); List<EEFWidgetAction> actions = description.getActions(); if (actions != null && actions.size() > 0) { widgetHeight = widgetHeight * (actions.size() + 1); } table.setSize(clientWidth, widgetHeight); scrolledComposite.setExpandHorizontal(true); scrolledComposite.setAlwaysShowScrollBars(true); }
Source:
<code>public void onItemDeleteClick(int position, String listName) { <START> String dialogContent = getString(R.string.confirm_deletion_message) + " \"" + listName + "\"?"; <END> deleteListDialog.dialog.setContent(dialogContent); deleteListDialog.show(position); }</code><technical_language>start placeholders, getString() API support additional parameters; pretty cool. suggestion String dialogContent = getString(R.string.confirm_deletion_message, " \"" + listName + "\");</technical_language>

Target:
public void onItemDeleteClick(int position, String listName) { deleteListDialog.presentForList(position, listName); }
Source:
<code>private DnsSRVResult validateLdapServers(String domainName) throws ManageDomainsResult { LdapSRVLocator locator = new LdapSRVLocator(); DnsSRVResult ldapDnsResult = null; boolean foundServers = true; try { <START> ldapDnsResult = locator.getLdapServers(domainName); <END> if (ldapDnsResult.getNumOfValidAddresses() == 0) { foundServers = false; } } catch (Exception ex) { foundServers = false; } if (!foundServers) { throw new ManageDomainsResult("Could not locate LDAP servers to be used to validate the input of the utility", ManageDomainsResultEnum.NO_LDAP_SERVERS_FOR_DOMAIN, domainName); } return ldapDnsResult; }</code><technical_language>here, ignore 'getNumOfValidAddresses()' check verify ldapDnsResult is non-null</technical_language>

Target:
private DnsSRVResult validateLdapServers(String domainName) throws ManageDomainsResult { LdapSRVLocator locator = new LdapSRVLocator(); DnsSRVResult ldapDnsResult = null; boolean foundServers = true; try { ldapDnsResult = locator.getLdapServers(domainName); if (ldapDnsResult == null || ldapDnsResult.getNumOfValidAddresses() == 0) { foundServers = false; } } catch (Exception ex) { foundServers = false; } if (!foundServers) { throw new ManageDomainsResult("Could not locate LDAP servers to be used to validate the input of the utility", ManageDomainsResultEnum.NO_LDAP_SERVERS_FOR_DOMAIN, domainName); } return ldapDnsResult; }
Source:
<code>public String getModifiedIndex() { <START> Calendar cal= Calendar.getInstance(); <END> Objects.requireNonNull(eventIndexName, "null value"); if(!eventIndexName.equals("opennms")) { return String.format("%s-%s" , eventIndexName,INDEX_PREFIX) ; } return INDEX_PREFIX; }</code><technical_language>suggestion</technical_language>

Target:
private String getModifiedIndex() { if (!eventIndexName.isEmpty()) { return String.format("%s-%s", eventIndexName, INDEX_PREFIX); } return INDEX_PREFIX; }
Source:
<code>public void testRunBulkOperation() throws Exception { DocumentModel model = session.getDocument(new PathRef("/default-domain/workspaces/test")); String nxql = String.format("SELECT * from Document where ecm:parentId='%s'", model.getId()); BulkStatus status = service.runOperation(new BulkCommand().withQuery(nxql).withOperation("count")); assertNotNull(status); assertEquals(SCHEDULED, status.getState()); LogManager manager = Framework.getService(StreamService.class).getLogManager("bulk"); <START> LogTailer<Record> tailer = manager.createTailer("counter", "output"); <END> for (int i = 1; i <= 10; i++) { LogRecord<Record> logRecord = tailer.read(Duration.ofSeconds(1)); assertEquals(i, new BigInteger(logRecord.message().data).intValue()); } status = service.getStatus(status.getUUID()); assertNotNull(status); assertEquals(COMPLETED, status.getState()); assertNotNull(status.getScrolledDocumentCount()); assertEquals(10, status.getScrolledDocumentCount().longValue()); }</code><technical_language>try-with-resource for tailer</technical_language>

Target:
public void testRunBulkOperation() throws Exception { DocumentModel model = session.getDocument(new PathRef("/default-domain/workspaces/test")); String nxql = String.format("SELECT * from Document where ecm:parentId='%s'", model.getId()); BulkStatus status = service.runOperation(new BulkCommand().withQuery(nxql).withOperation("count")); assertNotNull(status); assertEquals(SCHEDULED, status.getState()); LogManager manager = Framework.getService(StreamService.class).getLogManager("bulk"); try (LogTailer<Record> tailer = manager.createTailer("counter", "output")) { for (int i = 1; i <= 10; i++) { LogRecord<Record> logRecord = tailer.read(Duration.ofSeconds(1)); assertEquals(i, new BigInteger(logRecord.message().data).intValue()); } } status = service.getStatus(status.getUUID()); assertNotNull(status); assertEquals(COMPLETED, status.getState()); assertNotNull(status.getScrolledDocumentCount()); assertEquals(10, status.getScrolledDocumentCount().longValue()); }
Source:
<code>public String translate(List<SourceFile> closureSource) throws Exception { final CompilerOptions options = new CompilerOptions(); options.setRenamingPolicy( VariableRenamingPolicy.OFF, PropertyRenamingPolicy.OFF); <START> for (Class<? extends CompilerPass> pass : new Class[] { <END> ConvertToTypedES6.class, ConvertToES6Classes.class, MoveMembersOutOfConstructor.class, RemoveFunctionBodies.class, }) { options.addCustomPass(BEFORE_CHECKS, pass.getConstructor(AbstractCompiler.class).newInstance(compiler)); } options.setTranspileOnly(true); options.setPrettyPrint(true); Result result = compiler.compile(Collections.<SourceFile>emptyList(), closureSource, options); if (!result.success) { throw new RuntimeException("Compile failed: " + Arrays.toString(result.errors)); } Node scriptNode = Iterables.getOnlyElement(compiler.getJsRoot().children()); final CodePrinter.Builder builder = new CodePrinter.Builder(scriptNode); builder.setCompilerOptions(options); builder.setCodeGeneratorFactory(new CodeGeneratorFactory() { @Override public CodeGenerator getCodeGenerator(Format outputFormat, CodeConsumer mcp) { return new DTSCodeGenerator(mcp, options); } }); return builder.build(); }</code><technical_language>Indentation is screwed up. I nicer extract this a constant</technical_language>

Target:
public String translate(List<SourceFile> closureSource) throws Exception { final CompilerOptions options = buildOptions(); Result result = compiler.compile(Collections.<SourceFile>emptyList(), closureSource, options); if (!result.success) { throw new RuntimeException("Compile failed: " + Arrays.toString(result.errors)); } Node scriptNode = Iterables.getOnlyElement(compiler.getJsRoot().children()); final CodePrinter.Builder builder = new CodePrinter.Builder(scriptNode); builder.setCompilerOptions(options); builder.setCodeGeneratorFactory(new CodeGeneratorFactory() { @Override public CodeGenerator getCodeGenerator(Format outputFormat, CodeConsumer mcp) { return new DTSCodeGenerator(mcp, options); } }); return builder.build(); }
Source:
<code>protected int rwAnyNode(IASTNode node, int indirection) { final IASTNode parent= node.getParent(); if (parent instanceof ICASTFieldDesignator) { return WRITE; <START> }else if (parent instanceof CASTIdExpression) { <END> IASTNode grandparent = parent.getParent(); if ( grandparent instanceof CASTArraySubscriptExpression){ return super.rwAnyNode(parent, 1); }else if ( grandparent instanceof CASTUnaryExpression && ((CASTUnaryExpression)grandparent).getOperator() == IASTUnaryExpression.op_star) { return WRITE; } } return super.rwAnyNode(node, indirection); }</code><technical_language>interface instead of a concrete class. below. Space is missing "else"</technical_language>

Target:
protected int rwAnyNode(IASTNode node, int indirection) { final IASTNode parent= node.getParent(); if (parent instanceof ICASTFieldDesignator) { return WRITE; } else if (parent instanceof IASTIdExpression) { IASTNode grandparent = parent.getParent(); if (grandparent instanceof IASTArraySubscriptExpression) { return super.rwAnyNode(parent, 1); } else if (grandparent instanceof IASTUnaryExpression && ((CASTUnaryExpression) grandparent).getOperator() == IASTUnaryExpression.op_star) { return WRITE; } } return super.rwAnyNode(node, indirection); }
Source:
<code>public void notifyRcsAutoConfigurationReceived(int subId, @NonNull byte[] config, boolean isCompressed) { <START> try { <END> IImsConfig configBinder = getImsConfig(getSlotIndex(subId), ImsFeature.FEATURE_RCS); if (configBinder == null) { Rlog.e(LOG_TAG, "null result for getImsConfig"); } else { configBinder.notifyRcsAutoConfigurationReceived(config, isCompressed); } } catch (RemoteException e) { Rlog.e(LOG_TAG, "fail to getImsConfig " + e.getMessage()); } }</code><technical_language>change okay, need modify phone state carrier privilege permission do this, TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege</technical_language>

Target:
public void notifyRcsAutoConfigurationReceived(int subId, @NonNull byte[] config, boolean isCompressed) { TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege( mApp, subId, "notifyRcsAutoConfigurationReceived"); try { IImsConfig configBinder = getImsConfig(getSlotIndex(subId), ImsFeature.FEATURE_RCS); if (configBinder == null) { Rlog.e(LOG_TAG, "null result for getImsConfig"); } else { configBinder.notifyRcsAutoConfigurationReceived(config, isCompressed); } } catch (RemoteException e) { Rlog.e(LOG_TAG, "fail to getImsConfig " + e.getMessage()); } }
Source:
<code>protected void prepareTestData() { newSession = FeedbackSessionAttributes .builder("New Session ##", "CFeedbackUiT.CS1101", "teammates.test1@gmail.tmt") .withStartTime(TimeHelper.parseInstant("2035-04-01 3:59 PM +0000")) .withEndTime(TimeHelper.parseInstant("2035-04-30 2:00 PM +0000")) .withCreatedTime(Const.TIME_REPRESENTS_NEVER) .withSessionVisibleFromTime(Const.TIME_REPRESENTS_FOLLOW_OPENING) .withResultsVisibleFromTime(Const.TIME_REPRESENTS_LATER) .withGracePeriod(0) .withInstructions(new Text("Please fill in the new feedback session.")) .withSentOpenEmail(false) .withSentPublishedEmail(false) <START> .withTimeZone(TimeHelper.convertToZoneId(8)) <END> .withFeedbackSessionType(FeedbackSessionType.STANDARD) .withClosingEmailEnabled(true) .withPublishedEmailEnabled(true) .build(); }</code><technical_language>ZoneId.of("+08:00")? convertToZoneId removed eventually</technical_language>

Target:
protected void prepareTestData() { newSession = FeedbackSessionAttributes .builder("New Session ##", "CFeedbackUiT.CS1101", "teammates.test1@gmail.tmt") .withStartTime(TimeHelper.parseInstant("2035-04-01 3:59 PM +0000")) .withEndTime(TimeHelper.parseInstant("2035-04-30 2:00 PM +0000")) .withCreatedTime(Const.TIME_REPRESENTS_NEVER) .withSessionVisibleFromTime(Const.TIME_REPRESENTS_FOLLOW_OPENING) .withResultsVisibleFromTime(Const.TIME_REPRESENTS_LATER) .withGracePeriod(0) .withInstructions(new Text("Please fill in the new feedback session.")) .withSentOpenEmail(false) .withSentPublishedEmail(false) .withTimeZone(ZoneId.of("UTC+08:00")) .withFeedbackSessionType(FeedbackSessionType.STANDARD) .withClosingEmailEnabled(true) .withPublishedEmailEnabled(true) .build(); }
Source:
<code>private void waitForBreakpointEvent(Class<? extends IBreakpointsChangedEvent> eventType, int timeout) throws Exception { <START> System.out.println(String.format("%s Waiting for '%s' ...", DsfPlugin.getDebugTime(), eventType.getName())); <END> if (!breakpointEventReceived(eventType)) { synchronized(this) { try { wait(timeout); } catch (InterruptedException ex) { } } if (!breakpointEventReceived(eventType)) { System.out.println(String.format("%s Event '%s' is timed out", DsfPlugin.getDebugTime(), eventType.getName())); throw new Exception(String.format("Timed out waiting for '%s' to occur.", eventType.getName())); } } }</code><technical_language>leave printouts</technical_language>

Target:
private void waitForBreakpointEvent(Class<? extends IBreakpointsChangedEvent> eventType, int timeout) throws Exception { if (!breakpointEventReceived(eventType)) { synchronized(this) { try { wait(timeout); } catch (InterruptedException ex) { } } if (!breakpointEventReceived(eventType)) { throw new Exception(String.format("Timed out waiting for '%s' to occur.", eventType.getName())); } } }
Source:
<code>public BulkInputCaller bulkCaller(CallContext callContext) { <START> return new BulkInputCallerImpl(this, getBatchSize(), newCallContext()); <END> }</code><technical_language>This call is throwing callContext parameter instead of passing in</technical_language>

Target:
public BulkInputCaller bulkCaller(CallContext callContext) { return new BulkInputCallerImpl(this, getBatchSize(), callContext); }
Source:
<code>public StepExpression createExpression(String expressionString, final TypeResolver tableOrDocStringType, final boolean transpose) { if (expressionString == null) throw new NullPointerException("expressionString can not be null"); if (tableOrDocStringType == null) throw new NullPointerException("tableOrDocStringType can not be null"); final Expression expression; try { expression = expressionFactory.createExpression(expressionString); } catch (UndefinedParameterTypeException e) { throw registerTypeInConfiguration(expressionString, e); } RawTableTransformer<?> tableTransform = (List<List<String>> raw) -> { DataTable dataTable = DataTable.create(raw, StepExpressionFactory.this.tableConverter); Type targetType = tableOrDocStringType.resolve(); return dataTable.convert(Object.class.equals(targetType) ? DataTable.class : targetType, transpose); }; <START> DocStringTransformer<?> docStringTransform = (DocStringTransformer<Object>) (docString, contentType) -> { <END> Type targetType = tableOrDocStringType.resolve(); if (String.class.equals(targetType)) { return docString; } if (contentType == null || contentType.isEmpty()) { return docStringConverter.convert(docString, targetType); } else { return docStringConverter.convert(docString, contentType); } }; return new StepExpression(expression, docStringTransform, tableTransform); }</code><technical_language>suggestion DocStringTransformer<?> docStringTransform = (String input, String contentType) -> {</technical_language>

Target:
public StepExpression createExpression(String expressionString, final TypeResolver tableOrDocStringType, final boolean transpose) { if (expressionString == null) throw new NullPointerException("expressionString can not be null"); if (tableOrDocStringType == null) throw new NullPointerException("tableOrDocStringType can not be null"); final Expression expression; try { expression = expressionFactory.createExpression(expressionString); } catch (UndefinedParameterTypeException e) { throw registerTypeInConfiguration(expressionString, e); } RawTableTransformer<?> tableTransform = (List<List<String>> raw) -> { DataTable dataTable = DataTable.create(raw, StepExpressionFactory.this.tableConverter); Type targetType = tableOrDocStringType.resolve(); return dataTable.convert(Object.class.equals(targetType) ? DataTable.class : targetType, transpose); }; DocStringTransformer<?> docStringTransform = (text, contentType) -> { DocString docString = DocString.create(text, contentType, docStringConverter); Type targetType = tableOrDocStringType.resolve(); return docString.convert(Object.class.equals(targetType) ? DocString.class : targetType); }; return new StepExpression(expression, docStringTransform, tableTransform); }
Source:
<code>public String getDisplayHost() { <START> StringBuffer ret = new StringBuffer(100); <END> if (this.host == null) { ret.append("N/A"); } else { if (this.user != null) { ret.append(this.user); ret.append("@"); } ret.append(this.host); if (this.port != DEFAULT_SSH_PORT) { ret.append(":"); ret.append(this.port); } } return ret.toString(); }</code><technical_language>StringBuilder is here, avoids synchronizations need in a local variable this one</technical_language>

Target:
public String getDisplayHost() { StringBuilder ret = new StringBuilder(100); if (this.host == null) { ret.append("N/A"); } else { if (this.user != null) { ret.append(this.user); ret.append("@"); } ret.append(this.host); if (this.port != DEFAULT_SSH_PORT) { ret.append(":"); ret.append(this.port); } } return ret.toString(); }
Source:
<code>public <T extends IResource> List<T> list(String kind, String namespace, Map<String, String> labels) { Map<String, String> params = new HashMap<>(); <START> if(!labels.isEmpty()){ <END> String labelQuery = labels.entrySet().stream() .map(e -> e.getKey() + "=" + e.getValue()) .collect(joining(",")); params.put("labelSelector", labelQuery); } IList recources = execute(HttpMethod.GET.toString(), kind, namespace, null, null, null, params); List<T> items = new ArrayList<>(); items.addAll((Collection<? extends T>) recources.getItems()); return items; }</code><technical_language>worth adding a null check too</technical_language>

Target:
public <T extends IResource> List<T> list(String kind, String namespace, Map<String, String> labels) { String labelQuery=""; if(labels != null && !labels.isEmpty()){ labelQuery = labels.entrySet().stream() .map(e -> e.getKey() + "=" + e.getValue()) .collect(joining(",")); } return list(kind, namespace, labelQuery); }
Source:
<code>public static void addConnectionHeader(HttpRequestHeader httpRequestHeader, List<String> connectionValues){ StringBuilder stringBuilder = new StringBuilder(); if(!connectionValues.isEmpty()){ <START> for(int i = 0; i < connectionValues.size(); i++){ <END> stringBuilder.append(connectionValues.get(i)); if(connectionValues.size() - 1 != i){ stringBuilder.append(", "); } } httpRequestHeader.addHeader(CONNECTION,stringBuilder.toString()); } }</code><technical_language>This loop replaced a call String.join</technical_language>

Target:
public static void addConnectionHeader(HttpRequestHeader httpRequestHeader, List<String> connectionValues){ if(!connectionValues.isEmpty()){ httpRequestHeader.addHeader(CONNECTION,String.join(",",connectionValues)); } }
Source:
<code><START> public Response preemptQuery(@PathParam("queryId") QueryId queryId, String message) <END> { return failQuery(queryId, message, ADMINISTRATIVELY_PREEMPTED); }</code><technical_language>Move this method above, killQuery. easier read, long helper method longer splitting up</technical_language>

Target:
public Response preemptQuery(@PathParam("queryId") QueryId queryId, String message) { return failQuery(queryId, createPreemptQueryException(message)); }
Source:
<code>protected UnsupportedOperationException throwUnsupportedOperationException() { return new UnsupportedOperationException("Not implemented yet"); <START> } <END></code><technical_language>I do amount of UnsupportedOperationException , if do do in methods ..... is put class implementations</technical_language>

Target:
private static UnsupportedOperationException throwUnsupportedOperationException() { return new UnsupportedOperationException("Operation is not supported"); }
Source:
<code>public ResultSet<T> sort(Comparator<T> comparator) { <START> List<T> list = new ArrayList<T>(100); <END> for (T item : data) { list.add(item); } Collections.sort(list, comparator); data = list; return this; }</code><technical_language>i a LinkedList instead. i find ArrayLists sort faster do need initial size</technical_language>

Target:
public ResultSet<T> sort(Comparator<T> comparator) { List<T> list = new LinkedList<T>(); for (T item : data) { list.add(item); } Collections.sort(list, comparator); data = list; return this; }
Source:
<code>public synchronized static void addEndpoint(String regionId, String product, String endpoint) { <START> ParameterHelper.validateParameter(regionId); <END> DefaultEndpointResolver.predefinedEndpointResolver.putEndpointEntry(regionId, product, endpoint); }</code><technical_language>ParameterHelper.validateParameter(regionId, "regionId");</technical_language>

Target:
public synchronized static void addEndpoint(String regionId, String product, String endpoint) { ParameterHelper.validateParameter(regionId, "regionId"); DefaultEndpointResolver.predefinedEndpointResolver.putEndpointEntry(regionId, product, endpoint); }
Source:
<code>private ValidationMessage createSolverFactory( final Path resourcePath, final Validator validator, final KieProject kieWorkbenchProject ) { final org.drools.compiler.kie.builder.impl.KieProject kieProject = new KieModuleKieProject( ( InternalKieModule ) validator.getKieBuilder().getKieModule(), null ); final KieContainer kieContainer = new KieContainerImpl( kieProject, KieServices.Factory.get().getRepository() ); try { SolverFactory.createFromKieContainerXmlResource( kieContainer, getSolverConfigResource( resourcePath, kieWorkbenchProject ) ).buildSolver(); <START> } catch ( Exception e ) { <END> return make( e, resourcePath ); } return null; }</code><technical_language>side note: createFromKieContainerXmlResource() throw Exception, RuntimeException</technical_language>

Target:
private ValidationMessage createSolverFactory( final Path resourcePath, final Validator validator, final KieProject kieWorkbenchProject ) { final org.drools.compiler.kie.builder.impl.KieProject kieProject = new KieModuleKieProject( ( InternalKieModule ) validator.getKieBuilder().getKieModule(), null ); final KieContainer kieContainer = new KieContainerImpl( kieProject, KieServices.Factory.get().getRepository() ); try { final String solverConfigResource = getSolverConfigResource( resourcePath, kieWorkbenchProject ); SolverFactory.createFromKieContainerXmlResource( kieContainer, solverConfigResource ).buildSolver(); } catch ( Exception e ) { e.printStackTrace(); return make( e, resourcePath ); } return null; }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.e("TAG", "lfmain"); BottomNavigationView navigationView = (BottomNavigationView)findViewById(R.id.bottombar); SP = PreferenceUtil.getInstance(getApplicationContext()); albumsMode = true; editMode = false; securityObj = new SecurityHelper(LFMainActivity.this); if (getIntent().getExtras() != null) pickMode = getIntent().getExtras().getBoolean(SplashScreen.PICK_MODE); SP.putBoolean(getString(R.string.preference_use_alternative_provider), false); initUI(); new initAllPhotos().execute(); displayData(getIntent().getExtras()); checkNothing(); navigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { int itemID = item.getItemId(); if(itemID==R.id.navigation_home){ <START> startActivity(new Intent(LFMainActivity.this, LFMainActivity.class)); <END> return true; } return LFMainActivity.super.onNavigationItemSelected(item); } }); }</code><technical_language>restart activity pressing home button, switch Albums mode if is in photos mode</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.e("TAG", "lfmain"); BottomNavigationView navigationView = (BottomNavigationView)findViewById(R.id.bottombar); SP = PreferenceUtil.getInstance(getApplicationContext()); albumsMode = true; editMode = false; securityObj = new SecurityHelper(LFMainActivity.this); if (getIntent().getExtras() != null) pickMode = getIntent().getExtras().getBoolean(SplashScreen.PICK_MODE); SP.putBoolean(getString(R.string.preference_use_alternative_provider), false); initUI(); new initAllPhotos().execute(); displayData(getIntent().getExtras()); checkNothing(); navigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { int itemID = item.getItemId(); if(itemID==R.id.navigation_home){ if(!localFolder){ hidden = false; localFolder = true; } displayAlbums(); return true; } return LFMainActivity.super.onNavigationItemSelected(item); } }); }
Source:
<code>public int lookupId(String name) { <START> if (value == null) { <END> return Strings.isNullOrEmpty(name) ? 0 : -1; } else { return value.equals(name) ? 0 : -1; } }</code><technical_language>This branch is needed</technical_language>

Target:
public int lookupId(String name) { return value.equals(name) ? 0 : -1; }
Source:
<code>public String getProfileBanner600x200URL() { <START> return profileBannerImageUrl != null ? profileBannerImageUrl + "600x200" : null; <END> }</code><technical_language>missing "/"</technical_language>

Target:
public String getProfileBanner600x200URL() { return profileBannerImageUrl != null ? profileBannerImageUrl + "/600x200" : null; }
Source:
<code>public LgoProducts getProducts() { LgoProducts products = null; try { products = this.proxy.getProducts( exchange.getNonceFactory().createValue(), exchange.getSignatureService()); <START> } catch (HttpStatusIOException e) { <END> LgoErrorAdapter.adapt(e); } return products; }</code><technical_language>please improve error handling in accordance to: <LINK_0> introduce LgoException implements HttpStatusExceptionSupport try catch adapt done in methods implement generic interfaces, *Raw methods throw LgoException</technical_language>

Target:
public LgoProducts getProducts() throws IOException { return this.proxy.getProducts( exchange.getNonceFactory().createValue(), exchange.getSignatureService()); }
Source:
<code>public static boolean isOverlord(Properties properties) { <START> return !"false".equals(properties.getProperty("druid.coordinator.beOverlord")); <END> }</code><technical_language>prefer a tighter check here. As-is, setting "no" "FALSE" "false " some whitespace coordinator overlord. throwing exception if property is set, is "true" "false"? Or, least, log a warning</technical_language>

Target:
public static boolean isOverlord(Properties properties) { return Boolean.valueOf(properties.getProperty("druid.coordinator.asOverlord.enabled")).booleanValue(); }
Source:
<code><START> public void testGetDrugByMapping_shouldFailIfMultipleDrugsAreFoundMatchingTheBestMapType() throws Exception { <END> Drug drugs = conceptService.getDrugByMapping("WGT234", conceptService.getConceptSource(1), Arrays.asList(conceptService.getConceptMapType(2),conceptService.getConceptMapType(6)), false); assertNull(drugs); }</code><technical_language>This test is wrong, check expected exception thrown expected attribute of @Test annotation</technical_language>

Target:
public void testGetDrugByMapping_shouldFailIfMultipleDrugsAreFoundMatchingTheBestMapType() throws Exception { executeDataSet(GET_DRUG_MAPPINGS); List<ConceptMapType> conceptMapTypeList = conceptService.getConceptMapTypes(false,true); try { Drug drugs = conceptService.getDrugByMapping("WGT234", conceptService.getConceptSource(1), conceptMapTypeList, false); } catch (APIException ex) { fail(ex.toString()); } }
Source:
<code>private String getGiverTeam(String defaultTeam, InstructorAttributes instructorGiver, StudentAttributes studentGiver) { <START> String giverTeam; <END> boolean isStudentGiver = studentGiver != null; boolean isInstructorGiver = instructorGiver != null; if (isStudentGiver) { giverTeam = studentGiver.team; } else if (isInstructorGiver) { giverTeam = Const.USER_TEAM_FOR_INSTRUCTOR; } else { giverTeam = defaultTeam; } return giverTeam; }</code><technical_language>prefer this variable explicitly initialised null</technical_language>

Target:
private String getGiverTeam(String defaultTeam, InstructorAttributes instructorGiver, StudentAttributes studentGiver) { String giverTeam = defaultTeam; boolean isStudentGiver = studentGiver != null; boolean isInstructorGiver = instructorGiver != null; if (isStudentGiver) { giverTeam = studentGiver.team; } else if (isInstructorGiver) { giverTeam = Const.USER_TEAM_FOR_INSTRUCTOR; } return giverTeam; }
Source:
<code>public void testTextBuildWithoutPrivateUrl() { String icsName = ""; String content = builder.buildContentString(icsName); <START> System.out.println(content); <END> assertTrue(content.matches(withoutPrivateUrlPattern)); assertTrue(content.matches(withoutDefaultUrlPattern)); }</code><technical_language>Avoid "System.out.println" replace a logger if needed</technical_language>

Target:
public void testTextBuildWithoutPrivateUrl() { String icsName = ""; String content = builder.buildContentString(icsName); assertTrue(content.matches(withoutPrivateUrlPattern)); assertTrue(content.matches(withoutDefaultUrlPattern)); }
Source:
<code>private void doInitialize(final RequestMonitor rm) { fConnection = getServicesTracker().getService(IMICommandControl.class); fBreakpointsService = getServicesTracker().getService(MIBreakpoints.class); fBreakpointsManager = getServicesTracker().getService(MIBreakpointsManager.class); if (fConnection == null || fBreakpointsService == null && fBreakpointsManager == null) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Service is not available")); rm.done(); return; } fBreakpointsManager.addBreakpointsTrackingListener(this); <START> <END> register(new String[] { MIBreakpointsSynchronizer.class.getName() }, new Hashtable<String, String>()); rm.done(); }</code><technical_language>Missing: getSession().addServiceEventListener(this, null); this is called: @DsfServiceEventHandler public void eventDispatched(IExitedDMEvent e) {</technical_language>

Target:
private void doInitialize(final RequestMonitor rm) { fConnection = getServicesTracker().getService(IMICommandControl.class); fBreakpointsService = getServicesTracker().getService(MIBreakpoints.class); fBreakpointsManager = getServicesTracker().getService(MIBreakpointsManager.class); if (fConnection == null || fBreakpointsService == null && fBreakpointsManager == null) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Service is not available")); rm.done(); return; } fBreakpointsManager.addBreakpointsTrackingListener(this); getSession().addServiceEventListener(this, null); register(new String[] { MIBreakpointsSynchronizer.class.getName() }, new Hashtable<String, String>()); rm.done(); }
Source:
<code>public void run() { try { while (this.msgCount > 0) { String statusMsg = "Message-" + this.msgCount + " submitted by " + Thread.currentThread().getName(); Message newMessage = new Message(statusMsg); <START> this.submit(newMessage); <END> LOGGER.info(statusMsg); this.msgCount--; Thread.sleep(1000); } } catch (InterruptedException ie) { LOGGER.error(ie.getMessage()); } catch (Exception e) { LOGGER.error(e.getMessage()); } }</code><technical_language>Message created submitted line</technical_language>

Target:
public void run() { int count = this.msgCount; try { while (count > 0) { String statusMsg = "Message-" + count + " submitted by " + Thread.currentThread().getName(); this.submit(new Message(statusMsg)); LOGGER.info(statusMsg); count--; Thread.sleep(1000); } } catch (InterruptedException ie) { LOGGER.error(ie.getMessage()); } catch (Exception e) { LOGGER.error(e.getMessage()); } }
Source:
<code>public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression jsonExpression = this.children.get(0); if (!jsonExpression.evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { <START> return false; <END> } try { PhoenixJson phoenixJson = (PhoenixJson) PJson.INSTANCE.toObject(ptr.get(), ptr.getOffset(), ptr.getLength()); Object[] elements = phoenixJson.getJsonArrayElements(); if(elements == null || elements.length == 0){ ptr.set(ByteUtil.EMPTY_BYTE_ARRAY); }else{ PhoenixArray pa = PArrayDataType.instantiatePhoenixArray(PVarchar.INSTANCE, elements); byte[] array = PVarcharArray.INSTANCE.toBytes(pa); ptr.set(array); } } catch (SQLException sqe) { throw new IllegalDataException(sqe); } return true; }</code><technical_language>This (and other occurences of same) return true, meaning "yes, enough information for evaluate this expression, returned null (which is a ptr.getLength() of 0 means)"</technical_language>

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression jsonExpression = this.children.get(0); if (!jsonExpression.evaluate(tuple, ptr)) { return false; }else if (ptr.getLength() == 0) { return true; } try { PhoenixJson phoenixJson = (PhoenixJson) PJson.INSTANCE.toObject(ptr.get(), ptr.getOffset(), ptr.getLength()); Object[] elements = phoenixJson.getJsonArrayElements(); if(elements == null || elements.length == 0){ ptr.set(ByteUtil.EMPTY_BYTE_ARRAY); }else{ PhoenixArray pa = PArrayDataType.instantiatePhoenixArray(PVarchar.INSTANCE, elements); byte[] array = PVarcharArray.INSTANCE.toBytes(pa); ptr.set(array); } } catch (SQLException sqe) { throw new IllegalDataException(sqe); } return true; }
Source:
<code>public void testAddExtension() throws IOException { Path p = IOUtil.getPath("/folder/file"); List<FileSystemProvider> fileSystemProviders = FileSystemProvider.installedProviders(); Assert.assertEquals(IOUtil.addExtension(p, ".ext"), IOUtil.getPath("/folder/file.ext")); p = IOUtil.getPath("folder/file"); Assert.assertEquals(IOUtil.addExtension(p, ".ext"), IOUtil.getPath("folder/file.ext")); <START> FileSystem jimfs = Jimfs.newFileSystem(Configuration.unix()); <END> p = jimfs.getPath("folder/sub/file"); Assert.assertEquals(IOUtil.addExtension(p, ".ext"), jimfs.getPath("folder/sub/file.ext")); p = jimfs.getPath("folder/file"); Assert.assertEquals(IOUtil.addExtension(p, ".ext"), jimfs.getPath("folder/file.ext")); p = jimfs.getPath("file"); Assert.assertEquals(IOUtil.addExtension(p, ".ext"), jimfs.getPath("file.ext")); }</code><technical_language>jmfs closed. I guess try-with-resources is option for that..</technical_language>

Target:
public void testAddExtension() throws IOException { Path p = IOUtil.getPath("/folder/file"); List<FileSystemProvider> fileSystemProviders = FileSystemProvider.installedProviders(); Assert.assertEquals(IOUtil.addExtension(p, ".ext"), IOUtil.getPath("/folder/file.ext")); p = IOUtil.getPath("folder/file"); Assert.assertEquals(IOUtil.addExtension(p, ".ext"), IOUtil.getPath("folder/file.ext")); try (FileSystem jimfs = Jimfs.newFileSystem(Configuration.unix())) { p = jimfs.getPath("folder/sub/file"); Assert.assertEquals(IOUtil.addExtension(p, ".ext"), jimfs.getPath("folder/sub/file.ext")); p = jimfs.getPath("folder/file"); Assert.assertEquals(IOUtil.addExtension(p, ".ext"), jimfs.getPath("folder/file.ext")); p = jimfs.getPath("file"); Assert.assertEquals(IOUtil.addExtension(p, ".ext"), jimfs.getPath("file.ext")); } }
Source:
<code>public EnterProjectNamePage( ISarosSession session, IConnectionManager connectionManager, Preferences preferences, JID peer, List<ProjectNegotiationData> projectNegotiationData, Map<String, String> desiredRemoteToLocalProjectNameMapping) { <START> super(Messages.EnterProjectNamePage_title); <END> this.session = session; this.connectionManager = connectionManager; this.preferences = preferences; this.desiredRemoteToLocalProjectNameMapping = desiredRemoteToLocalProjectNameMapping != null ? desiredRemoteToLocalProjectNameMapping : Collections.emptyMap(); this.peer = peer; remoteProjectIdToNameMapping = new HashMap<String, String>(); for (final ProjectNegotiationData data : projectNegotiationData) { remoteProjectIdToNameMapping.put(data.getProjectID(), data.getProjectName()); unsupportedCharsets.addAll(getUnsupportedCharsets(data.getFileList().getEncodings())); } setPageComplete(false); setTitle(Messages.EnterProjectNamePage_title2); }</code><technical_language>strictly necessary as, currently, passed mapping null (getLastProjectNameMapping(peer) returns empty hash map if mapping is found). protect future 'misuse' if prefer. I move this end of initialization block (behind this.peer = peer;) avoid inline-nullcheck this easier read</technical_language>

Target:
public EnterProjectNamePage( ISarosSession session, IConnectionManager connectionManager, Preferences preferences, JID peer, List<ProjectNegotiationData> projectNegotiationData, Map<String, String> desiredRemoteToLocalProjectNameMapping) { super(Messages.EnterProjectNamePage_title); this.session = session; this.connectionManager = connectionManager; this.preferences = preferences; this.peer = peer; this.desiredRemoteToLocalProjectNameMapping = desiredRemoteToLocalProjectNameMapping != null ? desiredRemoteToLocalProjectNameMapping : Collections.emptyMap(); remoteProjectIdToNameMapping = new HashMap<String, String>(); for (final ProjectNegotiationData data : projectNegotiationData) { remoteProjectIdToNameMapping.put(data.getProjectID(), data.getProjectName()); unsupportedCharsets.addAll(getUnsupportedCharsets(data.getFileList().getEncodings())); } setPageComplete(false); setTitle(Messages.EnterProjectNamePage_title2); }
Source:
<code>private boolean otherBranchCommit(Change change, PatchSet patchSet) throws RepositoryNotFoundException, IOException, PatchSetInfoNotAvailableException { Repository git = repoManager.openRepository(change.getProject()); String targetBranch = change.getDest().get(); <START> boolean commitBranchFlag = true; <END> try { RefDatabase refDb = git.getRefDatabase(); Ref targetRef = refDb.getRef(targetBranch); Collection<Ref> branches = refDb.getRefs(Constants.R_HEADS).values(); RevWalk rw = new RevWalk(git); RevCommit pushedCommit = rw.parseCommit(ObjectId.fromString(patchSet.getRevision().get())); RevCommit target = rw.parseCommit(targetRef.getObjectId()); RevCommit mergeBase = null; RevFilter oldRevFilter = rw.getRevFilter(); try { rw.reset(); rw.setRevFilter(RevFilter.MERGE_BASE); rw.markStart(pushedCommit); rw.markStart(target); if (rw.next() != null) { mergeBase = rw.next(); } } finally { rw.reset(); rw.setRevFilter(oldRevFilter); } try { rw.markStart(pushedCommit); for (Ref branch : branches) { if (branch.getObjectId() != targetRef.getObjectId()) { rw.markUninteresting(rw.parseCommit(branch.getObjectId())); } } for (RevCommit n; (n = rw.next()) != null;) { if (n.equals(mergeBase)) { commitBranchFlag = false; break; } } } finally { rw.release(); } } finally { git.close(); } return commitBranchFlag; }</code><technical_language>This variable avoided. "return true" "return false" soon result is known</technical_language>

Target:
private boolean otherBranchCommit(Change change, PatchSet patchSet) throws RepositoryNotFoundException, IOException, PatchSetInfoNotAvailableException { Repository git = repoManager.openRepository(change.getProject()); String targetBranch = change.getDest().get(); try { RefDatabase refDb = git.getRefDatabase(); RevWalk rw = new RevWalk(git); RevCommit pushedCommit = rw.parseCommit(ObjectId.fromString(patchSet.getRevision().get())); Ref targetRef = refDb.getRef(targetBranch); RevCommit mergeBase; RevFilter oldRevFilter = rw.getRevFilter(); try { rw.reset(); rw.setRevFilter(RevFilter.MERGE_BASE); rw.markStart(pushedCommit); RevCommit target = rw.parseCommit(targetRef.getObjectId()); rw.markStart(target); if (rw.next() != null) { mergeBase = rw.next(); } else { return true; } } finally { rw.reset(); rw.setRevFilter(oldRevFilter); } try { rw.markStart(pushedCommit); Collection<Ref> branches = refDb.getRefs(Constants.R_HEADS).values(); for (Ref branch : branches) { if (!branch.getObjectId().equals(mergeBase)) { rw.markUninteresting(rw.parseCommit(branch.getObjectId())); } } for (RevCommit n; (n = rw.next()) != null;) { if (n.equals(mergeBase)) { return false; } } return true; } finally { rw.release(); } } finally { git.close(); } }
Source:
<code>private boolean deleteRef() { if (!fs.retryFailedLockFileCommit()) return ref.delete(); for (int i = 0; i < 10; i++) { <START> if (ref.delete()) { <END> return true; } try { Thread.sleep(100); } catch (InterruptedException e) { } } return false; }</code><technical_language>Style-nit: Braces necessary here</technical_language>

Target:
private boolean deleteRef() { if (!fs.retryFailedLockFileCommit()) return ref.delete(); for (int i = 0; i < 10; i++) { if (ref.delete()) return true; try { Thread.sleep(100); } catch (InterruptedException e) { return false; } } return false; }