auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static int threadPoolSize() { try { return Integer.parseInt(System.getenv(THREAD_POOL_SIZE)); } catch (NumberFormatException e) { return DEFAULT_THREAD_POOL_SIZE; } }

Target:
public static int threadPoolSize() { try { return Integer.parseInt(System.getenv(PUBLISHING_THREAD_POOL_SIZE)); } catch (NumberFormatException e) { logBuilder() .addParameter("envVar", PUBLISHING_THREAD_POOL_SIZE) .error(e, "fail to parse environment variable to integer"); throw e; } }
Source:
void fromJupiterEngineDescriptor() { JupiterEngineDescriptor engineTestDescriptor = new JupiterEngineDescriptor( UniqueId.root("engine", "junit-jupiter")); JupiterEngineExtensionContext engineContext = new JupiterEngineExtensionContext(null, engineTestDescriptor); assertAll("engineContext", () -> assertThat(engineContext.getTestClass()).isEmpty(), () -> assertThat(engineContext.getTestMethod()).isEmpty(), () -> assertThat(engineContext.getElement()).isEmpty(), () -> assertEquals(engineTestDescriptor.getDisplayName(), engineContext.getDisplayName()), () -> assertEquals(Optional.empty(), engineContext.getParent()) ); }

Target:
void fromJupiterEngineDescriptor() { JupiterEngineDescriptor engineTestDescriptor = new JupiterEngineDescriptor( UniqueId.root("engine", "junit-jupiter")); JupiterEngineExtensionContext engineContext = new JupiterEngineExtensionContext(null, engineTestDescriptor); assertAll("engineContext", () -> assertThat(engineContext.getTestClass()).isEmpty(), () -> assertThat(engineContext.getTestMethod()).isEmpty(), () -> assertThat(engineContext.getElement()).isEmpty(), () -> assertThat(engineContext.getDisplayName()).isEqualTo(engineTestDescriptor.getDisplayName()), () -> assertThat(engineContext.getParent()).isEmpty() ); }
Source:
private AttributeListAccumulator acquireCachedAttributeAccumulator() { if (mCachedAttributeAccumulator == null) { mCachedAttributeAccumulator = new AttributeListAccumulator(); } else if (mCachedAttributeAccumulator.size() > 0) { mCachedAttributeAccumulator.clear(); } return mCachedAttributeAccumulator; }

Target:
private AttributeListAccumulator acquireCachedAttributeAccumulator() { AttributeListAccumulator accumulator = mCachedAttributeAccumulator; if (accumulator == null) { accumulator = new AttributeListAccumulator(); } mCachedChildrenAccumulator = null; return accumulator; }
Source:
private LnClientConnection createConnection() throws IOException { final byte[] authenticationKey = Hex.decode(this.getSecurityKey(SecurityKeyType.E_METER_AUTHENTICATION) .getKey()); final byte[] encryptionKey = Hex.decode(this.getSecurityKey(SecurityKeyType.E_METER_ENCRYPTION).getKey()); LOGGER.info("Keys: = {}", this.getSecurityKey(SecurityKeyType.E_METER_AUTHENTICATION).getKey(), this .getSecurityKey(SecurityKeyType.E_METER_ENCRYPTION).getKey()); final TcpConnectionBuilder tcpConnectionBuilder = new TcpConnectionBuilder(InetAddress.getByName(this.device .getIpAddress())).useGmacAuthentication(authenticationKey, encryptionKey) .enableEncryption(encryptionKey).responseTimeout(10000).logicalDeviceAddress(1).clientAccessPoint(1); final Integer challengeLength = this.device.getChallengeLength(); if (challengeLength != null) { tcpConnectionBuilder.challengeLength(challengeLength); } return tcpConnectionBuilder.buildLnConnection(); }

Target:
private ClientConnection createConnection() throws IOException { final byte[] authenticationKey = Hex.decode(this.getSecurityKey(SecurityKeyType.E_METER_AUTHENTICATION) .getKey()); final byte[] encryptionKey = Hex.decode(this.getSecurityKey(SecurityKeyType.E_METER_ENCRYPTION).getKey()); final TcpConnectionBuilder tcpConnectionBuilder = new TcpConnectionBuilder(InetAddress.getByName(this.device .getIpAddress())).useGmacAuthentication(authenticationKey, encryptionKey) .enableEncryption(encryptionKey).responseTimeout(this.responseTimeout) .logicalDeviceAddress(this.logicalDeviceAddress).clientAccessPoint(this.clientAccessPoint); final Integer challengeLength = this.device.getChallengeLength(); if (challengeLength != null) { tcpConnectionBuilder.challengeLength(challengeLength); } return tcpConnectionBuilder.buildLnConnection(); }
Source:
public static FileUtils.FileCopyResult unzip( final ByteSource byteSource, final File outDir, final Predicate<Throwable> shouldRetry, boolean cacheLocally ) throws IOException { if (!cacheLocally) { try { return RetryUtils.retry( new Callable<FileUtils.FileCopyResult>() { @Override public FileUtils.FileCopyResult call() throws Exception { return unzip(byteSource.openStream(), outDir); } }, shouldRetry, DEFAULT_RETRY_COUNT ); } catch (Exception e) { throw Throwables.propagate(e); } } final File tmpFile = File.createTempFile("compressionUtilZipCache", ZIP_SUFFIX); try { FileUtils.FileCopyResult copyResult = FileUtils.retryCopy( byteSource, tmpFile, shouldRetry, DEFAULT_RETRY_COUNT ); return unzip(tmpFile, outDir); } finally { if (!tmpFile.delete()) { log.warn("Could not delete zip cache at [%s]", tmpFile.toString()); } } }

