auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void findFragmentReferences(ArrayList<TextFileChange> changes, IProgressMonitor monitor) throws CoreException { BundleDescription[] fragments = fDesc.getFragments(); SubMonitor subMonitor = SubMonitor.convert(monitor, "", fragments.length); String id = fDesc.getSymbolicName(); for (int i = 0; i < fragments.length; i++) { IPluginModelBase base = PluginRegistry.findModel(fragments[i]); if (base instanceof IFragmentModel && id.equals(((IFragmentModel) (base)).getFragment().getPluginId())) { CreateHeaderChangeOperation op = new CreateHeaderChangeOperation(base, Constants.FRAGMENT_HOST, id, fNewId); op.run(subMonitor.newChild(1)); TextFileChange change = op.getChange(); if (change != null) changes.add(change); } else subMonitor.worked(1); } }

Target:
private void findFragmentReferences(ArrayList<TextFileChange> changes, IProgressMonitor monitor) throws CoreException { BundleDescription[] fragments = fDesc.getFragments(); SubMonitor subMonitor = SubMonitor.convert(monitor, fragments.length); String id = fDesc.getSymbolicName(); for (int i = 0; i < fragments.length; i++) { IPluginModelBase base = PluginRegistry.findModel(fragments[i]); SubMonitor iterationMonitor = subMonitor.newChild(1); if (base instanceof IFragmentModel && id.equals(((IFragmentModel) (base)).getFragment().getPluginId())) { CreateHeaderChangeOperation op = new CreateHeaderChangeOperation(base, Constants.FRAGMENT_HOST, id, fNewId); op.run(iterationMonitor); TextFileChange change = op.getChange(); if (change != null) { changes.add(change); } } } }
Source:
private void register(Bundle parameters) throws Exception { final Map<String, String> parameterMap = new HashMap<>(); for (String key : parameters.keySet()) { parameterMap.put(key, parameters.getString(key)); } final Response<ResponseBody> response = loginService.register(parameterMap).execute(); if (!response.isSuccessful()) { final int errorCode = response.code(); final String errorBody = response.errorBody().string(); if ((errorCode == HttpStatus.BAD_REQUEST || errorCode == HttpStatus.CONFLICT) && !android.text.TextUtils.isEmpty(errorBody)) { try { final Type objectMapType = new TypeToken<HashMap<String, Object>>() { }.getType(); final Type fieldErrorListType = new TypeToken<List<RegisterResponseFieldError>>() { }.getType(); final HashMap<String, Object> body = gson.fromJson(errorBody, objectMapType); final FormFieldMessageBody errorResponse = new FormFieldMessageBody(); for (String key : body.keySet()) { final Object fieldError = body.get(key); if (fieldError instanceof Collection<?>) { errorResponse.put(key, gson.fromJson(gson.toJson(fieldError), fieldErrorListType)); } } if (errorResponse.size() > 0) { throw new RegistrationException(errorResponse); } } catch (JsonSyntaxException ex) { } } throw new HttpStatusException(response); } }

Target:
private void register(Bundle parameters) throws Exception { final Map<String, String> parameterMap = new HashMap<>(); for (String key : parameters.keySet()) { parameterMap.put(key, parameters.getString(key)); } final Response<ResponseBody> response = loginService.register(parameterMap).execute(); if (!response.isSuccessful()) { final int errorCode = response.code(); final String errorBody = response.errorBody().string(); if ((errorCode == HttpStatus.BAD_REQUEST || errorCode == HttpStatus.CONFLICT) && !android.text.TextUtils.isEmpty(errorBody)) { try { final Type objectMapType = new TypeToken<HashMap<String, Object>>() { }.getType(); final Type fieldErrorListType = new TypeToken<List<RegisterResponseFieldError>>() { }.getType(); final HashMap<String, Object> body = gson.fromJson(errorBody, objectMapType); final FormFieldMessageBody errorResponse = new FormFieldMessageBody(); for (String key : body.keySet()) { final Object fieldError = body.get(key); if (fieldError instanceof Collection<?>) { final String fieldErrorJson = gson.toJson(fieldError); errorResponse.put(key, gson.fromJson(fieldErrorJson, fieldErrorListType)); } } if (errorResponse.size() > 0) { throw new RegistrationException(errorResponse); } } catch (JsonSyntaxException ex) { } } throw new HttpStatusException(response); } }
Source:
public void runBeforeEachTest() { executeDataSet(CREATE_PATIENT_PROGRAMS_XML); if (pws == null) { pws = Context.getProgramWorkflowService(); adminService = Context.getAdministrationService(); encounterService = Context.getEncounterService(); cs = Context.getConceptService(); } pws = (ProgramWorkflowService) applicationContext.getBean("programWorkflowDAO"); }

Target:
public void runBeforeEachTest() { executeDataSet(CREATE_PATIENT_PROGRAMS_XML); if (pws == null) { pws = Context.getProgramWorkflowService(); adminService = Context.getAdministrationService(); encounterService = Context.getEncounterService(); cs = Context.getConceptService(); } pws = (ProgramWorkflowService) applicationContext.getBean("programWorkflowService"); }
Source:
public SignatureToolTipManager(DocDisplay docDisplay) { RStudioGinjector.INSTANCE.injectMembers(this); toolTip_ = new RCompletionToolTip(docDisplay); docDisplay_ = docDisplay; handlers_ = new HandlerRegistrations(); timer_ = new Timer() { @Override public void run() { if (!uiPrefs_.showSignatureTooltips().getGlobalValue()) return; if (coordinates_ == null && !uiPrefs_.showFunctionTooltipOnIdle().getGlobalValue()) return; resolveActiveFunctionAndDisplayToolTip(); } }; handlers_.add(docDisplay_.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { attachPreviewHandler(); } })); handlers_.add(docDisplay_.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { timer_.cancel(); toolTip_.hide(); detachPreviewHandler(); } })); handlers_.add(docDisplay_.addCursorChangedHandler(new CursorChangedHandler() { @Override public void onCursorChanged(final CursorChangedEvent event) { Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { if (anchor_ != null && toolTip_.isShowing() && !anchor_.getRange().contains(event.getPosition())) { anchor_ = null; toolTip_.hide(); } timer_.schedule(DELAY_MS); } }); } })); handlers_.add(toolTip_.addAttachHandler(new AttachEvent.Handler() { @Override public void onAttachOrDetach(AttachEvent event) { if (event.isAttached()) { } else { coordinates_ = null; position_ = null; anchor_ = null; } } })); }

