auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void handleCVSException(CVSException ex) { IStatus status = ex.getStatus(); List toShow = new ArrayList(); IStatus children[] = status.getChildren(); boolean may = true; for (int i = 0; i < children.length; i++) { if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER || children[i].getCode() == CVSStatus.PROTOCOL_ERROR || children[i].getCode() == CVSStatus.ERROR_LINE) { toShow.add(children[i]); if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER) may = false; } } if (toShow.size() > 0) { String msg = may ? CVSUIMessages.DiffOperation_ThePatchMayNotContainAllTheChanges : CVSUIMessages.DiffOperation_ThePatchDoesNotContainAllTheChanges; StatusAdapter adapter = new StatusAdapter( new MultiStatus( CVSProviderPlugin.ID, CVSStatus.SERVER_ERROR, (IStatus[]) toShow.toArray(new IStatus[0]), CVSUIMessages.DiffOperation_ErrorsOccurredWhileCreatingThePatch, null)); adapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, msg); StatusManager.getManager().handle(adapter, StatusManager.SHOW | StatusManager.NONE); } }

Target:
private void handleCVSException(CVSException ex) { IStatus status = ex.getStatus(); List toShow = new ArrayList(); IStatus children[] = status.getChildren(); boolean may = true; for (int i = 0; i < children.length; i++) { if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER || children[i].getCode() == CVSStatus.PROTOCOL_ERROR || children[i].getCode() == CVSStatus.ERROR_LINE) { toShow.add(children[i]); if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER) may = false; } } if (toShow.size() > 0) { String msg = may ? CVSUIMessages.DiffOperation_ThePatchMayNotContainAllTheChanges : CVSUIMessages.DiffOperation_ThePatchDoesNotContainAllTheChanges; StatusAdapter adapter = new StatusAdapter( new MultiStatus( CVSProviderPlugin.ID, CVSStatus.SERVER_ERROR, (IStatus[]) toShow.toArray(new IStatus[toShow.size()]), CVSUIMessages.DiffOperation_ErrorsOccurredWhileCreatingThePatch, null)); adapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, msg); StatusManager.getManager().handle(adapter, StatusManager.SHOW | StatusManager.NONE); } }
Source:
public Blob call(Blob blob, String targetExt, String commandName) { CommandLineExecutorService cles = Framework.getService(CommandLineExecutorService.class); CommandAvailability availability = cles.getCommandAvailability(commandName); if (!availability.isAvailable()) { return null; } try { makeFiles(blob, targetExt); callImageMagick(); Blob targetBlob = Blobs.createBlob(targetFile); targetBlob.setFilename(getFilename(blob, targetExt)); Framework.trackFile(targetFile, targetBlob); return targetBlob; } catch (CommandNotAvailable | CommandException | IOException e) { log.error(() -> String.format("ImageMagick failed on command: %s", commandName), e); return null; } finally { if (tmpFile != null) { try { Files.delete(tmpFile.toPath()); } catch (IOException e) { log.error(() -> String.format( "Unable to delete temporary file when calling ImageMagick command: %s", commandName), e); } } } }

Target:
public Blob call(Blob blob, String targetExt, String commandName) { CommandLineExecutorService cles = Framework.getService(CommandLineExecutorService.class); CommandAvailability availability = cles.getCommandAvailability(commandName); if (!availability.isAvailable()) { return null; } try { makeFiles(blob, targetExt); callImageMagick(); Blob targetBlob = Blobs.createBlob(targetFile); targetBlob.setFilename(getFilename(blob, targetExt)); return targetBlob; } catch (CommandNotAvailable | CommandException | IOException e) { log.error("ImageMagick failed on command: {}", commandName, e); return null; } finally { if (tmpFile != null) { try { Files.delete(tmpFile.toPath()); } catch (IOException e) { log.error("Unable to delete temporary file when calling ImageMagick command: {}", commandName, e); } } } }
Source:
public void testAutoChart() throws IOException { XMLSlideShow ppt = new XMLSlideShow(); XSLFSlide slide = ppt.createSlide(); XSLFChart chart = ppt.createChart(); slide.addChart(chart); assertNotNull(chart); ppt.close(); }

Target:
public void testAutoChart() throws IOException { XMLSlideShow ppt = new XMLSlideShow(); XSLFSlide slide = ppt.createSlide(); XSLFChart chart = ppt.createChart(); assertNotNull(chart); slide.addChart(chart); assertEquals(XSLFRelation.CHART.getContentType(), chart.getPackagePart().getContentType()); String partName = slide.getRelationPartById("rId2").getDocumentPart().getPackagePart().getPartName().getName(); assertEquals(partName, chart.getPackagePart().getPartName().getName()); ppt.close(); }
Source:
public static long widthBucket(@SqlType(StandardTypes.DOUBLE) double operand, @SqlType("array(double)") Block bins) { int numberOfBins = bins.getPositionCount(); checkCondition(numberOfBins > 0, INVALID_FUNCTION_ARGUMENT, "Bins cannot be an empty array"); checkCondition(!isNaN(operand), INVALID_FUNCTION_ARGUMENT, "Operand cannot be NaN"); int lower = 0; int upper = numberOfBins; int index; double bin; while (lower < upper) { if (DOUBLE.getDouble(bins, lower) > DOUBLE.getDouble(bins, upper - 1)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Bin values are not sorted in ascending order"); } index = (lower + upper) / 2; bin = DOUBLE.getDouble(bins, index); checkCondition(isFinite(bin), INVALID_FUNCTION_ARGUMENT, "Bin value must be finite, got %s", bin); if (operand < bin) { upper = index; } else { lower = index + 1; } } return lower; }

Target:
public static long widthBucket(@SqlType(StandardTypes.DOUBLE) double operand, @SqlType("array(double)") Block bins) { int numberOfBins = bins.getPositionCount(); checkCondition(numberOfBins > 0, INVALID_FUNCTION_ARGUMENT, "Bins cannot be an empty array"); checkCondition(!isNaN(operand), INVALID_FUNCTION_ARGUMENT, "Operand cannot be NaN"); int lower = 0; int upper = numberOfBins; int index; double bin; while (lower < upper) { if (DOUBLE.getDouble(bins, lower) > DOUBLE.getDouble(bins, upper - 1)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Bin values are not sorted in ascending order"); } index = (lower + upper) / 2; bin = DOUBLE.getDouble(bins, index); if (!isFinite(bin)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Bin value must be finite, got " + bin); } if (operand < bin) { upper = index; } else { lower = index + 1; } } return lower; }
Source:
public void testUnicastSerialDataReceiveSubscribedReceive() throws Exception { dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, receivePacket); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_NOT_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).serialDataReceived(XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); assertEquals(XBEE_64BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }

Target:
public void testUnicastSerialDataReceiveSubscribedReceive() throws Exception { dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, receivePacket); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_NOT_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).serialDataReceived(XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); Mockito.verify(receiveSerialDataListener, Mockito.never()).broadcastSerialDataReceived(Mockito.anyString(), (byte[])Mockito.any()); assertEquals(XBEE_64BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }
Source:
void editAccounts(Collection<String> accountNames) throws IOException, InterruptedException { Path accountJsonPath = Files.createTempFile("account-update-", ".json"); JSONArray accountsToEdit = new JSONArray(); accountNames.stream() .map(accountName -> accountService.getAccountByName(accountName).toJson(false)) .forEach(accountsToEdit::put); try (BufferedWriter writer = Files.newBufferedWriter(accountJsonPath)) { accountsToEdit.write(writer, 2, 0); } ToolUtils.editFile(accountJsonPath); System.out.println("The following account metadata will be uploaded:"); try (Stream<String> lines = Files.lines(accountJsonPath)) { lines.forEach(System.out::println); } if (ToolUtils.yesNoPrompt("Do you want to update these accounts?")) { updateAccountsFromFile(accountJsonPath.toAbsolutePath().toString()); } else { System.out.println("Not updating any accounts"); } }