Target:
public static FileUtils.FileCopyResult unzip( final ByteSource byteSource, final File outDir, final Predicate<Throwable> shouldRetry, boolean cacheLocally ) throws IOException { if (!cacheLocally) { try { return RetryUtils.retry( new Callable<FileUtils.FileCopyResult>() { @Override public FileUtils.FileCopyResult call() throws Exception { return unzip(byteSource.openStream(), outDir); } }, shouldRetry, DEFAULT_RETRY_COUNT ); } catch (Exception e) { throw Throwables.propagate(e); } } else { final File tmpFile = File.createTempFile("compressionUtilZipCache", ZIP_SUFFIX); try { FileUtils.FileCopyResult copyResult = FileUtils.retryCopy( byteSource, tmpFile, shouldRetry, DEFAULT_RETRY_COUNT ); return unzip(tmpFile, outDir); } finally { if (!tmpFile.delete()) { log.warn("Could not delete zip cache at [%s]", tmpFile.toString()); } } } }
Source:
public Profile validated(final Profile master, final Profile merged) throws IOException { final String[] security = {"architect", "commander"}; for (final String section : security) { if (!Arrays.equals( master.read().xpath( String.format(Profiles.ITEMS, section) ).toArray(), merged.read().xpath( String.format(Profiles.ITEMS, section) ).toArray() )) { throw new Profile.ConfigException( String.format( "You cannot change `%s` section for security reasons", section ) ); } } return merged; }

Target:
public Profile validated(final Profile master, final Profile merged) throws IOException { final String commanders = "commanders"; final String[][] security = { {"architect"}, {Profiles.MERGE, commanders}, {"deploy", commanders}, {"release", commanders}, }; for (final String[] section : security) { if (!Arrays.equals( Profiles.section(master, section), Profiles.section(merged, section) )) { throw new Profile.ConfigException( String.format( "You cannot change `%s` section for security reasons", Arrays.toString(section) ) ); } } return merged; }
Source:
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String selected = (String) parent.getItemAtPosition(position); ApplicationRecord r = namesToRecords.get(selected); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.edit().putString(KEY_LAST_APP, r.getUniqueId()).commit(); loadFields(false); CommCareApplication._().initializeAppResources(new CommCareApp(r)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { refreshBreadcrumbBar(); } }

Target:
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { ApplicationRecord r = appRecordDropdownList.get(position); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.edit().putString(KEY_LAST_APP, r.getUniqueId()).commit(); loadFields(false); CommCareApplication._().initializeAppResources(new CommCareApp(r)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { refreshActionBar(); } }
Source:
public static CommandContext createInternalJobContext(EngineLock lock) { ExecutionContext executionContext = new ExecutionContext(); executionContext.setJobRequired(true); executionContext.setMonitored(true); return new CommandContext(new EngineContext()).setExecutionContext(executionContext).setLock(lock); }

Target:
public static CommandContext createInternalJobContext(EngineLock lock) { ExecutionContext executionContext = new ExecutionContext(); executionContext.setJobRequired(true); executionContext.setMonitored(true); return new CommandContext(new EngineContext()).withExecutionContext(executionContext).withtLock(lock); }
Source:
public FlyingAbilityDataProcessor() { super(EntityPlayer.class, Keys.IS_FLYING); }

Target:
public FlyingAbilityDataProcessor() { super(EntityPlayer.class, Keys.CAN_FLY); }
Source:
public void testNullModuleIdAndNonMatchingChecks() throws Exception { final String xpath = "NON_MATCHING_QUERY"; final XpathFilterElement filter = new XpathFilterElement( (String) null, null, null, null, xpath); final TreeWalkerAuditEvent ev = getEvent(3, 0, TokenTypes.CLASS_DEF); assertTrue("Event should be accepted", filter.accept(ev)); }

Target:
public void testNullModuleIdAndNonMatchingChecks() throws Exception { final String xpath = "NON_MATCHING_QUERY"; final XpathFilterElement filter = new XpathFilterElement( "InputXpathFilterElementSuppressByXpath", "NonMatchingRegexp", null, null, xpath); final TreeWalkerAuditEvent ev = getEvent(3, 0, TokenTypes.CLASS_DEF); assertTrue("Event should be accepted", filter.accept(ev)); }
Source:
public String sysIdentifier(String upperName) { return dbSettings.databaseToLower ? StringUtils.toLowerEnglish(upperName) : upperName; }

Target:
public String sysIdentifier(String upperName) { assert isUpperSysIdentifier(upperName); return dbSettings.databaseToLower ? StringUtils.toLowerEnglish(upperName) : upperName; }
Source:
public static String loadTextFileFromAssets(Context context, String fileName) { String fileContent; try { InputStream iStream = context.getAssets().open(fileName); BufferedInputStream bInputStream = new BufferedInputStream(iStream); ByteArrayOutputStream bOutputStream = new ByteArrayOutputStream(); int result = bInputStream.read(); while(result != -1) { byte b = (byte)result; bOutputStream.write(b); result = bInputStream.read(); } fileContent = bOutputStream.toString(); } catch (IOException ioexception) { ioexception.printStackTrace(); return null; } return fileContent; }

Target:
public static String loadTextFileFromAssets (Context context, String fileName) throws IOException { InputStream inputStream = context.getAssets().open(fileName); try { OutputStream outputStream = new ByteArrayOutputStream(); try { byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; for (int n; (n = inputStream.read(buffer)) >= 0;) { outputStream.write(buffer, 0, n); } return outputStream.toString(); } finally { outputStream.close(); } } finally { inputStream.close(); } }
Source:
public static int getBrightness( Color color ) { if ( color == null ) { return BRIGHTNESS_THRESHOLD + 1; } final int r = color.getRed(); final int g = color.getGreen(); final int b = color.getBlue(); int brightness = ( r > g ) ? r : g; if ( b > brightness ) { brightness = b; } return brightness; }

Target:
public static int getBrightness( Color color ) { if ( color == null ) { return BRIGHTNESS_THRESHOLD + 1; } final int r = color.getRed(); final int g = color.getGreen(); final int b = color.getBlue(); int brightness = r > g ? r : g; if ( b > brightness ) { brightness = b; } return brightness; }
Source:
public void loadSettings(TuningContext context) { this.nudge = context.getFloat("auto.full.nudge", 1.0f); this.toteDistance = context.getFloat("auto.full.toteDistance", 7.0f); this.autoZoneDistance = context.getFloat("auto.full.autoZoneDistance", 5.0f); this.strafeDistance = context.getFloat("auto.full.strafeDistance", 2.0f); }

Target:
public void loadSettings(TuningContext context) { this.nudge = context.getFloat("auto-full-nudge", 1.0f); this.toteDistance = context.getFloat("auto-full-toteDistance", 7.0f); this.autoZoneDistance = context.getFloat("auto-full-autoZoneDistance", 5.0f); this.strafeDistance = context.getFloat("auto-full-strafeDistance", 2.0f); }
Source:
private void addAttributeArgument(Argument argument, EntityProjection entityProjection) { String argumentName = argument.getName(); Class<?> entityType = entityProjection.getType(); if (!entityDictionary.isValidField(entityType, argumentName)) { throw new IllegalStateException( String.format("Unknown argument field {%s.%s}.", entityType, argument)); } Attribute argumentAttribute = entityProjection.getAttributeByName(argumentName); com.yahoo.elide.request.Argument elideArgument = com.yahoo.elide.request.Argument.builder() .name(argumentName) .value(argument.getValue()) .build(); if (argumentAttribute == null) { argumentAttribute = Attribute.builder() .type(entityDictionary.getType(entityType, argumentName)) .name(argumentName) .argument(elideArgument) .build(); Set<Attribute> attributes = entityProjection.getAttributes(); attributes.add(argumentAttribute); entityProjection.setAttributes(attributes); } else { argumentAttribute.getArguments().add(elideArgument); } }

Target:
private void addAttributeArgument(Argument argument, EntityProjection entityProjection) { String argumentName = argument.getName(); Class<?> entityType = entityProjection.getType(); Attribute argumentAttribute = entityProjection.getAttributeByName(argumentName); com.yahoo.elide.request.Argument elideArgument = com.yahoo.elide.request.Argument.builder() .name(argumentName) .value(variableResolver.resolveValue(argument.getValue())) .build(); if (argumentAttribute == null) { argumentAttribute = Attribute.builder() .type(entityDictionary.getType(entityType, argumentName)) .name(argumentName) .argument(elideArgument) .build(); Set<Attribute> attributes = entityProjection.getAttributes(); attributes.add(argumentAttribute); entityProjection.setAttributes(attributes); } else { argumentAttribute.getArguments().add(elideArgument); } }
Source:
public SchedulerType getBackupSchedulerType() { return SchedulerType.TIME; }

Target:
public SchedulerType getBackupSchedulerType() { return SchedulerType.HOUR; }
Source:
public Object geometryToBingTiles(BenchmarkData data) throws Throwable { return BingTileFunctions.geometryToBingTiles(data.geometry, data.zoomLevel); }

Target:
public Object geometryToBingTiles(BenchmarkData data) { return BingTileFunctions.geometryToBingTiles(data.geometry, data.zoomLevel); }
Source:
public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder( new ContextThemeWrapper(getActivity(), R.style.Calypso_Dialog_Alert)); builder.setTitle(R.string.plugin_install_custom_domain_required_dialog_title); builder.setMessage(R.string.plugin_install_custom_domain_required_dialog_message); builder.setPositiveButton(R.string.plugin_install_custom_domain_required_dialog_register_btn, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); builder.setCancelable(true); builder.create(); return builder.create(); }

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder( new ContextThemeWrapper(getActivity(), R.style.Calypso_Dialog_Alert)); builder.setTitle(R.string.plugin_install_custom_domain_required_dialog_title); builder.setMessage(R.string.plugin_install_custom_domain_required_dialog_message); builder.setPositiveButton(R.string.plugin_install_custom_domain_required_dialog_register_btn, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); builder.setCancelable(true); return builder.create(); }
Source:
private BlockingAction<Void> copyInternal(String from, String to, CopyOptions options, Handler<AsyncResult<Void>> handler) { Objects.requireNonNull(from); Objects.requireNonNull(to); Objects.requireNonNull(options); Set<CopyOption> copyOptionSet = options.toCopyOptionSet(); CopyOption[] copyOptions = copyOptionSet.toArray(new CopyOption[copyOptionSet.size()]); return new BlockingAction<Void>(handler) { public Void perform() { try { Path source = vertx.resolveFile(from).toPath(); Path target = vertx.resolveFile(to).toPath(); Files.copy(source, target, copyOptions); } catch (IOException e) { throw new FileSystemException(e); } return null; } }; }