Target:
public SignatureToolTipManager(DocDisplay docDisplay) { RStudioGinjector.INSTANCE.injectMembers(this); toolTip_ = new RCompletionToolTip(docDisplay); docDisplay_ = docDisplay; handlers_ = new HandlerRegistrations(); timer_ = new Timer() { @Override public void run() { if (!uiPrefs_.showSignatureTooltips().getGlobalValue()) return; if (coordinates_ == null && !uiPrefs_.showFunctionTooltipOnIdle().getGlobalValue()) return; resolveActiveFunctionAndDisplayToolTip(); } }; monitor_ = new Timer() { @Override public void run() { if (ready_) { timer_.schedule(TIMER_DELAY_MS); ready_ = false; } } }; handlers_.add(docDisplay_.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { attachPreviewHandler(); beginMonitoring(); } })); handlers_.add(docDisplay_.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { timer_.cancel(); toolTip_.hide(); detachPreviewHandler(); endMonitoring(); } })); handlers_.add(docDisplay_.addCursorChangedHandler(new CursorChangedHandler() { @Override public void onCursorChanged(final CursorChangedEvent event) { Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { if (anchor_ != null && toolTip_.isShowing() && !anchor_.getRange().contains(event.getPosition())) { anchor_ = null; toolTip_.hide(); } } }); } })); handlers_.add(toolTip_.addAttachHandler(new AttachEvent.Handler() { @Override public void onAttachOrDetach(AttachEvent event) { if (!event.isAttached()) { coordinates_ = null; position_ = null; anchor_ = null; } } })); }
Source:
protected void testDelStereotypedElementMergeLToR(Resource left, Resource right) throws IOException { final Comparison comparison = compare(left, right); final EList<Diff> differences = comparison.getDifferences(); final StereotypedElementChange stereotypedElementChange = getStereotypedElementChange(differences, DifferenceKind.DELETE, 2); assertDeletedBaseElementDiff(differences, "model.Class0", stereotypedElementChange); mergeLeftToRight(stereotypedElementChange); for (Diff diff : differences) { assertSame(DifferenceState.MERGED, diff.getState()); } assertEqualsB4Right(right); }

Target:
protected void testDelStereotypedElementMergeLToR(Resource left, Resource right) throws IOException { final Comparison comparison = compare(left, right); final EList<Diff> differences = comparison.getDifferences(); final StereotypedElementChange stereotypedElementChange = getStereotypedElementChange(differences, DifferenceKind.DELETE, 2); assertDeletedBaseElementDiff(differences, "model.Class0", stereotypedElementChange); mergeLeftToRight(stereotypedElementChange); for (Diff diff : differences) { assertSame(DifferenceState.MERGED, diff.getState()); } assertEqualsM2(right); assertEqualsM2(left); }
Source:
protected static String chooseIndexForFields(Set<String> neededFields, Map<String, Object> indexes) { String chosenIndex = null; for (String indexName: indexes.keySet()) { Map<String, Object> indexDefinition = (Map<String, Object>) indexes.get(indexName); String indexType = (String) indexDefinition.get("type"); if (indexType.equalsIgnoreCase("text")) { continue; } List<String> fieldList = (List<String>) indexDefinition.get("fields"); Set<String> providedFields = new HashSet<String>(fieldList); if (providedFields.containsAll(neededFields)) { chosenIndex = indexName; break; } } return chosenIndex; }

Target:
protected static String chooseIndexForFields(Set<String> neededFields, Map<String, Object> indexes) { String chosenIndex = null; for (String indexName: indexes.keySet()) { Map<String, Object> indexDefinition = (Map<String, Object>) indexes.get(indexName); String indexType = (String) indexDefinition.get("type"); if (indexType.equalsIgnoreCase("text")) { logger.log(Level.INFO, "Full text search is not yet supported. " + String.format("Text index %s is being ignored.", indexName)); continue; } List<String> fieldList = (List<String>) indexDefinition.get("fields"); Set<String> providedFields = new HashSet<String>(fieldList); if (providedFields.containsAll(neededFields)) { chosenIndex = indexName; break; } } return chosenIndex; }
Source:
protected OneAndOneApi create(Properties props, Iterable<Module> modules) { Injector injector = newBuilder().modules(modules).overrides(props).buildInjector(); constants = injector.getInstance(OneAndOneConstants.class); Predicate<Server> serverAvailableCheck = new Predicate<Server>() { @Override public boolean apply(Server currentServer) { Server server = api.serverApi().get(currentServer.id()); if ((server.status().state() != Types.ServerState.POWERED_OFF && server.status().state() != Types.ServerState.POWERED_ON) || server.status().percent() != 0) { return false; } else { return true; } } }; serverReady = Predicates2.retry(serverAvailableCheck, constants.pollTimeout(), constants.pollPeriod(), constants.pollMaxPeriod(), TimeUnit.SECONDS); return injector.getInstance(OneAndOneApi.class); }

Target:
protected OneAndOneApi create(Properties props, Iterable<Module> modules) { Injector injector = newBuilder().modules(modules).overrides(props).buildInjector(); constants = injector.getInstance(OneAndOneConstants.class); Predicate<Server> serverAvailableCheck = new Predicate<Server>() { @Override public boolean apply(Server currentServer) { Server server = api.serverApi().get(currentServer.id()); if ((server.status().state() != Types.ServerState.POWERED_OFF && server.status().state() != Types.ServerState.POWERED_ON) || server.status().percent() != 0) { return false; } else { return true; } } }; Predicate<ServerPrivateNetworkRef> privateNetworkAvailableCheck = new Predicate<ServerPrivateNetworkRef>() { @Override public boolean apply(ServerPrivateNetworkRef networkRef) { PrivateNetwork server = api.serverApi().getPrivateNetwork(networkRef.serverId(), networkRef.privateNetworkId()); return server.state() != Types.GenericState.ACTIVE; } }; waitUntilPrivateNetworkReady = Predicates2.retry(privateNetworkAvailableCheck, constants.pollTimeout(), constants.pollPeriod(), constants.pollMaxPeriod(), TimeUnit.SECONDS); waitUntilServerReady = Predicates2.retry(serverAvailableCheck, constants.pollTimeout(), constants.pollPeriod(), constants.pollMaxPeriod(), TimeUnit.SECONDS); return injector.getInstance(OneAndOneApi.class); }
Source:
private boolean isPubsubTrigger(Trigger trigger) { return PUBSUB_TRIGGER_TYPE.equals(trigger.getType()) && (trigger.getSubscriptionName() != null && !trigger.getSubscriptionName().isEmpty()) && (trigger.getPubsubType() != null && !trigger.getPubsubType().isEmpty()); }

