auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean validateHosts() { List<Guid> hostIds = getParameters().getAffinityGroup().getVdsIds(); if (hostIds.isEmpty()) { if (getParameters().getAffinityGroup().isVdsAffinityEnabled()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_AFFINITY_GROUP_WITH_HOST_AFFINITY_BUT_NO_HOSTS, String.format("$polarity %s", getAffinityGroup().isVdsPositive() ? "positive": "negative")); } return true; } Map<Guid, VdsStatic> hosts = vdsStaticDao.getByIds(hostIds).stream() .collect(Collectors.toMap(VdsStatic::getId, host -> host)); Set<Guid> vdsSet = new HashSet<>(); for (Guid vdsId : hostIds) { VdsStatic vdsStatic = hosts.get(vdsId); if (vdsStatic == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_INVALID_ENTITY_FOR_AFFINITY_GROUP, String .format("$entity %s", Entity_VDS)); } if (!Objects.equals(vdsStatic.getClusterId(), getClusterId())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_ENTITY_NOT_IN_AFFINITY_GROUP_CLUSTER, String .format("$entity %s", Entity_VDS)); } if (vdsSet.contains(vdsStatic.getId())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_DUPLICATE_ENTITY_IN_AFFINITY_GROUP, String .format("$entity %s", Entity_VDS)); } vdsSet.add(vdsStatic.getId()); } return true; }

Target:
private boolean validateHosts() { List<Guid> hostIds = getParameters().getAffinityGroup().getVdsIds(); if (hostIds.isEmpty()) { return true; } Map<Guid, VdsStatic> hosts = vdsStaticDao.getByIds(hostIds).stream() .collect(Collectors.toMap(VdsStatic::getId, host -> host)); Set<Guid> vdsSet = new HashSet<>(); for (Guid vdsId : hostIds) { VdsStatic vdsStatic = hosts.get(vdsId); if (vdsStatic == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_INVALID_ENTITY_FOR_AFFINITY_GROUP, String .format("$entity %s", Entity_VDS)); } if (!Objects.equals(vdsStatic.getClusterId(), getClusterId())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_ENTITY_NOT_IN_AFFINITY_GROUP_CLUSTER, String .format("$entity %s", Entity_VDS)); } if (vdsSet.contains(vdsStatic.getId())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_DUPLICATE_ENTITY_IN_AFFINITY_GROUP, String .format("$entity %s", Entity_VDS)); } vdsSet.add(vdsStatic.getId()); } return true; }
Source:
public void stop() throws MuleException { super.stop(); stopIfNeeded(delegate); stopIfNeeded(backpressureHandler); disposeIfNeeded(sink, logger); sink = null; if (reactorScheduler != null) { reactorScheduler.dispose(); reactorScheduler = null; } stopIfNeeded(processingStrategy); }

Target:
public void stop() throws MuleException { super.stop(); stopIfNeeded(delegate); safely(() -> stopIfNeeded(backpressureHandler)); disposeIfNeeded(sink, logger); sink = null; if (reactorScheduler != null) { reactorScheduler.dispose(); reactorScheduler = null; } stopIfNeeded(processingStrategy); }
Source:
protected void loadConfigFile(String filename, Map<String, byte[]> configs) { if (filename != null) { try { InputStream is = getClass().getClassLoader().getResourceAsStream(filename); ByteArrayOutputStream bos = new ByteArrayOutputStream(); int length; byte[] content = new byte[1024]; while ((length = is.read(content, 0, content.length)) != -1) { bos.write(content, 0, length); } configs.put(filename, bos.toByteArray()); } catch (Exception e) { log.error("Error while reading configuration file (" + filename + ")", e); } } }

Target:
private void loadConfigFile(String filename, Map<String, byte[]> configs) { if (filename != null) { try { InputStream is = getClass().getClassLoader().getResourceAsStream(filename); configs.put(filename, Utils.readAsBytes(is)); } catch (Exception e) { log.error("Error while reading configuration file (" + filename + ")", e); } } }
Source:
private static Response responseWithHeaders(ResponseBuilder builder, ProxyResponse response) { response.getHeaders().asMap().forEach((headerName, values) -> { String name = headerName.toString(); if (isPrestoHeader(name) || name.equalsIgnoreCase(SET_COOKIE)) { values.forEach(value -> builder.header(name, value)); } }); return builder.build(); }

Target:
private static Response responseWithHeaders(ResponseBuilder builder, ProxyResponse response) { response.getHeaders().forEach((headerName, value) -> { String name = headerName.toString(); if (isPrestoHeader(name) || name.equalsIgnoreCase(SET_COOKIE)) { builder.header(name, value); } }); return builder.build(); }
Source:
public static void openInEditor(Location location, IWorkbenchPage page) { IEditorPart part = null; IDocument targetDocument = null; IResource targetResource = LSPEclipseUtils.findResourceFor(location.getUri()); try { if (targetResource != null && targetResource.getType() == IResource.FILE) { part = IDE.openEditor(page, (IFile) targetResource); targetDocument = FileBuffers.getTextFileBufferManager() .getTextFileBuffer(targetResource.getFullPath(), LocationKind.IFILE).getDocument(); } else { URI fileUri = URI.create(location.getUri()); part = IDE.openEditor(page, fileUri, getEditorId(page, location.getUri()), true); targetDocument = FileBuffers.getTextFileBufferManager() .getTextFileBuffer(new Path(fileUri.getPath()), LocationKind.LOCATION).getDocument(); } } catch (PartInitException e) { e.printStackTrace(); } try { if (part instanceof AbstractTextEditor) { AbstractTextEditor editor = (AbstractTextEditor) part; int offset = LSPEclipseUtils.toOffset(location.getRange().getStart(), targetDocument); int endOffset = LSPEclipseUtils.toOffset(location.getRange().getEnd(), targetDocument); editor.getSelectionProvider() .setSelection(new TextSelection(offset, endOffset > offset ? endOffset - offset : 0)); } } catch (BadLocationException e) { e.printStackTrace(); } }