Target:
private BlockingAction<Void> copyInternal(String from, String to, CopyOptions options, Handler<AsyncResult<Void>> handler) { Objects.requireNonNull(from); Objects.requireNonNull(to); Objects.requireNonNull(options); Set<CopyOption> copyOptionSet = toCopyOptionSet(options); CopyOption[] copyOptions = copyOptionSet.toArray(new CopyOption[copyOptionSet.size()]); return new BlockingAction<Void>(handler) { public Void perform() { try { Path source = vertx.resolveFile(from).toPath(); Path target = vertx.resolveFile(to).toPath(); Files.copy(source, target, copyOptions); } catch (IOException e) { throw new FileSystemException(e); } return null; } }; }
Source:
public PathBuilder<Object> get(String property) { SimpleEntry<String, Class<?>> entry = new SimpleEntry<String, Class<?>>(property, Object.class); PathBuilder<Object> path = (PathBuilder<Object>) properties.get(entry); if (path == null) { Class<?> vtype = validate(property, Object.class); path = new PathBuilder<Object>(vtype, forProperty(property), validator); properties.putIfAbsent(entry, path); } return path; }

Target:
public PathBuilder<Object> get(String property) { SimpleEntry<String, Class<?>> entry = new SimpleEntry<String, Class<?>>(property, Object.class); PathBuilder<Object> path = (PathBuilder<Object>) properties.get(entry); PathBuilder<?> existingPath = null; if (path == null) { Class<?> vtype = validate(property, Object.class); path = new PathBuilder<Object>(vtype, forProperty(property), validator); existingPath = properties.putIfAbsent(entry, path); } return existingPath == null ? path : (PathBuilder<Object>) existingPath; }
Source:
public Long getXmxValue(String javaChildOptsStr) { if (StringUtils.isBlank(javaChildOptsStr)) { LOG.error("Null/empty input argument to get xmxValue"); throw new ProcessingException("Null/Empty input to get xmxValue"); } Long retVal = 0L; String valueStr = extractXmxValueStr(javaChildOptsStr); char lastChar = valueStr.charAt(valueStr.length() - 1); try { if (Character.isLetter(lastChar)) { String xmxValStr = valueStr.substring(0, valueStr.length() - 1); retVal = Long.parseLong(xmxValStr); switch (lastChar) { case 'M': case 'm': break; case 'K': case 'k': retVal /= 1024; break; case 'G': case 'g': retVal *= 1024; break; } } else { retVal = Long.parseLong(valueStr); retVal /= (1024 * 1024); } } catch (NumberFormatException nfe) { LOG.error("Unable to get the Xmx value from " + javaChildOptsStr); nfe.printStackTrace(); throw new ProcessingException("Unable to get the Xmx value from " + javaChildOptsStr, nfe); } return retVal; }

