auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected int computeNewLength(int[] dimValSelector, int numProcessed, int numToProcess) { int valid = 0; int length = 0; for (int i = numProcessed; i < dimValSelector.length; i++) { length++; if (SKIP_POSITION_VALUE != dimValSelector[i]) { valid++; } if (valid == numToProcess) { break; } } return length; }

Target:
protected int computeNewLength(int[] dimValSelector, int numProcessed, int numToProcess) { int valid = 0; int length = 0; for (int i = numProcessed; i < dimValSelector.length && valid < numToProcess; i++) { length++; if (SKIP_POSITION_VALUE != dimValSelector[i]) { valid++; } } return length; }
Source:
public Boolean call() throws Exception { mergeabilityCheckQueue.updatingMergeabilityFlag(change, force); RequestContext context = new RequestContext() { @Override public CurrentUser getCurrentUser() { return identifiedUserFactory.create(change.getOwner()); } @Override public Provider<ReviewDb> getReviewDbProvider() { return new Provider<ReviewDb>() { @Override public ReviewDb get() { if (reviewDb == null) { try { reviewDb = schemaFactory.open(); } catch (OrmException e) { throw new ProvisionException("Cannot open ReviewDb", e); } } return reviewDb; } }; } }; RequestContext old = tl.setContext(context); ReviewDb db = context.getReviewDbProvider().get(); try { PatchSet ps = db.patchSets().get(change.currentPatchSetId()); Mergeable m = mergeable.get(); m.setForce(force); ChangeControl control = changeControlFactory.controlFor(change.getId(), identifiedUserFactory.create(change.getOwner())); MergeableInfo info = m.apply( new RevisionResource(new ChangeResource(control), ps)); return change.isMergeable() != info.mergeable; } catch (ResourceConflictException e) { return false; } finally { tl.setContext(old); if (reviewDb != null) { reviewDb.close(); reviewDb = null; } } }

Target:
public Boolean call() throws Exception { mergeabilityCheckQueue.updatingMergeabilityFlag(change, force); RequestContext context = new RequestContext() { @Override public CurrentUser getCurrentUser() { return identifiedUserFactory.create(change.getOwner()); } @Override public Provider<ReviewDb> getReviewDbProvider() { return new Provider<ReviewDb>() { @Override public ReviewDb get() { if (reviewDb == null) { try { reviewDb = schemaFactory.open(); } catch (OrmException e) { throw new ProvisionException("Cannot open ReviewDb", e); } } return reviewDb; } }; } }; RequestContext old = tl.setContext(context); ReviewDb db = context.getReviewDbProvider().get(); try { PatchSet ps = db.patchSets().get(change.currentPatchSetId()); Mergeable m = mergeable.get(); m.setForce(force); ChangeControl control = changeControlFactory.controlFor(change.getId(), context.getCurrentUser()); MergeableInfo info = m.apply( new RevisionResource(new ChangeResource(control), ps)); return change.isMergeable() != info.mergeable; } catch (ResourceConflictException e) { return false; } finally { tl.setContext(old); if (reviewDb != null) { reviewDb.close(); reviewDb = null; } } }
Source:
public void execute(ScriptEntry scriptEntry) { EntityTag source = scriptEntry.getObjectTag("source"); List<MythicMobsMobTag> targets = (List<MythicMobsMobTag>) scriptEntry.getObject("targets"); ElementTag signal = scriptEntry.getElement("signal"); Debug.report(scriptEntry, getName(),ArgumentHelper.debugList("mythicmobs", targets) + signal.debug() + (source == null ? "" : source.debug())); for (MythicMobsMobTag mob : targets) { mob.getMob().signalMob((source == null ? null : BukkitAdapter.adapt(source.getBukkitEntity())), signal.asString()); } }

Target:
public void execute(ScriptEntry scriptEntry) { EntityTag source = scriptEntry.getObjectTag("source"); List<MythicMobsMobTag> targets = (List<MythicMobsMobTag>) scriptEntry.getObject("targets"); ElementTag signal = scriptEntry.getElement("signal"); if (scriptEntry.dbCallShouldDebug()) { Debug.report(scriptEntry, getName(), ArgumentHelper.debugList("mythicmobs", targets) + signal.debug() + (source == null ? "" : source.debug())); } for (MythicMobsMobTag mob : targets) { mob.getMob().signalMob(source == null ? null : BukkitAdapter.adapt(source.getBukkitEntity()), signal.asString()); } }
Source:
protected boolean check() { return true; }

Target:
protected boolean check() { return file.exists(context); }
Source:
public static void main(String[] args) throws Exception { Map<String, Object> cl = CLI.opt("w", "wait", null, CLI.AS_INT) .boolOpt("i", "ignore-errors") .arg("TOPO", CLI.INTO_LIST) .parse(args); @SuppressWarnings("unchecked") final List<String> names = (List<String>) cl.get("TOPO"); Integer wait = (Integer) cl.get("w"); Boolean continueOnError = (Boolean) cl.get("i"); final KillOptions opts = new KillOptions(); if (wait != null) { opts.set_wait_secs(wait); } NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface nimbus) throws Exception { int errorCount = 0; for (String name : names) { try { nimbus.killTopologyWithOpts(name, opts); LOG.info("Killed topology: {}", name); } catch (Exception e) { errorCount += 1; if (!continueOnError) { throw e; } else { LOG.info( "Caught error killing topology '{}'; continuing as -i was passed. Exception: {}", name, e.getClass().getName() ); } } } if (errorCount > 0) { throw new RuntimeException("Failed to successfully kill " + errorCount + " topologies."); } } }); }

Target:
public static void main(String[] args) throws Exception { Map<String, Object> cl = CLI.opt("w", "wait", null, CLI.AS_INT) .boolOpt("i", "ignore-errors") .arg("TOPO", CLI.INTO_LIST) .parse(args); @SuppressWarnings("unchecked") final List<String> names = (List<String>) cl.get("TOPO"); Integer wait = (Integer) cl.get("w"); Boolean continueOnError = (Boolean) cl.get("i"); final KillOptions opts = new KillOptions(); if (wait != null) { opts.set_wait_secs(wait); } NimbusClient.withConfiguredClient(new NimbusClient.WithNimbus() { @Override public void run(Nimbus.Iface nimbus) throws Exception { int errorCount = 0; for (String name : names) { try { nimbus.killTopologyWithOpts(name, opts); LOG.info("Killed topology: {}", name); } catch (Exception e) { errorCount += 1; if (!continueOnError) { throw e; } else { LOG.error( "Caught error killing topology '{}'; continuing as -i was passed.", name, e ); } } } if (errorCount > 0) { throw new RuntimeException("Failed to successfully kill " + errorCount + " topologies."); } } }); }
Source:
private void resetSelection() { if (fSelectionGroupRoot != null) { disposeSelectionGroupRoot(); } fSelectionGroupRoot = getFileSystemTree(); fSelectionGroup.setRoot(fSelectionGroupRoot); if (fCreateExperimentCheckbox != null && fCreateExperimentCheckbox.getSelection()) { File file = getSourceFile(); if (file != null) { IPath path = new Path(file.getAbsolutePath()); fExperimentNameText.setText(path.lastSegment()); } } }

