auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void downloadPatientByUuid(@NonNull final String uuid, @NonNull final DownloadPatientCallbackListener callbackListener) { RestApi restApi = RestServiceBuilder.createService(RestApi.class); Call<Patient> call = restApi.getPatientByUUID(uuid, "full"); call.enqueue(new Callback<Patient>() { @Override public void onResponse(Call<Patient> call, Response<Patient> response) { if (response.isSuccessful()) { final Patient newPatient = response.body(); downloadPatientPhotoByUuid(uuid, new DownloadPatientPhotoCallbackListener() { @Override public void onPatientPhotoDownloaded(ResponseBody base64PatientPhoto) { InputStream inputStream = base64PatientPhoto.byteStream(); logger.i("setting image"); Bitmap bitmap = BitmapFactory.decodeStream(inputStream); try { inputStream.close(); } catch (IOException e) { <START> e.printStackTrace(); <END> } if (bitmap != null) { newPatient.getPerson().setPhoto(bitmap); } else logger.i("bitmap = null"); } @Override public void onResponse() { } @Override public void onErrorResponse(String errorMsg) { logger.i(errorMsg); } }); if (newPatient.getPerson().getPhoto() != null) { logger.i("photo set"); } else { logger.i("photo is null"); } callbackListener.onPatientDownloaded(newPatient); } else { callbackListener.onErrorResponse(response.message()); } } @Override public void onFailure(Call<Patient> call, Throwable t) { callbackListener.onErrorResponse(t.getMessage()); } }); }</code><technical_language>do exception. e.g. logging</technical_language>

Target:
public void downloadPatientByUuid(@NonNull final String uuid, @NonNull final DownloadPatientCallbackListener callbackListener) { RestApi restApi = RestServiceBuilder.createService(RestApi.class); Call<Patient> call = restApi.getPatientByUUID(uuid, "full"); call.enqueue(new Callback<Patient>() { @Override public void onResponse(Call<Patient> call, Response<Patient> response) { if (response.isSuccessful()) { final Patient newPatient = response.body(); AndroidDeferredManager dm = new AndroidDeferredManager(); dm.when(downloadPatientPhotoByUuid(newPatient.getUuid())).done(new DoneCallback<Bitmap>() { @Override public void onDone(Bitmap result) { if (result != null) { newPatient.getPerson().setPhoto(result); callbackListener.onPatientPhotoDownloaded(newPatient); } } }); callbackListener.onPatientDownloaded(newPatient); } else { callbackListener.onErrorResponse(response.message()); } } @Override public void onFailure(Call<Patient> call, Throwable t) { callbackListener.onErrorResponse(t.getMessage()); } }); }
Source:
<code>public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { <START> name = (Text)ExtUtil.read(in, new ExtWrapNullable(Text.class)); <END> imageReference = (Text)ExtUtil.read(in, new ExtWrapNullable(Text.class)); audioReference = (Text)ExtUtil.read(in, new ExtWrapNullable(Text.class)); }</code><technical_language>This nullable, it? (not sure...)</technical_language>

Target:
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { name = (Text)ExtUtil.read(in, Text.class, pf); imageReference = (Text)ExtUtil.read(in, new ExtWrapNullable(Text.class)); audioReference = (Text)ExtUtil.read(in, new ExtWrapNullable(Text.class)); }
Source:
<code>public void testDisabledOutcomeSuccess() throws Exception { service.setSuccess(true); trackerFactory.saveInfluenceParams(disabledInfluenceParams); sessionManager.initSessionFromCache(); controller.sendOutcomeEvent(OUTCOME_NAME); threadAndTaskWait(); new Thread(new Runnable() { @Override public void run() { <START> handler.setOutcomes(repository.getSavedOutcomeEvents()); <END> } }, "OS_GET_SAVED_OUTCOMES_SUCCESS").start(); threadAndTaskWait(); assertEquals(0, outcomeEvents.size()); assertEquals("{}", service.getLastJsonObjectSent()); }</code><technical_language>run this thread</technical_language>

Target:
public void testDisabledOutcomeSuccess() throws Exception { service.setSuccess(true); trackerFactory.saveInfluenceParams(disabledInfluenceParams); sessionManager.initSessionFromCache(); controller.sendOutcomeEvent(OUTCOME_NAME); threadAndTaskWait(); handler.setOutcomes(repository.getSavedOutcomeEvents()); threadAndTaskWait(); assertEquals(0, outcomeEvents.size()); assertEquals("{}", service.getLastJsonObjectSent()); }
Source:
<code>public void testHttpIngestionInvalidPastCollectionTime() throws Exception { String prefix = getPrefix(); <START> long time = System.currentTimeMillis() - 600000 - Configuration.getInstance().getLongProperty( CoreConfig.BEFORE_CURRENT_COLLECTIONTIME_MS ); <END> HttpResponse response = postGenMetric( TID, prefix, postPath, time ); assertEquals( 400, response.getStatusLine().getStatusCode() ); String[] output = getBodyArray( response ); assertTrue( Pattern.matches( JSONMetricsContainerTest.PAST_COLLECTION_TIME_REGEX, output[ 1 ] ) ); assertTrue( Pattern.matches( JSONMetricsContainerTest.PAST_COLLECTION_TIME_REGEX, output[ 2 ] ) ); assertTrue( Pattern.matches( JSONMetricsContainerTest.PAST_COLLECTION_TIME_REGEX, output[ 3 ] ) ); }</code><technical_language>this 600000 significance</technical_language>