Target:
public static Long getXmxValue(String javaChildOptsStr) { Long retVal = 0L; String valueStr = extractXmxValueStr(javaChildOptsStr); char lastChar = valueStr.charAt(valueStr.length() - 1); try { if (Character.isLetter(lastChar)) { String xmxValStr = valueStr.substring(0, valueStr.length() - 1); retVal = Long.parseLong(xmxValStr); switch (lastChar) { case 'M': case 'm': break; case 'K': case 'k': retVal /= 1024; break; case 'G': case 'g': retVal *= 1024; break; default: throw new ProcessingException("Unable to get the Xmx value from " + javaChildOptsStr + " invalid value for Xmx " + xmxValStr); } } else { retVal = Long.parseLong(valueStr); retVal /= (1024 * 1024); } } catch (NumberFormatException nfe) { LOG.error("Unable to get the Xmx value from " + javaChildOptsStr); nfe.printStackTrace(); throw new ProcessingException("Unable to get the Xmx value from " + javaChildOptsStr, nfe); } return retVal; }
Source:
public ListenableFuture<?> setBytes(long bytes) { return null; }

Target:
public ListenableFuture<?> setBytes(long bytes) { return Futures.immediateFuture(null); }
Source:
private int getDefaultIconResource(final BoxItem boxItem) { if (boxItem instanceof BoxFolder) { BoxFolder boxFolder = (BoxFolder) boxItem; if (boxFolder.getHasCollaborations() == Boolean.TRUE) { if (boxFolder.getIsExternallyOwned() == Boolean.TRUE) { return R.drawable.ic_box_browsesdk_locked; } return R.drawable.ic_box_browsesdk_folder_shared; } return R.drawable.ic_box_browsesdk_personal; } else if (boxItem instanceof BoxBookmark) { return R.drawable.ic_box_browsesdk_linked; } else { String name = boxItem.getName(); if (name != null) { String ext = name.substring(name.lastIndexOf('.') + 1).toLowerCase(); Integer resId = DEFAULT_ICON_RESORCE_MAP.get(ext); if (resId != null){ return resId; } } return R.drawable.ic_box_browsesdk_other; } }

Target:
private int getDefaultIconResource(final BoxItem boxItem) { if (boxItem instanceof BoxFolder) { BoxFolder boxFolder = (BoxFolder) boxItem; if (boxFolder.getHasCollaborations() == Boolean.TRUE) { if (boxFolder.getIsExternallyOwned() == Boolean.TRUE) { return R.drawable.ic_box_browsesdk_folder_external; } return R.drawable.ic_box_browsesdk_folder_shared; } return R.drawable.ic_box_browsesdk_folder_personal; } else if (boxItem instanceof BoxBookmark) { return R.drawable.ic_box_browsesdk_web_link; } else { String name = boxItem.getName(); if (name != null) { String ext = name.substring(name.lastIndexOf('.') + 1).toLowerCase(); Integer resId = DEFAULT_ICON_RESORCE_MAP.get(ext); if (resId != null){ return resId; } } return R.drawable.ic_box_browsesdk_other; } }
Source:
public void verifyCommentRowContent(String commentRowIdSuffix, String commentText, String giverName) { WebDriverWait wait = new WebDriverWait(browser.driver, 30); WebElement commentRow; try { commentRow = wait.until(ExpectedConditions.presenceOfElementLocated(By.id("responseCommentRow" + commentRowIdSuffix))); } catch (TimeoutException e) { return; } try { wait.until(ExpectedConditions.textToBePresentInElement(commentRow.findElement(By.id("plainCommentText" + commentRowIdSuffix)), commentText)); } catch (TimeoutException e) { fail("Not expected message"); } try { assertTrue(commentRow.findElement(By.className("text-muted")).getText().contains(giverName)); } catch (AssertionError e) { assertTrue(commentRow.findElement(By.className("text-muted")).getText().contains("you")); } }

Target:
public void verifyCommentRowContent(String commentRowIdSuffix, String commentText, String giverName) { WebDriverWait wait = new WebDriverWait(browser.driver, 30); WebElement commentRow; try { commentRow = wait.until(ExpectedConditions.presenceOfElementLocated( By.id("responseCommentRow" + commentRowIdSuffix))); } catch (TimeoutException e) { fail("Timeout!"); commentRow = null; } try { wait.until(ExpectedConditions.textToBePresentInElement(commentRow.findElement(By.id("plainCommentText" + commentRowIdSuffix)), commentText)); } catch (TimeoutException e) { fail("Not expected message"); } try { assertTrue(commentRow.findElement(By.className("text-muted")).getText().contains(giverName)); } catch (AssertionError e) { assertTrue(commentRow.findElement(By.className("text-muted")).getText().contains("you")); } }
Source:
protected String getConfiguredProtocols() { return "AMQP,OPENWIRE,CORE"; }

Target:
protected String getConfiguredProtocols() { return "AMQP,OPENWIRE"; }
Source:
public void canDoActionFailedUpdateReadOnly() { VmDevice device = createVmDevice(diskImageGuid, vmId); assertEquals(true, device.getIsPlugged()); when(diskDao.get(diskImageGuid)).thenReturn(createDiskImage()); UpdateVmDiskParameters parameters = createParameters(); parameters.getDiskInfo().setReadOnly(true); initializeCommand(parameters, Collections.singletonList(createVm(VMStatus.Up))); CanDoActionTestUtils.runAndAssertCanDoActionFailure(command, VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); }

