auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<IDValue> get( @PathParam("userID") List<PathSegment> pathSegmentsList, @DefaultValue("10") @QueryParam("howMany") int howMany, @DefaultValue("0") @QueryParam("offset") int offset, @DefaultValue("false") @QueryParam("considerKnownItems") boolean considerKnownItems, @QueryParam("rescorerParams") List<String> rescorerParams) throws OryxServingException { check(!pathSegmentsList.isEmpty() && pathSegmentsList.size() > 0, "Need atleast 1 user"); check(howMany > 0, "howMany must be positive"); check(offset >= 0, "offset must be non-negative"); ALSServingModel alsServingModel = getALSServingModel(); List<double[]> userFeaturesList = new ArrayList<>(pathSegmentsList.size()); ObjectSet<String> userKnownItems = new ObjectOpenHashSet<>(); for (PathSegment pathSegment : pathSegmentsList) { <START> float[] userFeatureVector = alsServingModel.getUserVector(pathSegment.getPath()); <END> if (userFeatureVector != null) { userFeaturesList.add(VectorMath.toDoubles(userFeatureVector)); } if (!considerKnownItems) { ObjectSet<String> knownItems = alsServingModel.getKnownItems(pathSegment.getPath()); if (knownItems != null && !knownItems.isEmpty()) { synchronized (knownItems) { for (ObjectCursor<String> knownItem : knownItems) { userKnownItems.add(knownItem.value); } } } } } List<Pair<String,Double>> topIDDots = alsServingModel.topN( new DotsFunction(userFeaturesList), howMany + offset, new NotKnownPredicate(userKnownItems)); return toIDValueResponse(topIDDots, howMany, offset); }</code><technical_language>For clarity pathSegment.getPath() stored in a variable called uesrID reused</technical_language>

Target:
public List<IDValue> get( @PathParam("userID") List<PathSegment> pathSegmentsList, @DefaultValue("10") @QueryParam("howMany") int howMany, @DefaultValue("0") @QueryParam("offset") int offset, @DefaultValue("false") @QueryParam("considerKnownItems") boolean considerKnownItems, @QueryParam("rescorerParams") List<String> rescorerParams) throws OryxServingException { check(!pathSegmentsList.isEmpty() && pathSegmentsList.size() > 0, "Need atleast 1 user"); check(howMany > 0, "howMany must be positive"); check(offset >= 0, "offset must be non-negative"); ALSServingModel alsServingModel = getALSServingModel(); List<double[]> userFeaturesList = new ArrayList<>(pathSegmentsList.size()); ObjectSet<String> userKnownItems = new ObjectOpenHashSet<>(); for (PathSegment pathSegment : pathSegmentsList) { String userID = pathSegment.getPath(); float[] userFeatureVector = alsServingModel.getUserVector(userID); if (userFeatureVector != null) { userFeaturesList.add(VectorMath.toDoubles(userFeatureVector)); } if (!considerKnownItems) { ObjectSet<String> knownItems = alsServingModel.getKnownItems(userID); if (knownItems != null && !knownItems.isEmpty()) { synchronized (knownItems) { for (ObjectCursor<String> knownItem : knownItems) { userKnownItems.add(knownItem.value); } } } } } List<Pair<String,Double>> topIDDots = alsServingModel.topN( new DotsFunction(userFeaturesList), howMany + offset, new NotKnownPredicate(userKnownItems)); return toIDValueResponse(topIDDots, howMany, offset); }
Source:
<code>protected boolean validateAndAddListenerInvocations(Object listener, AbstractInvocationBuilder builder) { Listener l = testListenerClassValidity(listener.getClass()); boolean foundMethods = false; builder.setTarget(listener); Subject subject; if (System.getSecurityManager() == null) { <START> subject = Security.getSubject(); <END> } else { subject = AccessController.doPrivileged((PrivilegedAction<Subject>) () -> Security.getSubject()); } builder.setSubject(subject); builder.setSync(l.sync()); Map<Class<? extends Annotation>, Class<?>> allowedListeners = getAllowedMethodAnnotations(l); for (Method m : listener.getClass().getMethods()) { if (!m.isSynthetic() || !m.isBridge()) { for (Map.Entry<Class<? extends Annotation>, Class<?>> annotationEntry : allowedListeners.entrySet()) { final Class<? extends Annotation> annotationClass = annotationEntry.getKey(); if (m.isAnnotationPresent(annotationClass)) { final Class<?> eventClass = annotationEntry.getValue(); testListenerMethodValidity(m, eventClass, annotationClass.getName()); if (System.getSecurityManager() == null) { m.setAccessible(true); } else { AccessController.doPrivileged((PrivilegedAction<Void>) () -> { m.setAccessible(true); return null; }); } builder.setMethod(m); builder.setAnnotation(annotationClass); L invocation = builder.build(); getListenerCollectionForAnnotation(annotationClass).add(invocation); foundMethods = true; } } } } if (!foundMethods) getLog().noAnnotateMethodsFoundInListener(listener.getClass()); return foundMethods; }</code><technical_language>This check Security class, here</technical_language>