Target:
public void testHttpIngestionInvalidPastCollectionTime() throws Exception { String postfix = getPostfix(); long time = System.currentTimeMillis() - TIME_DIFF_MS - Configuration.getInstance().getLongProperty( CoreConfig.BEFORE_CURRENT_COLLECTIONTIME_MS ); HttpResponse response = postGenMetric( TID, postfix, postPath, time ); assertEquals( 400, response.getStatusLine().getStatusCode() ); String[] output = getBodyArray( response ); assertTrue( Pattern.matches( PAST_COLLECTION_TIME_REGEX, output[ 1 ] ) ); assertTrue( Pattern.matches( PAST_COLLECTION_TIME_REGEX, output[ 2 ] ) ); assertTrue( Pattern.matches( PAST_COLLECTION_TIME_REGEX, output[ 3 ] ) ); }
Source:
<code>public void testReadThroughputLatency() throws Exception { ExecutorService executor = Executors.newSingleThreadExecutor( new ThreadFactoryBuilder().setNameFormat("read-throughput-latency-test").build()); Future<Integer> f = executor.submit(() -> { BenchReadThroughputLatency.main(new String[] { "--zookeeper", zkUtil.getZooKeeperConnectString(), "--listen", "10"}); return 0; }); <START> Thread.sleep(2000); <END> byte data[] = new byte[1024]; Arrays.fill(data, (byte)'x'); long lastLedgerId = 0; for (int i = 0; i < 10; i++) { BookKeeper bk = new BookKeeper(zkUtil.getZooKeeperConnectString()); LedgerHandle lh = bk.createLedger(BookKeeper.DigestType.CRC32, "benchPasswd".getBytes()); lastLedgerId = lh.getId(); try { for (int j = 0; j < 100; j++) { lh.addEntry(data); } } finally { lh.close(); bk.close(); } } Assert.assertEquals(Integer.valueOf(0), f.get(30, TimeUnit.SECONDS)); BenchReadThroughputLatency.main(new String[] { "--zookeeper", zkUtil.getZooKeeperConnectString(), "--ledger", String.valueOf(lastLedgerId)}); }</code><technical_language>changing here, improve get rid of sleep logic here</technical_language>

Target:
public void testReadThroughputLatency() throws Exception { final AtomicBoolean threwException = new AtomicBoolean(false); Thread t = new Thread() { public void run() { try { BenchReadThroughputLatency.main(new String[] { "--zookeeper", zkUtil.getZooKeeperConnectString(), "--listen", "10"}); } catch (Throwable t) { LOG.error("Error reading", t); threwException.set(true); } } }; t.start(); Thread.sleep(10000); byte data[] = new byte[1024]; Arrays.fill(data, (byte)'x'); long lastLedgerId = 0; Assert.assertTrue("Thread should be running", t.isAlive()); for (int i = 0; i < 10; i++) { BookKeeper bk = new BookKeeper(zkUtil.getZooKeeperConnectString()); LedgerHandle lh = bk.createLedger(BookKeeper.DigestType.CRC32, "benchPasswd".getBytes()); lastLedgerId = lh.getId(); try { for (int j = 0; j < 100; j++) { lh.addEntry(data); } } finally { lh.close(); bk.close(); } } for (int i = 0; i < 60; i++) { if (!t.isAlive()) { break; } Thread.sleep(100); } Assert.assertFalse("Thread should be finished", t.isAlive()); BenchReadThroughputLatency.main(new String[] { "--zookeeper", zkUtil.getZooKeeperConnectString(), "--ledger", String.valueOf(lastLedgerId)}); }
Source:
<code>public Opt<Identity> enter(final Request request) { <START> final Opt<Identity> retValue; <END> if (this.condition) { retValue = new Opt.Single<Identity>( new Identity.Simple("urn:test:1") ); } else { retValue = new Opt.Empty<Identity>(); } return retValue; }</code><technical_language>@antonini please name user</technical_language>

Target:
public Opt<Identity> enter(final Request request) { final Opt<Identity> user; if (this.condition) { user = new Opt.Single<Identity>( new Identity.Simple("urn:test:1") ); } else { user = new Opt.Empty<Identity>(); } return user; }
Source:
<code>public String getDescription() { <START> return "Make Pubmed ID to be a multiple value field."; <END> }</code><technical_language>description is incorrect. lines of "clean empty pubmed id entries"</technical_language>

Target:
public String getDescription() { return "Clean up empty pubmed id entries."; }
Source:
<code>private void setMerged(final Change c, final ChangeMessage msg) throws OrmException { try { db.changes().beginTransaction(c.getId()); CodeReviewCommit commit = commits.get(c.getId()); PatchSet.Id merged = commit.change.currentPatchSetId(); setMergedPatchSet(c.getId(), merged); PatchSetApproval submitter = saveApprovals(c, merged); addMergedMessage(submitter, msg); <START> sendMergedEmail(c, submitter); <END> db.commit(); if (submitter != null) { try { hooks.doChangeMergedHook(c, accountCache.get(submitter.getAccountId()).getAccount(), db.patchSets().get(c.currentPatchSetId()), db); } catch (OrmException ex) { log.error("Cannot run hook for submitted patch set " + c.getId(), ex); } } } finally { db.rollback(); } }</code><technical_language>I sense this commit. background thread email delivery reading database is racing this thread finish writing</technical_language>

Target:
private void setMerged(final Change c, final ChangeMessage msg) throws OrmException { try { db.changes().beginTransaction(c.getId()); CodeReviewCommit commit = commits.get(c.getId()); PatchSet.Id merged = commit.change.currentPatchSetId(); setMergedPatchSet(c.getId(), merged); PatchSetApproval submitter = saveApprovals(c, merged); addMergedMessage(submitter, msg); db.commit(); sendMergedEmail(c, submitter); if (submitter != null) { try { hooks.doChangeMergedHook(c, accountCache.get(submitter.getAccountId()).getAccount(), db.patchSets().get(c.currentPatchSetId()), db); } catch (OrmException ex) { log.error("Cannot run hook for submitted patch set " + c.getId(), ex); } } } finally { db.rollback(); } }
Source:
<code>public void query(GridCacheQueryType type, String text, long id, long startTime, long duration, boolean success) { <START> FileWriter writer = fileWriter; <END> if (writer == null) return; boolean needWriteStr = !writer.stringCached(text); byte[] strBytes = needWriteStr ? text.getBytes() : null; doWrite(QUERY, () -> { int size = 1 + 1 + 4 + 8 + 8 + 8 + 1; if (needWriteStr) size += 4 + strBytes.length; return size; }, buf -> { buf.put((byte)type.ordinal()); buf.put(needWriteStr ? (byte)1 : 0); buf.putInt(text.hashCode()); if (needWriteStr) { buf.putInt(strBytes.length); buf.put(strBytes); } buf.putLong(id); buf.putLong(startTime); buf.putLong(duration); buf.put(success ? (byte)1 : 0); }); }</code><technical_language>check writer doWrite</technical_language>

Target:
public void query(GridCacheQueryType type, String text, long id, long startTime, long duration, boolean success) { boolean cached = cacheIfPossible(text); doWrite(QUERY, queryRecordSize(cached ? 0 : text.getBytes().length, cached), buf -> { writeString(buf, text, cached); buf.put((byte)type.ordinal()); buf.putLong(id); buf.putLong(startTime); buf.putLong(duration); buf.put(success ? (byte)1 : 0); }); }
Source:
<code><START> public Map<String, List<ReplicaId>> getPeerLeaderReplicasByPartition() { <END> return Collections.unmodifiableMap(peerLeaderReplicasByPartition); }</code><technical_language>This package private. add java doc this method please</technical_language>