Target:
public void canDoActionFailedUpdateReadOnly() { when(diskDao.get(diskImageGuid)).thenReturn(createDiskImage()); UpdateVmDiskParameters parameters = createParameters(); parameters.getDiskInfo().setReadOnly(true); initializeCommand(parameters, Collections.singletonList(createVm(VMStatus.Up))); CanDoActionTestUtils.runAndAssertCanDoActionFailure(command, VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); }
Source:
public ColumnCapabilities getColumnCapabilities(String column) { return ColumnCapabilitiesImpl.complete(index.getCapabilities(column), false); }

Target:
public ColumnCapabilities getColumnCapabilities(String column) { return ColumnCapabilitiesImpl.snapshot(index.getCapabilities(column), true); }
Source:
private void setRepoConfig() throws IOException { Map<String,Object> repoConfig = (Map<String, Object>) soaService.requestObject("config?type=repo", Map.class); if (repoConfig.containsKey("contentRepoAddress")){ try { contentRepoAddress = new URI(repoConfig.get("contentRepoAddress").toString()); } catch (URISyntaxException e) { throw new RuntimeException("Invalid content repo URI returned from service", e); } } else { throw new RuntimeException("No content repo URI returned from service"); } if (repoConfig.containsKey("repoBucketName")){ repoBucketName = repoConfig.get("repoBucketName").toString(); } }

Target:
private void setRepoConfig() throws IOException { Map<String,Object> repoConfig = (Map<String, Object>) soaService.requestObject("config?type=repo", Map.class); Object address = repoConfig.get("contentRepoAddress"); if (address != null){ try { contentRepoAddress = new URI(address.toString()); } catch (URISyntaxException e) { throw new RuntimeException("Invalid content repo URI returned from service", e); } } Object bucket = repoConfig.get("repoBucketName"); if (bucket != null){ repoBucketName = bucket.toString(); } }
Source:
protected Episode setAdditionalEpisodeFields(Entry entry, Map<String, String> lookup, Episode episode) { episode.addAliasUrl(C4AtomApi.canonicalizeEpisodeFeedId(entry)); episode.addAliasUrl(entry.getId()); String programmeId = lookup.get(C4AtomApi.DC_PROGRAMME_ID); if (programmeId != null) { episode.addAlias(new Alias("gb:channel4:prod:pmlsd:programmeId", programmeId)); } return episode; }

Target:
protected Episode setAdditionalEpisodeFields(Entry entry, Map<String, String> lookup, Episode episode) { episode.addAliasUrl(C4AtomApi.canonicalizeEpisodeFeedId(entry)); episode.addAliasUrl(entry.getId()); String programmeId = lookup.get(C4AtomApi.DC_PROGRAMME_ID); if (programmeId != null) { episode.addAlias(new Alias(C4AtomApi.ALIAS, programmeId)); } return episode; }
Source:
public Response<CommentInfo> apply(RevisionResource rsrc, Input in) throws AuthException, BadRequestException, ResourceConflictException, OrmException { if (Strings.isNullOrEmpty(in.path)) { throw new BadRequestException("path must be non-empty"); } else if (in.message == null || in.message.trim().isEmpty()) { throw new BadRequestException("message must be non-empty"); } else if (in.line != null && in.line <= 0) { throw new BadRequestException("line must be > 0"); } else if (in.line != null && in.range != null && in.line != in.range.getEndLine()) { throw new BadRequestException("range endLine must be on the same line as the comment"); } PatchLineComment c = new PatchLineComment( new PatchLineComment.Key( new Patch.Key(rsrc.getPatchSet().getId(), in.path), ChangeUtil.messageUUID(db.get())), in.line != null ? in.line : 0, rsrc.getAccountId(), Url.decode(in.inReplyTo)); c.setSide(in.side == Side.PARENT ? (short) 0 : (short) 1); c.setMessage(in.message.trim()); c.setRange(in.range); db.get().patchComments().insert(Collections.singleton(c)); return Response.created(new CommentInfo(c, null)); }

Target:
public Response<CommentInfo> apply(RevisionResource rsrc, Input in) throws AuthException, BadRequestException, ResourceConflictException, OrmException { if (Strings.isNullOrEmpty(in.path)) { throw new BadRequestException("path must be non-empty"); } else if (in.message == null || in.message.trim().isEmpty()) { throw new BadRequestException("message must be non-empty"); } else if (in.line != null && in.line <= 0) { throw new BadRequestException("line must be > 0"); } else if (in.line != null && in.range != null && in.line != in.range.getEndLine()) { throw new BadRequestException("range endLine must be on the same line as the comment"); } else if ((in.line == null || in.line == 0) && in.range != null) { throw new BadRequestException("range must be null if line is null or 0"); } int line; if (in.range != null || in.line != null) { line = in.range != null ? in.range.getEndLine() : in.line; } else { line = 0; } PatchLineComment c = new PatchLineComment( new PatchLineComment.Key( new Patch.Key(rsrc.getPatchSet().getId(), in.path), ChangeUtil.messageUUID(db.get())), line, rsrc.getAccountId(), Url.decode(in.inReplyTo)); c.setSide(in.side == Side.PARENT ? (short) 0 : (short) 1); c.setMessage(in.message.trim()); c.setRange(in.range); db.get().patchComments().insert(Collections.singleton(c)); return Response.created(new CommentInfo(c, null)); }
Source:
public void deleteAllById(Iterable<? extends ID> ids) { Assert.notNull(ids, "The given Iterable of ids must not be null"); ids.forEach(id -> operations.deleteById(id, entityInformation.getJavaType())); }

Target:
public void deleteAllById(Iterable<? extends ID> ids) { Assert.notNull(ids, "The given Iterable of ids must not be null"); if (!ids.iterator().hasNext()) { return; } this.operations.delete(createIdsInQuery(ids), this.entityInformation.getJavaType()); }
Source:
public void testGetEmptyGzipResponse() throws Exception { client = new ContentEncodingHttpClient() { @Override protected ClientConnectionManager createClientConnectionManager() { return connectionManager; } }; Message message = new Message("HTTP/1.1 200 OK"); message.headers.add("Content-Length: 0"); message.headers.add("Content-Encoding: gzip"); message.headers.add("Connection: close"); testProxy.addResponse(message); HttpRequestBase request = new HttpGet(testProxy.getUrl()); HttpUtil.configureClient(client, null); HttpResponse response = HttpUtil.execute(client, null, request, null); HttpUtil.release(request, response, null); assertEquals(0, connectionManager.getConnectionsInPool()); }