Target:
private void resetSelection() { if (fSelectionGroupRoot != null) { disposeSelectionGroupRoot(); } fSelectionGroupRoot = getFileSystemTree(); fSelectionGroup.setRoot(fSelectionGroupRoot); if (fCreateExperimentCheckbox != null) { File file = getSourceFile(); if (file != null) { String previousName = fExperimentNameText.getText().trim(); if (((fPreviousSource != null) && (previousName.equals(fPreviousSource))) || previousName.isEmpty()) { fExperimentNameText.setText(file.getName()); } fPreviousSource = file.getName(); } } }
Source:
private void addMemory(int mem) { if(!isPersistent()) { throw DataUtils.newIllegalStateException( DataUtils.ERROR_INTERNAL, "Memory calculation error2"); } memory += mem; }

Target:
private void addMemory(int mem) { memory += mem; }
Source:
public String valueOfAttributeOnIn(String attribute, String place, String container) { String result; WebElement element = getElementToRetrieveValue(place, container); try { result = element.getAttribute(attribute); } catch(NullPointerException e) { result = null; } return result; }

Target:
public String valueOfAttributeOnIn(String attribute, String place, String container) { String result = null; WebElement element = getElementToRetrieveValue(place, container); if (element != null) { result = element.getAttribute(attribute); } return result; }
Source:
public void call(Object base, Method method) { Class<?>[] paramTypes = method.getParameterTypes(); java.lang.annotation.Annotation[][] parmAnnos = method.getParameterAnnotations(); Object[] params = new Object[paramTypes.length]; try { for (int i = 0; i < paramTypes.length; i++) { params[i] = resolveParameter(parmAnnos[i], paramTypes[i]); } method.setAccessible(true); method.invoke(base, params); } catch (InvocationTargetException invokEx) { Throwable c = invokEx.getCause(); if (c == null) c = invokEx; _log.debug("", c); throw UiException.Aide.wrap(c); } catch (Exception e) { _log.error("", e); throw UiException.Aide.wrap(e); } }

Target:
public void call(Object base, Method method) { Class<?>[] paramTypes = method.getParameterTypes(); java.lang.annotation.Annotation[][] parmAnnos = method.getParameterAnnotations(); Object[] params = new Object[paramTypes.length]; try { for (int i = 0; i < paramTypes.length; i++) { params[i] = resolveParameter(parmAnnos[i], paramTypes[i]); } method.setAccessible(true); method.invoke(base, params); } catch (InvocationTargetException invokEx) { Throwable c = invokEx.getCause(); if (c == null) c = invokEx; if (c instanceof OperationException) { _log.debug("", c); } else { _log.error("", c); } throw UiException.Aide.wrap(c); } catch (Exception e) { _log.error("", e); throw UiException.Aide.wrap(e); } }
Source:
public FindIterable<Document> prepare(FindIterable<Document> cursor) { FindIterable<Document> target = delegate.prepare(cursor); if (limit.isPresent()) { target = target.limit(limit.get()); } return target; }

Target:
public FindIterable<Document> prepare(FindIterable<Document> cursor) { FindIterable<Document> target = delegate.prepare(cursor); return limit.map(it -> target.limit(it)).orElse(target); }
Source:
private String calculateNonce() { Date d = new Date(); SimpleDateFormat f = new SimpleDateFormat("yyyy:MM:dd:hh:mm:ss"); String fmtDate = f.format(d); Random rand = new Random(100000); Integer randomInt = rand.nextInt(); return CredentialUtil.H(fmtDate + randomInt.toString()); }