Target:
void editAccounts(Collection<String> accountNames) throws IOException, InterruptedException { Path accountJsonPath = Files.createTempFile("account-update-", ".json"); JSONArray accountsToEdit = new JSONArray(); accountNames.stream() .map(accountName -> Optional.ofNullable(accountService.getAccountByName(accountName)) .orElseThrow(() -> new IllegalArgumentException("Could not find account: " + accountName)) .toJson(false)) .forEach(accountsToEdit::put); try (BufferedWriter writer = Files.newBufferedWriter(accountJsonPath)) { accountsToEdit.write(writer, 2, 0); } ToolUtils.editFile(accountJsonPath); System.out.println("The following account metadata will be uploaded:"); try (Stream<String> lines = Files.lines(accountJsonPath)) { lines.forEach(System.out::println); } if (ToolUtils.yesNoPrompt("Do you want to update these accounts?")) { updateAccountsFromFile(accountJsonPath.toAbsolutePath().toString()); } else { System.out.println("Not updating any accounts"); } Files.delete(accountJsonPath); }
Source:
public void handle(HttpExchange t) throws IOException { String query = t.getRequestURI().getRawQuery(); String contextPath = t.getHttpContext().getPath(); ByteArrayOutputStream response = this.response.get(); response.reset(); OutputStreamWriter osw = new OutputStreamWriter(response); if(HEALTH_PATH.equals(contextPath)) { osw.write(RESPONSE); } else { TextFormat.write004(osw, registry.filteredMetricFamilySamples(parseQuery(query))); } osw.flush(); osw.close(); response.flush(); response.close(); t.getResponseHeaders().set("Content-Type", TextFormat.CONTENT_TYPE_004); if (shouldUseCompression(t)) { t.getResponseHeaders().set("Content-Encoding", "gzip"); t.sendResponseHeaders(HttpURLConnection.HTTP_OK, 0); final GZIPOutputStream os = new GZIPOutputStream(t.getResponseBody()); response.writeTo(os); os.close(); } else { t.getResponseHeaders().set("Content-Length", String.valueOf(response.size())); t.sendResponseHeaders(HttpURLConnection.HTTP_OK, response.size()); response.writeTo(t.getResponseBody()); } t.close(); }

Target:
public void handle(HttpExchange t) throws IOException { String query = t.getRequestURI().getRawQuery(); String contextPath = t.getHttpContext().getPath(); ByteArrayOutputStream response = this.response.get(); response.reset(); OutputStreamWriter osw = new OutputStreamWriter(response); if ("/-/healthy".equals(contextPath)) { osw.write(HEALTHY_RESPONSE); } else { TextFormat.write004(osw, registry.filteredMetricFamilySamples(parseQuery(query))); } osw.flush(); osw.close(); response.flush(); response.close(); t.getResponseHeaders().set("Content-Type", TextFormat.CONTENT_TYPE_004); if (shouldUseCompression(t)) { t.getResponseHeaders().set("Content-Encoding", "gzip"); t.sendResponseHeaders(HttpURLConnection.HTTP_OK, 0); final GZIPOutputStream os = new GZIPOutputStream(t.getResponseBody()); response.writeTo(os); os.close(); } else { t.getResponseHeaders().set("Content-Length", String.valueOf(response.size())); t.sendResponseHeaders(HttpURLConnection.HTTP_OK, response.size()); response.writeTo(t.getResponseBody()); } t.close(); }
Source:
@Override public void parseArguments(CommandArgIterator argIter) { PropertySubCommandsList subcommand = PropertySubCommandsList.parse(argIter.nextArg("Expected property action.")); if (subcommand == null) throw new IllegalArgumentException("Expected correct metadata action."); delegate = subcommand.command(); delegate.parseArguments(argIter); }

Target:
@Override public void parseArguments(CommandArgIterator argIter) { PropertySubCommandsList subcommand = PropertySubCommandsList.parse(argIter.nextArg("Expected property action.")); if (subcommand == null) throw new IllegalArgumentException("Expected correct property action."); delegate = subcommand.command(); delegate.parseArguments(argIter); }
Source:
public void storeAuthTokenResponse(@NonNull AuthResponse response, @NonNull AuthBackend backend) { pref.put(PrefManager.Key.AUTH_JSON, gson.toJson(response)); pref.put(PrefManager.Key.SEGMENT_KEY_BACKEND, eventKeyFromAuthBackend(backend)); }

Target:
public void storeAuthTokenResponse(@NonNull AuthResponse response, @NonNull AuthBackend backend) { pref.put(PrefManager.Key.AUTH_JSON, gson.toJson(response)); pref.put(PrefManager.Key.ANALYTICS_KEY_BACKEND, analyticsTokenFromAuthBackend(backend)); }
Source:
public void onNext(T t) { ReferenceCountUtil.retain(t); state.bufferedSubject.onNext(t); if (state.casTimeoutScheduled() && state.state == 0) { timeoutScheduler.subscribe(new Action1<Long>() { @Override public void call(Long aLong) { disposeIfNotSubscribed(); } }); } }