Target:
public static void openInEditor(Location location, IWorkbenchPage page) { IEditorPart part = null; IDocument targetDocument = null; IResource targetResource = LSPEclipseUtils.findResourceFor(location.getUri()); try { if (targetResource != null && targetResource.getType() == IResource.FILE) { part = IDE.openEditor(page, (IFile) targetResource); targetDocument = FileBuffers.getTextFileBufferManager() .getTextFileBuffer(targetResource.getFullPath(), LocationKind.IFILE).getDocument(); } else { URI fileUri = URI.create(location.getUri()).normalize(); IFileStore fileStore = EFS.getLocalFileSystem().getStore(fileUri); IFileInfo fetchInfo = fileStore.fetchInfo(); if (!fetchInfo.isDirectory() && fetchInfo.exists()) { part = IDE.openEditorOnFileStore(page, fileStore); ITextFileBuffer fileStoreTextFileBuffer = FileBuffers.getTextFileBufferManager() .getFileStoreTextFileBuffer(fileStore); targetDocument = fileStoreTextFileBuffer.getDocument(); } } } catch (PartInitException e) { e.printStackTrace(); } try { if (part instanceof AbstractTextEditor) { AbstractTextEditor editor = (AbstractTextEditor) part; int offset = LSPEclipseUtils.toOffset(location.getRange().getStart(), targetDocument); int endOffset = LSPEclipseUtils.toOffset(location.getRange().getEnd(), targetDocument); editor.getSelectionProvider() .setSelection(new TextSelection(offset, endOffset > offset ? endOffset - offset : 0)); } } catch (BadLocationException e) { e.printStackTrace(); } }
Source:
private void setCoordinates(long start, long end) { if (start < 0 || end < 0) { throw new IllegalArgumentException("Variant co-ordinate cannot be negative: " + this.toString()); } if (end < start) { throw new IllegalArgumentException("End position must be equal or greater than the start position"); } this.start = start; this.end = end; }

Target:
private void setCoordinates(long start, long end) { if (start < 0) { throw new IllegalArgumentException(VARIANT_START_COORDINATE_CANNOT_BE_NEGATIVE); } if (end < 0) { throw new IllegalArgumentException(VARIANT_END_COORDINATE_CANNOT_BE_NEGATIVE); } if (end < start) { throw new IllegalArgumentException(END_POSITION_MUST_BE_EQUAL_OR_GREATER_THAN_THE_START_POSITION); } this.start = start; this.end = end; }
Source:
public void shouldDeserializeValues(Object memoryLimit, Object parsedLimit) throws ValidationException { ComposeRecipe service = factory.doParse(String.format(RECIPE_WITHOUT_COMMAND_VALUE, memoryLimit)); assertEquals(service.getServices().get("machine1").getMemLimit(), parsedLimit); }

Target:
public void shouldDeserializeValues(Object memoryLimit, Object parsedLimit) throws ValidationException { ComposeRecipe recipe = factory.doParse(String.format(RECIPE_WITHOUT_MEMORY_LIMIT, memoryLimit)); assertEquals(recipe.getServices().get("machine1").getMemLimit(), parsedLimit); }
Source:
private Long createProviderTestTask() { TaskTriggerInformation triggerInformation = new TaskTriggerInformation("CREATE SettingsRecord", "data-services", MDS_CHANNEL_NAME, VERSION, TRIGGER_SUBJECT, TRIGGER_SUBJECT); TaskActionInformation actionInformation = new TaskActionInformation("Create Patient [" + DEFAULT_CONFIG_NAME + "]", OPENMRS_CHANNEL_NAME, OPENMRS_CHANNEL_NAME, VERSION, TEST_INTERFACE, "createPatient"); actionInformation.setSubject("validate"); SortedSet<TaskConfigStep> taskConfigStepSortedSet = new TreeSet<>(); taskConfigStepSortedSet.add(createProviderDataSource()); TaskConfig taskConfig = new TaskConfig(); taskConfig.addAll(taskConfigStepSortedSet); Map<String, String> values = new HashMap<>(); values.put(Keys.GIVEN_NAME, "GivenName"); values.put(Keys.FAMILY_NAME, "FamilyName"); values.put(Keys.ADDRESS_1, "{{ad.openMRS.Provider-" + DEFAULT_CONFIG_NAME + "#0.uuid}}"); values.put(Keys.ADDRESS_2, "{{ad.openMRS.Provider-" + DEFAULT_CONFIG_NAME + "#0.identifier}}"); values.put(Keys.ADDRESS_3, "{{ad.openMRS.Provider-" + DEFAULT_CONFIG_NAME + "#0.person.uuid}}"); values.put(Keys.GENDER, "M"); values.put(Keys.MOTECH_ID, TEST_MOTECH_ID); values.put(Keys.CONFIG_NAME, DEFAULT_CONFIG_NAME); actionInformation.setValues(values); Task task = new Task("OpenMRSProviderTestTask", triggerInformation, Arrays.asList(actionInformation), taskConfig, true, true); getTaskService().save(task); getTriggerHandler().registerHandlerFor(task.getTrigger().getEffectiveListenerSubject()); return task.getId(); }

Target:
private Long createProviderTestTask() { TaskTriggerInformation triggerInformation = new TaskTriggerInformation("CREATE SettingsRecord", "data-services", MDS_CHANNEL_NAME, VERSION, TRIGGER_SUBJECT, TRIGGER_SUBJECT); TaskActionInformation actionInformation = new TaskActionInformation("Create Patient [" + DEFAULT_CONFIG_NAME + "]", OPENMRS_CHANNEL_NAME, OPENMRS_CHANNEL_NAME, VERSION, TEST_INTERFACE, "createPatient"); actionInformation.setSubject("validate"); SortedSet<TaskConfigStep> taskConfigStepSortedSet = new TreeSet<>(); taskConfigStepSortedSet.add(createProviderDataSource()); TaskConfig taskConfig = new TaskConfig(); taskConfig.addAll(taskConfigStepSortedSet); Map<String, String> values = new HashMap<>(); values.put(Keys.GIVEN_NAME, "GivenName"); values.put(Keys.FAMILY_NAME, "FamilyName"); values.put(Keys.ADDRESS_1, "{{ad.openMRS.Provider-" + DEFAULT_CONFIG_NAME + "#0.uuid}}"); values.put(Keys.ADDRESS_2, "{{ad.openMRS.Provider-" + DEFAULT_CONFIG_NAME + "#0.identifier}}"); values.put(Keys.ADDRESS_3, "{{ad.openMRS.Provider-" + DEFAULT_CONFIG_NAME + "#0.person.uuid}}"); values.put(Keys.GENDER, "M"); values.put(Keys.MOTECH_ID, TEST_MOTECH_ID); values.put(Keys.CONFIG_NAME, DEFAULT_CONFIG_NAME); actionInformation.setValues(values); Task task = new Task("OpenMRSProviderTestTask", triggerInformation, Collections.singletonList(actionInformation), taskConfig, true, true); getTaskService().save(task); getTriggerHandler().registerHandlerFor(task.getTrigger().getEffectiveListenerSubject()); return task.getId(); }
Source:
private void init() throws Exception { mOffsetTracker = new OffsetTracker(); mMessageReader = new MessageReader(mConfig, mOffsetTracker); FileRegistry fileRegistry = new FileRegistry(mConfig); UploadManager uploadManager = ReflectionUtil.createUploadManager(mConfig.getUploadManagerClass(), mConfig); mUploader = ReflectionUtil.createUploader(mConfig.getUploaderClass(), mConfig, mOffsetTracker, fileRegistry, uploadManager); mMessageWriter = new MessageWriter(mConfig, mOffsetTracker, fileRegistry); mMessageParser = ReflectionUtil.createMessageParser(mConfig.getMessageParserClass(), mConfig); mMessageTransformer = ReflectionUtil.createMessageTransformer(mConfig.getMessageTransformerClass(), mConfig); mUnparsableMessages = 0.; }