Target:
protected boolean validateAndAddListenerInvocations(Object listener, AbstractInvocationBuilder builder) { Listener l = testListenerClassValidity(listener.getClass()); boolean foundMethods = false; builder.setTarget(listener); builder.setSubject(Security.getSubject()); builder.setSync(l.sync()); Map<Class<? extends Annotation>, Class<?>> allowedListeners = getAllowedMethodAnnotations(l); for (Method m : listener.getClass().getMethods()) { if (!m.isSynthetic() || !m.isBridge()) { for (Map.Entry<Class<? extends Annotation>, Class<?>> annotationEntry : allowedListeners.entrySet()) { final Class<? extends Annotation> annotationClass = annotationEntry.getKey(); if (m.isAnnotationPresent(annotationClass)) { final Class<?> eventClass = annotationEntry.getValue(); testListenerMethodValidity(m, eventClass, annotationClass.getName()); if (System.getSecurityManager() == null) { m.setAccessible(true); } else { AccessController.doPrivileged((PrivilegedAction<Void>) () -> { m.setAccessible(true); return null; }); } builder.setMethod(m); builder.setAnnotation(annotationClass); L invocation = builder.build(); getListenerCollectionForAnnotation(annotationClass).add(invocation); foundMethods = true; } } } } if (!foundMethods) getLog().noAnnotateMethodsFoundInListener(listener.getClass()); return foundMethods; }
Source:
<code>public void factoryTest() throws Exception { Properties properties = new Properties(); JSONObject jsonObject = new JSONObject().put("POST", UPLOAD_ENDPOINT).put("GET", DOWNLOAD_ENDPOINT); properties.setProperty(FrontendConfig.URL_SIGNER_ENDPOINTS, jsonObject.toString()); properties.setProperty("frontend.url.signer.default.url.ttl.secs", Long.toString(DEFAULT_URL_TTL_SECS)); properties.setProperty("frontend.url.signer.default.max.upload.size.bytes", Long.toString(DEFAULT_MAX_UPLOAD_SIZE)); properties.setProperty("frontend.url.signer.max.url.ttl.secs", Long.toString(MAX_URL_TTL_SECS)); UrlSigningService signer = new AmbryUrlSigningServiceFactory(new VerifiableProperties(properties), new MetricRegistry()).getUrlSigningService(); assertNotNull("UrlSigningService is null", signer); assertTrue("UrlSigningService is AmbryUrlSigningService", signer instanceof AmbryUrlSigningService); <START> assertTrue(((AmbryUrlSigningService) signer).getUploadEndpoint().contains(UPLOAD_ENDPOINT)); <END> assertTrue(((AmbryUrlSigningService) signer).getDownloadEndpoint().contains(DOWNLOAD_ENDPOINT)); }</code><technical_language>this assertEquals()</technical_language>

Target:
public void factoryTest() { Properties properties = new Properties(); JSONObject jsonObject = new JSONObject().put("POST", UPLOAD_ENDPOINT).put("GET", DOWNLOAD_ENDPOINT); properties.setProperty(FrontendConfig.URL_SIGNER_ENDPOINTS, jsonObject.toString()); properties.setProperty("frontend.url.signer.default.url.ttl.secs", Long.toString(DEFAULT_URL_TTL_SECS)); properties.setProperty("frontend.url.signer.default.max.upload.size.bytes", Long.toString(DEFAULT_MAX_UPLOAD_SIZE)); properties.setProperty("frontend.url.signer.max.url.ttl.secs", Long.toString(MAX_URL_TTL_SECS)); UrlSigningService signer = new AmbryUrlSigningServiceFactory(new VerifiableProperties(properties), new MetricRegistry()).getUrlSigningService(); assertNotNull("UrlSigningService is null", signer); assertTrue("UrlSigningService is AmbryUrlSigningService", signer instanceof AmbryUrlSigningService); assertTrue(((AmbryUrlSigningService) signer).getUploadEndpoint().contains(UPLOAD_ENDPOINT)); assertTrue(((AmbryUrlSigningService) signer).getDownloadEndpoint().contains(DOWNLOAD_ENDPOINT)); }
Source:
<code><START> public KafkaContainer withNetwork(Network network) { <END> implicitNetwork = false; return super.withNetwork(network); }</code><technical_language>need remove line 39 in constructor for this PR sense? set implicitNetwork false</technical_language>

Target:
public KafkaContainer withNetwork(Network network) { useImplicitNetwork = false; return super.withNetwork(network); }
Source:
<code>private boolean validatePage() { fileMatch = null; url = null; if (fileMatchText.getText().trim().length() <= 0) { setErrorMessage(JSONUIMessages.The_name_field_is_required); return updateButton(false); } Set<UserEntry> list = entries.getEntries(); for(UserEntry entry:list) { if (entry != selectedEntry && fileMatchText.getText().equals(entry.getFileMatch())) { setErrorMessage(JSONUIMessages.The_entry_already_exists); return updateButton(false); } } if (urlText.getText().trim().length() <= 0) { setErrorMessage(JSONUIMessages.The_url_field_is_required); return updateButton(false); } try { @SuppressWarnings("unused") URL url = new URL(urlText.getText()); } catch (MalformedURLException e) { setErrorMessage(JSONUIMessages.Invalid_URL); return updateButton(false); } setErrorMessage(null); fileMatch = fileMatchText.getText(); try { url = new URL(urlText.getText()).toURI(); <START> } catch (MalformedURLException | URISyntaxException ignore) <END> return updateButton(true); }</code><technical_language>compilation error here: [ERROR] Failed execute goal org.eclipse.tycho:tycho-compiler-plugin:0.21.0:compile (default-compile) project org.eclipse.wst.json.ui: Compilation failure: Compilation failure: [ERROR] /home/jeremy/projects/webtools/source/webtools.releng.aggregator/webtools.sourceediting/bundles/org.eclipse.wst.json.ui/src/org/eclipse/wst/json/ui/internal/preferences/EntryDialog.java:[183] [ERROR] } catch (MalformedURLException | URISyntaxException ignore) [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ERROR] Multi-catch parameters allowed for source level 1.7 constructions, especially fact of "Bundle-RequiredExecutionEnvironment: JavaSE-1.6" in Manifest file. move code require Java 8</technical_language>

Target:
private boolean validatePage() { fileMatch = null; url = null; if (fileMatchText.getText().trim().length() <= 0) { setErrorMessage(JSONUIMessages.The_name_field_is_required); return updateButton(false); } Set<UserEntry> list = entries.getEntries(); for(UserEntry entry:list) { if (entry != selectedEntry && fileMatchText.getText().equals(entry.getFileMatch())) { setErrorMessage(JSONUIMessages.The_entry_already_exists); return updateButton(false); } } if (urlText.getText().trim().length() <= 0) { setErrorMessage(JSONUIMessages.The_url_field_is_required); return updateButton(false); } try { @SuppressWarnings("unused") URL url = new URL(urlText.getText()); } catch (MalformedURLException e) { setErrorMessage(JSONUIMessages.Invalid_URL); return updateButton(false); } setErrorMessage(null); fileMatch = fileMatchText.getText(); try { url = new URL(urlText.getText()).toURI(); } catch (MalformedURLException ignore) { } catch (URISyntaxException ignore) { } return updateButton(true); }
Source:
<code>public String encode(String parentStringSeparator) { if (FIELD_SEPARATOR.equals(parentStringSeparator)) { <START> throw new IllegalArgumentException("The string separator must not be the same as Field Separator (~)."); <END> } if (username == null) { return NULL_CREDENTIALS; } StringBuilder out = new StringBuilder(); out.append(Base64.encodeBase64String(username.getBytes())).append(FIELD_SEPARATOR); out.append(Base64.encodeBase64String(password.getBytes())).append(FIELD_SEPARATOR); return out.toString(); }</code><technical_language>append/use FIELD_SEPARATOR</technical_language>