Target:
public void onNext(T t) { ReferenceCountUtil.retain(t); state.bufferedSubject.onNext(t); if (state.casTimeoutScheduled() && state.state == State.STATES.UNSUBSCRIBED.ordinal()) { timeoutScheduler.subscribe(new Action1<Long>() { @Override public void call(Long aLong) { disposeIfNotSubscribed(); } }); } }
Source:
public void testStopAtNonRetryableException() { final int retries = 10; final int notRetry = 3; final AtomicInteger atomicInteger = new AtomicInteger(0); final String notRetryExceptionMsg = "Non-retryable exception"; CompletableFuture<Boolean> retryFuture = FutureUtils.retry( () -> CompletableFuture.supplyAsync( () -> { if (atomicInteger.incrementAndGet() == notRetry) { throw new CompletionException(new FlinkRuntimeException(notRetryExceptionMsg)); } else { throw new CompletionException(new FlinkException("Test exception")); } }, TestingUtils.defaultExecutor()), retries, throwable -> ExceptionUtils.findThrowable(throwable, FlinkException.class).isPresent(), TestingUtils.defaultExecutor()); try { retryFuture.get(); fail("Exception should be thrown."); } catch (Exception ex) { assertThat(ExceptionUtils.findThrowableWithMessage(ex, notRetryExceptionMsg).isPresent(), is(true)); } assertThat(atomicInteger.get(), is(notRetry)); }

Target:
public void testStopAtNonRetryableException() { final int retries = 10; final int notRetry = 3; final AtomicInteger atomicInteger = new AtomicInteger(0); final FlinkRuntimeException nonRetryableException = new FlinkRuntimeException("Non-retryable exception"); CompletableFuture<Boolean> retryFuture = FutureUtils.retry( () -> CompletableFuture.supplyAsync( () -> { if (atomicInteger.incrementAndGet() == notRetry) { throw new CompletionException(nonRetryableException); } else { throw new CompletionException(new FlinkException("Test exception")); } }, TestingUtils.defaultExecutor()), retries, throwable -> ExceptionUtils.findThrowable(throwable, FlinkException.class).isPresent(), TestingUtils.defaultExecutor()); try { retryFuture.get(); fail("Exception should be thrown."); } catch (Exception ex) { assertThat(ex, FlinkMatchers.containsCause(nonRetryableException)); } assertThat(atomicInteger.get(), is(notRetry)); }
Source:
public FormClass getParameterFormClass() { EnumType cardinalityType = (EnumType) EnumType.TYPE_CLASS.createType(); cardinalityType.getValues().add(new EnumItem(ResourceId.valueOf("single"), "Single")); cardinalityType.getValues().add(new EnumItem(ResourceId.valueOf("multiple"), "Multiple")); EnumType kindType = (EnumType) EnumType.TYPE_CLASS.createType(); kindType.getValues().add(new EnumItem(ResourceId.valueOf(Kind.ATTACHMENT.name()), "Attachment")); kindType.getValues().add(new EnumItem(ResourceId.valueOf(Kind.IMAGE.name()), "Image")); FormClass formClass = new FormClass(ResourceIdPrefixType.TYPE.id("image")); formClass.addElement(new FormField(ResourceId.valueOf("cardinality")) .setType(cardinalityType) .setLabel("Cardinality") .setDescription("Determines whether users can add a single image, or multiple images") ); formClass.addElement(new FormField(ResourceId.valueOf("kind")) .setType(kindType) .setLabel("Type") .setDescription("Determines type of attachment (image or file)") .setVisible(false) ); return formClass; }

Target:
public FormClass getParameterFormClass() { EnumType cardinalityType = (EnumType) EnumType.TYPE_CLASS.createType(); cardinalityType.getValues().add(new EnumItem(ResourceId.valueOf("single"), I18N.CONSTANTS.single())); cardinalityType.getValues().add(new EnumItem(ResourceId.valueOf("multiple"), I18N.CONSTANTS.multiple())); EnumType kindType = (EnumType) EnumType.TYPE_CLASS.createType(); kindType.getValues().add(new EnumItem(ResourceId.valueOf(Kind.ATTACHMENT.name()), I18N.CONSTANTS.attachment())); kindType.getValues().add(new EnumItem(ResourceId.valueOf(Kind.IMAGE.name()), I18N.CONSTANTS.image())); FormClass formClass = new FormClass(ResourceIdPrefixType.TYPE.id("image")); formClass.addElement(new FormField(ResourceId.valueOf("kind")) .setType(kindType) .setLabel(I18N.CONSTANTS.type()) .setDescription(I18N.CONSTANTS.attachmentTypeDescription()) .setVisible(false) ); return formClass; }
Source:
public CommcareMetadataJson getMetadata() { if (metadata != null) { return metadata; } else if (serializedMetadata != null) { deserializeMetadata(); return metadata; } return null; }

Target:
public CommcareMetadataJson getMetadata() { return metadata; }
Source:
public void whenSchemaHasRefToSchemaWithOneOfItShouldHaveAnUnknownModelAssociated() throws Exception { InputStream jsonSchemaStream = getClass().getClassLoader().getResourceAsStream("jsonSchema/jsonSchemaWithRefToOneOf.json"); String jsonSchemaString = convertStreamToString(jsonSchemaStream); MetaDataModel metaDataModel = modelFactory.buildModel(jsonSchemaString); Assert.assertThat(metaDataModel, CoreMatchers.instanceOf(DefaultStructuredMetadataModel.class)); DefaultStructuredMetadataModel model = (DefaultStructuredMetadataModel) metaDataModel; Assert.assertThat(model.getFields().size(), CoreMatchers.is(1)); Assert.assertThat(model.getFields().get(0).getName(), CoreMatchers.is("additionalInformation")); Assert.assertThat(model.getFields().get(0).getMetaDataModel().getDataType(), CoreMatchers.is(DataType.UNKNOWN)); Assert.assertThat(model.getFields().get(0).getMetaDataModel(), CoreMatchers.instanceOf(UnknownMetaDataModel.class)); }