Target:
Map<String, List<ReplicaId>> getPeerLeaderReplicasByPartition() { return Collections.unmodifiableMap(peerLeaderReplicasByPartition); }
Source:
<code>public void logsRequestsWithoutSkew() { monitor.runInBackground(); RequestTime requestTime = new RequestTime(1L, 1L, 1L); mockLocalAndRemoteClockSuppliers(requestTime); executorService.tick(1, TimeUnit.NANOSECONDS); RequestTime remoteTime = new RequestTimeBuilder(requestTime) .progressLocalClock(100L) <START> .progressRemoteClock(100L) <END> .build(); mockLocalAndRemoteClockSuppliers(remoteTime); executorService.tick(PAUSE_BETWEEN_REQUESTS.toNanos(), TimeUnit.NANOSECONDS); verify(mockedEvents, times(1)) .requestPace(anyString(), anyLong(), anyLong(), anyLong()); }</code><technical_language>this test if logs skew, critical feature</technical_language>

Target:
public void logsRequestsWithoutSkew() { monitor.runInBackground(); RequestTime requestTime = new RequestTime(1L, 1L, 1L); mockLocalAndRemoteClockSuppliers(requestTime); executorService.tick(1, TimeUnit.NANOSECONDS); RequestTime remoteTime = new RequestTime.Builder(requestTime) .progressLocalClock(100L) .progressRemoteClock(100L) .build(); mockLocalAndRemoteClockSuppliers(remoteTime); executorService.tick(ClockSkewMonitor.PAUSE_BETWEEN_REQUESTS.toNanos(), TimeUnit.NANOSECONDS); verify(mockedEvents, times(1)) .requestPace(anyString(), anyLong(), anyLong(), anyLong()); }
Source:
<code>private Predicate<RefundHistory> filterForRefundTransaction(RefundTransactionEntity refundTransactionEntity) { return refundHistory -> <START> refundHistory.getReference().equals(refundTransactionEntity.getRefundReference()); <END> }</code><technical_language>Again, I external ID is</technical_language>

Target:
private Predicate<RefundHistory> filterForRefundTransaction(RefundTransactionEntity refundTransactionEntity) { return refundHistory -> refundHistory.getExternalId().equals(refundTransactionEntity.getRefundExternalId()); }
Source:
<code>protected Promise<Expression> eval(BranchContext context, MemberOf memberOf) { if (memberOf.getConstraint() instanceof ConceptReference) { final ConceptReference concept = (ConceptReference) memberOf.getConstraint(); <START> return Promise.immediate(referringRefSet(concept.getId())); <END> } else if (memberOf.getConstraint() instanceof Any) { return Promise.immediate(Expressions.exists(REFERRING_REFSETS)); } else { return throwUnsupported(memberOf.getConstraint()); } }</code><technical_language>mapping refsets</technical_language>

Target:
protected Promise<Expression> eval(BranchContext context, MemberOf memberOf) { if (memberOf.getConstraint() instanceof ConceptReference) { final ConceptReference concept = (ConceptReference) memberOf.getConstraint(); return Promise.immediate( Expressions.builder() .should(referringRefSet(concept.getId())) .should(referringMappingRefSet(concept.getId())) .build() ); } else if (memberOf.getConstraint() instanceof Any) { return Promise.immediate(Expressions.builder() .should(Expressions.exists(REFERRING_REFSETS)) .should(Expressions.exists(REFERRING_MAPPING_REFSETS)) .build()); } else { return throwUnsupported(memberOf.getConstraint()); } }
Source:
<code>public SmartImportJob getImportJob() { final File root = this.projectRootPage.getSelectedRoot(); if (root == null) { return null; } if (root.isDirectory()) { this.directoryToImport = root; } else if (SmartImportWizard.isValidArchive(root)) { this.directoryToImport = getExpandDirectory(root); if (!directoryToImport.isDirectory()) { throw new IllegalArgumentException("Archive wasn't expanded first"); } } else { <START> throw new IllegalArgumentException("Not supported archive type: " + root); END> } if (this.easymportJob == null || !matchesPage(this.easymportJob, this.projectRootPage)) { this.easymportJob = new SmartImportJob(this.directoryToImport, projectRootPage.getSelectedWorkingSets(), projectRootPage.isConfigureProjects(), projectRootPage.isDetectNestedProject()); } return this.easymportJob; }</code><technical_language>I exception is here. Imagine type in location of a plain file, show error. Example: a file /home/me/f a folder /home/me/folder. User types /home/me/f sees error while a transistional step typing /home/me/folder. Returning null simply mark wizard page incomplete</technical_language>

Target:
public SmartImportJob getImportJob() { final File root = this.projectRootPage.getSelectedRoot(); if (root == null) { return null; } if (root.isDirectory()) { this.directoryToImport = root; } else if (SmartImportWizard.isValidArchive(root)) { this.directoryToImport = getExpandDirectory(root); if (!directoryToImport.isDirectory()) { throw new IllegalArgumentException("Archive wasn't expanded first"); } } else { return null; } if (this.easymportJob == null || !matchesPage(this.easymportJob, this.projectRootPage)) { this.easymportJob = new SmartImportJob(this.directoryToImport, projectRootPage.getSelectedWorkingSets(), projectRootPage.isConfigureProjects(), projectRootPage.isDetectNestedProject()); } return this.easymportJob; }
Source:
<code>public static String escapeUnderScore(final String customizedValue, final String customizedRelation) { String escapedValue = customizedValue; if (customizedRelation.equalsIgnoreCase("LIKE") || customizedRelation.equalsIgnoreCase("ILIKE")) { String replaceWith = "_"; int pgMajorRelease = Config.<Integer> getValue(ConfigValues.PgMajorRelease); if (pgMajorRelease == SyntaxChecker.PgMajorRelease.PG8.getValue()) { replaceWith = "\\\\_"; <START> } <END> else if (pgMajorRelease == SyntaxChecker.PgMajorRelease.PG9.getValue()) { replaceWith = "\\_"; } escapedValue = customizedValue.replace("_", replaceWith); } return escapedValue; }</code><technical_language>pls merge next line</technical_language>

