auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void triggerWindowProcess() throws Exception { while (windowsGrouping.hasTriggerWindow()) { RowIterator<BinaryRowData> elementIterator = windowsGrouping.buildTriggerWindowElementsIterator(); TimeWindow currentWindow = windowsGrouping.getTriggerWindow(); while (elementIterator.advanceNext()) { BinaryRowData winElement = elementIterator.getRow(); arrowSerializer.write(getFunctionInput(winElement)); currentBatchCount++; } if (currentBatchCount > 0) { inputKeyAndWindow.add(Tuple2.of(lastGroupSet, currentWindow)); arrowSerializer.finishCurrentBatch(); pythonFunctionRunner.process(baos.toByteArray()); elementCount += currentBatchCount; checkInvokeFinishBundleByCount(); currentBatchCount = 0; baos.reset(); } } }

Target:
private void triggerWindowProcess() throws Exception { while (windowsGrouping.hasTriggerWindow()) { RowIterator<BinaryRowData> elementIterator = windowsGrouping.buildTriggerWindowElementsIterator(); while (elementIterator.advanceNext()) { BinaryRowData winElement = elementIterator.getRow(); arrowSerializer.write(getFunctionInput(winElement)); currentBatchCount++; } if (currentBatchCount > 0) { TimeWindow currentWindow = windowsGrouping.getTriggerWindow(); inputKeyAndWindow.add(Tuple2.of(lastGroupSet, currentWindow)); arrowSerializer.finishCurrentBatch(); pythonFunctionRunner.process(baos.toByteArray()); elementCount += currentBatchCount; checkInvokeFinishBundleByCount(); currentBatchCount = 0; baos.reset(); } } }
Source:
public void shutdown() { m_executorService.shutdown(); }

Target:
public void shutdown() throws InterruptedException { m_isShutdown.set(true); networkLog.debug("Shutting down Encryption and Decryption services."); if (m_encEs != null) { m_encEs.shutdown(); m_encEs.awaitTermination(365, TimeUnit.DAYS); } if (m_decEs != null) { m_decEs.shutdown(); m_decEs.awaitTermination(365, TimeUnit.DAYS); } networkLog.debug("Encryption and Decryption services successfully shutdown."); }
Source:
public Double getExpectedValue(int start, int length) { assertTrue(length < MAX_SAMPLES); double[] samples = new double[2 * length]; for (int i = 0; i < length; i++) { samples[i] = (double) (start + i); samples[i + length] = (double) (start + i); } return calculateFromSamplesUsingVasicek(samples); }

Target:
public Double getExpectedValue(int start, int length) { assertTrue(2 * length < MAX_SAMPLES); double[] samples = new double[2 * length]; for (int i = 0; i < length; i++) { samples[i] = (double) (start + i); samples[i + length] = (double) (start + i); } return calculateFromSamplesUsingVasicek(samples); }
Source:
public static LogicalTableSpool create(RelNode input, Type readType, Type writeType, String tableName) { RelOptCluster cluster = input.getCluster(); RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE); return new LogicalTableSpool(cluster, traitSet, input, readType, writeType, tableName); }

Target:
public static LogicalTableSpool create(RelNode input, Type readType, Type writeType, String tableName) { RelOptCluster cluster = input.getCluster(); RelMetadataQuery mq = cluster.getMetadataQuery(); RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE) .replaceIfs(RelCollationTraitDef.INSTANCE, () -> mq.collations(input)) .replaceIf(RelDistributionTraitDef.INSTANCE, () -> mq.distribution(input)); return new LogicalTableSpool(cluster, traitSet, input, readType, writeType, tableName); }
Source:
public void getUserGroups() throws NotFoundException { Long[] expectedGroupIDs = {4l, 5l, 6l}; JCUser jcUser = new JCUser("user", "email@email.com", "pwd"); for (int i = 0; i < expectedGroupIDs.length; i++) { Group group = new Group("group" + i); group.setId(expectedGroupIDs[i]); jcUser.getGroups().add(group); } when(userService.get(anyLong())).thenReturn(jcUser); JsonResponse jsonResponse = userController.userGroups(1l); assertThat(jsonResponse.getStatus(), is(JsonResponseStatus.SUCCESS)); assertThat((Iterable<Long>) jsonResponse.getResult(), hasItems(expectedGroupIDs)); }

Target:
public void getUserGroups() throws NotFoundException { long userID = 1l; Component component = createDefaultComponent(); when(componentService.getComponentOfForum()).thenReturn(component); userController.userGroups(userID); verify(userService).getUserGroupIDs(component.getId(), userID); }
Source:
private void outputDiff(PrintStream out, String path, ObjectId id1, FileMode mode1, ObjectId id2, FileMode mode2, Repository repo) throws IOException { DiffFormatter fmt = new DiffFormatter(); String name1 = "a/" + path; String name2 = "b/" + path; out.println("diff --git " + name1 + " " + name2); boolean isNew = false; boolean isDelete = false; if (id1.equals(ObjectId.zeroId())) { out.println("new file mode " + mode2); isNew = true; } else if (id2.equals(ObjectId.zeroId())) { out.println("deleted file mode " + mode1); isDelete = true; } else if (!mode1.equals(mode2)) { out.println("old mode " + mode1); out.println("new mode " + mode2); } out.println("index " + id1.abbreviate(repo, 7).name() + ".." + id2.abbreviate(repo, 7).name() + (mode1.equals(mode2) ? " " + mode1 : "")); out.println("--- " + (isNew ? "/dev/null" : name1)); out.println("+++ " + (isDelete ? "/dev/null" : name2)); RawText a = getRawText(id1, repo); RawText b = getRawText(id2, repo); MyersDiff diff = new MyersDiff(a, b); fmt.formatEdits(out, a, b, diff.getEdits()); }