Target:
private void init() throws Exception { mOffsetTracker = new OffsetTracker(); mMessageReader = new MessageReader(mConfig, mOffsetTracker); FileRegistry fileRegistry = new FileRegistry(mConfig); UploadManager uploadManager = ReflectionUtil.createUploadManager(mConfig.getUploadManagerClass(), mConfig); mUploader = ReflectionUtil.createUploader(mConfig.getUploaderClass()); mUploader.init(mConfig, mOffsetTracker, fileRegistry, uploadManager); mMessageWriter = new MessageWriter(mConfig, mOffsetTracker, fileRegistry); mMessageParser = ReflectionUtil.createMessageParser(mConfig.getMessageParserClass(), mConfig); mMessageTransformer = ReflectionUtil.createMessageTransformer(mConfig.getMessageTransformerClass(), mConfig); mUnparsableMessages = 0.; }
Source:
public void setUp() { registry = new CollectorRegistry(); noLabels = Summary.build().name("nolabels").help("help").register(registry); labels = Summary.build().name("labels").help("help").labelNames("l").register(registry); noLabelsAndQuantiles = Summary.build() .quantile(0.5, 0.05) .quantile(0.9, 0.01) .quantile(0.99, 0.001) .name("noLabelsAndQuantiles").help("help").register(registry); labelsAndQuantiles = Summary.build() .quantile(0.5, 0.05) .quantile(0.9, 0.01) .quantile(0.99, 0.001) .labelNames("l") .name("labelsAndQuantiles").help("help").register(registry); }

Target:
public void setUp() { registry = new CollectorRegistry(); noLabels = Summary.build().name("nolabels").help("help").register(registry); labels = Summary.build().name("labels").help("help").labelNames("l").register(registry); noLabelsAndQuantiles = Summary.build() .quantile(0.5, 0.05) .quantile(0.9, 0.01) .quantile(0.99, 0.001) .name("no_labels_and_quantiles").help("help").register(registry); labelsAndQuantiles = Summary.build() .quantile(0.5, 0.05) .quantile(0.9, 0.01) .quantile(0.99, 0.001) .labelNames("l") .name("labels_and_quantiles").help("help").register(registry); }
Source:
public Single<String> getCaptionByWikibaseIdentifier(String wikibaseIdentifier) { return mediaDetailInterface.getCaptionForImage(Locale.getDefault().getLanguage(), wikibaseIdentifier) .map(mediaDetailResponse -> { if (mediaDetailResponse != null && mediaDetailResponse.getSuccess() != null && mediaDetailResponse.getSuccess() == 1 && mediaDetailResponse.getEntities() != null) { Map<String, CommonsWikibaseItem> entities = mediaDetailResponse.getEntities(); try { Map.Entry<String, CommonsWikibaseItem> entry = entities.entrySet().iterator().next(); CommonsWikibaseItem commonsWikibaseItem = entry.getValue(); Map<String, Caption> labels = commonsWikibaseItem.getLabels(); Map.Entry<String, Caption> captionEntry = labels.entrySet().iterator().next(); Caption caption = captionEntry.getValue(); return caption.getValue(); } catch (Exception e) { return NO_CAPTION; } } return NO_CAPTION; }) .singleOrError(); }

Target:
public Single<String> getCaptionByWikibaseIdentifier(String wikibaseIdentifier) { return mediaDetailInterface.getCaptionForImage(Locale.getDefault().getLanguage(), wikibaseIdentifier) .map(mediaDetailResponse -> { if (isSuccess(mediaDetailResponse)) { for (Entity wikibaseItem : mediaDetailResponse.entities().values()) { for (Label label : wikibaseItem.labels().values()) { return label.value(); } } } return NO_CAPTION; }) .singleOrError(); }
Source:
public static void beforeClass() { String envId = StringUtils.defaultIfBlank(System.getenv(SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR), System.getenv(SDKGlobalConfiguration.ALTERNATE_ACCESS_KEY_ENV_VAR)); String envSecret = StringUtils.defaultIfBlank(System.getenv(SDKGlobalConfiguration.SECRET_KEY_ENV_VAR), System.getenv(SDKGlobalConfiguration.ALTERNATE_SECRET_KEY_ENV_VAR)); String envToken = StringUtils.defaultIfBlank(System.getenv(SDKGlobalConfiguration.AWS_SESSION_TOKEN_ENV_VAR), ""); String envBucketName = StringUtils.defaultIfBlank(System.getenv("AWS_BUCKET_NAME_ENV_VAR"),"nuxeo-s3-directupload"); String envBucketPrefix = StringUtils.defaultIfBlank(System.getenv("AWS_BUCKET_PREFIX_ENV_VAR"),"testfolder/"); String envBucketRegion = StringUtils.defaultIfBlank(System.getenv("AWS_BUCKET_REGION_ENV_VAR"),"eu-west-3"); assumeTrue("AWS Credentials not set in the environment variables", StringUtils.isNoneBlank(envId, envSecret)); PROPERTIES = new HashMap<>(); PROPERTIES.put(AWS_ID_PROPERTY, envId); PROPERTIES.put(AWS_SECRET_PROPERTY, envSecret); PROPERTIES.put(AWS_SESSION_TOKEN_PROPERTY, envToken); PROPERTIES.put(BUCKET_NAME_PROPERTY, envBucketName); PROPERTIES.put(BUCKET_PREFIX_PROPERTY, envBucketPrefix); PROPERTIES.put(S3BinaryManager.BUCKET_REGION_PROPERTY, envBucketRegion); }