Target:
public void testGetEmptyGzipResponse() throws Exception { client = new ContentEncodingHttpClient() { @Override protected ClientConnectionManager createClientConnectionManager() { return connectionManager; } }; Message message = new Message("HTTP/1.1 200 OK"); message.headers.add("Content-Length: 0"); message.headers.add("Content-Encoding: gzip"); message.headers.add("Connection: close"); testProxy.addResponse(message); HttpRequestBase request = new HttpGet(testProxy.getUrl()); HttpUtil.configureClient(client, null); HttpResponse response = HttpUtil.execute(client, null, request, null); assertEquals(1, connectionManager.getConnectionsInPool()); HttpUtil.release(request, response, null); assertEquals(0, connectionManager.getConnectionsInPool()); }
Source:
public void shouldBeAValidXSD() throws Exception { SchemaFactory factory = SchemaFactory.newInstance("<LINK_0>"); File schemaLocation = new File("resources/cruise-config.xsd"); factory.newSchema(schemaLocation); }

Target:
public void shouldBeAValidXSD() throws Exception { SchemaFactory factory = SchemaFactory.newInstance("<LINK_0>"); factory.newSchema(new StreamSource(getClass().getResourceAsStream("/cruise-config.xsd"))); }
Source:
private boolean decodeNACK(Cardio2eTransaction receivedCardio2eTransaction, List<String> digestedTransaction) { boolean decodeComplete = false; if (digestedTransaction.size() == 3) { try { receivedCardio2eTransaction.setErrorCode(Integer.parseInt(digestedTransaction.get(2))); decodeComplete = true; } catch (IllegalArgumentException e1) { e1.printStackTrace(); } } if (digestedTransaction.size() == 4) { try { receivedCardio2eTransaction.setObjectNumber (Short.parseShort(digestedTransaction.get(2))); receivedCardio2eTransaction.setErrorCode(Integer.parseInt(digestedTransaction.get(3))); decodeComplete = true; } catch (IllegalArgumentException e1) { e1.printStackTrace(); } } return decodeComplete; }

Target:
private boolean decodeNACK(Cardio2eTransaction receivedCardio2eTransaction, List<String> digestedTransaction) { boolean decodeComplete = false; if (digestedTransaction.size() == 3) { try { receivedCardio2eTransaction.setErrorCode(Integer .parseInt(digestedTransaction.get(2))); decodeComplete = true; } catch (IllegalArgumentException ex) { logger.warn( "Illegal argument in decoding NACK transaction: '{}'", ex.toString()); } } if (digestedTransaction.size() == 4) { try { receivedCardio2eTransaction.setObjectNumber(Short .parseShort(digestedTransaction.get(2))); receivedCardio2eTransaction.setErrorCode(Integer .parseInt(digestedTransaction.get(3))); decodeComplete = true; } catch (IllegalArgumentException ex) { logger.warn( "Illegal argument in decoding NACK transaction: '{}'", ex.toString()); } } return decodeComplete; }
Source:
public void devModeInitializerToWebpackUpIsBelowThreshold() { getDriver().get(getRootURL()); waitForDevServer(); long timeoutTime = System.currentTimeMillis() + 20000; while (System.currentTimeMillis() < timeoutTime && !isElementPresent(By.id("performance-component"))) { getDriver().navigate().refresh(); } int startupTime = measureLogEntryTimeDistance( "- Starting dev-mode updaters in", "- (Started|Reusing) webpack-dev-server", true); int npmInstallTime = measureLogEntryTimeDistance( "- Running `pnpm install`", "- Frontend dependencies resolved successfully", false); int startupTimeWithoutNpmInstallTime = startupTime - npmInstallTime; final int thresholdMs = Boolean.getBoolean( System.getProperty("vaadin.useDeprecatedV14Bootstrapping")) ? 3000 : 1000; Assert.assertTrue( String.format("startup time expected <= %d but was %d", thresholdMs, startupTimeWithoutNpmInstallTime), startupTimeWithoutNpmInstallTime <= thresholdMs); }

Target:
public void devModeInitializerToWebpackUpIsBelowThreshold() { getDriver().get(getRootURL()); waitForDevServer(); long timeoutTime = System.currentTimeMillis() + 20000; while (System.currentTimeMillis() < timeoutTime && !isElementPresent(By.id("performance-component"))) { getDriver().navigate().refresh(); } int startupTime = measureLogEntryTimeDistance( "- Starting dev-mode updaters in", "- (Started|Reusing) webpack-dev-server", true); int npmInstallTime = measureLogEntryTimeDistance( "- Running `pnpm install`", "- Frontend dependencies resolved successfully", false); int startupTimeWithoutNpmInstallTime = startupTime - npmInstallTime; final int thresholdMs = Boolean.getBoolean( System.getProperty("vaadin.useDeprecatedV14Bootstrapping")) ? 5500 : 10000; Assert.assertTrue( String.format("startup time expected <= %d but was %d", thresholdMs, startupTimeWithoutNpmInstallTime), startupTimeWithoutNpmInstallTime <= thresholdMs); }
Source:
public static void setAuthorText(@NonNull TextView textView, @NonNull IAuthorData authorData) { final CharSequence authorText; { final Context context = textView.getContext(); List<CharSequence> joinableStrings = new ArrayList<>(); final String author = authorData.getAuthor(); if (!TextUtils.isEmpty(author)) { final SpannableString authorSpan = new SpannableString(author); authorSpan.setSpan(new ForegroundColorSpan( context.getResources().getColor(R.color.edx_brand_primary_base)), 0, authorSpan.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); authorSpan.setSpan(new StyleSpan(Typeface.BOLD), 0, authorSpan.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); joinableStrings.add(authorSpan); } final String authorLabel = authorData.getAuthorLabel(); if (!TextUtils.isEmpty(authorLabel)) { joinableStrings.add(ResourceUtil.getFormattedString(context.getResources(), R.string.discussion_post_author_label_attribution, "text", authorLabel)); } authorText = org.edx.mobile.util.TextUtils.join(" ", joinableStrings); } if (TextUtils.isEmpty(authorText)) { textView.setVisibility(View.GONE); } else { textView.setText(authorText); } }