Target:
public void whenSchemaHasRefToSchemaWithOneOfItShouldHaveAnUnknownModelAssociated() throws Exception { InputStream jsonSchemaStream = getClass().getClassLoader().getResourceAsStream("jsonSchema/jsonSchemaWithRefToOneOf.json"); String jsonSchemaString = convertStreamToString(jsonSchemaStream); MetaDataModel metaDataModel = modelFactory.buildModel(jsonSchemaString); Assert.assertThat(metaDataModel, CoreMatchers.instanceOf(DefaultStructuredMetadataModel.class)); DefaultStructuredMetadataModel model = (DefaultStructuredMetadataModel) metaDataModel; Assert.assertThat(model.getFields(), IsCollectionWithSize.hasSize(1)); Assert.assertThat(model.getFields().get(0).getName(), CoreMatchers.is("additionalInformation")); Assert.assertThat(model.getFields().get(0).getMetaDataModel().getDataType(), CoreMatchers.is(DataType.UNKNOWN)); Assert.assertThat(model.getFields().get(0).getMetaDataModel(), CoreMatchers.instanceOf(UnknownMetaDataModel.class)); }
Source:
private int decodeRun(final Tree tree) throws IOException { int total = 0; Node n = tree.root; while (true) { boolean bit = readBit(); n = n.walk(bit); if (n == null) { throw new IOException("Unknown code in Huffman RLE stream"); } if (n.isLeaf) { total += n.value; if (n.value < 64) { if (n.value < 0) { return columns; } return total; } else { n = tree.root; } } } }

Target:
private int decodeRun(final Tree tree) throws IOException { int total = 0; Node n = tree.root; while (true) { boolean bit = readBit(); n = n.walk(bit); if (n == null) { throw new IOException("Unknown code in Huffman RLE stream"); } if (n.isLeaf) { total += n.value; if (n.value >= 64) { n = tree.root; } else if (n.value >= 0) { return total; } else { return columns; } } } }
Source:
private void addQueryParams(final Request request) { if (dateCreated != null) { request.addQueryParam("DateCreated", dateCreated.format(DateTimeFormatter.ofPattern(Request.QUERY_STRING_DATE_TIME_FORMAT))); } else { if (dateCreatedBefore != null || dateCreatedAfter != null) { request.addQueryDateTimeRange("DateCreated", dateCreatedBefore, dateCreatedAfter); } } if (callSid != null) { request.addQueryParam("CallSid", callSid); } if (conferenceSid != null) { request.addQueryParam("ConferenceSid", conferenceSid); } if (getPageSize() != null) { request.addQueryParam("PageSize", Integer.toString(getPageSize())); } }

Target:
private void addQueryParams(final Request request) { if (dateCreated != null) { request.addQueryParam("DateCreated", dateCreated.format(DateTimeFormatter.ofPattern(Request.QUERY_STRING_DATE_TIME_FORMAT))); } else if (dateCreatedAfter != null || dateCreatedBefore != null) { request.addQueryDateTimeRange("DateCreated", dateCreatedAfter, dateCreatedBefore); } if (callSid != null) { request.addQueryParam("CallSid", callSid); } if (conferenceSid != null) { request.addQueryParam("ConferenceSid", conferenceSid); } if (getPageSize() != null) { request.addQueryParam("PageSize", Integer.toString(getPageSize())); } }
Source:
private void shutdown(Lifecycle lifecycle) { try { lifecycle.stop(); } catch (Throwable t) { log.warn(t, "Exception when stopping druid lifecycle"); } finally { System.exit(1); } }

Target:
private void shutdown(Lifecycle lifecycle) { try { lifecycle.stop(); } catch (Throwable t) { log.error(t, "Exception when stopping druid lifecycle"); } finally { System.exit(1); } }
Source:
public HybridCacheProvider( @JacksonInject @Named("l1") CacheProvider level1, @JacksonInject @Named("l2") CacheProvider level2 ) { Preconditions.checkNotNull(level1, "l1 cache not specified for hybrid cache"); Preconditions.checkNotNull(level2, "l2 cache not specified for hybrid cache"); this.level1 = level1; this.level2 = level2; }

Target:
public HybridCacheProvider( @JacksonInject @Named("l1") CacheProvider level1, @JacksonInject @Named("l2") CacheProvider level2 ) { this.level1 = Preconditions.checkNotNull(level1, "l1 cache not specified for hybrid cache"); this.level2 = Preconditions.checkNotNull(level2, "l2 cache not specified for hybrid cache"); }
Source:
static DocumentResultCollection<RecognizeEntitiesResult> getExpectedBatchNamedEntities() { NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.80624294281005859); NamedEntity namedEntity2 = new NamedEntity("last week", "DateTime", "DateRange", 34, 9, 0.8); NamedEntity namedEntity3 = new NamedEntity("Microsoft", "Organization", null, 10, 9, 0.99983596801757812); List<NamedEntity> namedEntityList1 = Arrays.asList(namedEntity1, namedEntity2); List<NamedEntity> namedEntityList2 = Collections.singletonList(namedEntity3); TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(44, 1); TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(20, 1); RecognizeEntitiesResult recognizeEntitiesResult1 = new RecognizeEntitiesResult("0", textDocumentStatistics1, null, namedEntityList1); RecognizeEntitiesResult recognizeEntitiesResult2 = new RecognizeEntitiesResult("1", textDocumentStatistics2, null, namedEntityList2); TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(2, 2, 0, 2); List<RecognizeEntitiesResult> recognizeEntitiesResultList = Arrays.asList(recognizeEntitiesResult1, recognizeEntitiesResult2); return new DocumentResultCollection<>(recognizeEntitiesResultList, DEFAULT_MODEL_VERSION, textDocumentBatchStatistics); }