Target:
public static String escapeUnderScore(final String customizedValue, final String customizedRelation) { String escapedValue = customizedValue; if (customizedRelation.equalsIgnoreCase("LIKE") || customizedRelation.equalsIgnoreCase("ILIKE")) { escapedValue = customizedValue.replace("_", getEscapedCharacter("_")); } return escapedValue; }
Source:
<code>protected String retrieveProxyGrantingTicket(final String response) { final List<String> values = XmlUtils.getTextForElements(response, "proxyGrantingTicket"); for (final String value : values) { if (value != null) { <START> if (value.startsWith("PGTIOU-")) { <END> return retrieveProxyGrantingTicketFromStorage(value); } else { return retrieveProxyGrantingTicketViaEncryption(value); } } } return null; }</code><technical_language>of PGT starts out PGTIOU. a attribute. want check for PGT- instead</technical_language>

Target:
protected String retrieveProxyGrantingTicket(final String response) { final List<String> values = XmlUtils.getTextForElements(response, PGT_ATTRIBUTE); for (final String value : values) { if (value != null) { if (value.startsWith(PGTIOU_PREFIX)) { return retrieveProxyGrantingTicketFromStorage(value); } else { return retrieveProxyGrantingTicketViaEncryption(value); } } } return null; }
Source:
<code>public int pingEndpoint() { String sName = selectedEndpoint.getName(); <START> int pingResponse = 0; <END> for (ConnectionEndpoint connEndpoint : endpoints) { String eName = connEndpoint.getName(); if (sName.equals(eName)) { return exchangeService.pingService(connEndpoint); } } return pingResponse; }</code><technical_language>set this in code. remove hardcode 0 a return set pingResponse 0 break loop line 348</technical_language>

Target:
public int pingEndpoint() { for (ConnectionEndpoint connEndpoint : endpoints) { if (connEndpoint.getName().equals(selectedEndpoint.getName())) { return exchangeService.pingService(connEndpoint); } } return 0; }
Source:
<code>public DateTime timestamp(Map<String, Object> theMap) { if (!theMap.containsKey(timestampField)) <START> LOG.error("Data tuple doesn't contain timestamp field : " + timestampField); <END> return new DateTime(theMap.get(timestampField), DateTimeZone.UTC); }</code><technical_language>nit: placeholder '{}'</technical_language>

Target:
public DateTime timestamp(Map<String, Object> theMap) { Object timeStamp = theMap.get(timestampField); if (Objects.isNull(timeStamp)) LOG.error("Data tuple doesn't contain timestamp field : {}, so using current time as timestamp", timestampField); return new DateTime(timeStamp, DateTimeZone.UTC); }
Source:
<code><START> public int indexOf(int tag, int fromIndex) { <END> for (int i = fromIndex; i < count; i++) { if (tags[i] == tag) return i; } return -1; }</code><technical_language>I retain existing indexOf body avoid indirection in common case</technical_language>

Target:
public int indexOf(int tag, int fromIndex) { for (; fromIndex < count; fromIndex++) { if (tags[fromIndex] == tag) return fromIndex; } return -1; }
Source:
<code>protected boolean validateFields() { ProxiesParamProxy testProxy = proxyPanel.getProxy(); if (extension.getAdditionalProxy(testProxy.getAddress(), testProxy.getPort()) != null) { JOptionPane.showMessageDialog( this, <START> Constant.messages.getString("options.proxy.dialog.proxy.warning.dup.message"), <END> Constant.messages.getString("options.proxy.dialog.proxy.warning.dup.title"), JOptionPane.ERROR_MESSAGE); return false; } if (this.proxy == null || !(this.proxy.getAddress().equals(testProxy.getAddress()) && this.proxy.getPort() == testProxy.getPort())) { if (!extension.canListenOn(testProxy.getAddress(), testProxy.getPort())) { JOptionPane.showMessageDialog( this, Constant.messages.getString("options.proxy.dialog.proxy.warning.fail.message"), Constant.messages.getString("options.proxy.dialog.proxy.warning.fail.title"), JOptionPane.ERROR_MESSAGE); return false; } } return true; }</code><technical_language>validate MainProxy address port</technical_language>

Target:
protected boolean validateFields() { ProxiesParamProxy testProxy = proxyPanel.getProxy(); if (extension.getAdditionalProxy(testProxy.getAddress(), testProxy.getPort()) != null) { JOptionPane.showMessageDialog( this, Constant.messages.getString("options.proxy.dialog.proxy.warning.dup.message"), Constant.messages.getString("options.proxy.dialog.proxy.warning.dup.title"), JOptionPane.ERROR_MESSAGE); return false; } if (this.proxy == null || !(this.proxy.getAddress().equals(testProxy.getAddress()) && this.proxy.getPort() == testProxy.getPort())) { if (!extension.canListenOn(testProxy.getAddress(), testProxy.getPort())) { JOptionPane.showMessageDialog( this, Constant.messages.getString("options.proxy.dialog.proxy.warning.fail.message", testProxy.getAddress(), testProxy.getPort()), Constant.messages.getString("options.proxy.dialog.proxy.warning.fail.title"), JOptionPane.ERROR_MESSAGE); return false; } } return true; }
Source:
<code>public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { checkArgument(arity == 1, "Expected arity to be 1"); Type type = boundVariables.getTypeVariable("T"); Class<?> indeterminateOperatorClass = generateIndeterminate(type, functionRegistry); MethodHandle methodHandle = methodHandle(indeterminateOperatorClass, "indeterminate", type.getJavaType(), boolean.class); return new ScalarFunctionImplementation( false, <START> ImmutableList.of( <END> valueTypeArgumentProperty(USE_NULL_FLAG)), methodHandle, isDeterministic()); }</code><technical_language>nit: For list element, I in line (unless long..)</technical_language>

Target:
public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionRegistry functionRegistry) { checkArgument(arity == 1, "Expected arity to be 1"); Type type = boundVariables.getTypeVariable("T"); Class<?> indeterminateOperatorClass = generateIndeterminate(type, functionRegistry); MethodHandle indeterminateMethod = methodHandle(indeterminateOperatorClass, "indeterminate", type.getJavaType(), boolean.class); return new ScalarFunctionImplementation( false, ImmutableList.of(valueTypeArgumentProperty(USE_NULL_FLAG)), indeterminateMethod, isDeterministic()); }
Source:
<code>public BackupLeaderRole(CoreMasterContext masterContext) { super(masterContext); LOG.info("Creating backup-leader role."); mStateLockManager = masterContext.getStateLockManager(); <START> mStateLockTimeout = ServerConfiguration.getMs(PropertyKey.MASTER_SHELL_BACKUP_STATE_LOCK_TIMEOUT); <END> mBackupAbandonTimeout = ServerConfiguration.getMs(PropertyKey.MASTER_BACKUP_ABANDON_TIMEOUT); }</code><technical_language>Is this supposed shell</technical_language>