Target:
public String encode(String parentStringSeparator) { if (FIELD_SEPARATOR.equals(parentStringSeparator)) { throw new IllegalArgumentException( "The string separator must not be the same as Field Separator (" + FIELD_SEPARATOR + ")."); } if (username == null) { return NULL_CREDENTIALS; } StringBuilder out = new StringBuilder(); out.append(Base64.encodeBase64String(username.getBytes())).append(FIELD_SEPARATOR); out.append(Base64.encodeBase64String(password.getBytes())).append(FIELD_SEPARATOR); return out.toString(); }
Source:
<code>public CoordinatorStats run( DruidCoordinator coordinator, DruidCoordinatorRuntimeParams params, DataSegment segment ) { final List<ServerHolder> targetServerHolders = params .getDruidCluster().getAllServers().stream() <START> .filter(eachHolder -> eachHolder.getServer().getDataSource(getColocatedDatasource()) != null) <END> .collect(Collectors.toList()); final CoordinatorStats assignStats = assign( targetServerHolders, segment ); final CoordinatorStats stats = new CoordinatorStats(); stats.accumulate(assignStats); return stats; }</code><technical_language>valuable colocatedDataSources a list, if empty broadcast _all_ servers. That'd give some more flexibilty user broadcast data sources</technical_language>

Target:
public CoordinatorStats run( DruidCoordinator coordinator, DruidCoordinatorRuntimeParams params, DataSegment segment ) { final Set<ServerHolder> loadServerHolders = new HashSet<>(); final Set<ServerHolder> dropServerHolders = new HashSet<>(); final List<String> colocatedDataSources = getColocatedDataSources(); if (colocatedDataSources == null || colocatedDataSources.isEmpty()) { loadServerHolders.addAll(params.getDruidCluster().getAllServers()); } else { params.getDruidCluster().getAllServers().forEach( eachHolder -> { if (colocatedDataSources.stream() .anyMatch(source -> eachHolder.getServer().getDataSource(source) != null)) { loadServerHolders.add(eachHolder); } else if (eachHolder.isServingSegment(segment)) { if (!eachHolder.getPeon().getSegmentsToDrop().contains(segment)) { dropServerHolders.add(eachHolder); } } } ); } final CoordinatorStats stats = new CoordinatorStats(); return stats.accumulate(assign(loadServerHolders, segment)) .accumulate(drop(dropServerHolders, segment)); }
Source:
<code>private Path getProFile(Path basePath) { <START> Path proFile = new File(basePath.toFile().getName() + ".pro").toPath(); <END> return basePath.resolve(proFile); }</code><technical_language>prefer avoid java.io possible. this done java.nio.Paths.get() avoid casting File</technical_language>

Target:
private Path getProFile(Path basePath) { return Paths.get(basePath.toString() + "/" + basePath.getFileName() + ".pro"); }
Source:
<code>private UniqueId(UniqueIdFormat uniqueIdFormat, Segment segment) { this.uniqueIdFormat = uniqueIdFormat; this.segments = singletonList(segment); this.hashCode = this.segments.hashCode(); <START> this.toString = this.uniqueIdFormat.format(this); <END> }</code><technical_language>if do this eagerly. slow other cases. WDYT</technical_language>

Target:
private UniqueId(UniqueIdFormat uniqueIdFormat, Segment segment) { this.uniqueIdFormat = uniqueIdFormat; this.segments = singletonList(segment); }
Source:
<code>private static <T> void retryOperation( final CompletableFuture<T> resultFuture, final Supplier<CompletableFuture<T>> operation, final int retries, final Predicate<Throwable> retryPredicate, final Executor executor) { if (!resultFuture.isDone()) { final CompletableFuture<T> operationFuture = operation.get(); operationFuture.whenCompleteAsync( (t, throwable) -> { if (throwable != null) { if (throwable instanceof CancellationException) { resultFuture.completeExceptionally(new RetryException("Operation future was cancelled.", throwable)); } else { throwable = ExceptionUtils.stripExecutionException(throwable); if (!retryPredicate.test(throwable)) { <START> resultFuture.completeExceptionally(throwable); <END> } else { if (retries > 0) { retryOperation( resultFuture, operation, retries - 1, retryPredicate, executor); } else { resultFuture.completeExceptionally( new RetryException("Could not complete the operation. Number of retries " + "has been exhausted.", throwable)); } } } } else { resultFuture.complete(t); } }, executor); resultFuture.whenComplete( (t, throwable) -> operationFuture.cancel(false)); } }</code><technical_language>fail RetryException("Stopped retrying operation error is retriable.", throwable)</technical_language>

Target:
private static <T> void retryOperation( final CompletableFuture<T> resultFuture, final Supplier<CompletableFuture<T>> operation, final int retries, final Predicate<Throwable> retryPredicate, final Executor executor) { if (!resultFuture.isDone()) { final CompletableFuture<T> operationFuture = operation.get(); operationFuture.whenCompleteAsync( (t, throwable) -> { if (throwable != null) { if (throwable instanceof CancellationException) { resultFuture.completeExceptionally(new RetryException("Operation future was cancelled.", throwable)); } else { throwable = ExceptionUtils.stripExecutionException(throwable); if (!retryPredicate.test(throwable)) { resultFuture.completeExceptionally( new RetryException("Stopped retrying the operation because the error is not " + "retryable.", throwable)); } else { if (retries > 0) { retryOperation( resultFuture, operation, retries - 1, retryPredicate, executor); } else { resultFuture.completeExceptionally( new RetryException("Could not complete the operation. Number of retries " + "has been exhausted.", throwable)); } } } } else { resultFuture.complete(t); } }, executor); resultFuture.whenComplete( (t, throwable) -> operationFuture.cancel(false)); } }
Source:
<code>public TestMvcClient(MockMvc mvc, LinkDiscoverers discoverers) { Assert.notNull(mvc, "MockMvc must not be null!"); <START> Assert.notNull(discoverers, "LinkDiscoverers must not be null!"); <END> this.mvc = mvc; this.discoverers = discoverers; }</code><technical_language>AssertJ for assertions, please? assertThat(mvc).isNotNull()</technical_language>