Target:
private boolean isPubsubTrigger(Trigger trigger) { return PUBSUB_TRIGGER_TYPE.equals(trigger.getType()) && !StringUtils.isEmpty(trigger.getSubscriptionName()) && !StringUtils.isEmpty(trigger.getPubsubType()); }
Source:
public final Image getTitleImage() { if (isDisposed()) { return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEF_VIEW); } Image newLegacyPartImage = null; if (legacyPart != null) { newLegacyPartImage = legacyPart.getTitleImage(); } if ((newLegacyPartImage != null) && (newLegacyPartImage != legacyPartImage)) { legacyPartImage = newLegacyPartImage; setImageDescriptor(computeImageDescriptor()); } if (image == null) { image = JFaceResources.getResources().createImageWithDefault(imageDescriptor); } return image; }

Target:
public final Image getTitleImage() { if (isDisposed()) { return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEF_VIEW); } Image newLegacyPartImage = null; if (legacyPart != null) { newLegacyPartImage = legacyPart.getTitleImage(); } if (newLegacyPartImage != null && newLegacyPartImage != legacyPartImage) { legacyPartImage = newLegacyPartImage; setImageDescriptor(computeImageDescriptor()); } if (image == null) { image = JFaceResources.getResources().createImageWithDefault(imageDescriptor); } return image; }
Source:
public String[] profilesToActivate() { if (this.regexPattern != null) { return new String[] { REGEX_PATTERN_FILTER }; } else if (this.pattern != null) { return new String[] { SIMPLE_PATTERN_FILTER }; } else { return new String[] { ACCEPT_ALL_FILES }; } }

Target:
public String[] profilesToActivate() { if (this.regexPattern != null) { return new String[] { REGEX_PATTERN_FILTER }; } else if (this.pattern != null) { return new String[] { SIMPLE_PATTERN_FILTER }; } return new String[] { ACCEPT_ALL_FILES }; }
Source:
private void init() { if(eventService == null) { eventService = EventServiceFactory.getInstance().getEventService(); } if(dbConnection == null) { dbConnection = new DSpace().getSingletonService(DBConnection.class); if(dbConnection == null) { log.fatal("Cannot obtain the bean the provides a database connection, " + "check previous entries in the dspace.log to find why the db failed to initialize."); } } currentUser = null; currentLocale = I18nUtil.DEFAULTLOCALE; extraLogInfo = ""; ignoreAuth = false; specialGroups = new ArrayList<>(); authStateChangeHistory = new Stack<Boolean>(); authStateClassCallHistory = new Stack<String>(); }

Target:
private void init() { if(eventService == null) { eventService = EventServiceFactory.getInstance().getEventService(); } if(dbConnection == null) { dbConnection = new DSpace().getSingletonService(DBConnection.class); if(dbConnection == null) { log.fatal("Cannot obtain the bean which provides a database connection. " + "Check previous entries in the dspace.log to find why the db failed to initialize."); } } currentUser = null; currentLocale = I18nUtil.DEFAULTLOCALE; extraLogInfo = ""; ignoreAuth = false; specialGroups = new ArrayList<>(); authStateChangeHistory = new Stack<Boolean>(); authStateClassCallHistory = new Stack<String>(); }
Source:
private void writeUnlockPage( long page, FullPageId fullId, Boolean walPlc, boolean markDirty, boolean restore ) { boolean wasDirty = isDirty(page); if (!restore && markDirty && !wasDirty && changeTracker != null) changeTracker.apply(page, fullId, this); boolean pageWalRec = markDirty && walPlc != FALSE && (walPlc == TRUE || !wasDirty); assert PageIO.getCrc(page + PAGE_OVERHEAD) == 0; if (markDirty) setDirty(fullId, page, markDirty, false); try { beforeReleaseWrite(fullId, page + PAGE_OVERHEAD, pageWalRec); } catch (IgniteCheckedException e) { throw new IgniteException(e); } finally { long pageId = PageIO.getPageId(page + PAGE_OVERHEAD); assert pageId != 0 : U.hexLong(PageHeader.readPageId(page)); assert PageIO.getVersion(page + PAGE_OVERHEAD) != 0 : U.hexLong(pageId); assert PageIO.getType(page + PAGE_OVERHEAD) != 0 : U.hexLong(pageId); try { rwLock.writeUnlock(page + PAGE_LOCK_OFFSET, PageIdUtils.tag(pageId)); if (throttlingPlc != ThrottlingPolicy.DISABLED && !restore && markDirty && !wasDirty) writeThrottle.onMarkDirty(isInCheckpoint(fullId)); } catch (AssertionError ex) { U.error(log, "Failed to unlock page [fullPageId=" + fullId + ", binPage=" + U.toHexString(page, systemPageSize()) + ']'); throw ex; } } }

Target:
private void writeUnlockPage( long page, FullPageId fullId, Boolean walPlc, boolean markDirty, boolean restore ) { boolean wasDirty = isDirty(page); try { if (!restore && markDirty && !wasDirty && changeTracker != null) changeTracker.apply(page, fullId, this); boolean pageWalRec = markDirty && walPlc != FALSE && (walPlc == TRUE || !wasDirty); assert PageIO.getCrc(page + PAGE_OVERHEAD) == 0; if (markDirty) setDirty(fullId, page, markDirty, false); beforeReleaseWrite(fullId, page + PAGE_OVERHEAD, pageWalRec); } catch (IgniteCheckedException e) { throw new IgniteException(e); } finally { long pageId = PageIO.getPageId(page + PAGE_OVERHEAD); assert pageId != 0 : U.hexLong(PageHeader.readPageId(page)); assert PageIO.getVersion(page + PAGE_OVERHEAD) != 0 : U.hexLong(pageId); assert PageIO.getType(page + PAGE_OVERHEAD) != 0 : U.hexLong(pageId); try { rwLock.writeUnlock(page + PAGE_LOCK_OFFSET, PageIdUtils.tag(pageId)); if (throttlingPlc != ThrottlingPolicy.DISABLED && !restore && markDirty && !wasDirty) writeThrottle.onMarkDirty(isInCheckpoint(fullId)); } catch (AssertionError ex) { U.error(log, "Failed to unlock page [fullPageId=" + fullId + ", binPage=" + U.toHexString(page, systemPageSize()) + ']'); throw ex; } } }
Source:
public Adjustments getAccountAdjustments(final String accountCode, final Adjustments.AdjustmentType type,final Adjustments.AdjustmentState state) { final String url = new StringBuilder().append(Account.ACCOUNT_RESOURCE).append("/").append(accountCode).append(Adjustments.ADJUSTMENTS_RESOURCE ) .append((type != null ? "?type=" + type.getType() : "")).append((state != null ? "&state=" + state.getState() : "")).toString(); return doGET(url,Adjustments.class); }