Target:
public static void setAuthorText(@NonNull TextView textView, @NonNull IAuthorData authorData) { final CharSequence authorText; { final Context context = textView.getContext(); List<CharSequence> joinableStrings = new ArrayList<>(); final String author = authorData.getAuthor(); if (!TextUtils.isEmpty(author)) { final SpannableString authorSpan = new SpannableString(author); applyColorAndStyle(context, authorSpan, R.color.edx_brand_primary_base, Typeface.BOLD); joinableStrings.add(authorSpan); } final String authorLabel = authorData.getAuthorLabel(); if (!TextUtils.isEmpty(authorLabel)) { joinableStrings.add(ResourceUtil.getFormattedString(context.getResources(), R.string.discussion_post_author_label_attribution, "text", authorLabel)); } authorText = org.edx.mobile.util.TextUtils.join(" ", joinableStrings); } if (TextUtils.isEmpty(authorText)) { textView.setVisibility(View.GONE); } else { textView.setText(authorText); } }
Source:
public void addCluster(String clusterName, boolean overwritePrevious, CloudConfig cloudConfig) throws HelixException { if (cloudConfig != null) { if (cloudConfig.isCloudEnabled()) { String cloudID = cloudConfig.getCloudID(); String cloudProvider = cloudConfig.getCloudProvider(); List<String> cloudInfoSources = cloudConfig.getCloudInfoSources(); String cloudProcessorName = cloudConfig.getCloudInfoProcessorName(); CloudConfig.Builder builder = new CloudConfig.Builder(clusterName, true, CloudProvider.valueOf(cloudProvider), cloudID, cloudInfoSources, cloudProcessorName); CloudConfig validatedCloudConfig = builder.build(); addCluster(clusterName, overwritePrevious); _admin.addCloudConfig(clusterName, validatedCloudConfig); } else { addCluster(clusterName, overwritePrevious); } } else { throw new HelixException("Cannot add the cluster, cloudConfig is null!"); } }

Target:
public void addCluster(String clusterName, boolean overwritePrevious, CloudConfig cloudConfig) throws HelixException { _admin.addCluster(clusterName, overwritePrevious); for (BuiltInStateModelDefinitions def : BuiltInStateModelDefinitions.values()) { addStateModelDef(clusterName, def.getStateModelDefinition().getId(), def.getStateModelDefinition(), overwritePrevious); } if (cloudConfig != null) { _admin.addCloudConfig(clusterName, cloudConfig); } }
Source:
public Response get(@PathParam("path") String path, @QueryParam("command") String commandStr) { ZooKeeperCommand cmd = getZooKeeperCommandIfPresent(commandStr); if (cmd == null) { return badRequest("Invalid ZooKeeper command: " + commandStr); } ServerContext _serverContext = (ServerContext) _application.getProperties().get(ContextPropertyKeys.SERVER_CONTEXT.name()); _zkBaseDataAccessor = _serverContext.getByteArrayZkBaseDataAccessor(); path = "/" + path; if (!ZkValidationUtil.isPathValid(path)) { String errMsg = "The given path is not a valid ZooKeeper path: " + path; LOG.info(errMsg); return badRequest(errMsg); } switch (cmd) { case exists: return exists(_zkBaseDataAccessor, path); case getBinaryData: return getBinaryData(_zkBaseDataAccessor, path); case getStringData: return getStringData(_zkBaseDataAccessor, path); case getChildren: return getChildren(_zkBaseDataAccessor, path); case getStat: return getStat(_zkBaseDataAccessor, path); case delete: return delete(_zkBaseDataAccessor, path); default: String errMsg = "Unsupported command: " + commandStr; LOG.error(errMsg); return badRequest(errMsg); } }

Target:
public Response get(@PathParam("path") String path, @QueryParam("command") String commandStr) { ZooKeeperCommand cmd = getZooKeeperCommandIfPresent(commandStr); if (cmd == null) { return badRequest("Invalid ZooKeeper command: " + commandStr); } ServerContext _serverContext = (ServerContext) _application.getProperties().get(ContextPropertyKeys.SERVER_CONTEXT.name()); _zkBaseDataAccessor = _serverContext.getByteArrayZkBaseDataAccessor(); if (!ZkValidationUtil.isPathValid(path)) { String errMsg = "The given path is not a valid ZooKeeper path: " + path; LOG.info(errMsg); return badRequest(errMsg); } switch (cmd) { case exists: return exists(_zkBaseDataAccessor, path); case getBinaryData: return getBinaryData(_zkBaseDataAccessor, path); case getStringData: return getStringData(_zkBaseDataAccessor, path); case getChildren: return getChildren(_zkBaseDataAccessor, path); case getStat: return getStat(_zkBaseDataAccessor, path); default: String errMsg = "Unsupported command: " + commandStr; LOG.error(errMsg); return badRequest(errMsg); } }
Source:
public boolean performNextOperation(int completedChildCount) { syncChildCommandList(getParameters().getCommandStep(), getParameters().getChildCommands()); Guid currentChildId = getCurrentChildId(getParameters().getCommandStep(), getParameters().getChildCommands()); if (currentChildId != null) { getParameters().setCommandStep(getParameters().getNextCommandStep()); } log.info("Executing Cold Merge command step '{}'", getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: nextCommand = new Pair<>(VdcActionType.PrepareMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.MERGE); break; case MERGE: nextCommand = new Pair<>(VdcActionType.ColdMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.FINALIZE_MERGE); break; case FINALIZE_MERGE: break; case DESTROY_IMAGE: break; case DESTROY_IMAGE_CHECK: break; case COMPLETE: getParameters().setDestroyImageCommandComplete(true); setCommandStatus(CommandStatus.SUCCEEDED); break; } persistCommand(getParameters().getParentCommand(), true); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }

Target:
public boolean performNextOperation(int completedChildCount) { log.info("Executing Cold Merge command step '{}'", getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: nextCommand = new Pair<>(VdcActionType.PrepareMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.MERGE); break; case MERGE: nextCommand = new Pair<>(VdcActionType.ColdMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.FINALIZE_MERGE); break; case FINALIZE_MERGE: break; case DESTROY_IMAGE: break; case DESTROY_IMAGE_CHECK: break; case COMPLETE: getParameters().setDestroyImageCommandComplete(true); setCommandStatus(CommandStatus.SUCCEEDED); break; } persistCommand(getParameters().getParentCommand(), true); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }
Source:
public void removeEdge(Source source, Sink sink, String streamId, Stream.Grouping grouping) { Iterator<Edge> it = dag.get(source).iterator(); Edge edge = new Edge(source, sink, streamId, grouping); while (it.hasNext()) { Edge e = it.next(); if (e.getSink().equals(sink)) { e.removeStreamGrouping(new StreamGrouping(source.getStream(streamId), grouping)); if(e.getStreamGroupings().isEmpty()) { it.remove(); } break; } } }

Target:
public void removeEdge(Source source, Sink sink, String streamId, Stream.Grouping grouping) { Iterator<Edge> it = dag.get(source).iterator(); while (it.hasNext()) { Edge e = it.next(); if (e.getSink().equals(sink)) { e.removeStreamGrouping(new StreamGrouping(source.getStream(streamId), grouping)); if(e.getStreamGroupings().isEmpty()) { it.remove(); } break; } } }
Source:
public void setParameters(int commandId, Object[] args) { if (commandId != COMMAND_ID) throw new IllegalStateException("Unsupported command id:" + commandId); int i = 0; globalTx = (GlobalTransaction) args[i++]; unlock = (Boolean) args[i++]; keys = (List<Object>) args[i++]; flags = (EnumSet<Flag>) args[i]; }

Target:
public void setParameters(int commandId, Object[] args) { if (commandId != COMMAND_ID) throw new IllegalStateException("Unsupported command id:" + commandId); int i = 0; globalTx = (GlobalTransaction) args[i++]; unlock = (Boolean) args[i++]; keys = (List<Object>) args[i++]; flags = (Set<Flag>) args[i]; }
Source:
public Response installExtensionByURL( final @PathParam("url") @ApiParam(value = "extension install URL", required = true) String url) { try { URI extensionURI = new URI(url); String extensionId = getExtensionId(extensionURI); installExtension(extensionId); } catch (Exception e) { logger.error("Exception while parsing the extension URL '{}': {}", url, e.getMessage()); return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "The given URL is malformed or not valid."); } return Response.ok().build(); }

Target:
public Response installExtensionByURL( final @PathParam("url") @ApiParam(value = "extension install URL", required = true) String url) { try { URI extensionURI = new URI(url); String extensionId = getExtensionId(extensionURI); installExtension(extensionId); } catch (URISyntaxException | IllegalArgumentException e) { logger.error("Exception while parsing the extension URL '{}': {}", url, e.getMessage()); return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "The given URL is malformed or not valid."); } return Response.ok().build(); }
Source:
private ExpressionNode doReplaceLiteral(@Transient ExpressionNode node, QueryModel translatingModel, QueryModel innerModel, QueryModel validatingModel) throws SqlException { final LowerCaseCharSequenceObjHashMap<CharSequence> map = translatingModel.getColumnNameToAliasMap(); int index = map.keyIndex(node.token); if (index > -1) { final int joinCount = validatingModel.getJoinModels().size(); if (joinCount > 1) { boolean found = false; final StringSink sink = Misc.getThreadLocalBuilder(); sink.clear(); for (int i = 0; i < joinCount; i++) { final QueryModel jm = validatingModel.getJoinModels().getQuick(i); if (jm.getAliasToColumnMap().keyIndex(node.token) < 0) { if (found) { throw SqlException.ambiguousColumn(node.position); } if (jm.getAlias() != null) { sink.put(jm.getAlias().token); } else { sink.put(jm.getTableName().token); } sink.put('.'); sink.put(node.token); if ((index = map.keyIndex(sink)) < 0) { found = true; } } } if (found) { return nextLiteral(map.valueAt(index), node.position); } } CharSequence alias = createColumnAlias(node, translatingModel); QueryColumn column = queryColumnPool.next().of(alias, node); addColumnToTranslatingModel(column, translatingModel, validatingModel); if (innerModel != null) { innerModel.addBottomUpColumn(column); } return nextLiteral(alias, node.position); } return nextLiteral(map.valueAt(index), node.position); }

Target:
private ExpressionNode doReplaceLiteral(@Transient ExpressionNode node, QueryModel translatingModel, QueryModel innerModel, QueryModel validatingModel) throws SqlException { final LowerCaseCharSequenceObjHashMap<CharSequence> map = translatingModel.getColumnNameToAliasMap(); int index = map.keyIndex(node.token); if (index > -1) { final int joinCount = validatingModel.getJoinModels().size(); if (joinCount > 1) { boolean found = false; final StringSink sink = Misc.getThreadLocalBuilder(); sink.clear(); for (int i = 0; i < joinCount; i++) { final QueryModel jm = validatingModel.getJoinModels().getQuick(i); if (jm.getAliasToColumnMap().keyIndex(node.token) < 0) { if (found) { throw SqlException.ambiguousColumn(node.position); } if (jm.getAlias() != null) { sink.put(jm.getAlias().token); } else { sink.put(jm.getTableName().token); } sink.put('.'); sink.put(node.token); if ((index = map.keyIndex(sink)) < 0) { found = true; } } } if (found) { return nextLiteral(map.valueAtQuick(index), node.position); } } CharSequence alias = createColumnAlias(node, translatingModel); QueryColumn column = queryColumnPool.next().of(alias, node); addColumnToTranslatingModel(column, translatingModel, validatingModel); if (innerModel != null) { innerModel.addBottomUpColumn(column); } return nextLiteral(alias, node.position); } return nextLiteral(map.valueAtQuick(index), node.position); }