Target:
public BackupLeaderRole(CoreMasterContext masterContext) { super(masterContext); LOG.info("Creating backup-leader role."); mStateLockManager = masterContext.getStateLockManager(); mBackupAbandonTimeout = ServerConfiguration.getMs(PropertyKey.MASTER_BACKUP_ABANDON_TIMEOUT); }
Source:
<code>private void generateEnumReadMany(EnumType type) { JavaClassName typeName = javaTypes.getInterfaceName(type); javaBuffer.addImport(typeName); javaBuffer.addImport(ArrayList.class); javaBuffer.addImport(List.class); javaBuffer.addImport(NoSuchElementException.class); javaBuffer.addImport(XmlReader.class); javaBuffer.addLine("public static List<%1$s> readMany(XmlReader reader) {", typeName.getSimpleName()); javaBuffer.addLine( "List<%1$s> list = new ArrayList<>();", typeName.getSimpleName()); javaBuffer.addLine( "if (!reader.forward()) {"); javaBuffer.addLine( "return list;"); javaBuffer.addLine( "}"); javaBuffer.addLine( "reader.next();"); javaBuffer.addLine( "while (reader.forward()) {"); javaBuffer.addLine( "String v = reader.readString();"); javaBuffer.addLine( "%1$s next = %1$s.fromValue(v);", typeName.getSimpleName()); javaBuffer.addLine( "if (next == null) {"); <START> javaBuffer.addLine( "throw new NoSuchElementException();"); <END> javaBuffer.addLine( "}"); javaBuffer.addLine( "list.add(next);"); javaBuffer.addLine( "}"); javaBuffer.addLine( "reader.next();"); javaBuffer.addLine( "return list;"); javaBuffer.addLine("}"); javaBuffer.addLine(); }</code><technical_language>Throwing NoSuchElementException is part of contract of Iterator.next method, this iterator, want throw exceptions. more values stop process</technical_language>

Target:
private void generateEnumReadMany(EnumType type) { JavaClassName typeName = javaTypes.getInterfaceName(type); javaBuffer.addImport(typeName); javaBuffer.addImport(ArrayList.class); javaBuffer.addImport(List.class); javaBuffer.addImport(NoSuchElementException.class); javaBuffer.addImport(XmlReader.class); javaBuffer.addLine("public static List<%1$s> readMany(XmlReader reader) {", typeName.getSimpleName()); javaBuffer.addLine( "List<%1$s> list = new ArrayList<>();", typeName.getSimpleName()); javaBuffer.addLine( "if (!reader.forward()) {"); javaBuffer.addLine( "return list;"); javaBuffer.addLine( "}"); javaBuffer.addLine( "reader.next();"); javaBuffer.addLine( "while (reader.forward()) {"); javaBuffer.addLine( "String v = reader.readString();"); javaBuffer.addLine( "%1$s next = %1$s.fromValue(v);", typeName.getSimpleName()); javaBuffer.addLine( "if (next == null) {"); javaBuffer.addLine( "break;"); javaBuffer.addLine( "}"); javaBuffer.addLine( "list.add(next);"); javaBuffer.addLine( "}"); javaBuffer.addLine( "reader.next();"); javaBuffer.addLine( "return list;"); javaBuffer.addLine("}"); javaBuffer.addLine(); }
Source:
<code><START> public void saveDetails(HttpResponse method, HTTPSampleResult res) { <END> if (isCacheable(res)){ String lastModified = getHeader(method ,HTTPConstants.LAST_MODIFIED); String expires = getHeader(method ,HTTPConstants.EXPIRES); String etag = getHeader(method ,HTTPConstants.ETAG); String cacheControl = getHeader(method, HTTPConstants.CACHE_CONTROL); String date = getHeader(method, HTTPConstants.DATE); setCache(lastModified, cacheControl, expires, etag, res.getUrlAsString(), date, getVaryHeader(getHeader(method, HTTPConstants.VARY), res.getRequestHeaders())); } }</code><technical_language>This method contents duplicate of another saveDetails. suggest refactoring common code separate method avoid duplication</technical_language>

Target:
public void saveDetails(HttpResponse method, HTTPSampleResult res) { final String varyHeader = getHeader(method, HTTPConstants.VARY); if (isCacheable(res, varyHeader)){ String lastModified = getHeader(method ,HTTPConstants.LAST_MODIFIED); String expires = getHeader(method ,HTTPConstants.EXPIRES); String etag = getHeader(method ,HTTPConstants.ETAG); String cacheControl = getHeader(method, HTTPConstants.CACHE_CONTROL); String date = getHeader(method, HTTPConstants.DATE); setCache(lastModified, cacheControl, expires, etag, res.getUrlAsString(), date, getVaryHeader(varyHeader, asHeaders(res.getRequestHeaders()))); } }
Source:
<code>private Map<String, UserType> buildUserTypes(KeyspaceMetadata keyspace, List<Row> udtRows, VersionNumber cassandraVersion, Cluster cluster) { Map<String, UserType> userTypes = new LinkedHashMap<String, UserType>(); if (udtRows != null) { if(cassandraVersion.getMajor() >= 3 && udtRows.size() > 1) { UserTypeDependencyGraph graph = new UserTypeDependencyGraph(udtRows, cluster, keyspace.getName()); for (Row udtRow: graph) { UserType type = UserType.build(keyspace, udtRow, cassandraVersion, cluster, userTypes); userTypes.put(type.getTypeName(), type); } } else { for (Row udtRow : udtRows) { UserType type = UserType.build(keyspace, udtRow, cassandraVersion, cluster, userTypes); userTypes.put(type.getTypeName(), type); <START> } <END> } } return userTypes; }</code><technical_language>This simplified avoid duplicating for loop</technical_language>