Target:
static DocumentResultCollection<RecognizeEntitiesResult> getExpectedBatchNamedEntities() { NamedEntity namedEntity1 = new NamedEntity("Seattle", "Location", null, 26, 7, 0.0); NamedEntity namedEntity2 = new NamedEntity("last week", "DateTime", "DateRange", 34, 9, 0.0); NamedEntity namedEntity3 = new NamedEntity("Microsoft", "Organization", null, 10, 9, 0.0); List<NamedEntity> namedEntityList1 = Arrays.asList(namedEntity1, namedEntity2); List<NamedEntity> namedEntityList2 = Collections.singletonList(namedEntity3); TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(44, 1); TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(20, 1); RecognizeEntitiesResult recognizeEntitiesResult1 = new RecognizeEntitiesResult("0", textDocumentStatistics1, null, namedEntityList1); RecognizeEntitiesResult recognizeEntitiesResult2 = new RecognizeEntitiesResult("1", textDocumentStatistics2, null, namedEntityList2); TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(2, 2, 0, 2); List<RecognizeEntitiesResult> recognizeEntitiesResultList = Arrays.asList(recognizeEntitiesResult1, recognizeEntitiesResult2); return new DocumentResultCollection<>(recognizeEntitiesResultList, DEFAULT_MODEL_VERSION, textDocumentBatchStatistics); }
Source:
TransactionsSearchDto getTransactionsSearchDto(final String transactionDbId, final String seedLotDbId, final String germplasmDbId) { final TransactionsSearchDto searchDTO = new TransactionsSearchDto(); if(!StringUtils.isEmpty(transactionDbId)) { searchDTO.setTransactionIds(Collections.singletonList(Integer.valueOf(transactionDbId))); } if(!StringUtils.isEmpty(germplasmDbId)) { searchDTO.setGids(Collections.singletonList(Integer.valueOf(germplasmDbId))); } if(!StringUtils.isEmpty(seedLotDbId)) { searchDTO.setLotUUIDs(Collections.singletonList(seedLotDbId)); } searchDTO.setLotStatus(0); return searchDTO; }

Target:
TransactionsSearchDto getTransactionsSearchDto(final String transactionDbId, final String seedLotDbId, final String germplasmDbId) { final TransactionsSearchDto searchDTO = new TransactionsSearchDto(); if(!StringUtils.isEmpty(transactionDbId)) { searchDTO.setTransactionIds(Collections.singletonList(Integer.valueOf(transactionDbId))); } if(!StringUtils.isEmpty(germplasmDbId)) { searchDTO.setGids(Collections.singletonList(Integer.valueOf(germplasmDbId))); } if(!StringUtils.isEmpty(seedLotDbId)) { searchDTO.setLotUUIDs(Collections.singletonList(seedLotDbId)); } searchDTO.setLotStatus(LotStatus.ACTIVE.getIntValue()); return searchDTO; }
Source:
public String generateSubscriptionKeyFieldsHash(final SubscriptionBase subscription) { final Hasher hasher = Hashing.murmur3_128() .newHasher() .putString(subscription.getOwningApplication(), UTF_8) .putString(subscription.getConsumerGroup(), UTF_8); subscription.getEventTypes() .stream() .sorted() .forEach(et -> hasher.putString(et, UTF_8)); return hasher.hash().toString(); }

Target:
public String generateSubscriptionKeyFieldsHash(final SubscriptionBase subscription) { final Hasher hasher = Hashing.md5() .newHasher() .putString(subscription.getOwningApplication(), UTF_8) .putString(subscription.getConsumerGroup(), UTF_8); subscription.getEventTypes() .stream() .sorted() .forEach(et -> hasher.putString(et, UTF_8)); return hasher.hash().toString(); }
Source:
public List<Court> GetAllCourts() { List<Court> courts = courtDAO.getAllCourts(); return courts; }

Target:
public List<Court> GetAllCourts() { return courtDAO.getAllCourts(); }
Source:
public void checkCount(DetailAST ast) { if (checking && maxAllowed != null && count > maxAllowed) { if (context.isVoidContext) { log(ast.getLineNo(), ast.getColumnNo(), MSG_KEY_VOID, count, maxAllowed); } else { log(ast.getLineNo(), ast.getColumnNo(), MSG_KEY, count, maxAllowed); } } }

Target:
public void checkCount(DetailAST ast) { if (checking && maxAllowed != null && count > maxAllowed) { if (isVoidContext) { log(ast.getLineNo(), ast.getColumnNo(), MSG_KEY_VOID, count, maxAllowed); } else { log(ast.getLineNo(), ast.getColumnNo(), MSG_KEY, count, maxAllowed); } } }
Source:
protected void assertResultEquals(String message, Change expected, ChangeInfo actual) { assertEquals(message, expected.getId().get(), (int) actual._number); }

Target:
protected void assertResultEquals(String message, Change expected, ChangeInfo actual) { assertEquals(message, expected.getId().get(), actual._number); }
Source:
public SpaceReference getNodeSpaceRef() { if (nodeSpaceRef.isPresent()) { return new SpaceReference(nodeSpaceRef.get().clone()); } return null; }

Target:
public Optional<SpaceReference> getNodeSpaceRef() { if (nodeSpaceRef.isPresent()) { return Optional.of(ModelUtils.cloneReference(nodeSpaceRef.get(), SpaceReference.class)); } return Optional.absent(); }
Source:
private Date getDateFromDiskDescription(Map<String, Object> map) { try { if (map.get(OvfInfoFileConstants.LastUpdated) != null) { return new SimpleDateFormat(OvfParser.formatStrFromDiskDescription).parse(map.get(OvfInfoFileConstants.LastUpdated) .toString()); } else { log.info("LastUpdate Date is not initialized in the OVF_STORE disk."); } } catch (java.text.ParseException e) { log.errorFormat("LastUpdate Date could not be parsed from disk desscription. Exception: {0}", e); } return null; }

Target:
private Date getDateFromDiskDescription(Map<String, Object> map) { try { if (getLastUpdate(map) != null) { return new SimpleDateFormat(OvfParser.formatStrFromDiskDescription).parse(getLastUpdate(map).toString()); } else { log.info("LastUpdate Date is not initialized in the OVF_STORE disk."); } } catch (java.text.ParseException e) { log.errorFormat("LastUpdate Date could not be parsed from disk desscription. Exception: {0}", e); } return null; }
Source:
private Answer executeRequest(ImplementVspCommand cmd) { try { isNuageVspElementLoaded(); boolean success = _nuageVspElementClient.implement(cmd.getNetworkId(), cmd.getNetworkDomainUuid(), cmd.getNetworkUuid(), cmd.getNetworkName(), cmd.getVpcOrSubnetUuid(), cmd.isL2Network(), cmd.isL3Network(), cmd.isVpc(), cmd.isShared(), cmd.getDomainTemplateName(), cmd.isFirewallServiceSupported(), cmd.getDnsServers(), cmd.getIngressFirewallRules(), cmd.getEgressFirewallRules(), cmd.getAcsFipUuid(), cmd.isEgressDefaultPolicy()); return new ImplementVspAnswer(cmd, success, "Implemented network in VSP " + cmd.getNetworkUuid()); } catch (Exception e) { s_logger.error("Failure during " + cmd, e); return new ImplementVspAnswer(cmd, e); } }