Target:
private void outputDiff(PrintStream out, String path, ObjectId id1, FileMode mode1, ObjectId id2, FileMode mode2, Repository repo) throws IOException { DiffFormatter fmt = new DiffFormatter(); String name1 = "a/" + path; if (needsQuoting(name1)) { name1 = QuotedString.GIT_PATH.quote(name1); } String name2 = "b/" + path; if (needsQuoting(name2)) { name2 = QuotedString.GIT_PATH.quote(name2); } out.print("diff --git " + name1 + " " + name2 + "\n"); boolean isNew = FileMode.MISSING.equals(mode1); boolean isDelete = FileMode.MISSING.equals(mode2); if (isNew) { out.print("new file mode " + mode2 + "\n"); } else if (isDelete) { out.print("deleted file mode " + mode1 + "\n"); } else if (!mode1.equals(mode2)) { out.print("old mode " + mode1 + "\n"); out.print("new mode " + mode2 + "\n"); } out.print("index " + id1.abbreviate(repo, 7).name() + ".." + id2.abbreviate(repo, 7).name() + (mode1.equals(mode2) ? " " + mode1 : "") + "\n"); out.print("--- " + (isNew ? "/dev/null" : name1) + "\n"); out.print("+++ " + (isDelete ? "/dev/null" : name2) + "\n"); RawText a = getRawText(id1, repo); RawText b = getRawText(id2, repo); MyersDiff diff = new MyersDiff(a, b); fmt.formatEdits(out, a, b, diff.getEdits()); }
Source:
public void pointWrite() throws IOException { Table table = connection.getTable(TableName.valueOf(BENCHMARK_WRITE_TABLE)); String rowPrefix = getRowPrefix(jobConfig.cellsPerRow, jobConfig.cellSize); Put put = new Put(Bytes.toBytes(rowPrefix + String.format(SUFFIX_FMT, 100))); long currentTimestamp = System.currentTimeMillis(); for (int cellInd = 0; cellInd < jobConfig.cellsPerRow; cellInd++) { put.addColumn( COL_FAMILY, Bytes.toBytes("qualifier-" + String.format(SUFFIX_FMT, cellInd)), currentTimestamp, getRandomBytes(jobConfig.cellSize)); } table.put(put); }

Target:
public void pointWrite() throws IOException { String rowKey = MUTATE_ROW_PREFIX + String.format("%06d", getRandomInt(1_000_000)); Put put = new Put(Bytes.toBytes(rowKey)); byte[] cellValue = getRandomBytes(rowShapeParams.cellSize); for (int cellInd = 0; cellInd < rowShapeParams.cellsPerRow; cellInd++) { put.addColumn( COL_FAMILY, Bytes.toBytes("qualifier-" + String.format("%06d", cellInd)), SAMPLE_TIMESTAMP, cellValue); } table.put(put); }
Source:
protected String getPattern(int groupOffset) { return "(&[A-Za-z]+;)"; }

Target:
protected String getPattern(int groupOffset) { return "(&[A-Za-z]{1,32}+;)"; }
Source:
private synchronized void initConnectStatusCheckCommand() { int reconnect = getReconnectParam(getUrl()); if (reconnect > 0 && (reconnectExecutorFuture == null || reconnectExecutorFuture.isCancelled())) { Runnable connectStatusCheckCommand = new Runnable() { @Override public void run() { try { if (cancelFutureIfOffline()) return; if (!isConnected()) { connect(); } else { lastConnectedTime = System.currentTimeMillis(); } } catch (Throwable t) { String errorMsg = "client reconnect to " + getUrl().getAddress() + " find error . url: " + getUrl(); if (System.currentTimeMillis() - lastConnectedTime > shutdown_timeout) { if (!reconnect_error_log_flag.get()) { reconnect_error_log_flag.set(true); logger.error(errorMsg, t); return; } } if (reconnect_count.getAndIncrement() % reconnect_warning_period == 0) { logger.warn(errorMsg, t); } } } private boolean cancelFutureIfOffline() { if(isClosed()) { ScheduledFuture<?> future = reconnectExecutorFuture; if(future != null && !future.isCancelled()){ future.cancel(true); } return true; } return false; } }; reconnectExecutorFuture = reconnectExecutorService.scheduleWithFixedDelay(connectStatusCheckCommand, reconnect, reconnect, TimeUnit.MILLISECONDS); } }

Target:
private synchronized void initConnectStatusCheckCommand() { int reconnect = getReconnectParam(getUrl()); if (reconnect > 0 && (reconnectExecutorFuture == null || reconnectExecutorFuture.isCancelled())) { Runnable connectStatusCheckCommand = new Runnable() { @Override public void run() { try { if (cancelFutureIfOffline()) { return; } if (!isConnected()) { connect(); } else { lastConnectedTime = System.currentTimeMillis(); } } catch (Throwable t) { String errorMsg = "client reconnect to " + getUrl().getAddress() + " find error . url: " + getUrl(); if (System.currentTimeMillis() - lastConnectedTime > shutdown_timeout) { if (!reconnect_error_log_flag.get()) { reconnect_error_log_flag.set(true); logger.error(errorMsg, t); return; } } if (reconnect_count.getAndIncrement() % reconnect_warning_period == 0) { logger.warn(errorMsg, t); } } } private boolean cancelFutureIfOffline() { if(isClosed()) { ScheduledFuture<?> future = reconnectExecutorFuture; if(future != null && !future.isCancelled()){ future.cancel(true); } return true; } return false; } }; reconnectExecutorFuture = reconnectExecutorService.scheduleWithFixedDelay(connectStatusCheckCommand, reconnect, reconnect, TimeUnit.MILLISECONDS); } }
Source:
public Rule Query() { return Sequence( Optional( QueryCliOrSimple() ), push( builder ) ); }

Target:
public Rule Query() { return Sequence( push( new MongoDBQueryDescriptorBuilder() ), Optional( CliQueryOrJsonFindQuery() ) ); }
Source:
public void hasSameOrderableAs_shouldReturnFalseIfTheConceptsMatchAndHaveDifferentDrugNonCoded() throws Exception { DrugOrder order = new DrugOrder(); Concept concept = new Concept(); order.setDrugNonCoded("Chrocine"); DrugOrder otherOrder = new DrugOrder(); otherOrder.setConcept(concept); otherOrder.setDrugNonCoded("paracetemol"); assertFalse(order.hasSameOrderableAs(otherOrder)); }

Target:
public void hasSameOrderableAs_shouldReturnFalseIfTheConceptsMatchAndHaveDifferentDrugNonCoded() throws Exception { DrugOrder order = new DrugOrder(); Concept concept = new Concept(); order.setConcept(concept); order.setDrugNonCoded("Chrocine"); DrugOrder otherOrder = new DrugOrder(); otherOrder.setConcept(concept); otherOrder.setDrugNonCoded("paracetemol"); assertFalse(order.hasSameOrderableAs(otherOrder)); }
Source:
protected void assertNoService(String serviceName, IType parameterTypes[]) { final IService service = serviceLookUp(serviceName, parameterTypes); assertTrue(service == null); }