Target:
private Map<String, UserType> buildUserTypes(KeyspaceMetadata keyspace, List<Row> udtRows, VersionNumber cassandraVersion, Cluster cluster) { Map<String, UserType> userTypes = new LinkedHashMap<String, UserType>(); if (udtRows != null) { for (Row udtRow : maybeSortUdts(udtRows, cluster, keyspace.getName())) { UserType type = UserType.build(keyspace, udtRow, cassandraVersion, cluster, userTypes); userTypes.put(type.getTypeName(), type); } } return userTypes; }
Source:
<code>public AWSCredentials getCredentials() { if (profilesConfigFile == null) { synchronized (this) { if (profilesConfigFile == null) { profilesConfigFile = new ProfilesConfigFile(); } } } <START> if (ProfilesConfigFile.DEFAULT_PROFILE_NAME.equals(profileName)) { <END> String profileOverride = System.getenv(ProfilesConfigFile.AWS_PROFILE_ENVIRONMENT_VARIABLE); profileOverride = StringUtils.trim(profileOverride); if (!StringUtils.isNullOrEmpty(profileOverride)) { return profilesConfigFile.getCredentials(profileOverride); } } return profilesConfigFile.getCredentials(profileName); }</code><technical_language>I idea of AWS_PROFILE env var if a user explicitly in constructor. This change pretty close behavior, for edge case a user explicitly passed "default" constructor. tweak code account for case? I want AWS_PROFILE env var in case a user pass in explicit profile name. This behavior handling of AWS_PROFILE env var consistent other AWS SDKs</technical_language>

Target:
public AWSCredentials getCredentials() { if (profilesConfigFile == null) { synchronized (this) { if (profilesConfigFile == null) { profilesConfigFile = new ProfilesConfigFile(); } } } return profilesConfigFile.getCredentials(profileName); }
Source:
<code>public void init(final RuleModellerPage page) { this.page = page; if (page.plugin() instanceof BRLActionColumnPlugin) { <START> <END> } }</code><technical_language>If is do exactly? If want do do need this if(..) block all</technical_language>

Target:
public void init(final RuleModellerPage page) { this.page = page; }
Source:
<code>public void testCreateTransaction() { final String transactionId = "1"; Declared transactionState = new Declared(); transactionState.setTxnId(Binary.create(ByteBuffer.wrap(transactionId.getBytes()))); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono.just(transactionState)).when(sendLink).send(any(byte[].class), anyInt(), anyInt()); AtomicReference<AmqpTransaction> createdTransaction = new AtomicReference<>(); StepVerifier.create(transactionCoordinator.createTransaction() <START> .map(txn -> { <END> createdTransaction.set(txn); return txn; })) .verifyComplete(); Assertions.assertNotNull(createdTransaction.get(), "Should have got transaction id."); Assertions.assertTrue(new String(createdTransaction.get().getTransactionId().array()).equals(transactionId), "Transaction id is not equal."); verify(sendLink, times(1)).send(any(byte[].class), anyInt(), anyInt()); }</code><technical_language>txn -> transaction</technical_language>

Target:
public void testCreateTransaction() { final byte[] transactionId = "1".getBytes(); Declared transactionState = new Declared(); transactionState.setTxnId(Binary.create(ByteBuffer.wrap(transactionId))); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono.just(transactionState)).when(sendLink).send(any(byte[].class), anyInt(), eq(DeliveryImpl.DEFAULT_MESSAGE_FORMAT), isNull()); StepVerifier.create(transactionCoordinator.createTransaction()) .assertNext(actual -> { Assertions.assertNotNull(actual); Assertions.assertArrayEquals(transactionId, actual.getTransactionId().array()); }) .verifyComplete(); verify(sendLink).send(any(byte[].class), anyInt(), eq(DeliveryImpl.DEFAULT_MESSAGE_FORMAT), isNull()); }
Source:
<code>public void execute(OperationContext context, ModelNode operation) { final Resource resource = context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS); final ModelNode model = resource.getModel(); if (!context.isBooting()) model.get(ENABLED).set(true); if (context.isBooting()) { context.addStep(new OperationStepHandler() { public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final ManagementResourceRegistration registration = context.getResourceRegistrationForUpdate(); <START> addServices(context, operation, registration, model, isXa()); <END> context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { } }); } }, OperationContext.Stage.RUNTIME); } else { context.reloadRequired(); } }</code><technical_language>WFLY-4294 this op fail in runtime a server. this is adding services</technical_language>

Target:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { if (context.isNormalServer()) { throw ConnectorLogger.ROOT_LOGGER.legacyOperation(); } }
Source:
<code>private final void excludeLinesIfTrue(boolean shouldExclude, Tree tree, Class<? extends JavaCheck>... rules) { <START> BiConsumer<Tree, Class<? extends JavaCheck>> consumer = shouldExclude ? this::excludeLines : this::acceptLines; <END> Arrays.stream(rules).forEach(rule -> consumer.accept(tree, rule)); }</code><technical_language>I find a bit strange declare lambda variable, is next line. I Stream API a lot in terms of clarity here, I fashioned for (Class<? extends JavaCheck> rule : rules) { if (shouldExclude) { excludeLines(tree, rule); } else { acceptLines(tree, rule); } }</technical_language>

Target:
private final void excludeLinesIfTrue(boolean shouldExclude, Tree tree, Class<? extends JavaCheck>... rules) { for (Class<? extends JavaCheck> rule : rules) { excludeLinesIfTrue(shouldExclude, tree, rule); } }
Source:
<code>private Service getServiceInternal() { for (SplunkServer splunkServer : splunkServers) { Service service = servicePerServer.get( splunkServer ); if ( service != null && !splunkServer.isTestOnBorrow() ) { return service; } if (service!=null && splunkServer.isTestOnBorrow()){ if (pingService( service )){ return service; } else { continue; } } ExecutorService executor = Executors.newSingleThreadExecutor(); Callable<Service> callable = buildServiceCallable( splunkServer ); Future<Service> future = executor.submit( callable ); try { if ( splunkServer.getTimeout() > 0 ) { service = future.get( splunkServer.getTimeout(), TimeUnit.MILLISECONDS ); } else { <START> service = future.get(); <END> } servicePerServer.put( splunkServer, service ); return service; } catch ( Exception e ) { if (LOGGER.isInfoEnabled()) { LOGGER.info( String.format( "could not connect to Splunk Server @ %s:%d - %s, try next one", splunkServer.getHost(), splunkServer.getPort(), e.getMessage() ) ); } } } String message = String.format( "could not connect to any of Splunk Servers %s", this.splunkServers); LOGGER.error( message ); throw new RuntimeException( message ); }</code><technical_language>is reson of Callable separete Thread, if wait this Future? Splunk support connectTimeout</technical_language>