Target:
public TestMvcClient(MockMvc mvc, LinkDiscoverers discoverers) { assertThat(mvc).isNotNull(); assertThat(discoverers).isNotNull(); this.mvc = mvc; this.discoverers = discoverers; }
Source:
<code>public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { <START> super.processBindingConfiguration(context, item, bindingConfig); <END> PanStampBindingConfig<?> config; try { config = parse(item.getName(), bindingConfig); addBindingConfig(item, config); logger.debug("Created binding config '{}'", config); } catch (ValueException e) { throw new BindingConfigParseException(e.getMessage()); } }</code><technical_language>move super call end of method, preceding exception thrown skip superclass's processing of bad bindingConfig</technical_language>

Target:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { PanStampBindingConfig<?> config; try { config = parse(item.getName(), bindingConfig); addBindingConfig(item, config); logger.debug("Created binding config '{}'", config); } catch (ValueException e) { throw new BindingConfigParseException(e.getMessage()); } super.processBindingConfiguration(context, item, bindingConfig); }
Source:
<code>private static VoiceStepOption createVoiceStepOption() { final VoiceStepOption voiceStepOption = new VoiceStepOption(); <START> voiceStepOption.setDestination("31612345678"); <END> return voiceStepOption; }</code><technical_language>In opinion, properties VoiceStepOtion class set test values. In unit tests, of checked assertion</technical_language>

Target:
private static VoiceStepOption createVoiceStepOption() { final VoiceStepOption voiceStepOption = new VoiceStepOption(); voiceStepOption.setDestination("123"); voiceStepOption.setPayload("Test payload Update"); voiceStepOption.setLanguage("en-US"); voiceStepOption.setVoice("female"); voiceStepOption.setRepeat("5"); voiceStepOption.setMedia("test.wav"); voiceStepOption.setLength(10); voiceStepOption.setMaxLength(20); voiceStepOption.setTimeout(30); voiceStepOption.setFinishOnKey("#"); voiceStepOption.setTranscribe(true); voiceStepOption.setTranscribeLanguage("en-US"); voiceStepOption.setRecord("in"); voiceStepOption.setUrl("http://www."); voiceStepOption.setIfMachine("machine1"); voiceStepOption.setMachineTimeout(2000); voiceStepOption.setOnFinish("http://www."); voiceStepOption.setMask(false); return voiceStepOption; }
Source:
<code>protected final void output(HttpServletRequest request, ServletResponse response, List<TranslatedRecommendedItem> items) throws IOException { PrintWriter writer = response.getWriter(); writer.write('['); boolean first = true; for (TranslatedRecommendedItem item : items) { if (first) { first = false; } else { writer.write(','); } writer.write("[\""); writer.write(item.getItemID()); writer.write("\","); writer.write(Float.toString(item.getValue())); <START> writer.write(']'); <END> } writer.write(']'); writer.flush(); System.out.println("BDGFNMGJKNMSRKG"); }</code><technical_language>some simple library for generating JSON output? This icky, item.getItemID() returns nasty backslashes whatnot..</technical_language>

Target:
protected final void output(HttpServletRequest request, ServletResponse response, List<TranslatedRecommendedItem> items) throws IOException { PrintWriter writer = response.getWriter(); writer.write('['); boolean first = true; for (TranslatedRecommendedItem item : items) { if (first) { first = false; } else { writer.write(','); } writer.write("[\""); writer.write(item.getItemID()); writer.write("\","); writer.write(Float.toString(item.getValue())); writer.write(']'); } writer.write(']'); writer.flush(); }
Source:
<code><START> public Collection<Holiday> get(HolidayType holidayType, ExternalIdBundle regionOrExchangeIds) { <END> Set<Holiday> holidays = new HashSet<>(); for (ExternalId id : regionOrExchangeIds.getExternalIds()) { if (_calendarHolidays.containsKey(id) && (_calendarHolidays.get(id).getType().compareTo(holidayType) == 0)) { holidays.add(_calendarHolidays.get(id)); } } return holidays; }</code><technical_language>Set a return type for this method</technical_language>

Target:
public Set<Holiday> get(HolidayType holidayType, ExternalIdBundle regionOrExchangeIds) { Set<Holiday> holidays = new HashSet<>(); for (ExternalId id : regionOrExchangeIds.getExternalIds()) { Pair<ExternalId, HolidayType> key = Pairs.of(id, holidayType); if (_calendarHolidays.containsKey(key)) { holidays.add(_calendarHolidays.get(key)); } } return holidays; }
Source:
<code>public void testConvertDs3RequestWithoutRequestPayload() { final Request testRequest = RequestConverter.toRequest(Ds3ModelFixtures.createBucketRequest(), <START> new Ds3DocSpecImpl( <END> ImmutableMap.of(), ImmutableMap.of())); assertFalse(testRequest.hasRequestPayload()); assertEquals(testRequest.getRequestPayload(), null); }</code><technical_language>Ds3DocSpecEmptyImpl</technical_language>

Target:
public void testConvertDs3RequestWithoutRequestPayload() { final Request testRequest = RequestConverter.toRequest(Ds3ModelFixtures.createBucketRequest(), new Ds3DocSpecEmptyImpl()); assertFalse(testRequest.hasRequestPayload()); assertEquals(testRequest.getRequestPayload(), null); }
Source:
<code><START> UrlFactory getUrlFactory() { <END> if (urlFactory != null) { return urlFactory; } else { return DEFAULT_URL_FACTORY; } }</code><technical_language>able this private</technical_language>