Target:
public Adjustments getAccountAdjustments(final String accountCode, final Adjustments.AdjustmentType type,final Adjustments.AdjustmentState state) { StringBuilder sb = new StringBuilder().append(Account.ACCOUNT_RESOURCE).append("/").append(accountCode).append(Adjustments.ADJUSTMENTS_RESOURCE ); if(type != null){ sb.append("?type=").append(type.getType()); } if(state != null){ if(type != null){ sb.append("&"); }else{ sb.append("?"); } sb.append("state=").append(state.getState()); } return doGET(sb.toString(),Adjustments.class); }
Source:
private Locale parseLocaleFrom(String filename, String basename) { Locale result = null; if (filename.startsWith(basename)) { String tempfilename = filename.substring(basename.length()); filename = tempfilename; } String localespec = filename.substring(0, filename.indexOf('.')); if ("".equals(localespec)) { result = Locale.ENGLISH; } else { localespec = localespec.substring(1); result = LocaleUtility.fromSpecification(localespec); } return result; }

Target:
private Locale parseLocaleFrom(String filename, String basename) { Locale result = null; if (filename.startsWith(basename)) { String tempfilename = filename; tempfilename = tempfilename.substring(basename.length()); filename = tempfilename; } String localespec = filename.substring(0, filename.indexOf('.')); if ("".equals(localespec)) { result = Locale.ENGLISH; } else { localespec = localespec.substring(1); result = LocaleUtility.fromSpecification(localespec); } return result; }
Source:
public RowHmacCheck getRowHmacCheck() { if (rowHmacCheck.equals("enabled")) { return RowHmacCheck.ENABLED; } else if (rowHmacCheck.equals("logging")) { return RowHmacCheck.LOGGING; } return RowHmacCheck.DISABLED; }

Target:
public RowHmacCheck getRowHmacCheck() { switch (rowHmacCheck) { case "enforced": return RowHmacCheck.ENFORCED; case "logging": return RowHmacCheck.DISABLED_BUT_LOG; case "disabled": return RowHmacCheck.DISABLED; default: throw new IllegalArgumentException( String.format("%s is an invalid rowHmacCheck parameter", rowHmacCheck) ); } }
Source:
public void pack(String storageId, String repositoryId) throws IOException { String contextId = storageId + ":" + repositoryId + ":local"; logger.info("Packing index for " + contextId + " ..."); final RepositoryIndexer indexer = repositoryIndexManager.getRepositoryIndexer(contextId); if (indexer == null) { throw new NullPointerException("Unable to find RepositoryIndexer by key " + contextId + ". \nAvailable keys are " + repositoryIndexManager.getIndexes() .keySet()); } IndexingContext context = indexer.getIndexingContext(); final IndexSearcher indexSearcher = context.acquireIndexSearcher(); try { IndexPackingRequest request = new IndexPackingRequest(context, indexSearcher.getIndexReader(), new File(indexer.getRepositoryBasedir() + "/.index/local")); request.setUseTargetProperties(true); indexPacker.packIndex(request); logger.info("Index for " + storageId + ":" + repositoryId + ":local was packed successfully."); } finally { context.releaseIndexSearcher(indexSearcher); } }

Target:
public void pack(String storageId, String repositoryId) throws IOException { String contextId = storageId + ":" + repositoryId + ":" + IndexTypeEnum.LOCAL.getType(); logger.info("Packing index for " + contextId + " ..."); final RepositoryIndexer indexer = repositoryIndexManager.getRepositoryIndexer(contextId); if (indexer == null) { throw new NullPointerException("Unable to find RepositoryIndexer by key " + contextId + ". \nAvailable keys are " + repositoryIndexManager.getIndexes() .keySet()); } IndexingContext context = indexer.getIndexingContext(); final IndexSearcher indexSearcher = context.acquireIndexSearcher(); try { IndexPackingRequest request = new IndexPackingRequest(context, indexSearcher.getIndexReader(), new File(indexer.getRepositoryBasedir() + "/.index/local")); request.setUseTargetProperties(true); indexPacker.packIndex(request); logger.info("Index for " + storageId + ":" + repositoryId + ":" + IndexTypeEnum.LOCAL.getType() + " was packed successfully."); } finally { context.releaseIndexSearcher(indexSearcher); } }
Source:
public void addFinishedMission(DownloadMission downloadMission) { SQLiteDatabase database = getWritableDatabase(); ContentValues values = getValuesOfMission(Objects.requireNonNull(downloadMission, "downloadMission is null")); database.insert(FINISHED_TABLE_NAME, null, values); }

Target:
public void addFinishedMission(DownloadMission downloadMission) { ContentValues values = getValuesOfMission(Objects.requireNonNull(downloadMission)); SQLiteDatabase database = getWritableDatabase(); database.insert(FINISHED_TABLE_NAME, null, values); }
Source:
public String lineProtocol(final TimeUnit precision) { final StringBuilder sb = new StringBuilder(); sb.append(KEY_ESCAPER.escape(this.measurement)); sb.append(concatenatedTags()); sb.append(concatenateFields()); sb.append(formatedTime(precision)); return sb.toString(); }