Target:
public static void beforeClass() { String envId = StringUtils.defaultIfBlank(System.getenv(SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR), System.getenv(SDKGlobalConfiguration.ALTERNATE_ACCESS_KEY_ENV_VAR)); String envSecret = StringUtils.defaultIfBlank(System.getenv(SDKGlobalConfiguration.SECRET_KEY_ENV_VAR), System.getenv(SDKGlobalConfiguration.ALTERNATE_SECRET_KEY_ENV_VAR)); String envToken = StringUtils.defaultIfBlank(System.getenv(SDKGlobalConfiguration.AWS_SESSION_TOKEN_ENV_VAR), ""); String envBucketName = StringUtils.defaultIfBlank(System.getenv(BUCKET_NAME_NUXEO_TEST), "nuxeo-s3-directupload"); String envBucketPrefix = StringUtils.defaultIfBlank(System.getenv(BUCKET_PREFIX_NUXEO_TEST), "testfolder/"); String envBucketRegion = StringUtils.defaultIfBlank(System.getenv(BUCKET_REGION_NUXEO_TEST), "eu-west-3"); assumeTrue("AWS Credentials not set in the environment variables", StringUtils.isNoneBlank(envId, envSecret)); PROPERTIES = new HashMap<>(); PROPERTIES.put(AWS_ID_PROPERTY, envId); PROPERTIES.put(AWS_SECRET_PROPERTY, envSecret); PROPERTIES.put(AWS_SESSION_TOKEN_PROPERTY, envToken); PROPERTIES.put(BUCKET_NAME_PROPERTY, envBucketName); PROPERTIES.put(BUCKET_PREFIX_PROPERTY, envBucketPrefix); PROPERTIES.put(S3BinaryManager.BUCKET_REGION_PROPERTY, envBucketRegion); }
Source:
public boolean hasInflightRequests() { return !pendingOperationsWithSize.isEmpty(); }

Target:
public synchronized boolean hasInflightRequests() { return !pendingOperationsWithSize.isEmpty(); }
Source:
FlatTextInputFormat( @Nullable List<String> columns, @Nullable String listDelimiter, String delimiter, @Nullable Boolean hasHeaderRow, @Nullable Boolean findColumnsFromHeader, int skipHeaderRows ) { this.columns = columns == null ? Collections.emptyList() : columns; this.listDelimiter = listDelimiter; this.delimiter = Preconditions.checkNotNull(delimiter, "delimiter"); if (columns == null || columns.isEmpty()) { this.findColumnsFromHeader = Checks.checkOneNotNullOrEmpty( ImmutableList.of( new Property<>("hasHeaderRow", hasHeaderRow), new Property<>("findColumnsFromHeader", findColumnsFromHeader) ) ).getValue(); } else { this.findColumnsFromHeader = false; } this.skipHeaderRows = skipHeaderRows; Preconditions.checkArgument( !delimiter.equals(listDelimiter), "Cannot have same delimiter and list delimiter of [%s]", delimiter ); if (!this.columns.isEmpty()) { for (String column : this.columns) { Preconditions.checkArgument( !column.contains(delimiter), "Column[%s] cannot have the delimiter[" + delimiter + "] in its name", column ); } } else { Preconditions.checkArgument( this.findColumnsFromHeader, "If columns field is not set, the first row of your data must have your header" + " and hasHeaderRow must be set to true." ); } }

Target:
FlatTextInputFormat( @Nullable List<String> columns, @Nullable String listDelimiter, String delimiter, @Nullable Boolean hasHeaderRow, @Nullable Boolean findColumnsFromHeader, int skipHeaderRows ) { this.columns = columns == null ? Collections.emptyList() : columns; this.listDelimiter = listDelimiter; this.delimiter = Preconditions.checkNotNull(delimiter, "delimiter"); if (columns == null || columns.isEmpty()) { this.findColumnsFromHeader = Checks.checkOneNotNullOrEmpty( ImmutableList.of( new Property<>("hasHeaderRow", hasHeaderRow), new Property<>("findColumnsFromHeader", findColumnsFromHeader) ) ).getValue(); } else { this.findColumnsFromHeader = findColumnsFromHeader == null ? false : findColumnsFromHeader; } this.skipHeaderRows = skipHeaderRows; Preconditions.checkArgument( !delimiter.equals(listDelimiter), "Cannot have same delimiter and list delimiter of [%s]", delimiter ); if (!this.columns.isEmpty()) { for (String column : this.columns) { Preconditions.checkArgument( !column.contains(delimiter), "Column[%s] cannot have the delimiter[" + delimiter + "] in its name", column ); } } else { Preconditions.checkArgument( this.findColumnsFromHeader, "If columns field is not set, the first row of your data must have your header" + " and hasHeaderRow must be set to true." ); } }
Source:
public void unload() { super.unload(); httpsInfoTabsPanel.removeAll(); }

Target:
public void unload() { super.unload(); }
Source:
static private CharBuffer copyCharBufferData(CharBuffer buffer) { if (!buffer.isDirect() && !buffer.hasArray()) { int pos = buffer.position(); CharBuffer cb = CharBuffer.allocate(buffer.capacity()).put(buffer); cb.position(pos); cb.limit(buffer.limit()); buffer.position(pos); return cb; } return buffer; }

Target:
static private CharBuffer copyCharBufferData(CharBuffer buffer) { if(!buffer.isDirect() && !buffer.hasArray()) { int pos = buffer.position(); CharBuffer cb = CharBuffer.allocate(buffer.remaining()).put(buffer); cb.position(0); buffer.position(pos); return cb; } return buffer; }
Source:
public String convertToDatabaseColumn(DescriptorLanguageSubclass attribute) { if (attribute == null) { return null; } return attribute.getShortName(); }

Target:
public String convertToDatabaseColumn(DescriptorLanguageSubclass attribute) { return attribute.getShortName(); }
Source:
public static List<Long> getSequencedDishIds(final SQLiteDatabase db) { long b = System.currentTimeMillis(); final Cursor c = db.rawQuery("SELECT dc." + DISH_ID + " FROM " + TABLE_NAME + " dc, " + CategoryTable.TABLE_NAME + " c WHERE dc." + CATEGORY_ID + " = c." + CategoryTable.CATEGORY_ID + " ORDER BY c." + CategoryTable.SORT_ORDER + ", c." + CategoryTable.CATEGORY_ID + ", " + DISH_ID, null); if (c != null) { try { List<Long> list = new ArrayList<Long>(); while (c.moveToNext()) { list.add(c.getLong(c.getColumnIndex(DISH_ID))); } System.out.println("getSequencedDishIds " + (System.currentTimeMillis()-b)); return list; } finally { c.close(); } } return Collections.emptyList(); }

Target:
public static List<Long> getSequencedDishIds(final SQLiteDatabase db) { final Cursor c = db.rawQuery("SELECT dc." + DISH_ID + " FROM " + TABLE_NAME + " dc, " + CategoryTable.TABLE_NAME + " c WHERE dc." + CATEGORY_ID + " = c." + CategoryTable.CATEGORY_ID + " ORDER BY c." + CategoryTable.SORT_ORDER + ", c." + CategoryTable.CATEGORY_ID + ", " + DISH_ID, null); if (c != null) { try { List<Long> list = new ArrayList<Long>(); while (c.moveToNext()) { list.add(c.getLong(c.getColumnIndex(DISH_ID))); } return list; } finally { c.close(); } } return Collections.emptyList(); }
Source:
static DriverConfigLoader fromClasspath( @NonNull String resourceBaseName, @NonNull ClassLoader appClassLoader) { return new DefaultDriverConfigLoader( () -> { ConfigFactory.invalidateCaches(); Config config = ConfigFactory.defaultOverrides() .withFallback( ConfigFactory.parseResourcesAnySyntax( resourceBaseName, ConfigParseOptions.defaults().setClassLoader(appClassLoader))) .withFallback(ConfigFactory.defaultReference(DRIVER_CLASS_LOADER)) .resolve(); return config.getConfig(DefaultDriverConfigLoader.DEFAULT_ROOT_PATH); }); }