Target:
private String calculateNonce() { LocalDateTime time = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy:MM:dd:HH:mm:ss.SSS"); String fmtTime = formatter.format(time); return CredentialUtil.encryptMD5(fmtTime + CommonHelper.randomString(10)); }
Source:
public RunnerTaskState getRunnerTaskState(String taskId) { final ThreadingTaskRunnerWorkItem workItem = tasks.get(taskId); if (workItem == null) { return null; } else { if (workItem.getThread() == null) { return RunnerTaskState.PENDING; } else if (!workItem.isFinished()) { return RunnerTaskState.RUNNING; } else { return RunnerTaskState.NONE; } } }

Target:
public RunnerTaskState getRunnerTaskState(String taskId) { final ThreadingTaskRunnerWorkItem workItem = tasks.get(taskId); return workItem == null ? null : workItem.getState(); }
Source:
public void valdiateDateBad() { Date testDate = null; String message = "The date should NOT be valid."; assertFalse("The date should NOT be valid.", concurStandardAccountingExtractService.validateDate(testDate)); }

Target:
public void valdiateDateBad() { Date testDate = null; assertFalse("The date should NOT be valid.", concurStandardAccountingValidationService.validateDate(testDate)); }
Source:
public void onEvent(Event event) { long eventSeenAt = 0L; if (event.getHeader().getEventType() == EventType.QUERY) { QueryEventData queryEventData = event.getData(); mysqlTxExecutionTimer.update(queryEventData.getExecutionTime(), TimeUnit.SECONDS); } boolean trackMetrics = event.getHeader().getEventType() == EventType.XID; if (trackMetrics) { eventSeenAt = System.currentTimeMillis(); } while (mustStop.get() != true) { if (event.getHeader().getEventType() == EventType.GTID) { gtid = ((GtidEventData)event.getData()).getGtid(); } BinlogConnectorEvent ep = new BinlogConnectorEvent(event, client.getBinlogFilename(), client.getGtidSet(), gtid); try { if ( queue.offer(ep, 100, TimeUnit.MILLISECONDS ) ) { break; } } catch (InterruptedException e) { return; } } if (trackMetrics) { queueTimer.update(System.currentTimeMillis() - eventSeenAt, TimeUnit.MILLISECONDS); } }

Target:
public void onEvent(Event event) { long eventSeenAt = 0L; boolean trackMetrics = false; if (event.getHeader().getEventType() == EventType.QUERY) { trackMetrics = true; eventSeenAt = System.currentTimeMillis(); QueryEventData queryEventData = event.getData(); mysqlTxExecutionTimer.update(queryEventData.getExecutionTime(), TimeUnit.SECONDS); } while (mustStop.get() != true) { if (event.getHeader().getEventType() == EventType.GTID) { gtid = ((GtidEventData)event.getData()).getGtid(); } BinlogConnectorEvent ep = new BinlogConnectorEvent(event, client.getBinlogFilename(), client.getGtidSet(), gtid); try { if ( queue.offer(ep, 100, TimeUnit.MILLISECONDS ) ) { break; } } catch (InterruptedException e) { return; } } if (trackMetrics) { queueTimer.update(System.currentTimeMillis() - eventSeenAt, TimeUnit.MILLISECONDS); } }
Source:
private synchronized boolean buildSafeClusterMemberList(ArrayList<Process> members) { int previousMemberCount = members.size(); if (m_cluster != null && m_cluster.size() > previousMemberCount) { members.clear(); members.addAll(m_cluster.subList(previousMemberCount, m_cluster.size())); return true; } else { return false; } }

Target:
private synchronized boolean buildSafeClusterMemberList(ArrayList<Process> members) { int previousMemberCount = members.size(); if (m_cluster != null && m_cluster.size() > previousMemberCount) { members.clear(); for (int ii = 0; ii < previousMemberCount; ii++) { members.add(null); } members.addAll(m_cluster.subList(previousMemberCount, m_cluster.size())); return true; } else { return false; } }
Source:
static Binder proxy(Binder binder) { return (Binder) Proxy.newProxyInstance( ForbidInstallBinder.class.getClassLoader(), new Class[] {Binder.class}, new ForbidInstallBinder(binder)); }

Target:
static Binder proxy(Binder binder) { return (Binder) Proxy.newProxyInstance( ForbidInstallBinder.class.getClassLoader(), new Class<?>[] {Binder.class}, new ForbidInstallBinder(binder)); }
Source:
private static String getModules(Map<String, ModuleService> modules) { StringBuilder sb = new StringBuilder("Available Modules:"); for(ModuleService entry : modules.values()) { sb.append( String.format("%n %-10s - %s", entry.getName(), entry.getDescription()) ); } return sb.toString(); }

Target:
private String getModules(Map<String, ModuleService> modules) { StringBuilder sb = new StringBuilder(String.format("Modules:%n")); for(ModuleService entry : modules.values()) { sb.append( String.format(" %-10s - %s%n", entry.getName(), entry.getDescription()) ); } return sb.toString(); }
Source:
public TokenBucket(long capacity, long tokensPerSecond, long initialTokens) { this.tokens = new AtomicLong(initialTokens); this.capacity = Math.max(capacity, tokensPerSecond); this.tokensPerPeriod = tokensPerSecond; this.nextRefillTime = System.nanoTime() + refreshPeriodNanos; }

Target:
public TokenBucket(long capacity, long tokensPerSecond, long initialTokens) { init(capacity, tokensPerSecond, initialTokens); }
Source:
private String encryptPassword(String username, String realm, String password) { try { StringBuilder sb = new StringBuilder(); for (String algorithm : algorithms) { PasswordFactory passwordFactory = PasswordFactory.getInstance(algorithm); AlgorithmParameterSpec spec; sb.append(algorithm); sb.append(":"); switch (algorithm) { case ScramDigestPassword.ALGORITHM_SCRAM_SHA_1: case ScramDigestPassword.ALGORITHM_SCRAM_SHA_256: case ScramDigestPassword.ALGORITHM_SCRAM_SHA_384: case ScramDigestPassword.ALGORITHM_SCRAM_SHA_512: spec = new IteratedSaltedPasswordAlgorithmSpec(ScramDigestPassword.DEFAULT_ITERATION_COUNT, salt(ScramDigestPassword.DEFAULT_SALT_SIZE)); break; case DigestPassword.ALGORITHM_DIGEST_MD5: case DigestPassword.ALGORITHM_DIGEST_SHA: case DigestPassword.ALGORITHM_DIGEST_SHA_256: case DigestPassword.ALGORITHM_DIGEST_SHA_384: case DigestPassword.ALGORITHM_DIGEST_SHA_512: spec = new DigestPasswordAlgorithmSpec(username, realm); break; default: throw new IllegalArgumentException("Unknown algorithm " + algorithm); } Password encrypted = passwordFactory.generatePassword(new EncryptablePasswordSpec(password.toCharArray(), spec)); byte[] encoded = BasicPasswordSpecEncoding.encode(encrypted); sb.append(ByteIterator.ofBytes(encoded).base64Encode().drainToString()); sb.append(";"); } return sb.toString(); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { throw new RuntimeException(e); } }

Target:
private String encryptPassword(String username, String realm, String password) { try { StringBuilder sb = new StringBuilder(); for (String algorithm : algorithms) { PasswordFactory passwordFactory = PasswordFactory.getInstance(algorithm); AlgorithmParameterSpec spec; sb.append(algorithm); sb.append(":"); switch (algorithm) { case ScramDigestPassword.ALGORITHM_SCRAM_SHA_1: case ScramDigestPassword.ALGORITHM_SCRAM_SHA_256: case ScramDigestPassword.ALGORITHM_SCRAM_SHA_384: case ScramDigestPassword.ALGORITHM_SCRAM_SHA_512: spec = new IteratedSaltedPasswordAlgorithmSpec(ScramDigestPassword.DEFAULT_ITERATION_COUNT, salt(ScramDigestPassword.DEFAULT_SALT_SIZE)); break; case DigestPassword.ALGORITHM_DIGEST_MD5: case DigestPassword.ALGORITHM_DIGEST_SHA: case DigestPassword.ALGORITHM_DIGEST_SHA_256: case DigestPassword.ALGORITHM_DIGEST_SHA_384: case DigestPassword.ALGORITHM_DIGEST_SHA_512: spec = new DigestPasswordAlgorithmSpec(username, realm); break; default: throw MSG.userToolUnknownAlgorithm(algorithm); } Password encrypted = passwordFactory.generatePassword(new EncryptablePasswordSpec(password.toCharArray(), spec)); byte[] encoded = BasicPasswordSpecEncoding.encode(encrypted); sb.append(ByteIterator.ofBytes(encoded).base64Encode().drainToString()); sb.append(";"); } return sb.toString(); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { throw new RuntimeException(e); } }
Source:
private void handlePrepare() throws IOException { List<BufferManager.TrackFormat> trackFormatList = mBufferManager.readTrackInfoFiles(); if (trackFormatList == null || trackFormatList.isEmpty()) { throw new IOException("Cannot find meta files for the recording."); } List<Format> formats = ImmutableList.copyOf( Lists.transform(trackFormatList, tf -> createFormat(tf.mediaFormat))); Format videoFormat = Iterables.find(formats, f -> MimeTypes.isVideo(f.sampleMimeType)); Iterable<TrackGroup> trackGroups = Iterables.transform(formats, TrackGroup::new); if (videoFormat != null) { Format textFormat = Format.createTextSampleFormat( null, MimeTypes.APPLICATION_CEA708, 0, videoFormat.language, null); trackGroups = Iterables.concat(trackGroups, ImmutableList.of(new TrackGroup(textFormat))); } mTrackGroupArray = new TrackGroupArray(Iterables.toArray(trackGroups, TrackGroup.class)); mSampleBuffer = mRecordingSampleBufferFactory.create( mBufferManager, mBufferListener, true, RecordingSampleBuffer.BUFFER_REASON_RECORDED_PLAYBACK); mSampleBuffer.init(Lists.transform(trackFormatList, tf -> tf.trackId), formats); mCallback.onPrepared(); }

Target:
private void handlePrepare() throws IOException { List<BufferManager.TrackFormat> trackFormatList = mBufferManager.readTrackInfoFiles(); if (trackFormatList == null || trackFormatList.isEmpty()) { throw new IOException("Cannot find meta files for the recording."); } List<Format> formats = ImmutableList.copyOf( Lists.transform(trackFormatList, tf -> createFormat(tf.mediaFormat))); Format videoFormat = Iterables.find(formats, f -> MimeTypes.isVideo(f.sampleMimeType)); Iterable<TrackGroup> captionTrackGroups = new ArrayList<>(); if (videoFormat != null) { Format textFormat = Format.createTextSampleFormat( null, MimeTypes.APPLICATION_CEA708, 0, videoFormat.language, null); captionTrackGroups = ImmutableList.of(new TrackGroup(textFormat)); } Iterable<TrackGroup> trackGroups = Iterables.concat(Iterables.transform(formats, TrackGroup::new), captionTrackGroups); mTrackGroupArray = new TrackGroupArray(Iterables.toArray(trackGroups, TrackGroup.class)); mSampleBuffer = mRecordingSampleBufferFactory.create( mBufferManager, mBufferListener, true, RecordingSampleBuffer.BUFFER_REASON_RECORDED_PLAYBACK); mSampleBuffer.init(Lists.transform(trackFormatList, tf -> tf.trackId), formats); mCallback.onPrepared(); }
Source:
public static void putDocuments(String indexName, List<Document> documents) { Index index = getIndex(indexName); int delay = 2; for (int attempts = 0; attempts < MAX_RETRIES; attempts++) { try { PutResponse result = index.put(documents); if (Config.PERSISTENCE_CHECK_DURATION == 0) { continue; } boolean isSuccessful; List<Document> documentsToRetry = new ArrayList<Document>(); for (int i = 0; i < documents.size(); i++) { isSuccessful = result.getResults().get(i).getCode() == StatusCode.OK; if (!isSuccessful) { documentsToRetry.add(documents.get(i)); } } int elapsedTime = 0; isSuccessful = documentsToRetry.isEmpty(); while (!isSuccessful && elapsedTime < Config.PERSISTENCE_CHECK_DURATION) { ThreadHelper.waitBriefly(); result = index.put(documentsToRetry); for (int i = 0; i < documentsToRetry.size(); i++) { isSuccessful = result.getResults().get(i).getCode() == StatusCode.OK; if (!isSuccessful) { break; } } if (!isSuccessful) { elapsedTime += ThreadHelper.WAIT_DURATION; } } if (elapsedTime >= Config.PERSISTENCE_CHECK_DURATION) { log.info(String.format(ERROR_EXCEED_DURATION, documents, indexName)); } } catch (PutException e) { if (StatusCode.TRANSIENT_ERROR.equals(e.getOperationResult().getCode())) { ThreadHelper.waitFor(delay * 1000); delay *= 2; continue; } else { log.severe(String.format(ERROR_NON_TRANSIENT_BACKEND_ISSUE, documents, indexName) + TeammatesException.toStringWithStackTrace(e)); break; } } } }

Target:
public static void putDocuments(String indexName, List<Document> documents) { Index index = getIndex(indexName); int delay = 2; for (int attempts = 0; attempts < MAX_RETRIES; attempts++) { try { List<Document> failedDocuments = putDocuments(index, documents); boolean isSuccessful = failedDocuments.isEmpty(); if (Config.PERSISTENCE_CHECK_DURATION == 0) { continue; } int elapsedTime = 0; while (!isSuccessful && elapsedTime < Config.PERSISTENCE_CHECK_DURATION) { ThreadHelper.waitBriefly(); isSuccessful = putDocuments(index, failedDocuments).isEmpty(); if (!isSuccessful) { elapsedTime += ThreadHelper.WAIT_DURATION; } } if (elapsedTime >= Config.PERSISTENCE_CHECK_DURATION) { log.info(String.format(ERROR_EXCEED_DURATION, documents, indexName)); } } catch (PutException e) { if (StatusCode.TRANSIENT_ERROR.equals(e.getOperationResult().getCode())) { ThreadHelper.waitFor(delay * 1000); delay *= 2; continue; } else { log.severe(String.format(ERROR_NON_TRANSIENT_BACKEND_ISSUE, documents, indexName) + TeammatesException.toStringWithStackTrace(e)); break; } } } }
Source:
public LocalSearchResultProvider(LocalSearchBackend backend, IQueryBackendContext context, PQuery query, IPlanProvider planProvider, QueryEvaluationHint userHints) throws QueryProcessingException { this.backend = backend; this.resultProviderAccess = context.getResultProviderAccess(); this.hintProvider = context.getHintProvider(); engine = (AdvancedViatraQueryEngine) hintProvider; this.query = query; this.planProvider = planProvider; this.userHints = userHints; this.runtimeContext = context.getRuntimeContext(); try { searchContext = new ISearchContext.SearchContext(runtimeContext, engine.getBaseIndex(), resultProviderAccess, userHints, backend.getCache()); } catch (ViatraQueryException e) { throw new QueryProcessingException("Could not create search context for {1}", new String[]{query.getFullyQualifiedName()}, e.getMessage(), query, e); } }

Target:
public LocalSearchResultProvider(LocalSearchBackend backend, IQueryBackendContext context, PQuery query, IPlanProvider planProvider, QueryEvaluationHint userHints) throws QueryProcessingException { this.backend = backend; this.resultProviderAccess = context.getResultProviderAccess(); this.hintProvider = context.getHintProvider(); engine = (AdvancedViatraQueryEngine) hintProvider; this.query = query; this.planProvider = planProvider; this.userHints = userHints; this.runtimeContext = context.getRuntimeContext(); try { searchContext = new ISearchContext.SearchContext(context, engine.getBaseIndex(), userHints, backend.getCache()); } catch (ViatraQueryException e) { throw new QueryProcessingException("Could not create search context for {1}", new String[]{query.getFullyQualifiedName()}, e.getMessage(), query, e); } }
Source:
protected NuxeoPrincipal createAdministrator() { return new UserPrincipal("Administrator", new ArrayList<>(), false, true); }

Target:
protected NuxeoPrincipal createAdministrator() { return new UserPrincipal("Administrator", List.of(), false, true); }
Source:
private String deserializationPath() { return "avro.deserialization"; }

Target:
private String deserializationPath() { return "content.avro.deserialization"; }
Source:
private void filterOutLastReadBlobs(List<CloudBlobMetadata> cloudBlobMetadataList, Set<String> lastReadBlobIds, long lastUpdateTime) { List<CloudBlobMetadata> removeList = new LinkedList<>(); for (CloudBlobMetadata cloudBlobMetadata : cloudBlobMetadataList) { if (removeList.size() == lastReadBlobIds.size() || cloudBlobMetadata.getLastUpdateTime() > lastUpdateTime) { break; } if (lastReadBlobIds.contains(cloudBlobMetadata.getId())) { removeList.add(cloudBlobMetadata); } } cloudBlobMetadataList.removeAll(removeList); }

Target:
private void filterOutLastReadBlobs(List<CloudBlobMetadata> cloudBlobMetadataList, Set<String> lastReadBlobIds, long lastUpdateTime) { ListIterator<CloudBlobMetadata> iterator = cloudBlobMetadataList.listIterator(); int numRemovedBlobs = 0; while(iterator.hasNext()) { CloudBlobMetadata cloudBlobMetadata = iterator.next(); if(numRemovedBlobs == lastReadBlobIds.size() || cloudBlobMetadata.getLastUpdateTime() > lastUpdateTime) { break; } if (lastReadBlobIds.contains(cloudBlobMetadata.getId())) { iterator.remove(); numRemovedBlobs++; } } }
Source:
public void testOnGenerateClickedWhenUserConfirmGenerateKey() { InputDialog inputDialog = mock(InputDialog.class); when(dialogFactory.createInputDialog(anyString(), anyString(), (InputCallback)anyObject(), (CancelCallback)anyObject())) .thenReturn(inputDialog); when(inputDialog.withValidator(any(InputValidator.class))).thenReturn(inputDialog); presenter.onGenerateClicked(); verify(dialogFactory).createInputDialog(anyString(), anyString(), inputCallbackCaptor.capture(), (CancelCallback)anyObject()); InputCallback inputCallback = inputCallbackCaptor.getValue(); inputCallback.accepted(GITHUB_HOST); verify(service).generatePair(Matchers.eq(SshKeyManagerPresenter.VCS_SSH_SERVICE), eq(GITHUB_HOST)); }

Target:
public void testOnGenerateClickedWhenUserConfirmGenerateKey() { when(dialogFactory.createInputDialog(anyString(), anyString(), (InputCallback)anyObject(), (CancelCallback)anyObject())) .thenReturn(inputDialog); presenter.onGenerateClicked(); verify(dialogFactory).createInputDialog(anyString(), anyString(), inputCallbackCaptor.capture(), (CancelCallback)anyObject()); InputCallback inputCallback = inputCallbackCaptor.getValue(); inputCallback.accepted(GITHUB_HOST); verify(service).generatePair(Matchers.eq(SshKeyManagerPresenter.VCS_SSH_SERVICE), eq(GITHUB_HOST)); }
Source:
public List<IEntityAction> getAllEntityActions() { return Lists.newArrayList(VampirismRegistries.ENTITYACTIONS.getValues()); }

Target:
public List<IEntityAction> getAllEntityActions() { return Lists.newArrayList(VampirismRegistries.ENTITYACTIONS.getValuesCollection()); }
Source:
public int hashCode() { return Objects.hash(parentNode, predicate); }

Target:
public int hashCode() { return Objects.hash(System.identityHashCode(parentNode), System.identityHashCode(predicate)); }
Source:
public VMNamesListReturnForXmlRpc(Map<String, Object> innerMap) { status = new StatusForXmlRpc((Map<String, Object>) innerMap.get(STATUS)); Object[] vmNames = (Object[]) innerMap.get(VM_NAMES); if (vmNames != null) { vmNamesList = Arrays.asList(vmNames).stream().map(Objects::toString).collect(Collectors.toList()); } }

Target:
public VMNamesListReturnForXmlRpc(Map<String, Object> innerMap) { status = new StatusForXmlRpc((Map<String, Object>) innerMap.get(STATUS)); Object[] vmNames = (Object[]) innerMap.get(VM_NAMES); if (vmNames != null) { vmNamesList = Arrays.stream(vmNames).map(Objects::toString).collect(Collectors.toList()); } }
Source:
void createRsaKeyRunner(Consumer<CreateRsaKeyOptions> testRunner) { final Map<String, String> tags = new HashMap<>(); tags.put("foo", "baz"); final CreateRsaKeyOptions createRsaKeyOptions = new CreateRsaKeyOptions(KEY_NAME) .setExpiresOn(OffsetDateTime.of(2050, 1, 30, 0, 0, 0, 0, ZoneOffset.UTC)) .setNotBefore(OffsetDateTime.of(2000, 1, 30, 12, 59, 59, 0, ZoneOffset.UTC)) .setTags(tags); testRunner.accept(createRsaKeyOptions); }

Target:
void createRsaKeyRunner(Consumer<CreateRsaKeyOptions> testRunner) { final Map<String, String> tags = new HashMap<>(); tags.put("foo", "baz"); final CreateRsaKeyOptions createRsaKeyOptions = new CreateRsaKeyOptions(generateResourceId(KEY_NAME)) .setExpiresOn(OffsetDateTime.of(2050, 1, 30, 0, 0, 0, 0, ZoneOffset.UTC)) .setNotBefore(OffsetDateTime.of(2000, 1, 30, 12, 59, 59, 0, ZoneOffset.UTC)) .setTags(tags); testRunner.accept(createRsaKeyOptions); }
Source:
public CloudBigtableConfiguration build() { return new CloudBigtableConfiguration(projectId, zoneId, clusterId, additionalConfigurations); }

Target:
public CloudBigtableConfiguration build() { return new CloudBigtableConfiguration(projectId, zoneId, clusterId, additionalConfiguration); }
Source:
private static void assertGeometryEquals(Geometry actual, Geometry expected) { if (expected.isEmpty()) { assertTrue(actual.isEmpty()); } else { assertEquals(actual.norm(), expected.norm()); } }

Target:
private static void assertGeometryEquals(Geometry actual, Geometry expected) { assertEquals(actual.norm(), expected.norm()); }
Source:
public JsonRpcRequest(@Assisted("message") String message, JsonParser jsonParser, JsonRpcFactory jsonRpcFactory) { this.jsonParser = jsonParser; checkNotNull(message, "Message must not be null"); checkArgument(!message.isEmpty(), "Message must not be empty"); JsonObject jsonObject = jsonParser.parse(message).getAsJsonObject(); method = jsonObject.get("method").getAsString(); if (jsonObject.has("id")) { id = jsonObject.get("id").getAsString(); } else { id = null; } if (jsonObject.has("params")) { params = jsonRpcFactory.createParams(jsonObject.get("params").toString()); } else { params = null; } }

Target:
public JsonRpcRequest(@Assisted("message") String message, JsonParser jsonParser, JsonRpcFactory jsonRpcFactory) { checkNotNull(message, "Message must not be null"); checkArgument(!message.isEmpty(), "Message must not be empty"); JsonObject jsonObject = jsonParser.parse(message).getAsJsonObject(); method = jsonObject.get("method").getAsString(); if (jsonObject.has("id")) { id = jsonObject.get("id").getAsString(); } else { id = null; } if (jsonObject.has("params")) { params = jsonRpcFactory.createParams(jsonObject.get("params").toString()); } else { params = null; } }
Source:
private Point computeRelativeLocation(final Point absolutePointerLocation, boolean isBorderNode, boolean isConcernedBorderedNode) { if (absolutePointerLocation != null && getHost() instanceof IGraphicalEditPart) { final IFigure hostFigure = ((IGraphicalEditPart) getHost()).getFigure(); Dimension difference = new Dimension(absolutePointerLocation.x, absolutePointerLocation.y); if (!(getHost() instanceof DiagramEditPart)) { Point topLeftHostLocation = hostFigure.getBounds().getTopLeft().getCopy(); if (topLeftHostLocation.x == -1) { topLeftHostLocation.x = 0; } hostFigure.translateToAbsolute(topLeftHostLocation); GraphicalHelper.screen2logical(topLeftHostLocation, (IGraphicalEditPart) getHost()); difference = absolutePointerLocation.getDifference(topLeftHostLocation); } Point locationHint = new Point(difference.width, difference.height); if ((hostFigure instanceof ResizableCompartmentFigure) && (getHost() instanceof AbstractDNodeContainerCompartmentEditPart) && !isBorderNode) { final Point scrollOffset = ((ResizableCompartmentFigure) hostFigure).getScrollPane().getViewport().getViewLocation(); final Point shiftFromMarginOffset = FigureUtilities.getShiftFromMarginOffset((ResizableCompartmentFigure) hostFigure, isConcernedBorderedNode, getHost()); locationHint = new Point(locationHint.x + scrollOffset.x - shiftFromMarginOffset.x, locationHint.y + scrollOffset.y - shiftFromMarginOffset.y); } return locationHint; } return null; }

Target:
private Point computeRelativeLocation(final Point absolutePointerLocation, boolean isBorderNode, boolean isConcernedBorderedNode) { if (absolutePointerLocation != null && getHost() instanceof IGraphicalEditPart) { final IFigure hostFigure = ((IGraphicalEditPart) getHost()).getFigure(); Dimension difference; if (getHost() instanceof DiagramEditPart) { difference = new Dimension(absolutePointerLocation.x, absolutePointerLocation.y); } else { Point topLeftHostLocation = hostFigure.getBounds().getTopLeft().getCopy(); if (topLeftHostLocation.x == -1) { topLeftHostLocation.x = 0; } hostFigure.translateToAbsolute(topLeftHostLocation); GraphicalHelper.screen2logical(topLeftHostLocation, (IGraphicalEditPart) getHost()); difference = absolutePointerLocation.getDifference(topLeftHostLocation); } Point locationHint = new Point(difference.width, difference.height); if ((hostFigure instanceof ResizableCompartmentFigure) && (getHost() instanceof AbstractDNodeContainerCompartmentEditPart) && !isBorderNode) { final Point scrollOffset = ((ResizableCompartmentFigure) hostFigure).getScrollPane().getViewport().getViewLocation(); final Point shiftFromMarginOffset = FigureUtilities.getShiftFromMarginOffset((ResizableCompartmentFigure) hostFigure, isConcernedBorderedNode, getHost()); locationHint = new Point(locationHint.x + scrollOffset.x - shiftFromMarginOffset.x, locationHint.y + scrollOffset.y - shiftFromMarginOffset.y); } return locationHint; } return null; }
Source:
public CamusRequest popRequest() { if (requests.size() > 0){ for (int i = 0; i < requests.size(); i++) { if (requests.get(i).getTopic().equals(currentTopic)) return requests.remove(i); } return requests.remove(requests.size() - 1); } else return null; }

Target:
public CamusRequest popRequest() { if (requests.size() > 0){ for (int i = 0; i < requests.size(); i++) { if (requests.get(i).getTopic().equals(currentTopic)) return requests.remove(i); } CamusRequest cr = requests.remove(requests.size() - 1); currentTopic = cr.getTopic(); return cr; } else return null; }
Source:
public InputKind getKind() { String[] pathComponents = this.path.split("/"); int offset = 0; while (true) { if (pathComponents[offset].equals("inputs")) { break; } else { offset += 1; } } List<String> toJoin = new ArrayList<String>(); for (int i = offset+1; i < pathComponents.length; i++) { toJoin.add(pathComponents[i]); } String relpath = InputCollection.join("/", toJoin); return InputKind.makeInputKind(relpath); }

Target:
public InputKind getKind() { String[] pathComponents = this.path.split("/"); int offset = 0; while (!pathComponents[offset].equals("inputs")) { offset += 1; } List<String> toJoin = new ArrayList<String>(); for (int i = offset+1; i < pathComponents.length; i++) { toJoin.add(pathComponents[i]); } String relpath = Util.join("/", toJoin); return InputKind.create(relpath); }
Source:
private String copyJarsToDfs(String jars, String destDir) { String dfsAppRoot = config.getDfsRoot() + "/" + config.getApplicationName(); String dfsDestDir = dfsAppRoot + "/" + destDir; FileSystem fs = null; try { fs = FileSystem.get(new URI(config.getDfsRoot()), new Configuration()); fs.mkdirs(new Path(dfsDestDir)); } catch (Exception e) { throw new IllegalStateException(e); } finally { if (fs != null) { try { fs.close(); } catch (IOException ioe) { throw new IllegalStateException(ioe); } } } StringBuilder classpath = new StringBuilder(); for (String jarPath : jars.split(",")) { File jarFile = new File(jarPath); String jarName = jarFile.getName(); try { fs.copyFromLocalFile(new Path(jarPath), new Path(dfsDestDir)); } catch (IOException e) { logger.error("Failed to copy file to DFS directory {}", jarPath, dfsDestDir); try { fs.close(); } catch (IOException ioe) { throw new IllegalStateException(ioe); } throw new IllegalStateException(e); } if (classpath.length() != 0) { classpath.append(","); } classpath.append(dfsDestDir).append("/").append(jarName); } try { fs.close(); } catch (IOException e) { throw new IllegalStateException(e); } return classpath.toString(); }

Target:
private String copyJarsToDfs(String jars, String destDir) { String dfsAppRoot = config.getDfsRoot() + "/" + config.getApplicationName(); String dfsDestDir = dfsAppRoot + "/" + destDir; FileSystem fs = null; try { fs = FileSystem.get(new URI(config.getDfsRoot()), new Configuration()); fs.mkdirs(new Path(dfsDestDir)); } catch (Exception e) { logger.error("Failed to create DFS directory {}", dfsDestDir); if (fs != null) { try { fs.close(); } catch (IOException ioe) { throw new IllegalStateException(ioe); } } throw new IllegalStateException(e); } StringBuilder classpath = new StringBuilder(); for (String jarPath : jars.split(",")) { File jarFile = new File(jarPath); String jarName = jarFile.getName(); try { fs.copyFromLocalFile(new Path(jarPath), new Path(dfsDestDir)); } catch (IOException e) { logger.error("Failed to copy file to DFS directory {}", jarPath, dfsDestDir); try { fs.close(); } catch (IOException ioe) { throw new IllegalStateException(ioe); } throw new IllegalStateException(e); } if (classpath.length() != 0) { classpath.append(","); } classpath.append(dfsDestDir).append("/").append(jarName); } try { fs.close(); } catch (IOException e) { throw new IllegalStateException(e); } return classpath.toString(); }
Source:
public Optional<IncrementalResultExporter> build(Context context) throws IncrementalExporterFactoryException, ConfigurationException { final KafkaExportParameters exportParams = new KafkaExportParameters(context.getObserverConfiguration().toMap()); System.out.println("KafkaResultExporterFactory.build(): params.isExportToKafka()=" + exportParams.isExportToKafka()); if (exportParams.isExportToKafka()) { KafkaProducer<String, VisibilityBindingSet> producer = new KafkaProducer<String, VisibilityBindingSet>(exportParams.getProducerConfig()); final IncrementalResultExporter exporter = new KafkaResultExporter(producer); return Optional.of(exporter); } else { return Optional.absent(); } }

Target:
public Optional<IncrementalResultExporter> build(Context context) throws IncrementalExporterFactoryException, ConfigurationException { final KafkaExportParameters exportParams = new KafkaExportParameters(context.getObserverConfiguration().toMap()); log.debug("KafkaResultExporterFactory.build(): params.isExportToKafka()=" + exportParams.isExportToKafka()); if (exportParams.isExportToKafka()) { KafkaProducer<String, VisibilityBindingSet> producer = new KafkaProducer<String, VisibilityBindingSet>(exportParams.getProducerConfig()); final IncrementalResultExporter exporter = new KafkaResultExporter(producer); return Optional.of(exporter); } else { return Optional.absent(); } }
Source:
public EvalEvaluation(String type, String owner, String title, String instructions, Date startDate, Date dueDate, Date stopDate, Date viewDate, Boolean studentViewResults, Date studentsDate, Boolean instructorViewResults, Boolean instructorViewAllResults, Date instructorsDate, String state, String resultsSharing, String instructorOpt, Integer reminderDays, String reminderFromEmail, String termId, EvalEmailTemplate availableEmailTemplate, EvalEmailTemplate reminderEmailTemplate, EvalTemplate template, Set<EvalResponse> responses, Boolean blankResponsesAllowed, Boolean modifyResponsesAllowed, Boolean unregisteredAllowed, Boolean locked, String authControl, String evalCategory, String selectionSettings, Boolean emailOpenNotification){ this(type, owner, title, instructions, startDate, dueDate, stopDate, viewDate, studentViewResults, studentsDate, instructorViewResults, instructorViewAllResults, instructorsDate, state, resultsSharing, instructorOpt, reminderDays, reminderFromEmail, termId, availableEmailTemplate, reminderEmailTemplate, template, responses, blankResponsesAllowed, modifyResponsesAllowed, unregisteredAllowed, Boolean.FALSE ,locked, authControl, evalCategory, selectionSettings, Boolean.TRUE, null); }

Target:
public EvalEvaluation(String type, String owner, String title, String instructions, Date startDate, Date dueDate, Date stopDate, Date viewDate, Boolean studentViewResults, Date studentsDate, Boolean instructorViewResults, Boolean instructorViewAllResults, Date instructorsDate, String state, String resultsSharing, String instructorOpt, Integer reminderDays, String reminderFromEmail, String termId, EvalEmailTemplate availableEmailTemplate, EvalEmailTemplate reminderEmailTemplate, EvalTemplate template, Set<EvalResponse> responses, Boolean blankResponsesAllowed, Boolean modifyResponsesAllowed, Boolean unregisteredAllowed, Boolean locked, String authControl, String evalCategory, String selectionSettings, Boolean emailOpenNotification){ this(type, owner, title, instructions, startDate, dueDate, stopDate, viewDate, studentViewResults, studentsDate, instructorViewResults, instructorViewAllResults, instructorsDate, state, resultsSharing, instructorOpt, reminderDays, reminderFromEmail, termId, availableEmailTemplate, reminderEmailTemplate, template, responses, blankResponsesAllowed, modifyResponsesAllowed, unregisteredAllowed, Boolean.FALSE ,locked, authControl, evalCategory, selectionSettings, Boolean.TRUE, Boolean.FALSE); }
Source:
private void checkForParseError(String name, String stream, XDDSLMessages msg, int pos, String... inserts) { try { StreamsNode sn = parse(name, stream); fail("expected to fail but parsed " + sn.stringify()); } catch (DSLException e) { e.printStackTrace(); assertEquals(msg, e.getMessageCode()); assertEquals(pos, e.getPosition()); if (inserts != null) { for (int i = 0; i < inserts.length; i++) { assertEquals(inserts[i], e.getInserts()[i]); } } } }

Target:
private void checkForParseError(String name, String stream, XDDSLMessages msg, int pos, String... inserts) { try { StreamsNode sn = parse(name, stream); fail("expected to fail but parsed " + sn.stringify()); } catch (DSLException e) { assertEquals(msg, e.getMessageCode()); assertEquals(pos, e.getPosition()); if (inserts != null) { for (int i = 0; i < inserts.length; i++) { assertEquals(inserts[i], e.getInserts()[i]); } } } }
Source:
protected long getDelayMs(int currentAttempt) { return RANDOM.nextInt(_rangeUpper) * Integer.MAX_VALUE + RANDOM.nextInt(_rangeLower) + _minDelayMs; }

Target:
protected long getDelayMs(int currentAttempt) { return _minDelayMs + (long) (RANDOM.nextDouble() * (_maxDelayMs - _minDelayMs)); }
Source:
private ValidationResult hostStatusLegalForSetupNetworks() { boolean hostStatusLegalForSetupNetworks = LEGAL_STATUSES.contains(host.getStatus()) || host.getStatus() == VDSStatus.Installing && internalExecution; if (!hostStatusLegalForSetupNetworks) { logger.error( "Unable to setup network: operation can only be done when Host status is one of: {};" + " current status is {}", LEGAL_STATUSES_STR, host.getStatus()); return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VDS_STATUS_ILLEGAL, ReplacementUtils.replaceWith(VAR_HOST_STATUS, LEGAL_STATUSES, ",", LEGAL_STATUSES.size())); } return ValidationResult.VALID; }

Target:
private ValidationResult hostStatusLegalForSetupNetworks() { VDSStatus hostStatus = host.getStatus(); boolean hostStatusLegalForSetupNetworks = LEGAL_STATUSES.contains(hostStatus) || hostStatus == VDSStatus.Installing && internalExecution; if (!hostStatusLegalForSetupNetworks) { logger.error( "Unable to setup network: operation can only be done when Host status is one of: {};" + " current status is {}", LEGAL_STATUSES_STR, hostStatus); return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VDS_STATUS_ILLEGAL, ReplacementUtils.replaceWith(VAR_HOST_STATUS, LEGAL_STATUSES, ",", LEGAL_STATUSES.size())); } return ValidationResult.VALID; }
Source:
public static NodeType fromByte(byte rep) throws IOException { switch (rep) { case 1: return CORE; case 2: return LEAF; default: throw new IOException(); } }

Target:
public static NodeType fromByte(byte rep) { switch (rep) { case 1: return CORE; case 2: return LEAF; default: throw new IllegalArgumentException("The NodeType byte " + rep + " is not a valid type"); } }
Source:
Builder() { sparkProperties.put("spark.ui.enabled", "false"); sparkProperties.put("es.index.read.missing.as.empty", "true"); sparkProperties.put("es.nodes.wan.only", getEnv("ES_NODES_WAN_ONLY", "false")); sparkProperties.put("es.nodes", getEnv("ES_HOSTS", "127.0.0.1")); sparkProperties.put("es.net.ssl", getEnv("ES_SSL", "false")); final String username = getEnv("ES_USERNAME", null); if (username != null && !username.trim().isEmpty()) { sparkProperties.put("es.net.http.auth.user", username); } final String password = getEnv("ES_PASSWORD", null); if (password != null && !password.trim().isEmpty()) { sparkProperties.put("es.net.http.auth.pass", password); } }

Target:
Builder() { sparkProperties.put("spark.ui.enabled", "false"); sparkProperties.put("es.index.read.missing.as.empty", "true"); sparkProperties.put("es.nodes.wan.only", getEnv("ES_NODES_WAN_ONLY", "false")); }
Source:
public void registerAnalysis(final DAnalysis analysis) { if (!analysis.eAdapters().contains(this)) { analysis.eAdapters().add(this); } for (final DView view : analysis.getOwnedViews()) { registerView(view); } }

Target:
public void registerAnalysis(final DAnalysis analysis) { analysis.eAdapters().add(this); for (final DView view : analysis.getOwnedViews()) { registerView(view); } }
Source:
public List<Class> getSupportedTypes() { return new ArrayList<>(Arrays.asList(LocalDateTime.class)); }

Target:
public List<Class> getSupportedTypes() { return Collections.singletonList(LocalDateTime.class); }
Source:
public boolean hasExtra(ChatComponent component, boolean recursive) { $lock.readLock().lock(); if (extra.contains(component)) { $lock.readLock().unlock(); return true; } if (!recursive) { $lock.readLock().unlock(); return false; } for (ChatComponent child : extra) { if (child.hasExtra(component, true)) { $lock.readLock().unlock(); return true; } } $lock.readLock().unlock(); return false; }

Target:
public boolean hasExtra(ChatComponent component, boolean recursive) { if (extra.contains(component)) { return true; } if (!recursive) { return false; } for (ChatComponent child : extra) { if (child.hasExtra(component, true)) { return true; } } return false; }
Source:
private JSONObject handleGetRequest() throws AddressException, UnknownHostException, RPCException { StorageController storage = Node.getStorageController(); JSONObject responseObject = new JSONObject(); GetRpc rpc = (GetRpc) Rpc.fromJsonString(this.rpc.toString()); JSONArray json = new JSONArray(); try{ int index = rpc.getIndex(); if (index != 0){ NavigableSet<Address> keys = storage.getBucket(index); for (Address key: keys){ json.put(key); } } if (index == 0){ if(storage.containsValue(rpc.getDestination())){ FileAddress value = storage.get(rpc.getDestination()); json.put(value); } if (!storage.containsValue(rpc.getDestination())){ handleLookupRequest(); } } responseObject = RPCBuilder.RPCResponseFactory(rpc.getId(), true, json, null);} catch(JSONException e){ errorData = e.getMessage(); } return responseObject; }

Target:
private JSONObject handleGetRequest() throws RPCException, UnknownHostException, AddressException { StorageController storage = Node.getStorageController(); JSONObject responseObject = new JSONObject(); GetRpc rpc = (GetRpc) Rpc.fromJsonString(this.rpc.toString()); JSONArray json = new JSONArray(); try{ int index = rpc.getIndex(); if (index != 0){ NavigableSet<Address> keys = storage.getBucket(index); for (Address key: keys){ json.put(key); } } if (index == 0){ if(storage.containsValue(rpc.getDestination())){ FileAddress value = storage.get(rpc.getDestination()); File file = value.getFile(); try{ byte[] byteArray = Files.readAllBytes(file.toPath()); json.put(Base64.encode(byteArray)); } catch(IOException e){ throw new RPCException(JSONRPCError.NODE_STORAGE_ERROR); } } if (!storage.containsValue(rpc.getDestination())){ return handleLookupRequest(); } } responseObject = RPCBuilder.RPCResponseFactory(rpc.getId(), true, json, null);} catch(JSONException e){ errorData = e.getMessage(); } return responseObject; }