Target:
public String lineProtocol(final TimeUnit precision) { final StringBuilder sb = CACHED_STRINGBUILDERS .get() .computeIfAbsent(this.measurement, MeasurementStringBuilder::new) .resetForUse(); concatenatedTags(sb); concatenatedFields(sb); formatedTime(sb, precision); return sb.toString(); }
Source:
public void testPollableReactiveFlow() throws Exception { this.inputChannel.send(new GenericMessage<>("1,2,3,4,5")); CountDownLatch latch = new CountDownLatch(6); Flux.from(this.pollablePublisher) .take(6) .filter(m -> m.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER)) .log("org.springframework.integration.flux2", Level.WARNING) .doOnNext(p -> latch.countDown()) .subscribe(); Future<List<Integer>> future = Executors.newSingleThreadExecutor().submit(() -> Flux.just("11,12,13") .map(v -> v.split(",")) .flatMapIterable(Arrays::asList) .map(Integer::parseInt) .<Message<Integer>>map(GenericMessage::new) .concatWith(this.pollablePublisher) .take(7) .map(Message::getPayload) .log("org.springframework.integration.flux", Level.WARNING) .collectList() .block(Duration.ofSeconds(10)) ); this.inputChannel.send(new GenericMessage<>("6,7,8,9,10")); assertTrue(latch.await(20, TimeUnit.SECONDS)); List<Integer> integers = future.get(20, TimeUnit.SECONDS); assertNotNull(integers); assertEquals(7, integers.size()); }

Target:
public void testPollableReactiveFlow() throws Exception { this.inputChannel.send(new GenericMessage<>("1,2,3,4,5")); CountDownLatch latch = new CountDownLatch(6); Flux.from(this.pollablePublisher) .take(6) .filter(m -> m.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER)) .log("org.springframework.integration.flux2", Level.WARNING) .doOnNext(p -> latch.countDown()) .subscribe(); Future<List<Integer>> future = Executors.newSingleThreadExecutor().submit(() -> Flux.just("11,12,13") .map(v -> v.split(",")) .flatMapIterable(Arrays::asList) .map(Integer::parseInt) .<Message<Integer>>map(GenericMessage<Integer>::new) .concatWith(this.pollablePublisher) .take(7) .map(Message::getPayload) .log("org.springframework.integration.flux", Level.WARNING) .collectList() .block(Duration.ofSeconds(10)) ); this.inputChannel.send(new GenericMessage<>("6,7,8,9,10")); assertTrue(latch.await(20, TimeUnit.SECONDS)); List<Integer> integers = future.get(20, TimeUnit.SECONDS); assertNotNull(integers); assertEquals(7, integers.size()); }
Source:
public CoordinatorConfig(Properties config) { _config = config; _properties = new VerifiableProperties(config); _cluster = _properties.getString(CONFIG_CLUSTER); _zkAddress = _properties.getString(CONFIG_ZK_ADDRESS); _zkSessionTimeout = _properties.getInt(CONFIG_ZK_SESSION_TIMEOUT, ZkClient.DEFAULT_SESSION_TIMEOUT); _zkConnectionTimeout = _properties.getInt(CONFIG_ZK_CONNECTION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT); _retryIntervalMs = _properties.getInt(CONFIG_RETRY_INTERVAL, 1000 ); _heartbeatPeriodMs = _properties.getLong(CONFIG_HEARTBEAT_PERIOD_MS, Duration.ofMinutes(1).toMillis()); _debounceTimerMs = _properties.getLong(CONFIG_DEBOUNCE_TIMER_MS, Duration.ofSeconds(30).toMillis()); _defaultTransportProviderName = _properties.getString(CONFIG_DEFAULT_TRANSPORT_PROVIDER, ""); _zkCleanUpOrphanConnectorTask = _properties.getBoolean(CONFIG_ZK_CLEANUP_ORPHAN_CONNECTOR_TASK, false); _zkCleanUpOrphanConnectorTaskLock = _properties.getBoolean(CONFIG_ZK_CLEANUP_ORPHAN_CONNECTOR_TASK_LOCK, false); _performPreAssignmentCleanup = _properties.getBoolean(CONFIG_PERFORM_PRE_ASSIGNMENT_CLEANUP, true); }

Target:
public CoordinatorConfig(Properties config) { _config = config; _properties = new VerifiableProperties(config); _cluster = _properties.getString(CONFIG_CLUSTER); _zkAddress = _properties.getString(CONFIG_ZK_ADDRESS); _zkSessionTimeout = _properties.getInt(CONFIG_ZK_SESSION_TIMEOUT, ZkClient.DEFAULT_SESSION_TIMEOUT); _zkConnectionTimeout = _properties.getInt(CONFIG_ZK_CONNECTION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT); _retryIntervalMs = _properties.getInt(CONFIG_RETRY_INTERVAL, 1000 ); _heartbeatPeriodMs = _properties.getLong(CONFIG_HEARTBEAT_PERIOD_MS, Duration.ofMinutes(1).toMillis()); _debounceTimerMs = _properties.getLong(CONFIG_DEBOUNCE_TIMER_MS, Duration.ofSeconds(30).toMillis()); _defaultTransportProviderName = _properties.getString(CONFIG_DEFAULT_TRANSPORT_PROVIDER, ""); _zkCleanUpOrphanConnectorTask = _properties.getBoolean(CONFIG_ZK_CLEANUP_ORPHAN_CONNECTOR_TASK, false); _zkCleanUpOrphanConnectorTaskLock = _properties.getBoolean(CONFIG_ZK_CLEANUP_ORPHAN_CONNECTOR_TASK_LOCK, false); _maxDatastreamTasksPerInstance = _properties.getInt(CONFIG_MAX_DATASTREAM_TASKS_PER_INSTANCE, 0); _performPreAssignmentCleanup = _properties.getBoolean(CONFIG_PERFORM_PRE_ASSIGNMENT_CLEANUP, false); }
Source:
protected void ExecuteVDSCommand() { SetVmStatusVDSCommandParameters parameters = getParameters(); VmDynamic vmDynamic = DbFacade.getInstance().getVmDynamicDao().get(parameters.getVmId()); vmDynamic.setstatus(parameters.getStatus()); if (parameters.getStatus().isNotRunning()) { ResourceManager.getInstance().RemoveAsyncRunningVm(parameters.getVmId()); VmStatistics vmStatistics = DbFacade.getInstance().getVmStatisticsDao().get(parameters.getVmId()); VM vm = new VM(null, vmDynamic, vmStatistics); ResourceManager.getInstance().InternalSetVmStatus(vm, parameters.getStatus()); DbFacade.getInstance().getVmStatisticsDao().update(vm.getStatisticsData()); List<VmNetworkInterface> interfaces = vm.getInterfaces(); if (interfaces != null && interfaces.size() > 0) { for (VmNetworkInterface ifc : interfaces) { VmNetworkStatistics stats = ifc.getStatistics(); DbFacade.getInstance().getVmNetworkStatisticsDao().update(stats); } } } else if (parameters.getStatus() == VMStatus.Unknown) { ResourceManager.getInstance().RemoveAsyncRunningVm(parameters.getVmId()); } DbFacade.getInstance().getVmDynamicDao().update(vmDynamic); }