Target:
static DriverConfigLoader fromClasspath( @NonNull String resourceBaseName, @NonNull ClassLoader appClassLoader) { return new DefaultDriverConfigLoader( () -> { ConfigFactory.invalidateCaches(); Config config = ConfigFactory.defaultOverrides() .withFallback( ConfigFactory.parseResourcesAnySyntax( resourceBaseName, ConfigParseOptions.defaults().setClassLoader(appClassLoader))) .withFallback(ConfigFactory.defaultReference(CqlSession.class.getClassLoader())) .resolve(); return config.getConfig(DefaultDriverConfigLoader.DEFAULT_ROOT_PATH); }); }
Source:
private boolean preDexLibraries(List<File> inputs) { if (mDisableDexMerger || inputs.size() == 1) { return true; } synchronized (semaphore) { final int count = inputs.size(); boolean successful = true; for (int i = 0; i < count && successful; i++) { File input = inputs.get(i); if (input.isFile()) { String fileName = getDexFileName(input); File dexedLib = new File(mDexedLibs, fileName); String dexedLibPath = dexedLib.getAbsolutePath(); if (!dexedLib.isFile() ) { System.out.println( String.format("Pre-Dexing %1$s -> %2$s", input.getAbsolutePath(), fileName)); if (dexedLib.isFile()) { dexedLib.delete(); } successful = runDx(input, dexedLibPath, false); } else { System.out.println( String.format("Using Pre-Dexed %1$s <- %2$s", fileName, input.getAbsolutePath())); } inputs.set(i, dexedLib); } } return successful; } }

Target:
private boolean preDexLibraries(List<File> inputs) { if (mDisableDexMerger || inputs.size() == 1) { return true; } synchronized (semaphore) { final int count = inputs.size(); for (int i = 0; i < count; i++) { File input = inputs.get(i); if (input.isFile()) { String fileName = getDexFileName(input); File dexedLib = new File(mDexedLibs, fileName); String dexedLibPath = dexedLib.getAbsolutePath(); if (!dexedLib.isFile() ) { System.out.println( String.format("Pre-Dexing %1$s -> %2$s", input.getAbsolutePath(), fileName)); if (dexedLib.isFile()) { dexedLib.delete(); } boolean dexSuccess = runDx(input, dexedLibPath, false); if (!dexSuccess) return false; } else { System.out.println( String.format("Using Pre-Dexed %1$s <- %2$s", fileName, input.getAbsolutePath())); } inputs.set(i, dexedLib); } } return true; } }
Source:
protected void makeFiles(Blob blob, String targetExt) throws CommandNotAvailable, CommandException, IOException { sourceFile = blob.getFile(); String ext = FilenameUtils.getExtension(blob.getFilename()); if (ext == null || "".equals(ext)) { if (sourceFile == null) { sourceFile = createTempSource(blob, "tmp"); } ext = ImageIdentifier.getInfo(sourceFile.getPath()).getFormat(); if (tmpFile == null) { sourceFile = createTempSource(blob, ext); } else { File newTmpFile = new File(FilenameUtils.removeExtension(tmpFile.getPath()) + "." + ext); Files.move(tmpFile.toPath(), newTmpFile.toPath()); tmpFile = newTmpFile; sourceFile = newTmpFile; } } else { if (sourceFile != null && !ext.equals(FilenameUtils.getExtension(sourceFile.getName()))) { sourceFile = null; } } if (sourceFile == null) { sourceFile = createTempSource(blob, ext); } if (targetExt == null) { targetExt = ext; } targetFile = Framework.createTempFile("nuxeoImageTarget", "." + targetExt); Framework.trackFile(targetFile, targetFile); if (tmpFile != null) { Framework.trackFile(tmpFile, tmpFile); } }

Target:
protected void makeFiles(Blob blob, String targetExt) throws CommandNotAvailable, CommandException, IOException { sourceFile = blob.getFile(); String ext = FilenameUtils.getExtension(blob.getFilename()); if (ext == null || "".equals(ext)) { if (sourceFile == null) { sourceFile = createTempSource(blob, "tmp"); } ext = ImageIdentifier.getInfo(sourceFile.getPath()).getFormat(); if (tmpFile == null) { sourceFile = createTempSource(blob, ext); } else { File newTmpFile = new File(FilenameUtils.removeExtension(tmpFile.getPath()) + "." + ext); Files.move(tmpFile.toPath(), newTmpFile.toPath()); tmpFile = newTmpFile; sourceFile = newTmpFile; } } else { if (sourceFile != null && !ext.equals(FilenameUtils.getExtension(sourceFile.getName()))) { sourceFile = null; } } if (sourceFile == null) { sourceFile = createTempSource(blob, ext); } if (targetExt == null) { targetExt = ext; } targetFile = Framework.createTempFile("nuxeoImageTarget", "." + targetExt); Framework.trackFile(targetFile, targetFile); }
Source:
private Module createSimpleModule(ModuleDescriptor moduleDescriptor, ModuleOptions moduleOptions, ModuleDeploymentProperties deploymentProperties) { if (log.isInfoEnabled()) { log.info("creating simple module " + moduleDescriptor); } ModuleDefinition definition = moduleDescriptor.getModuleDefinition(); ClassLoader moduleClassLoader = (definition.getClasspath() == null) ? null : new ParentLastURLClassLoader(definition.getClasspath(), this.classLoader); Class<? extends SimpleModule> moduleType = determineModuleType(moduleDescriptor.getModuleDefinition()); Assert.notNull(moduleType, String.format("cannot create module '%s:%s' from module definition.", moduleDescriptor.getModuleName(), moduleDescriptor.getType())); return SimpleModuleCreator .newInstance(moduleDescriptor, deploymentProperties, moduleClassLoader, moduleOptions, moduleType); }