Target:
private UrlFactory getUrlFactory() { if (urlFactory != null) { return urlFactory; } else { return DEFAULT_URL_FACTORY; } }
Source:
<code>public boolean isSimpleType(Class<?> type) { Assert.notNull(type, "Type must not be null!"); Map<Class<?>, Boolean> localSimpleTypes = this.simpleTypes; Boolean isSimpleType = localSimpleTypes.get(type); if (Object.class.equals(type) || Enum.class.isAssignableFrom(type)) { return true; } if (isSimpleType != null) { return isSimpleType; } <START> if (type.getName().startsWith("java.lang") | type.getName().startsWith("java.time")) { <END> return true; } for (Class<?> simpleType : localSimpleTypes.keySet()) { if (simpleType.isAssignableFrom(type)) { isSimpleType = localSimpleTypes.get(simpleType); this.simpleTypes = put(localSimpleTypes, type, isSimpleType); return isSimpleType; } } this.simpleTypes = put(localSimpleTypes, type, false); return false; }</code><technical_language>double pipe for a reason</technical_language>

Target:
public boolean isSimpleType(Class<?> type) { Assert.notNull(type, "Type must not be null!"); Map<Class<?>, Boolean> localSimpleTypes = this.simpleTypes; Boolean isSimpleType = localSimpleTypes.get(type); if (Object.class.equals(type) || Enum.class.isAssignableFrom(type)) { return true; } if (isSimpleType != null) { return isSimpleType; } if (type.getName().startsWith("java.lang") || type.getName().startsWith("java.time")) { return true; } for (Class<?> simpleType : localSimpleTypes.keySet()) { if (simpleType.isAssignableFrom(type)) { isSimpleType = localSimpleTypes.get(simpleType); this.simpleTypes = put(localSimpleTypes, type, isSimpleType); return isSimpleType; } } this.simpleTypes = put(localSimpleTypes, type, false); return false; }
Source:
<code>private void processCurrentMessages(final ActorProcessingThread currentThread, final WebDebugger dbg) { if (VmSettings.ACTOR_TRACING) { baseMessageId = currentThread.generateMessageBaseId(size); currentThread.currentMessageId = baseMessageId; } if (size > 0) { actor.logMessageBeingExecuted(current); currentThread.currentMessage = current; if (VmSettings.TRUFFLE_DEBUGGER_ENABLED && current.isBreakpoint()) { dbg.prepareSteppingUntilNextRootNode(); } current.execute(); if (VmSettings.ACTOR_TRACING) { currentThread.currentMessageId += 1; } int i = 0; if (size > 1) { for (EventualMessage msg : moreCurrent) { <START> actor.logMessageBeingExecuted(msg); <END> currentThread.currentMessage = msg; if (VmSettings.TRUFFLE_DEBUGGER_ENABLED) { if (msg.isBreakpoint()) { dbg.prepareSteppingUntilNextRootNode(); } } if (VmSettings.MESSAGE_TIMESTAMPS) { executionTimeStamps[i] = System.currentTimeMillis(); i++; } msg.execute(); if (VmSettings.ACTOR_TRACING) { currentThread.currentMessageId += 1; } } } } if (VmSettings.ACTOR_TRACING) { ActorExecutionTrace.mailboxExecuted(current, moreCurrent, baseMessageId, sendTimeStamp, moreSendTimeStamps, executionTimeStamps, actor); } }</code><technical_language>this block identical handling of message. this a helper method</technical_language>

Target:
private void processCurrentMessages(final ActorProcessingThread currentThread, final WebDebugger dbg) { if (VmSettings.ACTOR_TRACING) { baseMessageId = currentThread.generateMessageBaseId(size); currentThread.currentMessageId = baseMessageId; } if (size > 0) { actor.logMessageBeingExecuted(firstMessage); currentThread.currentMessage = firstMessage; if (VmSettings.TRUFFLE_DEBUGGER_ENABLED && firstMessage.isBreakpoint()) { dbg.prepareSteppingUntilNextRootNode(); } firstMessage.execute(); if (VmSettings.ACTOR_TRACING) { currentThread.currentMessageId += 1; } int i = 0; if (size > 1) { for (EventualMessage msg : mailboxExtension) { actor.logMessageBeingExecuted(msg); currentThread.currentMessage = msg; if (VmSettings.TRUFFLE_DEBUGGER_ENABLED) { if (msg.isBreakpoint()) { dbg.prepareSteppingUntilNextRootNode(); } } if (VmSettings.MESSAGE_TIMESTAMPS) { executionTimeStamps[i] = System.currentTimeMillis(); i++; } msg.execute(); if (VmSettings.ACTOR_TRACING) { currentThread.currentMessageId += 1; } } } } if (VmSettings.ACTOR_TRACING) { ActorExecutionTrace.mailboxExecuted(firstMessage, mailboxExtension, baseMessageId, firstMessageTimeStamp, mailboxExtensionTimeStamps, executionTimeStamps, actor); } }
Source:
<code><START> public static String getHdfsStorageDir(DataSegment segment) <END> { return JOINER.join( getHdfsStorageDirUptoVersion(segment), segment.getShardSpec().getPartitionNum() ); }</code><technical_language>getHdfsStorageDir unused now, replace code getHdfsStorageDirUptoVersion</technical_language>

Target:
public static String getHdfsStorageDir(DataSegment segment) { return JOINER.join( segment.getDataSource(), String.format( "%s_%s", segment.getInterval().getStart().toString(ISODateTimeFormat.basicDateTime()), segment.getInterval().getEnd().toString(ISODateTimeFormat.basicDateTime()) ), segment.getVersion().replaceAll(":", "_") ); }
Source:
<code>public static OffsetDate now(ZoneOffset zoneOffset) { <START> final LocalDate localDate = LocalDates.now(); <END> final OffsetDate result = OffsetDate.newBuilder() .setDate(localDate) .setOffset(zoneOffset) .build(); return result; }</code><technical_language>This is wrong: local date in cases differ in passed zone offset</technical_language>

Target:
public static OffsetDate now(ZoneOffset zoneOffset) { checkNotNull(zoneOffset); final Calendar cal = nowAt(zoneOffset); final LocalDate localDate = toLocalDate(cal); final OffsetDate result = OffsetDate.newBuilder() .setDate(localDate) .setOffset(zoneOffset) .build(); return result; }
Source:
<code>public ConfigKey<?>[] getConfigKeys() { <START> return new ConfigKey<?>[] {SystemVMUseLocalStorage, iopsMaximumRateLength}; <END> }</code><technical_language>"iopsMaximumBytes" added in line 6328</technical_language>