Target:
protected void ExecuteVDSCommand() { SetVmStatusVDSCommandParameters parameters = getParameters(); final VMStatus status = parameters.getStatus(); if (status == null) { log.warnFormat("got request to change the status of VM whose id is {0} to null, ignoring", parameters.getVmId()); return; } VmDynamic vmDynamic = DbFacade.getInstance().getVmDynamicDao().get(parameters.getVmId()); vmDynamic.setstatus(status); if (status.isNotRunning()) { ResourceManager.getInstance().RemoveAsyncRunningVm(parameters.getVmId()); VmStatistics vmStatistics = DbFacade.getInstance().getVmStatisticsDao().get(parameters.getVmId()); VM vm = new VM(null, vmDynamic, vmStatistics); ResourceManager.getInstance().InternalSetVmStatus(vm, status); DbFacade.getInstance().getVmStatisticsDao().update(vm.getStatisticsData()); List<VmNetworkInterface> interfaces = vm.getInterfaces(); if (interfaces != null && interfaces.size() > 0) { for (VmNetworkInterface ifc : interfaces) { VmNetworkStatistics stats = ifc.getStatistics(); DbFacade.getInstance().getVmNetworkStatisticsDao().update(stats); } } } else if (status == VMStatus.Unknown) { ResourceManager.getInstance().RemoveAsyncRunningVm(parameters.getVmId()); } DbFacade.getInstance().getVmDynamicDao().update(vmDynamic); }
Source:
public boolean equals(Object other) { if (other == null || !(other instanceof Type)) { return false; } return equals((Type)other); }

Target:
public boolean equals(Object other) { if (!(other instanceof Type) || other == null) { return false; } return equals((Type)other); }
Source:
private boolean validateNames() { boolean valid = true; for (E entity : entities.getItems()) { EntityModel<String> nameEntity = validateName(entity); if (!nameEntity.getIsValid()) { valid = false; entity.setError(ConstantsManager.getInstance().getConstants().invalidName()); entity.setInvalidityReasons(nameEntity.getInvalidityReasons()); entity.setIsValid(nameEntity.getIsValid()); } } entities.getItems().stream().findFirst() .filter(e -> !e.getIsValid()) .ifPresent(e -> { entities.setSelectedItem(e); onPropertyChanged(new PropertyChangedEventArgs("InvalidVm")); }); return valid; }

Target:
private boolean validateNames() { for (E entity : entities.getItems()) { EntityModel<String> nameEntity = validateName(entity); if (!nameEntity.getIsValid()) { entity.setError(ConstantsManager.getInstance().getConstants().invalidName()); entity.setInvalidityReasons(nameEntity.getInvalidityReasons()); entity.setIsValid(nameEntity.getIsValid()); entities.setSelectedItem(entity); onPropertyChanged(new PropertyChangedEventArgs("InvalidVm")); return false; } } return true; }
Source:
protected Cache<Object, Object> createCache(String regionName) { switch ( missingCacheStrategy ) { case CREATE_WARN: LOG.missingCacheCreated( regionName ); cacheManager.createCache( regionName, new MutableConfiguration<>() ); return cacheManager.getCache( regionName ); case CREATE: cacheManager.createCache( regionName, new MutableConfiguration<>() ); return cacheManager.getCache( regionName ); case FAIL: throw new CacheException( "On-the-fly creation of JCache Cache objects is not supported [" + regionName + "]" ); default: throw new IllegalStateException( "Unsupported missing cache strategy: " + missingCacheStrategy ); } }

Target:
protected Cache<Object, Object> createCache(String regionName) { switch ( missingCacheStrategy ) { case CREATE_WARN: SecondLevelCacheLogger.INSTANCE.missingCacheCreated( regionName, ConfigSettings.MISSING_CACHE_STRATEGY, MissingCacheStrategy.CREATE.getExternalRepresentation() ); return cacheManager.createCache( regionName, new MutableConfiguration<>() ); case CREATE: return cacheManager.createCache( regionName, new MutableConfiguration<>() ); case FAIL: throw new CacheException( "On-the-fly creation of JCache Cache objects is not supported [" + regionName + "]" ); default: throw new IllegalStateException( "Unsupported missing cache strategy: " + missingCacheStrategy ); } }
Source:
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 2) { throw new OperationNotSupportedException("Percentile function has to have exactly 2 parameter, currently " + attributeExpressionExecutors.length + " parameters provided"); } try { if (attributeExpressionExecutors[1] instanceof ConstantExpressionExecutor) { percentileValue = ((Double) attributeExpressionExecutors[1].execute(null)); } else { throw new OperationNotSupportedException("Percentile value has to be a constant"); } } catch (ClassCastException c) { throw new ExecutionPlanCreationException("Percentile value should be of type double. But found " + attributeExpressionExecutors[1].getReturnType()); } if (percentileValue <= 0 || percentileValue > 100) { throw new OperationNotSupportedException("Percentile value should be in 0 < p ≤ 100 range"); } Attribute.Type type = attributeExpressionExecutors[0].getReturnType(); switch (type) { case FLOAT: percentileOutputFunctionExtension = new PercentileFunctionExtensionFloat(); break; case INT: percentileOutputFunctionExtension = new PercentileFunctionExtensionInt(); break; case LONG: percentileOutputFunctionExtension = new PercentileFunctionExtensionLong(); break; case DOUBLE: percentileOutputFunctionExtension = new PercentileFunctionExtensionDouble(); break; default: throw new OperationNotSupportedException("Percentile not supported for " + type); } }

Target:
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 2) { throw new OperationNotSupportedException("Percentile function has to have exactly 2 parameter, currently " + attributeExpressionExecutors.length + " parameters provided"); } try { if (attributeExpressionExecutors[1] instanceof ConstantExpressionExecutor) { percentileValue = ((Double) attributeExpressionExecutors[1].execute(null)); } else { throw new OperationNotSupportedException("Percentile value has to be a constant"); } } catch (ClassCastException c) { throw new ExecutionPlanCreationException("Percentile value should be of type double. But found " + attributeExpressionExecutors[1].getReturnType()); } if (percentileValue <= 0 || percentileValue > 100) { throw new OperationNotSupportedException( "Percentile value should be in 0 < p ≤ 100 range. But found " + percentileValue); } Attribute.Type type = attributeExpressionExecutors[0].getReturnType(); switch (type) { case FLOAT: percentileOutputFunctionExtension = new PercentileFunctionExtensionFloat(); break; case INT: percentileOutputFunctionExtension = new PercentileFunctionExtensionInt(); break; case LONG: percentileOutputFunctionExtension = new PercentileFunctionExtensionLong(); break; case DOUBLE: percentileOutputFunctionExtension = new PercentileFunctionExtensionDouble(); break; default: throw new OperationNotSupportedException("Percentile not supported for " + type); } }
Source:
public void removeActivity(String workspaceId) throws ServerException { EntityManager em = managerProvider.get(); WorkspaceActivity activity = em.find(WorkspaceActivity.class, workspaceId); try { if (activity != null) { em.remove(activity); em.flush(); } } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }

Target:
public void removeActivity(String workspaceId) throws ServerException { try { EntityManager em = managerProvider.get(); WorkspaceActivity activity = em.find(WorkspaceActivity.class, workspaceId); if (activity != null) { em.remove(activity); em.flush(); } } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }
Source:
public static void main(String[] args) { SingleCommand<TestMain> cmd = SingleCommand.singleCommand(TestMain.class); cmd.parse(args); ServerThread st = new ServerThread(port, serverfile); st.start(); try { Thread.sleep(2000); if (tests != null) new JavaTCPClient().run(clientfile, "localhost", port, debug, Arrays.asList(tests.split(","))); else new JavaTCPClient().run(clientfile, "localhost", port, debug, new ArrayList<>()); } catch (Exception e) { e.printStackTrace(); } }

Target:
public static void main(String[] args) { SingleCommand<TestMain> cmd = SingleCommand.singleCommand(TestMain.class); cmd.parse(args); ServerThread st = new ServerThread(port, serverfile); st.start(); st.awaitStart(); try { if (tests != null) new JavaTCPClient().run(clientfile, "localhost", port, debug, Arrays.asList(tests.split(","))); else new JavaTCPClient().run(clientfile, "localhost", port, debug, new ArrayList<>()); } catch (Exception e) { e.printStackTrace(); } if (ConsoleUtils.allPassed()) ConsoleUtils.success("ALL TESTS PASSED"); else { ConsoleUtils.failure("SOME TESTS FAILED"); System.exit(1); } }
Source:
private void startGetBlobAuthorizationFailTest(final OperationChain opChain) { Callback<GetBlobResult> callback = new TestCallback<>(opChain, false); BlobId originalId, fraudId = null; try { originalId = new BlobId(opChain.blobId, clusterMap); fraudId = BlobId.craft(originalId, originalId.getVersion(), (short) (1), (short) 1); } catch (IOException e) { Assert.fail("BlobId creation failed."); } Future<GetBlobResult> future = router.getBlob(fraudId.getID(), new GetBlobOptionsBuilder().operationType(GetBlobOptions.OperationType.All) .getOption(GetOption.Include_All) .build(), callback); TestFuture<GetBlobResult> testFuture = new TestFuture<GetBlobResult>(future, genLabel("getBlob", true), opChain) { @Override void check() throws Exception { checkExpectedRouterErrorCode(RouterErrorCode.BlobAuthorizationFailure); } }; opChain.testFutures.add(testFuture); }

Target:
private void startGetBlobAuthorizationFailTest(final OperationChain opChain) { Callback<GetBlobResult> callback = new TestCallback<>(opChain, false); BlobId originalId, fraudId; try { originalId = new BlobId(opChain.blobId, clusterMap); fraudId = BlobId.craft(originalId, originalId.getVersion(), (short) (originalId.getAccountId() + 1), (short) (originalId.getContainerId() + 1)); } catch (IOException e) { FutureResult<Void> future = new FutureResult<>(); future.done(null, e); callback.onCompletion(null, e); TestFuture<Void> testFuture = new TestFuture<Void>(future, genLabel("getBlob", true), opChain) { @Override void check() throws Exception { throw e; } }; opChain.testFutures.add(testFuture); return; } Future<GetBlobResult> future = router.getBlob(fraudId.getID(), new GetBlobOptionsBuilder().operationType(GetBlobOptions.OperationType.All) .getOption(GetOption.Include_All) .build(), callback); TestFuture<GetBlobResult> testFuture = new TestFuture<GetBlobResult>(future, genLabel("getBlob", true), opChain) { @Override void check() throws Exception { checkExpectedRouterErrorCode(RouterErrorCode.BlobAuthorizationFailure); } }; opChain.testFutures.add(testFuture); }
Source:
@Override public void stop() { if (initGuard.get()) { try { U.await(initLatch); } catch (IgniteInterruptedCheckedException e) { if (log.isDebugEnabled()) log.error("Failed waiting while initialization is completed.", e); } } else { if (initGuard.compareAndSet(false, true)) { initLatch.countDown(); if (log.isDebugEnabled()) log.debug("Semaphore wasn't initialized. Prevented further initialization."); return; } else { try { U.await(initLatch); } catch (IgniteInterruptedCheckedException e) { if (log.isDebugEnabled()) log.error("Failed waiting while initialization is completed.", e); } } } assert sync != null; sync.setBroken(true); sync.releaseShared(0); UUID nodeID = ctx.localNodeId(); onNodeRemoved(nodeID); }

Target:
@Override public void stop() { if (initGuard.get()) { try { U.await(initLatch); } catch (IgniteInterruptedCheckedException e) { if (log.isDebugEnabled()) log.error("Failed waiting while initialization is completed.", e); } } else { if (initGuard.compareAndSet(false, true)) { initLatch.countDown(); if (log.isDebugEnabled()) log.debug("Semaphore wasn't initialized. Prevented further initialization."); return; } else { try { U.await(initLatch); } catch (IgniteInterruptedCheckedException e) { if (log.isDebugEnabled()) log.error("Failed waiting while initialization is completed.", e); } } } assert sync != null; sync.setBroken(true); sync.releaseShared(0); }
Source:
private Map<String, Object>[] hashMapOfFoundSolutionsWithThresholds(Solution[] bestSols, Map<String, Object> applicMap, Topology topology, SuitableOptions cloudOffers, int numPlansToGenerate, QualityInformation requirements) { if (IS_DEBUG) { engine.checkQualityAttachedToSolutions(bestSols); } @SuppressWarnings("unchecked") Map<String, Object>[] solutions = new HashMap[numPlansToGenerate]; for (int i = 0; i < bestSols.length; i++) { Map<String, Object> baseAppMap = YAMLoptimizerParser.cloneYAML(applicMap); addSolutionToAppMap(bestSols[i], baseAppMap); if (IS_DEBUG) { log.info("Before creating reconfiguration thesholds"); } HashMap<String, ArrayList<Double>> thresholds = createReconfigurationThresholds(bestSols[i], baseAppMap, topology, cloudOffers, requirements); if (IS_DEBUG) { log.info("Before adding the reconfiguration thesholds to the map"); } YAMLoptimizerParser.AddReconfigurationThresholds(thresholds, baseAppMap); solutions[i] = baseAppMap; } return solutions; }