Target:
protected void assertNoService(String serviceName, IType parameterTypes[]) { final IService service = serviceLookUp(serviceName, parameterTypes); assertNull(service); }
Source:
public static int getMaxHttpConnectionsPerHost() { return getSystemPropertyAndParseInt("org.eclipse.mylyn.commons.http.connections.per.host", MAX_HTTP_HOST_CONNECTIONS); }

Target:
public static int getMaxHttpConnectionsPerHost() { return getSystemPropertyAndParseInt(MAX_HTTP_HOST_CONNECTIONS_PROPERTY, MAX_HTTP_HOST_CONNECTIONS_DEFAULT); }
Source:
private Times saveTimes(){ if(isTestingSTO) { delays.remove(); Times times = new Times(delayBeforeSTOFlag, delayAfterBuildingTree); delays.set(times); return times; } throw new UnsupportedOperationException("Operation only supported for testing"); }

Target:
private Times saveTimes(){ if(isTestingSTO) { delays.remove(); Times times = new Times(delayBeforeSTOFlag, delayAfterBuildingTree); delays.set(times); return times; }else{ return null; } }
Source:
public static Launcher create(LauncherConfig config) throws PreconditionViolationException { Preconditions.notNull(config, "LauncherConfig must not be null"); Set<TestEngine> engines = new LinkedHashSet<>(); if (config.isTestEngineAutoRegistrationEnabled()) { new ServiceLoaderTestEngineRegistry().loadTestEngines().forEach(engines::add); } engines.addAll(config.getAdditionalTestEngines()); Set<PostDiscoveryFilter> filters = new LinkedHashSet<>(); if (config.isPostDiscoveryFilterAutoRegistrationEnabled()) { new ServiceLoaderPostDiscoveryFilterRegistry().loadPostDiscoveryFilters().forEach(filters::add); } filters.addAll(config.getAdditionalPostDiscoveryFilters()); Launcher launcher = new DefaultLauncher(engines, filters); if (config.isTestExecutionListenerAutoRegistrationEnabled()) { loadAndFilterTestExecutionListeners().forEach(launcher::registerTestExecutionListeners); } config.getAdditionalTestExecutionListeners().forEach(launcher::registerTestExecutionListeners); return launcher; }

Target:
public static Launcher create(LauncherConfig config) throws PreconditionViolationException { Preconditions.notNull(config, "LauncherConfig must not be null"); Set<TestEngine> engines = new LinkedHashSet<>(); if (config.isTestEngineAutoRegistrationEnabled()) { new ServiceLoaderTestEngineRegistry().loadTestEngines().forEach(engines::add); } engines.addAll(config.getAdditionalTestEngines()); List<PostDiscoveryFilter> filters = new ArrayList<>(); if (config.isPostDiscoveryFilterAutoRegistrationEnabled()) { new ServiceLoaderPostDiscoveryFilterRegistry().loadPostDiscoveryFilters().forEach(filters::add); } filters.addAll(config.getAdditionalPostDiscoveryFilters()); Launcher launcher = new DefaultLauncher(engines, filters); if (config.isTestExecutionListenerAutoRegistrationEnabled()) { loadAndFilterTestExecutionListeners().forEach(launcher::registerTestExecutionListeners); } config.getAdditionalTestExecutionListeners().forEach(launcher::registerTestExecutionListeners); return launcher; }
Source:
private void addJUnitMethodSourceValues(SimpleSetOfCharArray junitMethodSourceValues, Annotation annotation, char[] methodName) { for (MemberValuePair memberValuePair : annotation.memberValuePairs()) { if (CharOperation.equals(memberValuePair.name, TypeConstants.VALUE)) { Expression value = memberValuePair.value; if (value instanceof ArrayInitializer) { ArrayInitializer arrayInitializer = (ArrayInitializer) value; for (Expression arrayValue : arrayInitializer.expressions) { junitMethodSourceValues.add(getValueAsChars(arrayValue)); } } else { junitMethodSourceValues.add(getValueAsChars(value)); } } } junitMethodSourceValues.add(methodName); }

Target:
private void addJUnitMethodSourceValues(SimpleSetOfCharArray junitMethodSourceValues, Annotation annotation, char[] methodName) { for (MemberValuePair memberValuePair : annotation.memberValuePairs()) { if (CharOperation.equals(memberValuePair.name, TypeConstants.VALUE)) { Expression value = memberValuePair.value; if (value instanceof ArrayInitializer) { ArrayInitializer arrayInitializer = (ArrayInitializer) value; for (Expression arrayValue : arrayInitializer.expressions) { junitMethodSourceValues.add(getValueAsChars(arrayValue)); } } else { junitMethodSourceValues.add(getValueAsChars(value)); } return; } } junitMethodSourceValues.add(methodName); }
Source:
public RadiologyReport() { }

Target:
protected RadiologyReport() { }
Source:
public Response intercept(Chain chain) throws IOException { Request request = chain.request(); Connection connection = chain.connection(); if (connection == null) { String name = tagIsLocalSpanName && !(request.tag() instanceof Request) ? request.tag().toString() : spanName.spanName(new OkHttpRequest(request)); SpanId spanId = brave.localTracer().startNewSpan("okhttp", name); if (spanId == null) request = request.newBuilder().addHeader(Sampled.getName(), "0").build(); try { return chain.proceed(request); } catch (IOException | RuntimeException | Error e) { brave.localTracer().submitBinaryAnnotation(Constants.ERROR, e.getMessage()); throw e; } finally { brave.localTracer().finishSpan(); } } else { return traceRequest(chain, request, connection); } }

Target:
public Response intercept(Chain chain) throws IOException { Connection connection = chain.connection(); boolean applicationRequest = connection == null; Request request = chain.request(); SpanId spanId; if (applicationRequest) { spanId = localTracer.startNewSpan("okhttp", parser.applicationSpanName(request)); } else { spanId = clientTracer.startNewSpan(parser.networkSpanName(request)); } if (spanId == null) { return applicationRequest ? chain.proceed(request) : chain.proceed(request.newBuilder().header(Sampled.getName(), "0").build()); } else if (applicationRequest) { return traceApplicationRequest(chain, request); } else { Request tracedRequest = addTraceHeaders(request, spanId).build(); return traceNetworkRequest(chain, tracedRequest); } }
Source:
public void bogusDataTest() throws Exception { Socket socket = new Socket(); socket.connect(new InetSocketAddress(HostUtil.getHostName(), config.getOraclePort())); OutputStream outstream = socket .getOutputStream(); PrintWriter out = new PrintWriter(outstream); out.print("abcd"); out.flush(); socket.close(); OracleClient client = OracleClient.getInstance(config); assertEquals(2, client.getTimestamp()); }