Target:
private Module createSimpleModule(ModuleDescriptor moduleDescriptor, ModuleOptions moduleOptions, ModuleDeploymentProperties deploymentProperties) { if (log.isInfoEnabled()) { log.info("creating simple module " + moduleDescriptor); } ModuleDefinition definition = moduleDescriptor.getModuleDefinition(); ClassLoader moduleClassLoader = (definition.getClasspath() == null) ? null : new ParentLastURLClassLoader(definition.getClasspath(), this.parentClassLoader); Class<? extends SimpleModule> moduleClass = determineModuleClass(moduleDescriptor.getModuleDefinition()); Assert.notNull(moduleClass, String.format("cannot create module '%s:%s' from module definition.", moduleDescriptor.getModuleName(), moduleDescriptor.getType())); return SimpleModuleCreator .createModule(moduleDescriptor, deploymentProperties, moduleClassLoader, moduleOptions, moduleClass); }
Source:
public void eventRaised(Event ev, Object sender, EventArgs args) { FrontendFailureEventArgs failureArgs = (FrontendFailureEventArgs) args; if (failureArgs.getMessage() != null) { errorPopupManager.show(ErrorMessageFormatter.formatMessage(failureArgs.getMessage())); } else if (failureArgs.getMessages() != null) { errorPopupManager.show(ErrorMessageFormatter.formatMessages(failureArgs.getMessages())); } }

Target:
public void eventRaised(Event ev, Object sender, EventArgs args) { FrontendFailureEventArgs failureArgs = (FrontendFailureEventArgs) args; if (failureArgs.getMessage() != null) { errorPopupManager.show(MESSAGES.uiCommonRunActionFailed(ErrorMessageFormatter.formatMessage(failureArgs.getMessage()))); } else if (failureArgs.getMessages() != null) { errorPopupManager.show(MESSAGES.uiCommonRunActionFailed(ErrorMessageFormatter.formatMessages(failureArgs.getMessages()))); } }
Source:
public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); Format formatter; ToCharFunction.Type type; switch (dataType) { case DATE: case TIME: case TIMESTAMP: if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = Type.TEMPORAL.getFormatter(formatString); } type = Type.TEMPORAL; break; case DECIMAL: case INTEGER: if (formatString == null) formatString = context.getNumberFormat(); formatter = Type.NUMERIC.getFormatter(formatString); type = Type.NUMERIC; break; default: throw new SQLException(dataType + " type is unsupported for TO_CHAR(). Supported types: DATE, TIMESTAMP, DECIMAL, INTEGER"); } return new ToCharFunction(children, type, formatString, formatter); }

Target:
public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); Format formatter; ToCharFunction.Type type; if (dataType.isCoercibleTo(PDataType.TIMESTAMP)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = Type.TEMPORAL.getFormatter(formatString); } type = Type.TEMPORAL; } else if (dataType.isCoercibleTo(PDataType.DECIMAL)) { if (formatString == null) formatString = context.getNumberFormat(); formatter = Type.NUMERIC.getFormatter(formatString); type = Type.NUMERIC; } else { throw new SQLException(dataType + " type is unsupported for TO_CHAR(). Numeric and temporal types are supported."); } return new ToCharFunction(children, type, formatString, formatter); }
Source:
public void activate() { try { subscribeKafkaConsumer(); metricsConsumer = new KafkaConsumer<>(kafkaSpoutConfig.getKafkaProps()); } catch (InterruptException e) { throwKafkaConsumerInterruptedException(); } }

Target:
public void activate() { try { subscribeKafkaConsumer(); } catch (InterruptException e) { throwKafkaConsumerInterruptedException(); } }
Source:
protected boolean canDoAction() { if (!isVmExist() || !isDiskExist(getOldDisk())) { return false; } List<VM> vmsDiskPluggedTo = getVmsDiskPluggedTo(); if (vmsDiskPluggedTo != null && !vmsDiskPluggedTo.isEmpty()) { if (isAtLeastOneVmIsNotDown(vmsDiskPluggedTo) && shouldUpdatePropertiesOtherThanSize()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); } if (!validateCanUpdateDiskInterfaceAndBootable(vmsDiskPluggedTo)) { return false; } } if (shouldResizeDiskImage() && !isImageStatusValid()) { return false; } return validateCanUpdateShareable(); }

Target:
protected boolean canDoAction() { if (!isVmExist() || !isDiskExist(getOldDisk())) { return false; } List<VM> vmsDiskPluggedTo = getVmsDiskPluggedTo(); if (vmsDiskPluggedTo != null && !vmsDiskPluggedTo.isEmpty()) { if (isAtLeastOneVmIsNotDown(vmsDiskPluggedTo) && shouldUpdatePropertiesOtherThanSize()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); } boolean isUpdatedAsBootable = !getOldDisk().isBoot() && getNewDisk().isBoot(); if (isUpdatedAsBootable && !validate(noVmsContainBootableDisks(vmsDiskPluggedTo))) { return false; } boolean isDiskInterfaceUpdated = getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface(); if (isDiskInterfaceUpdated && !validatePciAndIdeLimit(vmsDiskPluggedTo)) { return false; } } if (shouldResizeDiskImage() && !validateCanResizeDisk()) { return false; } return validateCanUpdateShareable(); }
Source:
InstalledDriver(K2Context context, Class<? extends StoreDriver> driverClass) throws StoreDriverException { if (context == null) { throw new NullPointerException("context"); } else if (driverClass == null) { throw new NullPointerException("driverClass"); } this.context = context; this.driverClass = driverClass; K2Strings strings = context.getStrings(); if (Modifier.isAbstract(driverClass.getModifiers())) { throw new StoreDriverException(driverClass, strings.get("storage.driver.abstract")); } for (Class<?> cl = driverClass; cl != null; cl = cl.getEnclosingClass()) { if (!Modifier.isPublic(cl.getModifiers())) { throw new StoreDriverException(driverClass, strings.get("storage.driver.nonpublic")); } } try { constructor = driverClass.getConstructor(K2Context.class, URI.class); for (Class<?> exClass : constructor.getExceptionTypes()) { if (!RuntimeException.class.isAssignableFrom(exClass) && !Error.class.isAssignableFrom(exClass) && !IllegalAddressException.class.isAssignableFrom(exClass)) { throw new StoreDriverException(driverClass, strings.get("storage.driver.constructor_throwsbad")); } } } catch (NoSuchMethodException ex) { throw new StoreDriverException(driverClass, strings.get("storage.driver.constructor_missing")); } info = driverClass.getAnnotation(StoreDriverInfo.class); if (info == null) { throw new StoreDriverException(driverClass, strings.get("storage.driver.metadata_missing")); } if (!LEGAL_ID.matcher(info.id()).matches()) { throw new StoreDriverException(driverClass, strings.get("storage.driver.id_illegal")); } }