Target:
private Service getServiceInternal() { for (SplunkServer splunkServer : splunkServers) { Service service = servicePerServer.get(splunkServer); if (service != null) { if (!splunkServer.isCheckServiceOnBorrow() || pingService(service)) { return service; } else { continue; } } ExecutorService executor = Executors.newSingleThreadExecutor(); Callable<Service> callable = buildServiceCallable(splunkServer); Future<Service> future = executor.submit(callable); try { if (splunkServer.getTimeout() > 0) { service = future.get(splunkServer.getTimeout(), TimeUnit.MILLISECONDS); } else { service = future.get(); } servicePerServer.put(splunkServer, service); return service; } catch (Exception e) { if (LOGGER.isInfoEnabled()) { LOGGER.info(String.format("could not connect to Splunk Server @ %s:%d - %s, try next one", splunkServer.getHost(), splunkServer.getPort(), e.getMessage())); } } } String message = String.format("could not connect to any of Splunk Servers %s", this.splunkServers); LOGGER.error(message); throw new RuntimeException(message); }
Source:
<code>public void invalidateSession( String subjectName, Function<Map<String, Object>, String> sessionSubjectExtractor) { final Optional<String> sessionIdOptional = idManager <START> .dataStores <END> .stream() .map(AttributeSharingSessionDataStore::getSessionDataMap) .map(Map::entrySet) .flatMap(Collection::stream) .filter( e -> subjectName.equals( sessionSubjectExtractor.apply(e.getValue().getAllAttributes()))) .map(Map.Entry::getKey) .findFirst(); sessionIdOptional.ifPresent(idManager::invalidateSession); }</code><technical_language>dataStores list is accessed multiple threads iteration (as here) add delete entries. However, I do concurrency considerations require collection synchronized accessed, modified while iterated</technical_language>

Target:
public void invalidateSession( String subjectName, Function<Map<String, Object>, String> sessionSubjectExtractor) { final Optional<String> sessionIdOptional; synchronized (idManager.dataStores) { sessionIdOptional = idManager .dataStores .stream() .map(AttributeSharingSessionDataStore::getSessionDataMap) .map(Map::entrySet) .flatMap(Collection::stream) .filter( e -> subjectName.equals( sessionSubjectExtractor.apply(e.getValue().getAllAttributes()))) .map(Map.Entry::getKey) .findFirst(); } sessionIdOptional.ifPresent(idManager::invalidateSession); }
Source:
<code><START> public void processes(WebContext ctx) { <END> ElasticQuery<Process> query = elastic.select(Process.class).orderDesc(Process.SCHEDULED); UserInfo user = UserContext.getCurrentUser(); if (!user.hasPermission(TenantUserManager.PERMISSION_SYSTEM_TENANT)) { query.eq(Process.TENANT_ID, user.getTenantId()); } if (!user.hasPermission(PERMISSION_MANAGE_PROCESSES)) { query.eq(Process.USER_ID, user.getUserId()); } ElasticPageHelper<Process> ph = ElasticPageHelper.withQuery(query); ph.withContext(ctx); ph.addTermAggregation(Process.STATE, ProcessState.class); ph.addTermAggregation(Process.PROCESS_TYPE, value -> NLS.getIfExists(value, NLS.getCurrentLang()).orElse(value)); ph.addTimeAggregation(Process.SCHEDULED, DateRange.lastFiveMinutes(), DateRange.lastFiveteenMinutes(), DateRange.lastTwoHours(), DateRange.today(), DateRange.yesterday(), DateRange.thisWeek(), DateRange.lastWeek()); ph.withSearchFields(QueryField.contains(ProcessLog.SEARCH_FIELD)); ctx.respondWith().template("templates/process/processes.html.pasta", ph.asPage()); }</code><technical_language>is this /system/tasks</technical_language>

Target:
public void processes(WebContext ctx) { ElasticQuery<Process> query = elastic.select(Process.class).orderDesc(Process.STARTED); UserInfo user = UserContext.getCurrentUser(); if (!user.hasPermission(PERMISSION_MANAGE_ALL_PROCESSES)) { query.eq(Process.TENANT_ID, user.getTenantId()); } if (!user.hasPermission(PERMISSION_MANAGE_PROCESSES)) { query.eq(Process.USER_ID, user.getUserId()); } query.where(Elastic.FILTERS.oneInField(Process.REQUIRED_PERMISSION, new ArrayList<>(user.getPermissions())) .orEmpty() .build()); ElasticPageHelper<Process> ph = ElasticPageHelper.withQuery(query); ph.withContext(ctx); ph.addTermAggregation(Process.STATE, ProcessState.class); ph.addTermAggregation(Process.PROCESS_TYPE, value -> NLS.getIfExists(value, null).orElse(value)); ph.addTimeAggregation(Process.STARTED, DateRange.lastFiveMinutes(), DateRange.lastFiveteenMinutes(), DateRange.lastTwoHours(), DateRange.today(), DateRange.yesterday(), DateRange.thisWeek(), DateRange.lastWeek()); ph.withSearchFields(QueryField.contains(ProcessLog.SEARCH_FIELD)); ctx.respondWith().template("templates/process/processes.html.pasta", ph.asPage()); }
Source:
<code>public String addTenant(TenantInfoBean tenantInfoBean) throws Exception { try { CommonUtil.validateEmail(tenantInfoBean.getEmail()); } catch (Exception e) { String msg = "Invalid email is provided."; log.error(msg, e); throw new Exception(msg, e); } String tenantDomain = tenantInfoBean.getTenantDomain(); TenantMgtUtil.validateDomain(tenantDomain); checkIsSuperTenantInvoking(); TenantMgtUtil.setTenantAdminCreationOperation(true); Tenant tenant = TenantMgtUtil.initializeTenant(tenantInfoBean); TenantPersistor persistor = new TenantPersistor(); int tenantId = persistor.persistTenant(tenant, false, tenantInfoBean.getSuccessKey(), tenantInfoBean.getOriginatedService(),false); tenantInfoBean.setTenantId(tenantId); PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); carbonContext.setTenantDomain(tenantDomain); carbonContext.setTenantId(tenantId); TenantMgtUtil.addClaimsToUserStoreManager(tenant); TenantMgtUtil.clearTenantAdminCreationOperation(); <START> PrivilegedCarbonContext.endTenantFlow(); <END> notifyTenantAddition(tenantInfoBean); TenantMgtUtil.activateTenantInitially(tenantInfoBean, tenantId); return TenantMgtUtil.prepareStringToShowThemeMgtPage(tenant.getId()); }</code><technical_language>end tenant flow a finally block</technical_language>