Target:
public void bogusDataTest() throws Exception { Level curLevel = Logger.getLogger(THsHaServer.class).getLevel(); Logger.getLogger(THsHaServer.class).setLevel(Level.FATAL); Socket socket = new Socket(); socket.connect(new InetSocketAddress(HostUtil.getHostName(), config.getOraclePort())); OutputStream outstream = socket .getOutputStream(); PrintWriter out = new PrintWriter(outstream); out.print("abcd"); out.flush(); socket.close(); OracleClient client = OracleClient.getInstance(config); assertEquals(2, client.getTimestamp()); Logger.getLogger(THsHaServer.class).setLevel(curLevel); }
Source:
public String completeToolTipText(String toolTipText, EObject eObject, EStructuralFeature feature) { String toolTip = toolTipText; Option<EObject> parentRepresentationDescription = new EObjectQuery(eObject).getFirstAncestorOfType(DescriptionPackage.eINSTANCE.getRepresentationDescription()); if (parentRepresentationDescription.some()) { for (final DialectUI dialect : dialects.values()) { if (dialect.getServices().canHandle((RepresentationDescription) parentRepresentationDescription.get())) { toolTip = dialect.getServices().completeToolTipText(toolTipText, eObject, feature); } } } else { Option<EObject> parentRepresentationExtensionDescription = new EObjectQuery(eObject).getFirstAncestorOfType(DescriptionPackage.eINSTANCE.getRepresentationExtensionDescription()); if (parentRepresentationDescription.some()) { for (final DialectUI dialect : dialects.values()) { if (dialect.getServices().canHandle((RepresentationExtensionDescription) parentRepresentationExtensionDescription.get())) { toolTip = dialect.getServices().completeToolTipText(toolTipText, eObject); } } } } return toolTip; }

Target:
public String completeToolTipText(String toolTipText, EObject eObject, EStructuralFeature feature) { String toolTip = toolTipText; Option<EObject> parentRepresentationDescription = new EObjectQuery(eObject).getFirstAncestorOfType(DescriptionPackage.eINSTANCE.getRepresentationDescription()); if (parentRepresentationDescription.some()) { for (final DialectUI dialect : dialects.values()) { if (dialect.getServices().canHandle((RepresentationDescription) parentRepresentationDescription.get())) { toolTip = dialect.getServices().completeToolTipText(toolTipText, eObject, feature); } } } else { Option<EObject> parentRepresentationExtensionDescription = new EObjectQuery(eObject).getFirstAncestorOfType(DescriptionPackage.eINSTANCE.getRepresentationExtensionDescription()); if (parentRepresentationDescription.some()) { for (final DialectUI dialect : dialects.values()) { if (dialect.getServices().canHandle((RepresentationExtensionDescription) parentRepresentationExtensionDescription.get())) { toolTip = dialect.getServices().completeToolTipText(toolTipText, eObject, feature); } } } } return toolTip; }
Source:
public void resetPassword(Users p, String pass) throws Exception { List<Project> projects = projectFacade.findByUser(p); List<UserCerts> oldCerts = userCertsFacade.findUserCertsByUid(p.getUsername()); try { for (Project project : projects) { UserCerts userCert = userCertsFacade.findUserCert(project.getName(), p.getUsername()); String certPassword = HopsUtils.decrypt(p.getPassword(), userCert.getUserKeyPwd()); String newSecret = HopsUtils.encrypt(pass, certPassword); userCert.setUserKeyPwd(newSecret); userCertsFacade.persist(userCert); } p.setPassword(pass); p.setPasswordChanged(new Timestamp(new Date().getTime())); em.merge(p); } catch (Exception ex) { Logger.getLogger(UserManager.class.getName()).log(Level.SEVERE, null, ex); for (UserCerts oldCert : oldCerts) { userCertsFacade.persist(oldCert); } throw new Exception(ex); } }

Target:
public void resetPassword(Users p, String pass) throws Exception { List<Project> projects = projectFacade.findAllMemberStudies(p); List<UserCerts> oldCerts = userCertsFacade.findUserCertsByUid(p.getUsername()); List<ProjectGenericUserCerts> pguCerts = null; try { for (Project project : projects) { UserCerts userCert = userCertsFacade.findUserCert(project.getName(), p.getUsername()); String certPassword = HopsUtils.decrypt(p.getPassword(), userCert.getUserKeyPwd()); String newSecret = HopsUtils.encrypt(pass, certPassword); userCert.setUserKeyPwd(newSecret); userCertsFacade.persist(userCert); if (project.getOwner().equals(p)) { if (pguCerts == null) { pguCerts = new ArrayList<>(); } ProjectGenericUserCerts pguCert = userCertsFacade.findProjectGenericUserCerts(project.getName() + Settings.PROJECT_GENERIC_USER_SUFFIX); pguCerts.add(userCertsFacade.findProjectGenericUserCerts(project.getName() + Settings.PROJECT_GENERIC_USER_SUFFIX)); String pguCertPassword = HopsUtils.decrypt(p.getPassword(), pguCert.getCertificatePassword()); String newPguSecret = HopsUtils.encrypt(pass, pguCertPassword); pguCert.setCertificatePassword(newPguSecret); userCertsFacade.persistPGUCert(pguCert); } } p.setPassword(pass); p.setPasswordChanged(new Timestamp(new Date().getTime())); em.merge(p); } catch (Exception ex) { Logger.getLogger(UserManager.class.getName()).log(Level.SEVERE, null, ex); for (UserCerts oldCert : oldCerts) { userCertsFacade.persist(oldCert); } if (pguCerts != null) { for (ProjectGenericUserCerts pguCert : pguCerts) { userCertsFacade.persistPGUCert(pguCert); } } throw new Exception(ex); } }
Source:
public SavedSearch getSavedSearch(CoreSession session, String id) { DocumentRef docRef = new IdRef(id); DocumentModel savedSearchDoc = session.getDocument(docRef); if (savedSearchDoc != null) { SavedSearch search = savedSearchDoc.getAdapter(SavedSearch.class); if (search != null) { return search; } } return null; }