Target:
InstalledDriver(K2Context context, Class<? extends StoreDriver> driverClass) throws StoreDriverException { if (context == null) { throw new NullPointerException("context"); } else if (driverClass == null) { throw new NullPointerException("driverClass"); } this.context = context; this.driverClass = driverClass; try { constructor = driverClass.getDeclaredConstructor(); for (Class<?> exClass : constructor.getExceptionTypes()) { if (!RuntimeException.class.isAssignableFrom(exClass) && !Error.class.isAssignableFrom(exClass)) { throw new StoreDriverException(driverClass, StoreDriverException.Reason.ILLEGAL_THROWS); } } constructor.newInstance(); } catch (NoSuchMethodException ex) { throw new StoreDriverException(driverClass, StoreDriverException.Reason.NO_CONSTRUCTOR); } catch (ReflectiveOperationException ex) { throw new StoreDriverException(driverClass, StoreDriverException.Reason.INSTANTIATE_FAIL); } info = driverClass.getAnnotation(StoreDriverInfo.class); if (info == null) { throw new StoreDriverException(driverClass, StoreDriverException.Reason.NO_METADATA); } if (!LEGAL_ID.matcher(info.id()).matches()) { throw new StoreDriverException(driverClass, StoreDriverException.Reason.ILLEGAL_ID); } }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } snapshot = getGlusterVolumeSnapshotDao().getByName(getGlusterVolumeId(), getParameters().getSnapshotName()); if (snapshot == null) { failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_DOES_NOT_EXIST, getParameters().getSnapshotName()); } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getSnapshot() == null) { failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_DOES_NOT_EXIST, getParameters().getSnapshotName()); } return true; }
Source:
private void onSuccessfulAuth() { Intent i = new Intent(); setResult(RESULT_OK, i); finish(); }

Target:
private void onSuccessfulAuth() { setResult(RESULT_OK); finish(); }
Source:
public void testReplicatesWhenRequiredBySession() { int aRows = 10_000; int bRows = 10_000; assertDetermineSemiJoinDistributionType() .setSystemProperty(JOIN_DISTRIBUTION_TYPE, JoinDistributionType.BROADCAST.name()) .overrideStats("valuesA", PlanNodeStatsEstimate.builder() .setOutputRowCount(aRows) .addSymbolStatistics(ImmutableMap.of(new Symbol("A1"), SymbolStatsEstimate.unknown())) .build()) .overrideStats("valuesB", PlanNodeStatsEstimate.builder() .setOutputRowCount(bRows) .addSymbolStatistics(ImmutableMap.of(new Symbol("B1"), SymbolStatsEstimate.unknown())) .build()) .on(p -> p.semiJoin( p.values(new PlanNodeId("valuesA"), aRows, p.symbol("A1", BIGINT)), p.values(new PlanNodeId("valuesB"), bRows, p.symbol("B1", BIGINT)), p.symbol("A1"), p.symbol("B1"), p.symbol("output"), Optional.empty(), Optional.empty(), Optional.empty())) .matches(semiJoin( "A1", "B1", "output", Optional.of(REPLICATED), values(ImmutableMap.of("A1", 0)), values(ImmutableMap.of("B1", 0)))); }

Target:
public void testReplicatesWhenRequiredBySession() { int aRows = 10_000; int bRows = 10_000; assertDetermineSemiJoinDistributionType() .setSystemProperty(JOIN_DISTRIBUTION_TYPE, JoinDistributionType.BROADCAST.name()) .setSystemProperty(JOIN_MAX_BROADCAST_TABLE_SIZE, "1B") .overrideStats("valuesA", PlanNodeStatsEstimate.builder() .setOutputRowCount(aRows) .addSymbolStatistics(ImmutableMap.of(new Symbol("A1"), SymbolStatsEstimate.unknown())) .build()) .overrideStats("valuesB", PlanNodeStatsEstimate.builder() .setOutputRowCount(bRows) .addSymbolStatistics(ImmutableMap.of(new Symbol("B1"), SymbolStatsEstimate.unknown())) .build()) .on(p -> p.semiJoin( p.values(new PlanNodeId("valuesA"), aRows, p.symbol("A1", BIGINT)), p.values(new PlanNodeId("valuesB"), bRows, p.symbol("B1", BIGINT)), p.symbol("A1"), p.symbol("B1"), p.symbol("output"), Optional.empty(), Optional.empty(), Optional.empty())) .matches(semiJoin( "A1", "B1", "output", Optional.of(REPLICATED), values(ImmutableMap.of("A1", 0)), values(ImmutableMap.of("B1", 0)))); }
Source:
public static boolean isEditableHeader(final ScenarioGridColumn column, final Integer uiHeaderRowIndex) { final GridColumn.HeaderMetaData headerMetaData = column.getHeaderMetaData().get(uiHeaderRowIndex); if (!(headerMetaData instanceof ScenarioHeaderMetaData)) { return false; } final ScenarioHeaderMetaData scenarioHeaderMetaData = (ScenarioHeaderMetaData) headerMetaData; if (scenarioHeaderMetaData.isEditingMode() || scenarioHeaderMetaData.isReadOnly()) { return false; } if (!column.isInstanceAssigned() || !column.isEditableHeaders()) { return false; } return scenarioHeaderMetaData.isInstanceHeader() || (scenarioHeaderMetaData.isPropertyHeader() && column.isPropertyAssigned()); }

Target:
public static boolean isEditableHeader(final ScenarioGridColumn column, final Integer uiHeaderRowIndex) { final GridColumn.HeaderMetaData headerMetaData = column.getHeaderMetaData().get(uiHeaderRowIndex); if (!(headerMetaData instanceof ScenarioHeaderMetaData)) { throw new IllegalStateException("Header metadata has to be an instance of ScenarioHeaderMetaData"); } final ScenarioHeaderMetaData scenarioHeaderMetaData = (ScenarioHeaderMetaData) headerMetaData; if (scenarioHeaderMetaData.isEditingMode() || scenarioHeaderMetaData.isReadOnly()) { return false; } if (!column.isInstanceAssigned() || !column.isEditableHeaders()) { return false; } return scenarioHeaderMetaData.isInstanceHeader() || (scenarioHeaderMetaData.isPropertyHeader() && column.isPropertyAssigned()); }
Source:
public void editCacheContainer() throws Exception { page.treeNavigation() .step("singleton-policy") .step(SINGLETON_POLICY_RESOURCE) .navigateToTreeItem() .clickLabel(); try { new ConfigChecker.Builder(client, SINGLETON_POLICY_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.TEXT, CACHE_CONTAINER, CACHE_CONTAINER_RESOURCE_EDIT) .verifyFormSaved() .verifyAttribute(CACHE_CONTAINER, CACHE_CONTAINER_RESOURCE_EDIT); } catch (NoSuchElementException e) { throw new UnexpectedException("This is failing because of <LINK_0>", e); } }