Target:
public ConfigKey<?>[] getConfigKeys() { return new ConfigKey<?>[] {SystemVMUseLocalStorage, IOPS_MAX_READ_LENGTH, IOPS_MAX_WRITE_LENGTH, BYTES_MAX_READ_LENGTH, BYTES_MAX_WRITE_LENGTH}; }
Source:
<code>private void openStagingViewLinkClicked() { IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench() .getActiveWorkbenchWindow(); IWorkbenchPage workbenchPage = workbenchWindow.getActivePage(); try { StagingView view = (StagingView) workbenchPage .showView(StagingView.VIEW_ID); view.reload(repository); String message = commitMessageComponent.getCommitMessage(); if (message != null && message.length() > 0) view.setCommitMessage(message); <START> close(); <END> } catch (PartInitException e) { Activator.handleError(UIText.CommitDialog_OpenStagingViewError, e, true); } }</code><technical_language>CommitDialog is opened e.g. CommitUI.commit() closing dialog this return a 0 return code, is interpreted a OK / commit button press, in turn initiates a commit. a return code set closing</technical_language>

Target:
private void openStagingViewLinkClicked() { IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench() .getActiveWorkbenchWindow(); IWorkbenchPage workbenchPage = workbenchWindow.getActivePage(); try { StagingView view = (StagingView) workbenchPage .showView(StagingView.VIEW_ID); view.reload(repository); String message = commitMessageComponent.getCommitMessage(); if (message != null && message.length() > 0) view.setCommitMessage(message); setReturnCode(CANCEL); close(); } catch (PartInitException e) { Activator.handleError(UIText.CommitDialog_OpenStagingViewError, e, true); } }
Source:
<code>public Change perform(IProgressMonitor pm) throws CoreException { Resource roomRes = rs.getResources().get(0); <START> for(Resource res : rs.getResources()) <END> if(res != roomRes) EcoreUtil.resolveAll(res); roomRes.setURI(newURI); Change undoChange = super.perform(pm); return undoChange; }</code><technical_language>resource list change resolution if additional resources loaded. In this case a concurrent modification exception is thrown. I accept change fix bug replacing loop EcoreUtil.resolveAll(rs); This handles room file well. problem</technical_language>