Target:
public SavedSearch getSavedSearch(CoreSession session, String id) { DocumentRef docRef = new IdRef(id); DocumentModel savedSearchDoc = session.getDocument(docRef); if (savedSearchDoc != null) { return savedSearchDoc.getAdapter(SavedSearch.class); } return null; }
Source:
public ColumnStatistics withBloomFilter(HiveBloomFilter bloomFilter) { return new ColumnStatistics( hasNumberOfValues() ? numberOfValues : null, minAverageValueSizeInBytes, booleanStatistics, integerStatistics, doubleStatistics, stringStatistics, dateStatistics, decimalStatistics, binaryStatistics, bloomFilter); }

Target:
public ColumnStatistics withBloomFilter(HiveBloomFilter bloomFilter) { return new ColumnStatistics( getNumberOfValues(), minAverageValueSizeInBytes, booleanStatistics, integerStatistics, doubleStatistics, stringStatistics, dateStatistics, decimalStatistics, binaryStatistics, bloomFilter); }
Source:
static NationalAppealChamberJudgment createSimpleNacJudgment(){ NationalAppealChamberJudgment judgment = new NationalAppealChamberJudgment(); judgment.addCourtCase(new CourtCase(RandomStringUtils.randomAlphanumeric(10))); judgment.getSourceInfo().setSourceCode(SourceCode.NATIONAL_APPEAL_CHAMBER); judgment.getSourceInfo().setSourceJudgmentId(RandomStringUtils.randomAlphabetic(20)); return judgment; }

Target:
public static NationalAppealChamberJudgment createSimpleNacJudgment(){ NationalAppealChamberJudgment judgment = new NationalAppealChamberJudgment(); judgment.addCourtCase(new CourtCase(RandomStringUtils.randomAlphanumeric(10))); judgment.getSourceInfo().setSourceCode(SourceCode.NATIONAL_APPEAL_CHAMBER); judgment.getSourceInfo().setSourceJudgmentId(RandomStringUtils.randomAlphabetic(20)); return judgment; }
Source:
public void close() throws Exception { metricsMgrClient.stop(); looper.exitLoop(); outMetricsQueues.clear(); }

Target:
public void close() throws Exception { looper.exitLoop(); metricsMgrClient.stop(); outMetricsQueues.clear(); }
Source:
public void getFromPoint(RotatedTileBox tb,PointF point, List<? super TransportStop> res) { if (objects != null) { int ex = (int) point.x; int ey = (int) point.y; final int rp = getRadiusPoi(tb); int radius = rp * 3 / 2; int small = rp; try { for (int i = 0; i < objects.size(); i++) { TransportStop n = objects.get(i); if (n.getLocation() == null){ return; } int x = (int) tb.getPixXFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude()); int y = (int) tb.getPixYFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude()); if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) { radius = small; res.add(n); } } } catch (IndexOutOfBoundsException e) { } } }

Target:
public void getFromPoint(RotatedTileBox tb,PointF point, List<? super TransportStop> res) { if (objects != null) { int ex = (int) point.x; int ey = (int) point.y; final int rp = getRadiusPoi(tb); int radius = rp * 3 / 2; int small = rp; try { for (int i = 0; i < objects.size(); i++) { TransportStop n = objects.get(i); if (n.getLocation() == null){ continue; } int x = (int) tb.getPixXFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude()); int y = (int) tb.getPixYFromLatLon(n.getLocation().getLatitude(), n.getLocation().getLongitude()); if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) { radius = small; res.add(n); } } } catch (IndexOutOfBoundsException e) { } } }
Source:
public void testKillEmpty() { Bubble bubble = new Bubble(new Point(0, 0), new Point(0, 0), null); ArrayList<Player> playerList = new ArrayList<Player>(); ArrayList<Unit> unitList = new ArrayList<Unit>(); List<Cell> items = new ArrayList<Cell>(); items.add(Cell.EMPTY); Grid<Cell> cells = new Grid<Cell>(items, 1, 1); Level level = new Level(playerList, unitList, cells); final int TIME_ALMOST_KILL = 498; assertTrue(bubble.isAlive()); for(int i = 0; i < TIME_ALMOST_KILL; i++) { bubble.tick(level); } assertTrue(bubble.isHit()); assertTrue(bubble.isAlive()); bubble.tick(level); assertFalse(bubble.isAlive()); }

Target:
public void testKillEmpty() { Bubble bubble = new Bubble(new Point(0, 0), new Point(0, 0), null); ArrayList<Player> playerList = new ArrayList<Player>(); ArrayList<Unit> unitList = new ArrayList<Unit>(); List<Cell> items = new ArrayList<Cell>(); items.add(Cell.EMPTY); Grid<Cell> cells = new Grid<Cell>(items, 1, 1); Level level = new Level(playerList, unitList, cells); assertTrue(bubble.isAlive()); for (int i = 0; i < TIME_ALMOST_KILL; i++) { bubble.tick(level); } assertTrue(bubble.isHit()); assertTrue(bubble.isAlive()); bubble.tick(level); assertFalse(bubble.isAlive()); }
Source:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof RefRepresentation || rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("value"); description.addProperty("locale"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("value"); description.addProperty("locale"); description.addSelfLink(); return description; } return null; }