Target:
public String addTenant(TenantInfoBean tenantInfoBean) throws Exception { try { CommonUtil.validateEmail(tenantInfoBean.getEmail()); } catch (Exception e) { String msg = "Invalid email is provided."; log.error(msg, e); throw new Exception(msg, e); } String tenantDomain = tenantInfoBean.getTenantDomain(); TenantMgtUtil.validateDomain(tenantDomain); checkIsSuperTenantInvoking(); TenantMgtUtil.setTenantAdminCreationOperation(true); Tenant tenant = TenantMgtUtil.initializeTenant(tenantInfoBean); TenantPersistor persistor = new TenantPersistor(); int tenantId = persistor.persistTenant(tenant, false, tenantInfoBean.getSuccessKey(), tenantInfoBean.getOriginatedService(),false); tenantInfoBean.setTenantId(tenantId); try { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); carbonContext.setTenantDomain(tenantDomain); carbonContext.setTenantId(tenantId); TenantMgtUtil.addClaimsToUserStoreManager(tenant); } finally { TenantMgtUtil.clearTenantAdminCreationOperation(); PrivilegedCarbonContext.endTenantFlow(); } notifyTenantAddition(tenantInfoBean); TenantMgtUtil.activateTenantInitially(tenantInfoBean, tenantId); return TenantMgtUtil.prepareStringToShowThemeMgtPage(tenant.getId()); }
Source:
<code>public void fromCallable() { Completable.fromCallable(new Callable<Object>() { @Override public Object call() throws Exception { <START> return null; <END> } }) .test() .assertResult(); }</code><technical_language>Assert counter. return assert get 1 a subsequent call 2</technical_language>

Target:
public void fromCallable() { final AtomicInteger atomicInteger = new AtomicInteger(); Completable.fromCallable(new Callable<Object>() { @Override public Object call() throws Exception { atomicInteger.incrementAndGet(); return null; } }) .test() .assertResult(); assertEquals(1, atomicInteger.get()); }
Source:
<code>private List<SubchainInfo> mockSnapshotList(List<DiskImage> snapshots, Version version) { mockCluster(version); configRule.mockConfigValue(ConfigValues.QemuimgCommitSupported, version); List<DiskImage> childSnapshots = createChildSnapshots(snapshots); when(diskImageDao.getAllSnapshotsForParents( <START> snapshots .stream() .map(DiskImage::getImageId) .collect(Collectors.toList()) <END> ) ).thenReturn(childSnapshots); return cmd.getAllDisksSnapshot(snapshots); }</code><technical_language>This replicates logic production code. create DiskImages SubchainInfo in symetrically</technical_language>

Target:
private List<SubchainInfo> mockSnapshotList(List<DiskImage> snapshots, Version version) { mockCluster(version); configRule.mockConfigValue(ConfigValues.QemuimgCommitSupported, version); List<DiskImage> childSnapshots = createChildSnapshots(snapshots); when(diskImageDao.getAllSnapshotsForParents( snapshots .stream() .map(DiskImage::getImageId) .collect(Collectors.toList()) ) ).thenReturn(new HashSet<>(childSnapshots)); return cmd.getAllDisksSnapshot(snapshots); }
Source:
<code>private void updateEnablement() { <START> remove.setEnabled(editable && !tv.getStructuredSelection().isEmpty()); <END> newValue.setEnabled(editable); }</code><technical_language>getSelection(). getStructuredSelection() is older Eclipses. EGit is supposed work Eclipse Luna</technical_language>

Target:
private void updateEnablement() { remove.setEnabled(editable && !tv.getSelection().isEmpty()); newValue.setEnabled(editable); }
Source:
<code>public SqlJsonTypeFunction() { super("JSON_TYPE", SqlKind.OTHER_FUNCTION, ReturnTypes.explicit(SqlTypeName.VARCHAR, 20), null, <START> OperandTypes.VARIADIC, <END> SqlFunctionCategory.SYSTEM); }</code><technical_language>OperandTypes.VARIADIC a parameter list varying length. JSON_TYPE is designed for processing a single input value. Is OperandTypes.ANY enough for that</technical_language>

Target:
public SqlJsonTypeFunction() { super("JSON_TYPE", SqlKind.OTHER_FUNCTION, ReturnTypes.explicit(SqlTypeName.VARCHAR, 20), null, OperandTypes.ANY, SqlFunctionCategory.SYSTEM); }
Source:
<code>public UniformGranularitySpec( @JsonProperty("gran") Granularity granularity, @JsonProperty("intervals") List<Interval> inputIntervals ) { List<Interval> granularIntervals = Lists.newArrayList(); if (inputIntervals != null) { for (Interval inputInterval : inputIntervals) { Iterables.addAll(granularIntervals, granularity.getIterable(inputInterval)); } } this.granularity = granularity; <START> this.inputIntervals = inputIntervals == null ? Collections.EMPTY_LIST : ImmutableList.copyOf(inputIntervals); <END> this.wrappedSpec = new ArbitraryGranularitySpec(granularIntervals); }</code><technical_language>This require special-case empty collection everywhere, I code confusing error prone maintenance. I nice modify GranularitySpec interface somehow. return Optional<SortedSet<Interval>> bucketIntervals</technical_language>

Target:
public UniformGranularitySpec( @JsonProperty("gran") Granularity granularity, @JsonProperty("intervals") List<Interval> inputIntervals ) { this.granularity = granularity; if (inputIntervals != null) { List<Interval> granularIntervals = Lists.newArrayList(); for (Interval inputInterval : inputIntervals) { Iterables.addAll(granularIntervals, granularity.getIterable(inputInterval)); } this.inputIntervals = ImmutableList.copyOf(inputIntervals); this.wrappedSpec = new ArbitraryGranularitySpec(granularIntervals); } else { this.inputIntervals = null; this.wrappedSpec = null; } }
Source:
<code>public Path getWorkingDirectory() { <START> return new Path(pathToString(workingDirectory)); <END> }</code><technical_language>return this.workingDirectory</technical_language>

Target:
public Path getWorkingDirectory() { return workingDirectory; }