Target:
public Change perform(IProgressMonitor pm) throws CoreException { Resource roomRes = rs.getResources().get(0); EcoreUtil.resolveAll(rs); roomRes.setURI(newURI); Change undoChange = super.perform(pm); return undoChange; }
Source:
<code>private boolean isInfiniteLoop(IterationStatementTree tree, @Nullable JavaScriptTree condition) { if (isNeverExecutedLoop(condition)) { return false; } ControlFlowGraph flowGraph = CheckUtils.buildControlFlowGraph(tree); Map<Tree, CfgBlock> treesOfFlowGraph = treesToBlocks(flowGraph); if (isBrokenLoop(tree, flowGraph)) { return false; } <START> if (condition != null && conditionIsUpdated(condition, (JavaScriptTree) tree, treesOfFlowGraph)) { <END> return false; } else { return true; } }</code><technical_language>![MINOR](<LINK_1> Replace this if-then-else statement a single return statement. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private static boolean isInfiniteLoop(IterationStatementTree tree, @Nullable JavaScriptTree condition) { if (isNeverExecutedLoop(condition)) { return false; } ControlFlowGraph flowGraph = CheckUtils.buildControlFlowGraph(tree); Map<Tree, CfgBlock> treesOfFlowGraph = treesToBlocks(flowGraph); if (isBrokenLoop(tree, flowGraph)) { return false; } return condition == null || conditionIsUpdated(condition, (JavaScriptTree) tree, treesOfFlowGraph); }
Source:
<code>void sendWarningForNonExportableDisks(ArrayList<Disk> disks) { final List<Disk> nonExportableDisks = new ArrayList<Disk>(); for(Disk disk : disks) { if(!disk.isAllowSnapshot()) { nonExportableDisks.add(disk); } } if(!nonExportableDisks.isEmpty()) { final StringBuilder s = new StringBuilder(); for(Disk disk : nonExportableDisks) { if(s.length() > 0) { s.append(", "); } s.append(disk.getDiskAlias()); } <START> setMessage(ConstantsManager.getInstance().getMessages().disksWillNotBePartOfTheExportedVMSnapshot(s.toString())); <END> } }</code><technical_language>preferable model view synchronized (iiuc, current solution - model's message view. Try handling messages concatenation in model maintain a list of messages for view's usage</technical_language>

Target:
void sendWarningForNonExportableDisks(ArrayList<Disk> disks) { final List<String> list = new ArrayList<String>(); for (Disk disk : disks) { if (!disk.isAllowSnapshot()) { list.add(disk.getDiskAlias()); } } if(!list.isEmpty()) { final String s = StringUtils.join(list, ", "); setMessage(ConstantsManager.getInstance().getMessages().disksWillNotBePartOfTheExportedVMSnapshot(s)); } }
Source:
<code>public final boolean equals(Object o) { <START> if (o instanceof LFUEvictionPolicyComparator) { <END> return true; } return false; }</code><technical_language>simplified return (o instanceof LFUEvictionPolicyComparator);</technical_language>

Target:
public final boolean equals(Object o) { if (o == null) { return false; } return getClass().equals(o.getClass()); }
Source:
<code>protected AsyncTaskResult<KeyPair> doInBackground(Void... voids) { AsyncTaskResult<KeyPair> retval = null; for(Provider provider : Security.getProviders()) Log.d(TAG, "Provider: " + provider.getName()); try { for(PemToKeyPairConverter converter : converters) { KeyPair keyPair = converter.convert(new String(pemFile)); if(keyPair != null) { retval = new AsyncTaskResult<KeyPair>(keyPair); break; } } if(retval == null) <START> throw new IOException("No converter availableExact to parse selected PEM"); <END> } catch (IOException e) { Log.e(TAG, "IOException reading PEM", e); retval = new AsyncTaskResult<KeyPair>(e); } return retval; }</code><technical_language>availableExact -></technical_language>

Target:
protected AsyncTaskResult<KeyPair> doInBackground(Void... voids) { AsyncTaskResult<KeyPair> retval = null; for(Provider provider : Security.getProviders()) Log.d(TAG, "Provider: " + provider.getName()); try { for(PemToKeyPairConverter converter : converters) { KeyPair keyPair = converter.convert(new String(pemFile)); if(keyPair != null) { retval = new AsyncTaskResult<KeyPair>(keyPair); break; } } if(retval == null) throw new IOException("No converter available to parse selected PEM"); } catch (IOException e) { Log.e(TAG, "IOException reading PEM", e); retval = new AsyncTaskResult<KeyPair>(e); } return retval; }
Source:
<code>private void startAllocatedContainer(Container container) { LOG.info("Starting container [" + container.getContainerId()+ "]"); <START> scheduledToRunContainers.put(container.getContainerId(), container); <END> this.utilizationManager.addContainerResources(container); if (container.getContainerTokenIdentifier().getExecutionType() == ExecutionType.OPPORTUNISTIC) { this.opportunisticContainersStatus.setOpportMemoryUsed( this.opportunisticContainersStatus.getOpportMemoryUsed() + container.getResource().getMemorySize()); this.opportunisticContainersStatus.setOpportCoresUsed( this.opportunisticContainersStatus.getOpportCoresUsed() + container.getResource().getVirtualCores()); this.opportunisticContainersStatus.setRunningOpportContainers( this.opportunisticContainersStatus.getRunningOpportContainers() + 1); } container.sendLaunchEvent(); }</code><technical_language>If reason tracking running containers is consider for preemption, do need track guaranteed containers</technical_language>

Target:
private void startAllocatedContainer(Container container) { LOG.info("Starting container [" + container.getContainerId()+ "]"); runningContainers.put(container.getContainerId(), container); this.utilizationTracker.addContainerResources(container); if (container.getContainerTokenIdentifier().getExecutionType() == ExecutionType.OPPORTUNISTIC) { this.metrics.opportunisticContainerStarted(container); } container.sendLaunchEvent(); }
Source:
<code>protected void doStop() { log.info("Stopping Netty server"); boss.shutdownGracefully(); if(!datagram) { <START> wrkr.shutdownGracefully(); <END> } try { sock.channel().closeFuture().sync(); } catch (InterruptedException e) { log.warn("Netty server stop interrupted"); Thread.currentThread().interrupt(); } log.info("Netty server stopped"); notifyStopped(); }</code><technical_language>I is boss shut if (!datagram)</technical_language>

Target:
protected void doStop() { log.info("Stopping Netty server"); wrkr.shutdownGracefully(); if(!datagram) { boss.shutdownGracefully(); } try { sock.channel().closeFuture().sync(); } catch (InterruptedException e) { log.warn("Netty server stop interrupted"); Thread.currentThread().interrupt(); } log.info("Netty server stopped"); notifyStopped(); }
Source:
<code>public static boolean equals(Thing a, Thing b) { if (!a.getUID().equals(b.getUID())) { return false; } if (a.getBridgeUID() == null && b.getBridgeUID() != null) { return false; } if (a.getBridgeUID() != null && !a.getBridgeUID().equals(b.getBridgeUID())) { return false; } if (a.getConfiguration() == null && b.getConfiguration() != null) { return false; } if (a.getConfiguration() != null && !a.getConfiguration().equals(b.getConfiguration())) { return false; } if (a.getLabel() == null && b.getLabel() != null) { return false; } if (a.getLabel() != null && !a.getLabel().equals(b.getLabel())) { return false; } if (a.getLocation() == null && b.getLocation() != null) { return false; } if (a.getLocation() != null && !a.getLocation().equals(b.getLocation())) { return false; <START> } <END> List<Channel> channelsOfA = a.getChannels(); List<Channel> channelsOfB = b.getChannels(); if (channelsOfA.size() != channelsOfB.size()) { return false; } if (!toString(channelsOfA).equals(toString(channelsOfB))) { return false; } return true; }</code><technical_language>Objects.equals result in code is IMHO readable. Missed I reason it? <LINK_0>,%20java.lang.Object)</technical_language>

Target:
public static boolean equals(Thing a, Thing b) { if (!a.getUID().equals(b.getUID())) { return false; } if (!Objects.equal(a.getBridgeUID(), b.getBridgeUID())) { return false; } if (!Objects.equal(a.getConfiguration(), b.getConfiguration())) { return false; } if (!Objects.equal(a.getLabel(), b.getLabel())) { return false; } if (!Objects.equal(a.getLocation(), b.getLocation())) { return false; } List<Channel> channelsOfA = a.getChannels(); List<Channel> channelsOfB = b.getChannels(); if (channelsOfA.size() != channelsOfB.size()) { return false; } if (!toString(channelsOfA).equals(toString(channelsOfB))) { return false; } return true; }
Source:
<code>public String toString() { <START> return cucumberFeature.getPath(); <END> }</code><technical_language>I feature name (possibly surrounded "") for sake of consistency, standardise feature name "classname" #1167</technical_language>

Target:
public String toString() { return "\"" + cucumberFeature.getGherkinFeature().getFeature().getName() + "\""; }
Source:
<code>public void testPauseContainer() throws Exception { MockWebServer server = mockWebServer(); server.enqueue(new MockResponse().setResponseCode(204)); DockerApi dockerApi = api(server.getUrl("/")); ContainerApi api = dockerApi.getContainerApi(); try { api.pause("1"); <START> assertRequestHasCommonFields(server.takeRequest(), "POST", "/containers/1/pause"); <END> } finally { dockerApi.close(); server.shutdown(); } }</code><technical_language>bad name</technical_language>

Target:
public void testPauseContainer() throws Exception { MockWebServer server = mockWebServer(new MockResponse().setResponseCode(204)); ContainerApi api = api(DockerApi.class, server.getUrl("/").toString()).getContainerApi(); try { api.pause("1"); assertSent(server, "POST", "/containers/1/pause"); } finally { server.shutdown(); } }
Source:
<code>public boolean validate() { if (getIsAttachDisk().getEntity()) { if (isSelectionsEmpty(getInternalAttachableDisks()) && isSelectionsEmpty(getExternalAttachableDisks())) { getInvalidityReasons().add(CONSTANTS.noDisksSelected()); setIsValid(false); return false; } return true; } if (!getIsInternal().getEntity() && getSanStorageModel() != null) { getSanStorageModel().validate(); if (!getSanStorageModel().getIsValid()) { return false; } ArrayList<String> partOfSdLunsMessages = getSanStorageModel().getPartOfSdLunsMessages(); if (!partOfSdLunsMessages.isEmpty() && !getSanStorageModel().isForce()) { forceCreationWarning(partOfSdLunsMessages); return false; } } StorageType storageType = getStorageDomain().getSelectedItem() == null ? StorageType.UNKNOWN : getStorageDomain().getSelectedItem().getStorageType(); <START> LongValidation sizeValidation = new LongValidation(); <END> sizeValidation.setMinimum(1); if (storageType.isBlockDomain()) { sizeValidation.setMaximum((Integer) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigurationValues.MaxBlockDiskSize)); } getSize().validateEntity(new IValidation[] { new NotEmptyValidation(), sizeValidation }); getStorageDomain().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); return super.validate() && getSize().getIsValid() && getStorageDomain().getIsValid(); }</code><technical_language>a solution define size Integer? size is in GB confusing allow large values... for block domains limit disk size 8TB default (ConfigValues.MaxBlockDiskSize). For file domains, I disks larger 2147483647GB.</technical_language>