Target:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof RefRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addSelfLink(); return description; } else if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addProperty("value"); description.addProperty("locale"); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); description.addSelfLink(); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addProperty("value"); description.addProperty("locale"); description.addSelfLink(); return description; } return null; }
Source:
private static String getXMLChunk(String xmlnsAttributeName, String xmlnsXsiAttributeName){ StringBuffer xmlChunk = new StringBuffer(); xmlChunk.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n"); xmlChunk.append("<!-- ******Testing tool generated XML****** Version 1.2.\n\n"); xmlChunk.append("Generated On").append(getCXMLDate(true)).append(" for PO ").append(poNumber).append(" Doc# ").append(docNumber).append(" -->\n\n"); xmlChunk.append("<!-- All the cXML attributes are junk values -->\n"); xmlChunk.append("<cXML payloadID=\"200807260401062080.964@eai002\"\n"); xmlChunk.append("timestamp="). append(getCXMLDate(true)).append("\n"); xmlChunk.append("version=\"1.2.014\" xml:lang=\"en\"\n"); if (StringUtils.isNotBlank(xmlnsAttributeName)) { xmlChunk.append(String.format(ATTRIBUTE_NAME_VALUE_FORMAT, xmlnsAttributeName, CuPurapTestConstants.EINVOICE_NAMESPACE_URL)); xmlChunk.append("\n"); } if (StringUtils.isNotBlank(xmlnsXsiAttributeName)) { xmlChunk.append(String.format(ATTRIBUTE_NAME_VALUE_FORMAT, xmlnsXsiAttributeName, CuPurapTestConstants.XSI_NAMESPACE_URL)); } xmlChunk.append(">\n"); xmlChunk.append(getHeaderXMLChunk()); xmlChunk.append(getRequestXMLChunk()); xmlChunk.append("</cXML>"); return xmlChunk.toString(); }

Target:
private static String getXMLChunk(String xmlnsAttributeName, String xmlnsXsiAttributeName){ StringBuffer xmlChunk = new StringBuffer(); xmlChunk.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n"); xmlChunk.append("<!-- ******Testing tool generated XML****** Version 1.2.\n\n"); xmlChunk.append("Generated On").append(getCXMLDate(true)).append(" for PO ").append(poNumber).append(" Doc# ").append(docNumber).append(" -->\n\n"); xmlChunk.append("<!-- All the cXML attributes are junk values -->\n"); xmlChunk.append("<cXML payloadID=\"200807260401062080.964@eai002\"\n"); xmlChunk.append("timestamp="). append(getCXMLDate(true)).append("\n"); xmlChunk.append("version=\"1.2.014\" xml:lang=\"en\"\n"); if (StringUtils.isNotBlank(xmlnsAttributeName)) { xmlChunk.append(String.format(ATTRIBUTE_NAME_VALUE_FORMAT, xmlnsAttributeName, CuPurapTestConstants.EINVOICE_NAMESPACE_URL)); xmlChunk.append(KFSConstants.NEWLINE); } if (StringUtils.isNotBlank(xmlnsXsiAttributeName)) { xmlChunk.append(String.format(ATTRIBUTE_NAME_VALUE_FORMAT, xmlnsXsiAttributeName, CuPurapTestConstants.XSI_NAMESPACE_URL)); } xmlChunk.append(">\n"); xmlChunk.append(getHeaderXMLChunk()); xmlChunk.append(getRequestXMLChunk()); xmlChunk.append("</cXML>"); return xmlChunk.toString(); }
Source:
private static BinaryResult stackBase64(HttpServletResponse res, final BinaryResult src) throws IOException { BinaryResult b64; long len = src.getContentLength(); if (0 <= len && len <= (7 << 20)) { b64 = base64(src); } else { b64 = new BinaryResult() { @Override public void writeTo(OutputStream out) throws IOException { OutputStream e = BaseEncoding.base64().encodingStream( new OutputStreamWriter(out, ISO_8859_1)); src.writeTo(e); e.flush(); e.close(); } }; } res.setHeader("X-FYI-Content-Encoding", "base64"); res.setHeader("X-FYI-Content-Type", src.getContentType()); return b64.setContentType("text/plain").setCharacterEncoding("ISO-8859-1"); }

Target:
private static BinaryResult stackBase64(HttpServletResponse res, final BinaryResult src) throws IOException { BinaryResult b64; long len = src.getContentLength(); if (0 <= len && len <= (7 << 20)) { b64 = base64(src); } else { b64 = new BinaryResult() { @Override public void writeTo(OutputStream out) throws IOException { try (OutputStream e = BaseEncoding.base64().encodingStream( new OutputStreamWriter(out, ISO_8859_1))) { src.writeTo(e); e.flush(); } } }; } res.setHeader("X-FYI-Content-Encoding", "base64"); res.setHeader("X-FYI-Content-Type", src.getContentType()); return b64.setContentType("text/plain").setCharacterEncoding("ISO-8859-1"); }
Source:
private void expandZip() throws CoreException, IOException { IProgressMonitor monitor = getProgessMonitor(); ZipFile zipFile = null; try { zipFile = new ZipFile(zipLocation.toFile()); } catch (IOException e1) { throw e1; } try { Enumeration entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); monitor.subTask(entry.getName()); File aFile = computeLocation(entry.getName()).toFile(); File parentFile = null; try { if (entry.isDirectory()) { aFile.mkdirs(); } else { parentFile = aFile.getParentFile(); if (!parentFile.exists()) parentFile.mkdirs(); if (!aFile.exists()) aFile.createNewFile(); copy(zipFile.getInputStream(entry), new FileOutputStream(aFile)); if (entry.getTime() > 0) aFile.setLastModified(entry.getTime()); } } catch (IOException e) { throw e; } monitor.worked(1); } } finally { if (zipFile != null) { zipFile.close(); } } }

Target:
private void expandZip() throws CoreException, IOException { IProgressMonitor monitor = getProgessMonitor(); ZipFile zipFile = null; try { zipFile = new ZipFile(zipLocation.toFile()); } catch (IOException e1) { throw e1; } try { Enumeration entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); monitor.subTask(entry.getName()); File aFile = computeLocation(entry.getName()).toFile(); File parentFile = null; try { if (entry.isDirectory()) { aFile.mkdirs(); } else { parentFile = aFile.getParentFile(); if (!parentFile.exists()) parentFile.mkdirs(); if (!aFile.exists()) aFile.createNewFile(); copy(zipFile.getInputStream(entry), new FileOutputStream(aFile)); if (entry.getTime() > 0) aFile.setLastModified(entry.getTime()); } } catch (IOException e) { throw e; } monitor.worked(1); } } finally { zipFile.close(); } }
Source:
public void run(String realfile, String host, int port, boolean debug2, List<String> tests) throws MalformedURLException, URISyntaxException { debug = debug2; String file = "reactivesocket-tck-drivers/src/test/resources/client.txt"; if (realfile != null) file = realfile; try { setURI(new URI("tcp://" + host + ":" + port + "/rs")); JavaClientDriver jd = new JavaClientDriver(file, JavaTCPClient::createClient, tests); jd.runTests(); } catch (Exception e) { e.printStackTrace(); } }