Target:
private Answer executeRequest(ImplementVspCommand cmd) { try { isNuageVspElementLoaded(); boolean success = _nuageVspElementClient.implement(cmd.getNetworkId(), cmd.getNetworkDomainUuid(), cmd.getNetworkUuid(), cmd.getNetworkName(), cmd.getVpcOrSubnetUuid(), cmd.isL2Network(), cmd.isL3Network(), cmd.isVpc(), cmd.isShared(), cmd.getDomainTemplateName(), cmd.isFirewallServiceSupported(), cmd.getDnsServers(), cmd.getIngressFirewallRules(), cmd.getEgressFirewallRules(), cmd.getAcsFipUuid(), cmd.isEgressDefaultPolicy()); return new Answer(cmd, success, "Implemented network " + cmd.getNetworkUuid() + " on Nuage VSD " + _hostName); } catch (ExecutionException | ConfigurationException e) { s_logger.error("Failure during " + cmd + " on Nuage VSD " + _hostName, e); return new Answer(cmd, e); } }
Source:
public void initialize() { super.initialize(); sensors.add(new DS2401(sensorIds.get(0), this)); refreshInterval = 10 * 1000; validConfig = true; updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.NONE); }

Target:
public void initialize() { Configuration configuration = getConfig(); Map<String, String> properties = editProperties(); if (!super.configure()) { return; } if (getThing().getStatus() == ThingStatus.OFFLINE) { return; } if (!properties.containsKey(PROPERTY_MODELID)) { scheduler.execute(() -> { updateSensorProperties(); }); } sensors.add(new DS2401(sensorIds.get(0), this)); if (configuration.get(CONFIG_REFRESH) == null) { refreshInterval = 10 * 1000; } validConfig = true; updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.NONE); }
Source:
public boolean removeAttribute(PerunSession sess, Resource resource, Member member, AttributeDefinition attribute) throws InternalErrorException { try { if (0 < jdbc.update("DELETE FROM member_resource_attr_values WHERE attr_id=? AND member_id=? AND resource_id=?", attribute.getId(), member.getId(), resource.getId())) { log.debug("Attribute value was removed from member on resource {}" + resource, attribute, member); return true; } return false; } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }

Target:
public boolean removeAttribute(PerunSession sess, Resource resource, Member member, AttributeDefinition attribute) throws InternalErrorException { try { if (0 < jdbc.update("DELETE FROM member_resource_attr_values WHERE attr_id=? AND member_id=? AND resource_id=?", attribute.getId(), member.getId(), resource.getId())) { log.debug("Attribute value for was removed from member on resource {}.", attribute.getName(), member, resource); return true; } return false; } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
private void visitMultilineComment(Token token) { String value = token.getValue(); int startStringContent; if (value.endsWith("'''")) { startStringContent = value.indexOf("'''") + 3; } else { startStringContent = value.indexOf("\"\"\"") + 3; } int endStringContent = value.length() - 3; String text = value.substring(startStringContent, endStringContent); text = text.trim(); if (!isEmpty(text) && isTextParsedAsCode(text)) { addIssue(new AstNode(token), MESSAGE); } }

Target:
private void visitMultilineComment(Token token) { String value = token.getValue(); int startStringContent; if (value.endsWith("'''")) { startStringContent = value.indexOf("'''") + 3; } else { startStringContent = value.indexOf("\"\"\"") + 3; } int endStringContent = value.length() - 3; String text = value.substring(startStringContent, endStringContent); text = text.trim(); if (!isEmpty(text) && isTextParsedAsCode(text)) { addIssue(token, MESSAGE); } }
Source:
public void getFactNameAlias() { if (query.matches("(.*)where(.*)")) { String joinString = query.substring(query.indexOf("from"), query.indexOf("where")); String[] keys = joinString.split(" "); factTable = keys[1]; factAlias = keys[2]; } else if (query.matches("(.*)group by(.*)")) { String joinString = query.substring(query.indexOf("from"), query.indexOf("group by")); String[] keys = joinString.split(" "); factTable = keys[1]; factAlias = keys[2]; LOG.info("Input query missing where clause"); } else if (query.matches("(.*)order by(.*)")) { String joinString = query.substring(query.indexOf("from"), query.indexOf("order by")); String[] keys = joinString.split(" "); factTable = keys[1]; factAlias = keys[2]; LOG.info("Input query missing where clause and group by clause"); } else { LOG.info("Input query missing where, group by and order by clause"); } }

Target:
public void getFactNameAlias() { Pattern p = Pattern.compile("from(.*)"); Matcher m = p.matcher(query.toLowerCase()); if (m.find()) { String fromClause = m.group(1); String[] keys = fromClause.split(" "); factTable = keys[1]; factAlias = keys[2]; } }
Source:
public IndexEntry next() { if (cursor < 0 || cursor > numberOfEntries) { throw new NoSuchElementException(); } try { StoreKey key = getKeyAt(mmap, cursor); mmap.get(valueBuf); return new IndexEntry(key, new IndexValue(startOffset.getName(), ByteBuffer.wrap(valueBuf), getVersion())); } catch (Exception e) { String message = "Failed to read index entry at " + cursor; logger.error(message, e); throw new IllegalStateException(message, e); } finally { cursor++; } }

Target:
public IndexEntry next() { if (cursor < 0 || cursor >= numberOfEntries) { throw new NoSuchElementException(); } try { StoreKey key = getKeyAt(mmap, cursor); mmap.get(valueBuf); return new IndexEntry(key, new IndexValue(startOffset.getName(), ByteBuffer.wrap(valueBuf), getVersion())); } catch (Exception e) { throw new IllegalStateException( "Failed to read index entry at " + cursor + " in index segment file " + indexFile.getAbsolutePath(), e); } finally { cursor++; } }
Source:
public void setMinimum(String minimum) { if (minimum != null) { minimum = (LenientLimit.COMPUTE ? BigDecimal.ONE : new BigDecimal(minimum).subtract(LenientLimit.OFFSET)).toPlainString(); } super.setMinimum(minimum); }

Target:
public void setMinimum(String minimum) { if (minimum != null) { minimum = (LenientLimit.COMPUTE ? LenientLimit.ONE : new BigDecimal(minimum).subtract(LenientLimit.OFFSET)).toPlainString(); } super.setMinimum(minimum); }
Source:
public static ServiceConfigTypeAmbariToOriginalPattern findByAmbariConfType(String ambariConfType) { for (ServiceConfigTypeAmbariToOriginalPattern value : values()) { if (value.ambariConfType.equals(ambariConfType)) { return value; } } return null; }

Target:
public static Optional<ServiceConfigTypeAmbariToOriginalPattern> findByAmbariConfType(String ambariConfType) { for (ServiceConfigTypeAmbariToOriginalPattern value : values()) { if (value.ambariConfType.equals(ambariConfType)) { return Optional.of(value); } } return Optional.empty(); }
Source:
public void onPostUploaded(PostStore.OnPostUploaded event) { final PostModel post = event.post; SiteModel site = getSelectedSite(); if (isAdded() && event.post != null && event.post.getLocalSiteId() == site.getId()) { UploadUtils.onPostUploadedSnackbarHandler(getActivity(), getActivity().findViewById(R.id.coordinator), event, site, mDispatcher); } }

Target:
public void onPostUploaded(PostStore.OnPostUploaded event) { final PostModel post = event.post; if (isAdded() && event.post != null) { SiteModel site = getSelectedSite(); if (site != null) { if (event.post.getLocalSiteId() == site.getId()) { UploadUtils.onPostUploadedSnackbarHandler(getActivity(), getActivity().findViewById(R.id.coordinator), event, site, mDispatcher); } } } }
Source:
public AnalysisJobMetadata getMetadataProperties() { AnalysisJobMetadata jobMetadata = _engine.getJobMetadataFromJobFile(_tenantContext, _file) ; return jobMetadata ; }

Target:
public Map<String, String> getMetadataProperties() { return Collections.emptyMap(); }
Source:
<T> Ref<T> getOrLoadRef(DfsStreamKey key, RefLoader<T> loader) throws IOException { int slot = slot(key, 0); HashEntry e1 = table.get(slot); Ref<T> ref = scanRef(e1, key, 0); if (ref != null) { getStat(statHit, key).incrementAndGet(); return ref; } ReentrantLock regionLock = lockRef(key); long lockStart = System.currentTimeMillis(); regionLock.lock(); try { HashEntry e2 = table.get(slot); if (e2 != e1) { ref = scanRef(e2, key, 0); if (ref != null) { getStat(statHit, key).incrementAndGet(); return ref; } } if (refLockWaitTime != null) { refLockWaitTime.accept( Long.valueOf(System.currentTimeMillis() - lockStart)); } getStat(statMiss, key).incrementAndGet(); ref = loader.load(); reserveSpace(ref.size, key); for (;;) { HashEntry n = new HashEntry(clean(e2), ref); if (table.compareAndSet(slot, e2, n)) break; e2 = table.get(slot); } addToClock(ref, 0); } finally { regionLock.unlock(); } return ref; }

Target:
<T> Ref<T> getOrLoadRef(DfsStreamKey key, RefLoader<T> loader) throws IOException { int slot = slot(key, 0); HashEntry e1 = table.get(slot); Ref<T> ref = scanRef(e1, key, 0); if (ref != null) { getStat(statHit, key).incrementAndGet(); return ref; } ReentrantLock regionLock = lockForRef(key); long lockStart = System.currentTimeMillis(); regionLock.lock(); try { HashEntry e2 = table.get(slot); if (e2 != e1) { ref = scanRef(e2, key, 0); if (ref != null) { getStat(statHit, key).incrementAndGet(); return ref; } } if (refLockWaitTime != null) { refLockWaitTime.accept( Long.valueOf(System.currentTimeMillis() - lockStart)); } getStat(statMiss, key).incrementAndGet(); ref = loader.load(); ref.hot = true; reserveSpace(ref.size, key); for (;;) { HashEntry n = new HashEntry(clean(e2), ref); if (table.compareAndSet(slot, e2, n)) { break; } e2 = table.get(slot); } addToClock(ref, 0); } finally { regionLock.unlock(); } return ref; }
Source:
protected Control createDialogArea(Composite parent) { GridLayoutFactory.fillDefaults().margins(10, 10).applyTo(parent); Label label = new Label(parent, SWT.NONE); label.setText("Please remove everything which should not be sent to the server."); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.FILL).grab(true, false).applyTo(label); editText = new StyledText(parent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); editText.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); editText.setAlwaysShowScrollBars(false); editText.setText(value); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(SIZE_HINT_WIDTH, SIZE_HINT_HEIGHT).grab(true, true) .applyTo(editText); return parent; }

Target:
protected Control createDialogArea(Composite parent) { GridLayoutFactory.fillDefaults().margins(10, 10).applyTo(parent); Label label = new Label(parent, SWT.NONE); label.setText("Please remove any irrelevant or sensitive data."); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.FILL).grab(true, false).applyTo(label); editText = new StyledText(parent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); editText.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); editText.setAlwaysShowScrollBars(false); editText.setText(value); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(SIZE_HINT_WIDTH, SIZE_HINT_HEIGHT).grab(true, true) .applyTo(editText); return parent; }
Source:
private void addInvalidation(Data key) { if (!mapContainer.hasInvalidationListener()) { return; } if (invalidationKeys == null) { invalidationKeys = new ArrayList<>(loadingSequence.size() / 2); } invalidationKeys.add(key); }

Target:
private void addInvalidation(Data key) { if (!mapContainer.hasInvalidationListener()) { return; } if (invalidationKeys == null) { if (includesExpirationTime) { invalidationKeys = new ArrayList<>(loadingSequence.size() / 3); } else { invalidationKeys = new ArrayList<>(loadingSequence.size() / 2); } } invalidationKeys.add(key); }
Source:
@Override public BinaryClassificationMetricValues scoreAll(Iterator<LabelPair<Double>> iter) { long tp = 0; long tn = 0; long fp = 0; long fn = 0; double rocauc = Double.NaN; long pos = 0; long neg = 0; PriorityQueue<Pair<Double, Double>> queue = new PriorityQueue<>(new Comparator<Pair<Double, Double>>() { @Override public int compare(Pair<Double, Double> o1, Pair<Double, Double> o2) { if (o1.getKey() < o2.getKey()) return -1; if (o1.getKey() > o2.getKey()) return 1; return 0; } }); while (iter.hasNext()) { LabelPair<Double> e = iter.next(); double prediction = e.getPrediction(); double truth = e.getTruth(); if (prediction != negativeClsLb && prediction != positiveClsLb) throw new UnknownClassLabelException(prediction, positiveClsLb, negativeClsLb); if (truth != negativeClsLb && truth != positiveClsLb) throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb); if (truth == positiveClsLb && prediction == positiveClsLb) tp++; else if (truth == positiveClsLb && prediction == negativeClsLb) fn++; else if (truth == negativeClsLb && prediction == negativeClsLb) tn++; else if (truth == negativeClsLb && prediction == positiveClsLb) fp++; if(enableROCAUC) { queue.add(new Pair<>(prediction, truth)); if (truth == positiveClsLb) pos++; else if (truth == negativeClsLb) neg++; else throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb); } } if (enableROCAUC) rocauc = ROCAUC.calculateROCAUC(queue, pos, neg, positiveClsLb); return new BinaryClassificationMetricValues(tp, tn, fp, fn, rocauc); }