Target:
public boolean validate() { if (getIsAttachDisk().getEntity()) { if (isSelectionsEmpty(getInternalAttachableDisks()) && isSelectionsEmpty(getExternalAttachableDisks())) { getInvalidityReasons().add(CONSTANTS.noDisksSelected()); setIsValid(false); return false; } return true; } if (!getIsInternal().getEntity() && getSanStorageModel() != null) { getSanStorageModel().validate(); if (!getSanStorageModel().getIsValid()) { return false; } ArrayList<String> partOfSdLunsMessages = getSanStorageModel().getPartOfSdLunsMessages(); if (!partOfSdLunsMessages.isEmpty() && !getSanStorageModel().isForce()) { forceCreationWarning(partOfSdLunsMessages); return false; } } StorageType storageType = getStorageDomain().getSelectedItem() == null ? StorageType.UNKNOWN : getStorageDomain().getSelectedItem().getStorageType(); IntegerValidation sizeValidation = new IntegerValidation(); sizeValidation.setMinimum(1); if (storageType.isBlockDomain()) { sizeValidation.setMaximum((Integer) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigurationValues.MaxBlockDiskSize)); } getSize().validateEntity(new IValidation[] { new NotEmptyValidation(), sizeValidation }); getStorageDomain().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); return super.validate() && getSize().getIsValid() && getStorageDomain().getIsValid(); }
Source:
<code>public void OnSave() { DataCenterModel model = (DataCenterModel) getWindow(); if (!model.Validate()) { return; } if (!model.getIsNew() && !((Version) model.getVersion().getSelectedItem()).equals(((storage_pool) getSelectedItem()).getcompatibility_version())) { ConfirmationModel confirmModel = new ConfirmationModel(); setConfirmWindow(confirmModel); confirmModel.setTitle(ConstantsManager.getInstance() .getConstants() .changeDataCenterCompatibilityVersionTitle()); confirmModel.setHashName("change_data_center_compatibility_version"); confirmModel.setMessage(ConstantsManager.getInstance() .getConstants() .youAreAboutChangeDcCompatibilityVersionMsg()); UICommand tempVar = new UICommand("OnSaveInternal", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); tempVar.setIsDefault(true); confirmModel.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("CancelConfirmation", this); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); tempVar2.setIsCancel(true); confirmModel.getCommands().add(tempVar2); } <START> else if (((storage_pool) getSelectedItem()).getQuotaEnforcementType() == QuotaEnforcementTypeEnum.DISABLED <END> && model.getQuotaEnforceTypeListModel().getSelectedItem() != QuotaEnforcementTypeEnum.DISABLED) { promptNoQuotaAvailable(model.getEntity(), this); } else { OnSaveInternal(); } }</code><technical_language>In new DC show notification (understood getSelectedItem() != null)? IMHO, creating a new DC in enforce mode equals editing a current DC. I show message in cases</technical_language>

Target:
public void OnSave() { DataCenterModel model = (DataCenterModel) getWindow(); if (!model.Validate()) { return; } if ((model.getIsNew() || model.getEntity() == null) && model.getQuotaEnforceTypeListModel().getSelectedItem() != QuotaEnforcementTypeEnum.DISABLED) { promptNoQuotaInDCMessage(); } else if (!((Version) model.getVersion().getSelectedItem()).equals(((storage_pool) getSelectedItem()).getcompatibility_version())) { ConfirmationModel confirmModel = new ConfirmationModel(); setConfirmWindow(confirmModel); confirmModel.setTitle(ConstantsManager.getInstance() .getConstants() .changeDataCenterCompatibilityVersionTitle()); confirmModel.setHashName("change_data_center_compatibility_version"); confirmModel.setMessage(ConstantsManager.getInstance() .getConstants() .youAreAboutChangeDcCompatibilityVersionMsg()); UICommand tempVar = new UICommand("OnSaveInternal", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); tempVar.setIsDefault(true); confirmModel.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("CancelConfirmation", this); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); tempVar2.setIsCancel(true); confirmModel.getCommands().add(tempVar2); } else if (((storage_pool) getSelectedItem()).getQuotaEnforcementType() == QuotaEnforcementTypeEnum.DISABLED && model.getQuotaEnforceTypeListModel().getSelectedItem() != QuotaEnforcementTypeEnum.DISABLED) { checkForQuotaInDC(model.getEntity(), this); } else { OnSaveInternal(); } }
Source:
<code>private String getDefaultRemoteName() { String defaultName = ""; boolean onlyOneRemote = syncRepos.size() == 2; <START> if (onlyOneRemote) { <END> defaultName = syncRepos.get(1).getName(); } else { for (SyncRepoEntity repo : syncRepos) if (repo.getName().equals(DEFAULT_REMOTE_NAME)) return DEFAULT_REMOTE_NAME; } return defaultName; }</code><technical_language>brackets removed default repo name returned immediately</technical_language>

Target:
private String getDefaultRemoteName() { boolean onlyOneRemote = syncRepos.size() == 2; if (onlyOneRemote) return syncRepos.get(1).getName(); else { for (SyncRepoEntity repo : syncRepos) if (repo.getName().equals(DEFAULT_REMOTE_NAME)) return DEFAULT_REMOTE_NAME; } return ""; }