Target:
public void run(String realfile, String host, int port, boolean debug2, List<String> tests) throws MalformedURLException, URISyntaxException { debug = debug2; String file = "reactivesocket-tck-drivers/src/test/resources/client$.txt"; if (realfile != null) file = realfile; try { setURI(new URI("tcp://" + host + ":" + port + "/rs")); JavaClientDriver jd = new JavaClientDriver(file, JavaTCPClient::createClient, tests); jd.runTests(); } catch (Exception e) { e.printStackTrace(); } }
Source:
private char[] versionClientLibs(final char[] chars, int pos, int len, Transformer transformer) { char[] outputChar = chars; String section = StringUtils.trim(new String(chars, pos, len)); Pattern pattern = Pattern.compile(CONDITIONAL_COMMENT_REGEX); Matcher matcher = pattern.matcher(section); if (matcher.matches()) { try { String parsedConditionalMarkup = parseConditionalMarkup(matcher.group(3), transformer); outputChar = StringUtils.replace(new String(chars), matcher.group(3), parsedConditionalMarkup).toCharArray(); } catch (IOException e) { log.error(e.getMessage()); } } return outputChar; }

Target:
private char[] versionClientLibs(final char[] chars, int pos, int len, Transformer transformer) { char[] outputChar = chars; final String section = StringUtils.trim(new String(chars, pos, len)); final Matcher matcher = CONDITIONAL_COMMENT_PATTERN.matcher(section); if (matcher.matches()) { try { String parsedConditionalMarkup = parseConditionalMarkup(matcher.group(3), transformer); outputChar = StringUtils.replace(new String(chars), matcher.group(3), parsedConditionalMarkup).toCharArray(); } catch (IOException e) { log.error(e.getMessage()); } } return outputChar; }
Source:
private void closeTableResources() { try { if (Objects.nonNull(statement)) { statement.close(); } if (Objects.nonNull(queryResults)) { queryResults.close(); } liveResultSet = false; } catch (SQLException ex) { } }

Target:
private void closeTableResources() { try { if (Objects.nonNull(statement)) { statement.close(); } if (Objects.nonNull(queryResults)) { queryResults.close(); } liveResultSet = false; } catch (SQLException ex) { logger.log(Level.SEVERE, "Failed to close table resources", ex); } }
Source:
public File getFlywayMigrationDirectory() { String flywayLocation = getFlywayLocations()[0]; File migrationDirectory = new File(System.getProperty("user.home"), Constants.EntitiesMigration.MIGRATION_DIRECTORY); migrationDirectory = new File(migrationDirectory, flywayLocation.substring(flywayLocation.lastIndexOf('/') + 1)); return migrationDirectory; }

Target:
public File getFlywayMigrationDirectory() { String flywayLocation = getFlywayLocations()[0]; File migrationDirectory = new File(coreConfigurationService.loadBootstrapConfig().getMotechDir(), Constants.EntitiesMigration.MIGRATION_DIRECTORY); migrationDirectory = new File(migrationDirectory, flywayLocation.substring(flywayLocation.lastIndexOf('/') + 1)); return migrationDirectory; }
Source:
public void init() { employeeRepository.save(new Employee("Bilbo", "Baggins", "thief")); employeeRepository.save(new Employee("Frodo", "Baggins", "ring bearer")); employeeRepository.save(new Employee("Gandalf", "the Wizard", "servant of the Secret Fire")); SecurityContextHolder.getContext().setAuthentication( new UsernamePasswordAuthenticationToken("system", "system", AuthorityUtils.createAuthorityList("ROLE_ADMIN"))); itemRepository.save(new Item("Sting")); itemRepository.save(new Item("the one ring")); SecurityContextHolder.clearContext(); }

Target:
public void init() { employeeRepository.save(new Employee("Bilbo", "Baggins", "thief")); employeeRepository.save(new Employee("Frodo", "Baggins", "ring bearer")); employeeRepository.save(new Employee("Gandalf", "the Wizard", "servant of the Secret Fire")); SecurityUtils.runAs("system", "system", "ROLE_ADMIN"); itemRepository.save(new Item("Sting")); itemRepository.save(new Item("the one ring")); SecurityContextHolder.clearContext(); }
Source:
private boolean isWithoutRoot(Parameter[] parameters, JsonObject root, ControllerMethod method) { if(method.containsAnnotation(Consumes.class) && method.getMethod().getAnnotation(Consumes.class).withoutRoot()) { return true; } for (Parameter parameter : parameters) { if (root.get(parameter.getName()) != null) return false; } return true; }

Target:
private boolean isWithoutRoot(Parameter[] parameters, JsonObject root, ControllerMethod method) { if(method.getMethod().getAnnotation(Consumes.class).withoutRoot()) { return true; } for (Parameter parameter : parameters) { if (root.get(parameter.getName()) != null) return false; } return true; }
Source:
protected Properties initJobProperties(Element root) { Properties properties = new Properties(); Node propertiesNode = root.getElementsByTagName(JOB_PROPERTIES_ELEMENT_NAME).item(0); if(propertiesNode != null) { NodeList children = propertiesNode.getChildNodes(); for(int i=0; i < children.getLength(); i++) { Node child = children.item(i); if(JOB_PROPERTY_ELEMENT_NAME.equals(child.getLocalName())) { NamedNodeMap attributes = child.getAttributes(); Node name = attributes.getNamedItem(JOB_PROPERTY_ELEMENT_NAME_ATTRIBUTE); Node value = attributes.getNamedItem(JOB_PROPERTY_ELEMENT_VALUE_ATTRIBUTE); properties.setProperty(name.getNodeValue(), value.getNodeValue()); } } } return properties; }