Target:
@Override public BinaryClassificationMetricValues scoreAll(Iterator<LabelPair<Double>> iter) { long tp = 0; long tn = 0; long fp = 0; long fn = 0; double rocauc = Double.NaN; long pos = 0; long neg = 0; PriorityQueue<Pair<Double, Double>> queue = new PriorityQueue<>(Comparator.comparingDouble(Pair::getKey)); while (iter.hasNext()) { LabelPair<Double> e = iter.next(); double prediction = e.getPrediction(); double truth = e.getTruth(); if (prediction != negativeClsLb && prediction != positiveClsLb) throw new UnknownClassLabelException(prediction, positiveClsLb, negativeClsLb); if (truth != negativeClsLb && truth != positiveClsLb) throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb); if (truth == positiveClsLb && prediction == positiveClsLb) tp++; else if (truth == positiveClsLb && prediction == negativeClsLb) fn++; else if (truth == negativeClsLb && prediction == negativeClsLb) tn++; else if (truth == negativeClsLb && prediction == positiveClsLb) fp++; if(enableROCAUC) { queue.add(new Pair<>(prediction, truth)); if (truth == positiveClsLb) pos++; else if (truth == negativeClsLb) neg++; else throw new UnknownClassLabelException(truth, positiveClsLb, negativeClsLb); } } if (enableROCAUC) rocauc = ROCAUC.calculateROCAUC(queue, pos, neg, positiveClsLb); return new BinaryClassificationMetricValues(tp, tn, fp, fn, rocauc); }
Source:
public void checkout() throws IOException { if (headCommitTree != null) preScanTwoTrees(); else prescanOneTree(); if (!conflicts.isEmpty()) { if (failOnConflict) { dc.unlock(); throw new IOException(JGitText.get().cannotDeleteFile); } else cleanUpConflicts(); } builder.finish(); File file=null; String last = ""; for (String r : removed) { file = new File(repo.getWorkDir(), r); file.delete(); if (!isSamePrefix(r, last)) removeEmptyParents(file); last = r; } if (file!=null) removeEmptyParents(file); for (String path : updated.keySet()) { file = new File(repo.getWorkDir(), path); file.getParentFile().mkdirs(); file.createNewFile(); DirCacheEntry entry = dc.getEntry(path); checkoutEntry(file, entry, config_filemode()); entry.setLastModified(file.lastModified()); entry.setLength((int) file.length()); } if (!builder.commit()) { dc.unlock(); throw new IOException(JGitText.get().cannotDeleteFile); } }

Target:
public boolean checkout() throws IOException { toBeDeleted.clear(); if (headCommitTree != null) preScanTwoTrees(); else prescanOneTree(); if (!conflicts.isEmpty()) { if (failOnConflict) { dc.unlock(); throw new CheckoutConflictException(conflicts.toArray(new String[conflicts.size()])); } else cleanUpConflicts(); } builder.finish(); File file=null; String last = ""; for (String r : removed) { file = new File(repo.getWorkDir(), r); if (!file.delete()) toBeDeleted.add(r); else { if (!isSamePrefix(r, last)) removeEmptyParents(file); last = r; } } if (file != null) removeEmptyParents(file); for (String path : updated.keySet()) { file = new File(repo.getWorkDir(), path); file.getParentFile().mkdirs(); file.createNewFile(); DirCacheEntry entry = dc.getEntry(path); checkoutEntry(file, entry, config_filemode()); } if (!builder.commit()) { dc.unlock(); throw new IndexWriteException(); } return toBeDeleted == null; }
Source:
public static OutputStyle forString(String outputStyle) { if(outputStyle == null) { return TABULAR; } switch(outputStyle) { case HTTP_PARAM_TABULAR: return TABULAR; case HTTP_PARAM_DOCUMENT: case HTTP_PARAM_MAP: return MAP; default: throw new IllegalArgumentException("Unknown outputStyle '" + outputStyle + "'"); } }

Target:
public static OutputStyle forString(String outputStyle) { if (outputStyle == null) { return TABULAR; } outputStyle = outputStyle.trim().toLowerCase(); switch (outputStyle) { case "": case PARAMETER_VALUE_OUTPUT_STYLE_TABULAR: return TABULAR; case PARAMETER_VALUE_OUTPUT_STYLE_DOCUMENT: case PARAMETER_VALUE_OUTPUT_STYLE_MAP: return MAP; default: throw new IllegalArgumentException("Unknown outputStyle '" + outputStyle + "'"); } }
Source:
public void onEventMainThread(LoginTask task) { if(AppPrefs.getInstance(this).isLoggedIn()) { broadcastLogInSuccess(this); Toast.makeText(this, "success login", Toast.LENGTH_SHORT).show(); startActivity(MainActivity.getLaunchIntent(this)); finish(); } else { Toast.makeText(this, "failed login", Toast.LENGTH_SHORT).show(); } }

Target:
public void onEventMainThread(LoginTask task) { if(AppPrefs.getInstance(this).isLoggedIn()) { broadcastLogInSuccess(this); Toast.makeText(this, "success login", Toast.LENGTH_SHORT).show(); startActivity(MainActivity.getLaunchIntent(this)); } else { Toast.makeText(this, "failed login", Toast.LENGTH_SHORT).show(); } }
Source:
private boolean copyCollapseOrNoSnapshots() { return !(noCollapseWithSnapshots()); }

Target:
private boolean copyCollapseOrNoSnapshots() { return getParameters().getVm().getSnapshots().size() <= 1 || getParameters().getCopyCollapse(); }