Target:
public void editCacheContainer() throws Exception { page.treeNavigation() .step("singleton-policy") .step(SINGLETON_POLICY_RESOURCE) .navigateToTreeItem() .clickLabel(); try { new ConfigChecker.Builder(client, SINGLETON_POLICY_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.TEXT, CACHE_CONTAINER, CACHE_CONTAINER_RESOURCE_EDIT) .verifyFormSaved() .verifyAttribute(CACHE_CONTAINER, CACHE_CONTAINER_RESOURCE_EDIT); } catch (NoSuchElementException e) { throw new IllegalStateException("This is probably failing because of <LINK_0>", e); } }
Source:
static CatalogKey of(final String namespace, final String value) { return Sponge.getRegistry().createKey(namespace, value); }

Target:
static CatalogKey of(final String namespace, final String value) { return Sponge.getRegistry().createBuilder(Builder.class).namespace(namespace).value(value).build(); }
Source:
private ReadLikelihoodCalculationEngine createLikelihoodCalculationEngine() { switch ( hcArgs.likelihoodEngineImplementation) { case PairHMM: return new PairHMMLikelihoodCalculationEngine((byte) hcArgs.likelihoodArgs.gcpHMM, hcArgs.likelihoodArgs.pairHMM, log10GlobalReadMismappingRate, hcArgs.pcrErrorModel); case Random: return new RandomLikelihoodCalculationEngine(); default: throw new UserException("Unsupported likelihood calculation engine '" + likelihoodCalculationEngine + "'. Please use one of the following instead: 'PairHMM' or 'GraphBased'."); } }

Target:
private ReadLikelihoodCalculationEngine createLikelihoodCalculationEngine() { switch ( hcArgs.likelihoodEngineImplementation) { case PairHMM: return new PairHMMLikelihoodCalculationEngine((byte) hcArgs.likelihoodArgs.gcpHMM, hcArgs.likelihoodArgs.pairHMM, log10GlobalReadMismappingRate, hcArgs.pcrErrorModel); case Random: return new RandomLikelihoodCalculationEngine(); default: throw new UserException("Unsupported likelihood calculation engine: " + likelihoodCalculationEngine); } }
Source:
private static void marshalFiles( WritableChannel buffer, File[] files ) throws IOException { buffer.putInt( files.length ); for ( File file : files ) { byte[] bytes = file.getName().getBytes(); buffer.putInt( bytes.length ); buffer.put( bytes, bytes.length ); } }

Target:
private static void marshalFiles( WritableChannel buffer, File[] files ) throws IOException { buffer.putInt( files.length ); for ( File file : files ) { putBytes( buffer, file.getName() ); } }
Source:
public CharSeq repeat(int times) { if (times <= 0) return empty(); else if (times == 1) return this; else { final int finalLength = length() * times; final StringBuilder result = new StringBuilder(2 * finalLength); result.append(back); for (int i = 1; i <= times; i *= 2) { result.append(result); } result.setLength(finalLength); return of(result); } }

Target:
public CharSeq repeat(int times) { if (times <= 0 || isEmpty()) return empty(); else if (times == 1) return this; else { final int finalLength = length() * times; final char[] result = new char[finalLength]; back.getChars(0, length(), result, 0); int i = length(); for (; i <= (finalLength >>> 1); i <<= 1) { System.arraycopy(result, 0, result, i, i); } System.arraycopy(result, 0, result, i, finalLength - i); return of(new String(result)); } }
Source:
protected AppiumDriverLocalService createDriverService(File nodeJSExecutable, int nodeJSPort, ImmutableList<String> nodeArguments, ImmutableMap<String, String> nodeEnvironment) { try { return new AppiumDriverLocalService(ipAddress, nodeJSExecutable, nodeJSPort, nodeArguments, nodeEnvironment, timeToWaitForAppiumNodeIsStarted, timeUnitToWaitForAppiumNodeIsStarted); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
protected AppiumDriverLocalService createDriverService(File nodeJSExecutable, int nodeJSPort, ImmutableList<String> nodeArguments, ImmutableMap<String, String> nodeEnvironment) { try { return new AppiumDriverLocalService(ipAddress, nodeJSExecutable, nodeJSPort, nodeArguments, nodeEnvironment, startupTimeout, timeUnit); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public static void updateDefaultFormats() { fDefaultTimeFormat = new TmfTimestampFormat(TmfTimePreferences.getInstance().getTimePattern(), TmfTimePreferences.getInstance().getTimeZone()); fDefaultIntervalFormat = new TmfTimestampFormat(TmfTimePreferences.getInstance().getIntervalPattern()); TmfSignalManager.dispatchSignal(new TmfTimestampFormatUpdateSignal(null)); }

Target:
public static void updateDefaultFormats() { fDefaultTimeFormat = new TmfTimestampFormat(TmfTimePreferences.getInstance().getTimePattern(), TmfTimePreferences.getInstance().getTimeZone()); fDefaultIntervalFormat = new TmfTimestampFormat(TmfTimePreferences.getInstance().getIntervalPattern()); }
Source:
public State as(Class<? extends State> target) { if (target == OnOffType.class) { return equals(ZERO) ? OnOffType.OFF : OnOffType.ON; } else if (target == PercentType.class) { return new PercentType(toBigDecimal().multiply(BigDecimal.valueOf(100))); } else if (target == UpDownType.class) { if (equals(ZERO)) { return UpDownType.UP; } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { return UpDownType.DOWN; } else { return UnDefType.UNDEF; } } else if (target == OpenClosedType.class) { if (equals(ZERO)) { return OpenClosedType.CLOSED; } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { return OpenClosedType.OPEN; } else { return UnDefType.UNDEF; } } else if (target == HSBType.class) { return new HSBType(DecimalType.ZERO, PercentType.ZERO, new PercentType(this.toBigDecimal().multiply(BigDecimal.valueOf(100)))); } else { return State.super.as(target); } }

Target:
public State as(Class<? extends State> target) { if (target == OnOffType.class) { return equals(ZERO) ? OnOffType.OFF : OnOffType.ON; } else if (target == PercentType.class) { return new PercentType(toBigDecimal().multiply(BigDecimal.valueOf(100))); } else if (target == UpDownType.class) { if (equals(ZERO)) { return UpDownType.UP; } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { return UpDownType.DOWN; } else { return UnDefType.UNDEF; } } else if (target == OpenClosedType.class) { if (equals(ZERO)) { return OpenClosedType.CLOSED; } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { return OpenClosedType.OPEN; } else { return UnDefType.UNDEF; } } else if (target == HSBType.class) { return new HSBType(DecimalType.ZERO, PercentType.ZERO, new PercentType(this.toBigDecimal().multiply(BigDecimal.valueOf(100)))); } else { return defaultConversion(target); } }