Target:
private Properties initJobProperties(Element root) { Properties properties = new Properties(); Node propertiesNode = root.getElementsByTagName(JOB_PROPERTIES_ELEMENT_NAME).item(0); if(propertiesNode != null) { NodeList children = propertiesNode.getChildNodes(); for(int i=0; i < children.getLength(); i++) { Node child = children.item(i); if(JOB_PROPERTY_ELEMENT_NAME.equals(child.getLocalName())) { NamedNodeMap attributes = child.getAttributes(); Node name = attributes.getNamedItem(JOB_PROPERTY_ELEMENT_NAME_ATTRIBUTE); Node value = attributes.getNamedItem(JOB_PROPERTY_ELEMENT_VALUE_ATTRIBUTE); properties.setProperty(name.getNodeValue(), value.getNodeValue()); } } } return properties; }
Source:
private void checkForMissedServletContexts() { Optional<BundleContext> optionalBundleContext = getContext(); if (!optionalBundleContext.isPresent()) { LOGGER.error( "Problem retrieving the bundle `Platform :: Error :: Page Injector` after it's just been initialized"); return; } final BundleContext context = optionalBundleContext.get(); ServiceReference<ServletContext>[] references = null; try { references = (ServiceReference<ServletContext>[]) context.getAllServiceReferences( null, "(" + Constants.OBJECTCLASS + "=javax.servlet.ServletContext)"); } catch (InvalidSyntaxException e) { LOGGER.error( "Problem getting ServletContexts from OSGI, One of the servlets running might print stack traces to the browser. A system restart is recommended. See debug logs for additional details."); LOGGER.debug("Additional Details:", e); } if (references == null) return; for (ServiceReference<ServletContext> reference : references) { final Bundle refBundle = reference.getBundle(); final BundleContext bundlectx = refBundle.getBundleContext(); ServletContext service = bundlectx.getService(reference); Optional<ServletContextHandler> optionalHttpContext = getHTTPContext(service, refBundle); if (!optionalHttpContext.isPresent()) return; ServletContextHandler httpContext = optionalHttpContext.get(); ErrorPageErrorHandler errorPageErrorHandler = (ErrorPageErrorHandler) httpContext.getErrorHandler(); final Map<String, String> errorPages = errorPageErrorHandler.getErrorPages(); if (errorPages.isEmpty()) { createAndAddErrorPageHandler(httpContext, refBundle); } } }

Target:
private void checkForMissedServletContexts() { Optional<BundleContext> optionalBundleContext = getContext(); if (!optionalBundleContext.isPresent()) { LOGGER.warn( "Problem retrieving the bundle `Platform :: Error :: Page Injector` after it's just been initialized"); return; } final BundleContext context = optionalBundleContext.get(); getServiceReferences(context) .ifPresent(e -> Arrays.asList(e).forEach(this::addMissedErrorPage)); }
Source:
protected boolean setAndValidateDiskProfiles() { if (getParameters().getVmTemplate().getDiskList() != null) { Map<DiskImage, Guid> map = new HashMap<>(); for (DiskImage diskImage : getParameters().getVmTemplate().getDiskList()) { if (diskImage.getDiskStorageType() == DiskStorageType.IMAGE) { map.put(diskImage, imageToDestinationDomainMap.get(diskImage.getId())); } } return validate(DiskProfileHelper.setAndValidateDiskProfiles(map)); } return true; }

Target:
protected boolean setAndValidateDiskProfiles() { if (getParameters().getVmTemplate().getDiskList() != null) { Map<DiskImage, Guid> map = new HashMap<>(); for (DiskImage diskImage : getParameters().getVmTemplate().getDiskList()) { map.put(diskImage, imageToDestinationDomainMap.get(diskImage.getId())); } return validate(DiskProfileHelper.setAndValidateDiskProfiles(map)); } return true; }
Source:
public void testCherryPickConflictResolution() throws Exception { Git git = new Git(db); RevCommit sideCommit = prepareCherryPick(git); CherryPickResult result = git.cherryPick().include(sideCommit.getId()) .call(); assertEquals(CherryPickStatus.CONFLICTING, result.getStatus()); assertTrue(new File(db.getDirectory(), Constants.MERGE_MSG).exists()); assertEquals("side\n\nConflicts:\n\ta", db.readMergeCommitMsg()); assertTrue(new File(db.getDirectory(), Constants.CHERRY_PICK_HEAD) .exists()); assertEquals(sideCommit.getId(), db.readCherryPickHead()); assertEquals(RepositoryState.CHERRY_PICKING, db.getRepositoryState()); writeTrashFile("a", "a"); git.add().addFilepattern("a").call(); assertEquals(RepositoryState.CHERRY_PICKING_RESOLVED, db.getRepositoryState()); git.commit().setOnly("a").setMessage("resolve").call(); assertEquals(RepositoryState.SAFE, db.getRepositoryState()); }

Target:
public void testCherryPickConflictResolution() throws Exception { Git git = new Git(db); RevCommit sideCommit = prepareCherryPick(git); CherryPickResult result = git.cherryPick().include(sideCommit.getId()) .call(); assertEquals(CherryPickStatus.CONFLICTING, result.getStatus()); assertTrue(new File(db.getDirectory(), Constants.MERGE_MSG).exists()); assertEquals("side\n\nConflicts:\n\ta\n", db.readMergeCommitMsg()); assertTrue(new File(db.getDirectory(), Constants.CHERRY_PICK_HEAD) .exists()); assertEquals(sideCommit.getId(), db.readCherryPickHead()); assertEquals(RepositoryState.CHERRY_PICKING, db.getRepositoryState()); writeTrashFile("a", "a"); git.add().addFilepattern("a").call(); assertEquals(RepositoryState.CHERRY_PICKING_RESOLVED, db.getRepositoryState()); git.commit().setOnly("a").setMessage("resolve").call(); assertEquals(RepositoryState.SAFE, db.getRepositoryState()); }
Source:
private void promptForFactorString( String title, final Operation complete, final String columnName, final String columnType) { globalDisplay_.promptForText( title, "Please a comma separated list of factors", "", new OperationWithInput<String>() { @Override public void execute(final String formatString) { String[] parts = formatString.split(","); String factorsString = ""; boolean first = true; for (String part : parts) { part = part.replaceAll("^\\s+|\\s+$", ""); if (!first) factorsString = factorsString + ", "; factorsString = factorsString + "\"" + part + "\""; first = false; } importOptions_.setColumnDefinition(columnName, columnType, "c(" + factorsString + ")"); complete.execute(); } }); }

Target:
private void promptForFactorString( String title, final Operation complete, final String columnName, final String columnType) { globalDisplay_.promptForText( title, "Please insert a comma separated list of factors", "", new OperationWithInput<String>() { @Override public void execute(final String formatString) { String[] parts = formatString.split(","); String factorsString = ""; boolean first = true; for (String part : parts) { part = part.replaceAll("^\\s+|\\s+$", ""); if (!first) factorsString = factorsString + ", "; factorsString = factorsString + "\"" + part + "\""; first = false; } importOptions_.setColumnDefinition(columnName, columnType, "c(" + factorsString + ")"); complete.execute(); } }); }