Target:
private Map<String, Object>[] hashMapOfFoundSolutionsWithThresholds(Solution[] bestSols, Map<String, Object> applicMap, Topology topology, SuitableOptions cloudOffers, int numPlansToGenerate, QualityInformation requirements) { if (IS_DEBUG) { engine.checkQualityAttachedToSolutions(bestSols); } @SuppressWarnings("unchecked") Map<String, Object>[] solutions = new HashMap[numPlansToGenerate]; for (int i = 0; i < bestSols.length; i++) { Map<String, Object> baseAppMap = YAMLoptimizerParser.cloneYAML(applicMap); addSolutionToAppMap(bestSols[i], baseAppMap); if (IS_DEBUG) { log.debug("Before creating reconfiguration thesholds"); } HashMap<String, ArrayList<Double>> thresholds = createReconfigurationThresholds(bestSols[i], baseAppMap, topology, cloudOffers, requirements); if (IS_DEBUG) { log.debug("Before adding the reconfiguration thesholds to the map"); } YAMLoptimizerParser.addReconfigurationThresholds(thresholds, baseAppMap); solutions[i] = baseAppMap; } return solutions; }
Source:
public static Map<List<String>, RichColumnDescriptor> getDescriptors(MessageType fileSchema, MessageType requestedSchema, Map<parquet.schema.Type, HiveColumnHandle> typeColumns) { Map<List<String>, RichColumnDescriptor> descriptorsByPath = new HashMap<>(); List<PrimitiveColumnIO> columns = getColumns(fileSchema, requestedSchema); for (String[] paths : fileSchema.getPaths()) { List<String> columnPath = Arrays.asList(paths); HiveColumnHandle hiveColumnHandle = typeColumns.get(fileSchema.getType(paths)); getDescriptor(columns, columnPath, hiveColumnHandle) .ifPresent(richColumnDescriptor -> { descriptorsByPath.put(columnPath, richColumnDescriptor); }); } return descriptorsByPath; }

Target:
public static Map<List<String>, RichColumnDescriptor> getDescriptors( MessageType fileSchema, MessageType requestedSchema, Map<parquet.schema.Type, HiveColumnHandle> typeColumns) { Map<List<String>, RichColumnDescriptor> descriptorsByPath = new HashMap<>(); List<PrimitiveColumnIO> columns = getColumns(fileSchema, requestedSchema); for (String[] paths : fileSchema.getPaths()) { List<String> columnPath = Arrays.asList(paths); HiveColumnHandle hiveColumnHandle = typeColumns.get(fileSchema.getType(paths)); Optional<RichColumnDescriptor> richColumnDescriptor = getDescriptor(columns, columnPath, hiveColumnHandle); richColumnDescriptor.ifPresent(descriptor -> descriptorsByPath.put(columnPath, descriptor)); } return descriptorsByPath; }
Source:
public static Request handleRequest(final Request req, final MultiConnectionManager internalConnections) { final String sessionInfo = req.getSessionInfo(); try { final ByteString result = handleSubmission(req); final Request.Builder build = Request.newBuilder(req); build.setResponseText("Submission Succesful!"); build.clearOtherData(); LOG.info("Session Info: {}", sessionInfo); if (result != null) { final Data.DataSend send = Data.DataSend.newBuilder().addItems(Data.ItemSend.newBuilder().setData(result). setQuery(Data.ItemQuery.EXPERIMENT)).build(); final Request.Builder databaseRequest = Request.newBuilder(req); databaseRequest.setRequestType(Request.MessageType.DATA_INSERT); databaseRequest.setOtherData(send.toByteString()); LOG.info("Sending experiment data to database server"); internalConnections.send(databaseRequest.build(), "", DataClientWebSocket.class); } return build.build(); } catch (SubmissionException e) { final Message.ProtoException protoEx = ExceptionUtilities.createProtoException(e); final Request.Builder build = Request.newBuilder(); build.setRequestType(Request.MessageType.ERROR); if (e.getMessage() != null) { build.setResponseText(e.getMessage()); } build.setSessionInfo(sessionInfo); build.setOtherData(protoEx.toByteString()); LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); return build.build(); } catch (ConnectionException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); } return null; }

Target:
public static Request handleRequest(final Request req, final MultiConnectionManager internalConnections) { final String sessionInfo = req.getSessionInfo(); try { final ByteString result = handleSubmission(req); final Request.Builder build = Request.newBuilder(req); build.setResponseText("Submission Succesful!"); build.clearOtherData(); LOG.info("Session Info: {}", sessionInfo); if (result != null) { final Data.DataSend send = Data.DataSend.newBuilder().addItems(Data.ItemSend.newBuilder().setData(result). setQuery(Data.ItemQuery.EXPERIMENT)).build(); final Request.Builder databaseRequest = Request.newBuilder(req); databaseRequest.setRequestType(Request.MessageType.DATA_INSERT); databaseRequest.setOtherData(send.toByteString()); LOG.info("Sending experiment data to database server"); internalConnections.send(databaseRequest.build(), "", DataClientWebSocket.class); } return build.build(); } catch (SubmissionException e) { final Message.ProtoException protoEx = ExceptionUtilities.createProtoException(e); final Request build = ExceptionUtilities.createExceptionRequest(protoEx, req); LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); return build; } catch (ConnectionException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); } return null; }
Source:
public String toString() { return "DocumentReplication {" + "replicator=" + replicator + ", is pushing =" + pushing + ", document id =" + docId + ", revision id =" + revId + ", error code =" + error.getCode()+ ", error domain=" + error.getDomain() + ", is transient=" + trans + ", flags =" + flags + ", doc is deleted =" + isDeleted + '}'; }

Target:
public String toString() { return "DocumentReplication {" + "replicator=" + replicator + ", is pushing =" + pushing + ", document id =" + docId + ", error code =" + error.getCode()+ ", error domain=" + error.getDomain() + ", doc is deleted =" + isDeleted + '}'; }