auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void maybeThrottle(double observed) throws InterruptedException { synchronized (lock) { observedSoFar += observed; long now = time.nanoseconds(); long elapsedNs = now - periodStartNs; if ((checkIntervalMs < 0 || elapsedNs > checkIntervalMs * Time.NsPerMs) && observedSoFar > 0) { double rateInSecs = elapsedNs > 0 ? (observedSoFar * Time.NsPerSec) / elapsedNs : Double.MAX_VALUE; boolean needAdjustment = !(throttleDown ^ (rateInSecs > desiredRatePerSec)); if (needAdjustment) { double desiredRateMs = desiredRatePerSec / Time.MsPerSec; double elapsedMs = elapsedNs / Time.NsPerMs; long sleepTime = Math.round(observedSoFar / desiredRateMs - elapsedMs); if (sleepTime > 0) { logger.trace("Natural rate is per second but desired rate is {}, sleeping for ms to compensate.", rateInSecs, desiredRatePerSec, sleepTime); synchronized (waitGuard) { if (enabled) { time.wait(waitGuard, sleepTime); } } } } periodStartNs = now; observedSoFar = 0; } } }

Target:
public void maybeThrottle(double observed) throws InterruptedException { synchronized (lock) { observedSoFar += observed; long now = time.nanoseconds(); long elapsedNs = now - periodStartNs; if ((checkIntervalMs < 0 || elapsedNs > checkIntervalMs * Time.NsPerMs) && observedSoFar > 0) { double rateInSecs = elapsedNs > 0 ? (observedSoFar * Time.NsPerSec) / elapsedNs : Double.MAX_VALUE; if (throttleDown == rateInSecs > desiredRatePerSec) { double desiredRateMs = desiredRatePerSec / Time.MsPerSec; double elapsedMs = elapsedNs / Time.NsPerMs; long sleepTime = Math.round(observedSoFar / desiredRateMs - elapsedMs); if (sleepTime > 0) { logger.trace("Natural rate is per second but desired rate is {}, sleeping for ms to compensate.", rateInSecs, desiredRatePerSec, sleepTime); synchronized (waitGuard) { if (enabled) { time.wait(waitGuard, sleepTime); } } } } periodStartNs = now; observedSoFar = 0; } } }
Source:
private Constructor<? extends Response<?>> locateResponseConstructor(Class<?> responseClass) { Constructor<?>[] constructors = responseClass.getDeclaredConstructors(); Arrays.sort(constructors, Comparator.comparing(Constructor::getParameterCount, (a, b) -> b - a)); for (Constructor<?> constructor : constructors) { final int paramCount = constructor.getParameterCount(); if (paramCount >= 3 && paramCount <= 5) { try { return (Constructor<? extends Response<?>>) constructor; } catch (Throwable t) { throw logger.logExceptionAsError(new RuntimeException("Failed to cast the constructor to Response." + "Error Details: " + t.getMessage(), t)); } } } return null; }

Target:
private Constructor<? extends Response<?>> locateResponseConstructor(Class<?> responseClass) { Constructor<?>[] constructors = responseClass.getDeclaredConstructors(); Arrays.sort(constructors, Comparator.comparing(Constructor::getParameterCount, (a, b) -> b - a)); for (Constructor<?> constructor : constructors) { final int paramCount = constructor.getParameterCount(); if (paramCount >= 3 && paramCount <= 5) { try { return (Constructor<? extends Response<?>>) constructor; } catch (Throwable t) { throw logger.logExceptionAsError(new RuntimeException(t)); } } } return null; }
Source:
private void doOpen() throws IOException { try { if (invalid) throw new PackInvalidException(getPackFile()); synchronized (readLock) { fd = new RandomAccessFile(getPackFile(), "r"); length = fd.length(); onOpenPack(); } } catch (InterruptedIOException e) { openFail(false); throw e; } catch (FileNotFoundException fn) { openFail(!packFile.exists()); throw fn; } catch (EOFException | AccessDeniedException | NoSuchFileException | CorruptObjectException | NoPackSignatureException | PackMismatchException | UnpackException | UnsupportedPackIndexVersionException | UnsupportedPackVersionException pe) { openFail(true); throw pe; } catch (IOException | RuntimeException ge) { openFail(false); throw ge; } }

Target:
private void doOpen() throws IOException { try { if (invalid) throw new PackInvalidException(packFileName); synchronized (readLock) { fd = new RandomAccessFile(packFileName, "r"); length = fd.length(); onOpenPack(); } } catch (InterruptedIOException e) { openFail(false); throw e; } catch (FileNotFoundException fn) { openFail(!packFileName.exists()); throw fn; } catch (EOFException | AccessDeniedException | NoSuchFileException | CorruptObjectException | NoPackSignatureException | PackMismatchException | UnpackException | UnsupportedPackIndexVersionException | UnsupportedPackVersionException pe) { openFail(true); throw pe; } catch (IOException | RuntimeException ge) { openFail(false); throw ge; } }
Source:
public static String getDescription(Group group) { Extension extension = group.getExtensionsByUrl(ExtensionsUtil.DESCRIPTION_URL).get(0); return extension.getValue().toString(); }

Target:
public static String getDescription(Group group) { Extension extension = group.getExtensionsByUrl(ExtensionsUtil.DESCRIPTION_URL).get(FIRST); return extension.getValue().toString(); }
Source:
private Method retrieveMethod(String name) { Method method; try { method = os.getClass().getDeclaredMethod(name); method.setAccessible(true); } catch (NoSuchMethodException e) { LOG.debug("No such method exists:", e); method = null; } return method; }

Target:
private Method retrieveMethod(String name) { try { final Method method = os.getClass().getDeclaredMethod(name); method.setAccessible(true); return method; } catch (NoSuchMethodException e) { LOG.error("No such method exists:", e); return null; } }
Source:
void remove() { for (String filename : localFilesDirectory.contents()) { if (!v2DatabaseFiles.databaseContents().contains(filename)) { localFilesDirectory.deleteFile(filename); } } }

Target:
void remove() { List<DownloadsFilePersisted> filesInV2Database = downloadsPersistence.loadAllFiles(); List<String> databaseFileNames = new ArrayList<>(); for (DownloadsFilePersisted filePersisted : filesInV2Database) { databaseFileNames.add(filePersisted.fileName().name()); } for (String localFile : localFilesDirectory.contents()) { if (!databaseFileNames.contains(localFile)) { localFilesDirectory.deleteFile(localFile); } } }
Source:
public ChannelFuture register(Channel channel) { EventExecutor eventExecutor = eventExecutorChooser.apply(channel, iterator()); return eventExecutor != null ? ((EventLoop) eventExecutor).register(channel) : super.register(channel); }

Target:
public ChannelFuture register(Channel channel) { EventLoop eventExecutor = eventLoopChooser.apply(channel, iterator()); return eventExecutor != null ? eventExecutor.register(channel) : super.register(channel); }
Source:
public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = super.getJobMessageProperties(); jobProperties.put(VdcObjectType.StoragePool.name().toLowerCase(), (getStoragePoolName() == null) ? "" : getStoragePoolName()); jobProperties.put(VdcObjectType.VDS.name().toLowerCase(), (getVdsName() == null) ? "" : getVdsName()); } return jobProperties; }

Target:
public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = super.getJobMessageProperties(); jobProperties.put(VdcObjectType.StoragePool.name().toLowerCase(), getStoragePoolName()); jobProperties.put(VdcObjectType.VDS.name().toLowerCase(), getVdsName()); } return jobProperties; }
Source:
TakeoverInAppNotification(JSONObject description) throws BadDecideObjectException { super(description); try { JSONArray buttonsArray = description.getJSONArray("buttons"); ArrayList<InAppButton> tempButtons = new ArrayList<>(); for (int i = 0; i < buttonsArray.length(); i++) { JSONObject buttonJson = (JSONObject) buttonsArray.get(i); tempButtons.add(new InAppButton(buttonJson)); } mButtons = tempButtons; mCloseButtonColor = description.getInt("close_color"); mTitle = JSONUtils.optionalStringKey(description, "title"); mTitleColor = description.optInt("title_color"); mShouldFadeImage = getExtras().getBoolean("image_fade"); } catch (final JSONException e) { throw new BadDecideObjectException("Notification JSON was unexpected or bad", e); } }

Target:
TakeoverInAppNotification(JSONObject description) throws BadDecideObjectException { super(description); try { JSONArray buttonsArray = description.getJSONArray("buttons"); mButtons = new ArrayList<>(); for (int i = 0; i < buttonsArray.length(); i++) { JSONObject buttonJson = (JSONObject) buttonsArray.get(i); mButtons.add(new InAppButton(buttonJson)); } mCloseButtonColor = description.getInt("close_color"); mTitle = JSONUtils.optionalStringKey(description, "title"); mTitleColor = description.optInt("title_color"); mShouldFadeImage = getExtras().getBoolean("image_fade"); } catch (final JSONException e) { throw new BadDecideObjectException("Notification JSON was unexpected or bad", e); } }
Source:
public void validate() { if (connectionFactory != null) { connectionFactory.validate(); } if (attributes.attribute(MANAGE_CONNECTION_FACTORY).get() && (connectionFactory == null || connectionFactory.needsManaging())) { table.validate(); } super.validate(); }

Target:
public void validate() { table.validate(); super.validate(); }
Source:
public Promise<Factory> getFactoryJson(String workspaceId, String path) { path = path == null ? "" : path; return asyncRequestFactory.createGetRequest(API_FACTORY_BASE_URL + "workspace/" + workspaceId + path) .header(HTTPHeader.ACCEPT, MimeType.APPLICATION_JSON) .loader(loader, "Getting info about factory...") .send(unmarshallerFactory.newUnmarshaller(Factory.class)); }

Target:
public Promise<Factory> getFactoryJson(String workspaceId, String path) { String url = API_FACTORY_BASE_URL + "workspace/" + workspaceId; if (path != null) { url += path; } return asyncRequestFactory.createGetRequest(url) .header(HTTPHeader.ACCEPT, MimeType.APPLICATION_JSON) .loader(loader, "Getting info about factory...") .send(unmarshallerFactory.newUnmarshaller(Factory.class)); }
Source:
public void executeCommand(final CommandSender sender, List<String> arguments) { final String playerName = arguments.get(0); final String playerPass = arguments.get(1); final String playerNameLowerCase = playerName.toLowerCase(); ValidationResult passwordValidation = validationService.validatePassword(playerPass, playerName); if (passwordValidation.hasError()) { commonService.send(sender, passwordValidation.getMessageKey(), passwordValidation.getArgs()); return; } bukkitService.runTaskOptionallyAsync(() -> { if (dataSource.isAuthAvailable(playerNameLowerCase)) { commonService.send(sender, MessageKey.NAME_ALREADY_REGISTERED); return; } HashedPassword hashedPassword = passwordSecurity.computeHash(playerPass, playerNameLowerCase); PlayerAuth auth = PlayerAuth.builder() .name(playerNameLowerCase) .realName(playerName) .password(hashedPassword) .build(); if (!dataSource.saveAuth(auth)) { commonService.send(sender, MessageKey.ERROR); return; } dataSource.setUnlogged(playerNameLowerCase); dataSource.revokeSession(playerNameLowerCase); commonService.send(sender, MessageKey.REGISTER_SUCCESS); ConsoleLogger.info(sender.getName() + " registered " + playerName); final Player player = bukkitService.getPlayerExact(playerName); if (player != null) { bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> player.kickPlayer(commonService.retrieveSingleMessage(MessageKey.KICK_FOR_ADMIN_REGISTER))); } }); }

Target:
public void executeCommand(final CommandSender sender, List<String> arguments) { final String playerName = arguments.get(0); final String playerPass = arguments.get(1); final String playerNameLowerCase = playerName.toLowerCase(); ValidationResult passwordValidation = validationService.validatePassword(playerPass, playerName); if (passwordValidation.hasError()) { commonService.send(sender, passwordValidation.getMessageKey(), passwordValidation.getArgs()); return; } bukkitService.runTaskOptionallyAsync(() -> { if (dataSource.isAuthAvailable(playerNameLowerCase)) { commonService.send(sender, MessageKey.NAME_ALREADY_REGISTERED); return; } HashedPassword hashedPassword = passwordSecurity.computeHash(playerPass, playerNameLowerCase); PlayerAuth auth = PlayerAuth.builder() .name(playerNameLowerCase) .realName(playerName) .password(hashedPassword) .build(); if (!dataSource.saveAuth(auth)) { commonService.send(sender, MessageKey.ERROR); return; } commonService.send(sender, MessageKey.REGISTER_SUCCESS); ConsoleLogger.info(sender.getName() + " registered " + playerName); final Player player = bukkitService.getPlayerExact(playerName); if (player != null) { bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> player.kickPlayer(commonService.retrieveSingleMessage(MessageKey.KICK_FOR_ADMIN_REGISTER))); } }); }
Source:
public synchronized double getUpdateFailureRatio() { long updateCounter = this.updateCounter; long updateAttemptCounter = this.updateAttemptCounter; MVMap.RootReference rootReference = meta.getRoot(); updateCounter += rootReference.updateCounter; updateAttemptCounter += rootReference.updateAttemptCounter; for (MVMap<?, ?> map : maps.values()) { MVMap.RootReference root = map.getRoot(); updateCounter += root.updateCounter; updateAttemptCounter += root.updateAttemptCounter; } return updateAttemptCounter == 0 ? 0 : 1 - ((double)updateCounter / updateAttemptCounter); }

Target:
public double getUpdateFailureRatio() { long updateCounter = this.updateCounter; long updateAttemptCounter = this.updateAttemptCounter; MVMap.RootReference rootReference = meta.getRoot(); updateCounter += rootReference.updateCounter; updateAttemptCounter += rootReference.updateAttemptCounter; for (MVMap<?, ?> map : maps.values()) { MVMap.RootReference root = map.getRoot(); updateCounter += root.updateCounter; updateAttemptCounter += root.updateAttemptCounter; } return updateAttemptCounter == 0 ? 0 : 1 - ((double)updateCounter / updateAttemptCounter); }
Source:
public String getShortBranch(Repository repository) throws IOException { Ref head = repository.getRef(Constants.HEAD); if (head == null || head.getObjectId() == null) return CoreText.RepositoryUtil_noHead; if (head.isSymbolic()) return repository.getBranch(); String fullBranch = repository.getFullBranch(); String refString = mapCommitToRef(repository, fullBranch, false); if (refString != null) return Repository.shortenRefName(refString) + ' ' + fullBranch.substring(0, 7); else return fullBranch.substring(0, 7); }

Target:
public String getShortBranch(Repository repository) throws IOException { Ref head = repository.getRef(Constants.HEAD); if (head == null || head.getObjectId() == null) return CoreText.RepositoryUtil_noHead; if (head.isSymbolic()) return repository.getBranch(); String id = head.getObjectId().name(); String ref = mapCommitToRef(repository, id, false); if (ref != null) return Repository.shortenRefName(ref) + ' ' + id.substring(0, 7); else return id.substring(0, 7); }
Source:
public void extractResponseDetails(FeedbackQuestionType questionType, FeedbackQuestionDetails questionDetails, String[] answer) { String rawResponses = answer[0]; FeedbackRubricQuestionDetails fqd = (FeedbackRubricQuestionDetails) questionDetails; initializeEmptyAnswerList(fqd.numOfRubricSubQuestions); String[] subQuestionResponses = rawResponses.split(Pattern.quote(",")); for (int i=0 ; i<subQuestionResponses.length ; i++) { String[] subQuestionIndexAndChoice = subQuestionResponses[i].split(Pattern.quote("-")); if (subQuestionIndexAndChoice.length == 2) { try { int subQuestionIndex = Integer.parseInt(subQuestionIndexAndChoice[0]); int subQuestionChoice = Integer.parseInt(subQuestionIndexAndChoice[1]); if (subQuestionIndex >=0 && subQuestionIndex <fqd.numOfRubricSubQuestions && subQuestionChoice >=0 && subQuestionChoice <fqd.numOfRubricChoices) { setAnswer(subQuestionIndex, subQuestionChoice); } } catch (NumberFormatException e) { } } else { } } }

Target:
public void extractResponseDetails(FeedbackQuestionType questionType, FeedbackQuestionDetails questionDetails, String[] answer) { String rawResponses = answer[0]; FeedbackRubricQuestionDetails fqd = (FeedbackRubricQuestionDetails) questionDetails; initializeEmptyAnswerList(fqd.numOfRubricSubQuestions); String[] subQuestionResponses = rawResponses.split(Pattern.quote(",")); for (int i=0 ; i<subQuestionResponses.length ; i++) { String[] subQuestionIndexAndChoice = subQuestionResponses[i].split(Pattern.quote("-")); if (subQuestionIndexAndChoice.length != 2) { continue; } try { int subQuestionIndex = Integer.parseInt(subQuestionIndexAndChoice[0]); int subQuestionChoice = Integer.parseInt(subQuestionIndexAndChoice[1]); if (subQuestionIndex >=0 && subQuestionIndex <fqd.numOfRubricSubQuestions && subQuestionChoice >=0 && subQuestionChoice <fqd.numOfRubricChoices) { setAnswer(subQuestionIndex, subQuestionChoice); } } catch (NumberFormatException e) { } } }
Source:
public void dispose() { if (fRegisterInProvider) { unregisterActions(); } fSelectionProvider = null; fFindDeclarationsAction = null; fFindDeclarationsInProjectAction = null; fFindDeclarationsInHierarchyAction = null; fFindDeclarationsInWorkingSetAction = null; updateGlobalActionHandlers(); super.dispose(); }

Target:
public void dispose() { unregisterActions(); fSelectionProvider = null; fFindDeclarationsAction = null; fFindDeclarationsInProjectAction = null; fFindDeclarationsInHierarchyAction = null; fFindDeclarationsInWorkingSetAction = null; updateGlobalActionHandlers(); super.dispose(); }
Source:
public Optional<Long> getColumn1(String component1) { SchemaApiTestTable.SchemaApiTestRow row = SchemaApiTestTable.SchemaApiTestRow.of(component1); byte[] bytes = row.persistToBytes(); ColumnSelection colSelection = ColumnSelection.create(Collections.singletonList(PtBytes.toCachedBytes("c"))); RowResult<byte[]> rowResult = t.getRows(tableRef, ImmutableSet.of(bytes), colSelection).get(bytes); if (rowResult == null) { return Optional.empty(); } else { return Optional.of(SchemaApiTestTable.SchemaApiTestRowResult.of(rowResult).getColumn1()); } }

Target:
public Optional<Long> getColumn1(String component1) { SchemaApiTestTable.SchemaApiTestRow row = SchemaApiTestTable.SchemaApiTestRow.of(component1); byte[] bytes = row.persistToBytes(); ColumnSelection colSelection = ColumnSelection.create(ImmutableList.of(PtBytes.toCachedBytes("c"))); RowResult<byte[]> rowResult = t.getRows(tableRef, ImmutableSet.of(bytes), colSelection).get(bytes); if (rowResult == null) { return Optional.empty(); } else { return Optional.of(SchemaApiTestTable.SchemaApiTestRowResult.of(rowResult).getColumn1()); } }
Source:
protected void createFieldEditors() { final Composite pane = getFieldEditorParent(); Label explanation = new Label(pane, SWT.LEFT | SWT.WRAP); explanation.setText(UIText.HistoryColumnsPreferencePage_explanation); GridData layout = new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1); layout.widthHint = 200; explanation.setLayoutData(layout); addField(new BooleanFieldEditor(UIPreferences.HISTORY_COLUMN_ID, UIText.CommitGraphTable_CommitId, pane)); addField(new BooleanFieldEditor(UIPreferences.HISTORY_COLUMN_AUTHOR, UIText.HistoryPage_authorColumn, pane)); addField( new BooleanFieldEditor(UIPreferences.HISTORY_COLUMN_AUTHOR_DATE, UIText.HistoryPage_authorDateColumn, pane)); addField(new BooleanFieldEditor(UIPreferences.HISTORY_COLUMN_COMMITTER, UIText.CommitGraphTable_Committer, pane)); addField(new BooleanFieldEditor( UIPreferences.HISTORY_COLUMN_COMMITTER_DATE, UIText.CommitGraphTable_committerDateColumn, pane)); }

Target:
protected void createFieldEditors() { final Composite pane = getFieldEditorParent(); addField(new BooleanFieldEditor(UIPreferences.HISTORY_COLUMN_ID, UIText.CommitGraphTable_CommitId, pane)); addField(new BooleanFieldEditor(UIPreferences.HISTORY_COLUMN_AUTHOR, UIText.HistoryPage_authorColumn, pane)); addField( new BooleanFieldEditor(UIPreferences.HISTORY_COLUMN_AUTHOR_DATE, UIText.HistoryPage_authorDateColumn, pane)); addField(new BooleanFieldEditor(UIPreferences.HISTORY_COLUMN_COMMITTER, UIText.CommitGraphTable_Committer, pane)); addField(new BooleanFieldEditor( UIPreferences.HISTORY_COLUMN_COMMITTER_DATE, UIText.CommitGraphTable_committerDateColumn, pane)); }
Source:
private Map<Client, PaxosLong> handleCacheMiss(Set<Client> requestedClients) { cacheKey = null; Set<Client> allClients = ImmutableSet.<Client>builder() .addAll(requestedClients) .addAll(cachedEntries.keySet()) .build(); cachedEntries.clear(); try { return unsafeGetLatest(allClients); } catch (InvalidAcceptorCacheKeyException e) { log.warn(""); throw new RuntimeException(e); } }

Target:
private Map<Client, PaxosLong> handleCacheMiss(Set<Client> requestedClients) { cacheKey = null; Set<Client> allClients = ImmutableSet.<Client>builder() .addAll(requestedClients) .addAll(cachedEntries.keySet()) .build(); cachedEntries.clear(); try { return unsafeGetLatest(allClients); } catch (InvalidAcceptorCacheKeyException e) { log.warn("Empty cache key is still invalid indicates product bug, failing request."); throw new RuntimeException(e); } }
Source:
public void nonCanonicalPath() { SurefireLauncher unpacked = unpack( "/surefire-1602" ); unpacked .executeInstall(); unpacked .addGoal( "--file" ) .addGoal( "./integration-tests/pom.xml" ) .executeTest(); }

Target:
public void nonCanonicalPath() throws Exception { SurefireLauncher launcher = unpack( "/surefire-1602" ); launcher .executeInstall(); launcher .addGoal( "--file" ) .addGoal( "./integration-tests/pom.xml" ) .executeTest(); launcher .getSubProjectValidator( "integration-tests" ) .assertTestSuiteResults( 1, 0, 0, 0 ); }
Source:
protected void log(final LogLevel level, final QueryNode node, final String log) { if (level == LogLevel.ERROR || level == LogLevel.WARN) { if (cacheable.get()) { cacheable.set(false); } } if (level.ordinal() > query.getLogLevel().ordinal()) { return; } final StringBuilder buf = new StringBuilder(15 + 6 + 32 + log.length()) .append(TS_FORMATTER.format(Instant.now())) .append(" ") .append(level) .append(" CTX:") .append(System.identityHashCode(this)) .append(" Q:"); if (node == null) { if (query == null) { buf.append("na"); } else { buf.append(query.buildHashCode().asLong()); } } else { if (node.pipelineContext() == null || node.pipelineContext().query() == null) { buf.append("na"); } else { buf.append(node.pipelineContext().query().buildHashCode().asLong()); } } buf.append(" [") .append(node == null ? "None" : node.config().getId()) .append("] - ") .append(log); synchronized (this) { if (logs == null) { logs = Lists.newArrayList(); } logs.add(buf.toString()); } }

Target:
protected void log(final LogLevel level, final QueryNode node, final String log) { if (level == LogLevel.ERROR || level == LogLevel.WARN) { if (cacheable.get()) { cacheable.set(false); } } if (level.ordinal() > query.getLogLevel().ordinal()) { return; } final StringBuilder buf = new StringBuilder(15 + 6 + 14 + 29 + 32 + log.length()) .append(TS_FORMATTER.format(Instant.now())) .append(" ") .append(level) .append(" CTX:") .append(System.identityHashCode(this)) .append(" Q:"); if (node == null) { if (query == null) { buf.append("na"); } else { buf.append(query.buildHashCode().asLong()); } } else { if (node.pipelineContext() == null || node.pipelineContext().query() == null) { buf.append("na"); } else { buf.append(node.pipelineContext().query().buildHashCode().asLong()); } } buf.append(" [") .append(node == null ? "None" : node.config().getId()) .append("] - ") .append(log); synchronized (this) { if (logs == null) { logs = Lists.newArrayList(); } logs.add(buf.toString()); } }
Source:
protected void log(Site site, int rate, Object... params) { if (!app.isEventLoggingEnabled()) { return; } if (rate != 0) { boolean chosen = app.getABTestingID() % rate == 0; if (chosen) { JSONObject eventData = new JSONObject(); String logString = this.getClass().getSimpleName() + ": Sending event"; try { for (int i = 0; i < params.length; i += 2) { eventData.put(params[i].toString(), params[i + 1]); logString += ", event_" + params[i] + " = " + params[i + 1]; } Log.d(ANALYTICS_TAG, logString); } catch (JSONException e) { throw new RuntimeException(e); } new EventLoggingEvent( schemaName, revision, Utils.getDBNameForSite(site), app.getUserAgent(), preprocessData(eventData) ).log(); } } }

Target:
protected void log(Site site, int rate, Object... params) { if (!app.isEventLoggingEnabled()) { return; } if (rate != 0) { boolean chosen = app.getFeatureFlagID() % rate == 0; if (chosen) { JSONObject eventData = new JSONObject(); String logString = this.getClass().getSimpleName() + ": Sending event"; try { for (int i = 0; i < params.length; i += 2) { eventData.put(params[i].toString(), params[i + 1]); logString += ", event_" + params[i] + " = " + params[i + 1]; } Log.d(ANALYTICS_TAG, logString); } catch (JSONException e) { throw new RuntimeException(e); } new EventLoggingEvent( schemaName, revision, Utils.getDBNameForSite(site), app.getUserAgent(), preprocessData(eventData) ).log(); } } }
Source:
public void showJob(Job job) { name_.setText(job.name); progress_.setLabel(job.name); String status = JobConstants.stateDescription(job.state); stop_.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { eventBus_.fireEvent(new JobExecuteActionEvent(job.id, JobConstants.ACTION_STOP)); } }); if (job.completed > 0) { progress_.setVisible(false); status += " " + StringUtil.friendlyDateTime(new Date(job.completed * 1000)); elapsed_.setText(StringUtil.conciseElaspedTime(job.completed - job.started)); status_.setVisible(true); stop_.setVisible(false); } else if (job.max > 0) { progress_.setVisible(true); progress_.setProgress(job.progress, job.max); status_.setVisible(false); stop_.setVisible(true); } else { progress_.setVisible(false); status_.setVisible(true); stop_.setVisible(true); if (!StringUtil.isNullOrEmpty(job.status)) { status = job.status; } } status_.setText(status); jobProgress_ = new LocalJobProgress(job); complete_ = job.completed > 0; }

Target:
public void showJob(Job job) { name_.setText(job.name); progress_.setLabel(job.name); String status = JobConstants.stateDescription(job.state); stop_.addClickHandler(clickEvent -> eventBus_.fireEvent(new JobExecuteActionEvent(job.id, JobConstants.ACTION_STOP))); if (job.completed > 0) { progress_.setVisible(false); status += " " + StringUtil.friendlyDateTime(new Date(job.completed * 1000)); elapsed_.setText(StringUtil.conciseElaspedTime(job.completed - job.started)); status_.setVisible(true); } else if (job.max > 0) { progress_.setVisible(true); progress_.setProgress(job.progress, job.max); status_.setVisible(false); } else { progress_.setVisible(false); status_.setVisible(true); if (!StringUtil.isNullOrEmpty(job.status)) { status = job.status; } } if (job.completed == 0) stop_.setVisible(JsArrayUtil.jsArrayStringContains(job.actions, JobConstants.ACTION_STOP)); else stop_.setVisible(false); status_.setText(status); jobProgress_ = new LocalJobProgress(job); complete_ = job.completed > 0; }
Source:
public void unload() { super.unload(); ExtensionSpider spider = Control.getSingleton().getExtensionLoader().getExtension(ExtensionSpider.class); if (spider != null) { spider.removeCustomParseFilter(graphQlParseFilter); spider.removeCustomParser(graphQlSpider); LOG.debug("Removed GraphQl spider."); } }

Target:
public void unload() { super.unload(); if (!"2.9.0".equals(Constant.PROGRAM_VERSION)) { ExtensionSpider spider = Control.getSingleton().getExtensionLoader().getExtension(ExtensionSpider.class); if (spider != null) { spider.removeCustomParseFilter(graphQlParseFilter); spider.removeCustomParser(graphQlSpider); LOG.debug("Removed GraphQl spider."); } } }
Source:
private void addAffinityLabels() { List<Label> affinityLabels = getParameters().getAffinityLabels(); if (affinityLabels == null) { affinityLabels = Collections.emptyList(); } List<Guid> labelIds = affinityLabels.stream() .map(Label::getId) .collect(Collectors.toList()); labelDao.addVmToLabels(getVmId(), labelIds); }

Target:
private void addAffinityLabels() { List<Label> affinityLabels = getParameters().getAffinityLabels(); if (affinityLabels == null) { return; } List<Guid> labelIds = affinityLabels.stream() .map(Label::getId) .collect(Collectors.toList()); labelDao.addVmToLabels(getVmId(), labelIds); }
Source:
public ActionResult execute() { String recoveryEmailAddress = getNonNullRequestParamValue(Const.ParamsNames.SESSION_LINKS_RECOVERY_EMAIL); boolean hasStudentsWithRecoveryEmail = !logic.getAllStudentForEmail(recoveryEmailAddress).isEmpty(); if (hasStudentsWithRecoveryEmail) { EmailWrapper email = new EmailGenerator().generateSessionLinksRecoveryEmail(recoveryEmailAddress); emailSender.sendEmail(email); } return new JsonResult(new SessionLinksRecoveryResponseData(hasStudentsWithRecoveryEmail, "The recovery links for your feedback sessions have been sent to the " + "specified email address: " + recoveryEmailAddress)); }

Target:
public ActionResult execute() { String recoveryEmailAddress = getNonNullRequestParamValue(Const.ParamsNames.SESSION_LINKS_RECOVERY_EMAIL); if (!StringHelper.isMatching(recoveryEmailAddress, REGEX_EMAIL)) { return new JsonResult("Invalid email address: " + recoveryEmailAddress, HttpStatusCodes.STATUS_CODE_BAD_REQUEST); } String userCaptchaResponse = getRequestParamValue(Const.ParamsNames.USER_CAPTCHA_RESPONSE); if (!new RecaptchaVerifier().isVerificationSuccessful(userCaptchaResponse)) { return new JsonResult(new SessionLinksRecoveryResponseData(false, "Something went wrong with " + "the reCAPTCHA verification. Please try again.")); } EmailWrapper email = emailGenerator.generateSessionLinksRecoveryEmailForStudent(recoveryEmailAddress); EmailSendingStatus status = emailSender.sendEmail(email); if (status.isSuccess()) { return new JsonResult(new SessionLinksRecoveryResponseData(true, "The recovery links for your feedback sessions have been sent to the " + "specified email address: " + recoveryEmailAddress)); } else { return new JsonResult(new SessionLinksRecoveryResponseData(false, "An error occurred. " + "The email could not be sent.")); } }
Source:
public void execute(LauncherDiscoveryRequest discoveryRequest, TestExecutionListener... listeners) { Preconditions.notNull(discoveryRequest, "LauncherDiscoveryRequest must not be null"); Preconditions.notNull(listeners, "TestExecutionListener array must not be null"); this.listenerRegistry.registerListeners(listeners); execute(discoverRoot(discoveryRequest, "execution"), discoveryRequest.getConfigurationParameters()); this.listenerRegistry.removeListeners(listeners); }

Target:
public void execute(LauncherDiscoveryRequest discoveryRequest, TestExecutionListener... listeners) { Preconditions.notNull(discoveryRequest, "LauncherDiscoveryRequest must not be null"); Preconditions.notNull(listeners, "TestExecutionListener array must not be null"); Preconditions.containsNoNullElements(listeners, "individual listeners must not be null"); execute(discoverRoot(discoveryRequest, "execution"), discoveryRequest.getConfigurationParameters(), listeners); }
Source:
public void renameTable(JdbcTableHandle handle, SchemaTableName newTable) { renameTable(null, handle.getSchemaTableName(), newTable); }

Target:
public void renameTable(JdbcTableHandle handle, SchemaTableName newTable) { renameTable(handle.getCatalogName(), handle.getSchemaTableName(), newTable); }
Source:
public void store(String tenantId, List<Property<?>> properties) throws CacheException { if (cacheContainer != null) { propertyCache.startBatch(); } for (Property<?> property: properties) { if (log.isLoggable(Level.FINEST)) { log.finest("Store property [id=" + property.getId() + "]: " + property); } propertyCache.put(property.getId(), property); } if (cacheContainer != null) { propertyCache.endBatch(true); } }

Target:
public void store(String tenantId, List<Property<?>> properties) throws CacheException { if (cacheContainer != null) { propertyCache.startBatch(); } for (Property<?> property: properties) { store(tenantId, property); } if (cacheContainer != null) { propertyCache.endBatch(true); } }
Source:
public void handle_addsTheHashAndThenSavesInTheDatabase() throws Exception { LoadHandler loadHandler = new LoadHandler(entriesUpdateDAO, logStream); String payload = "{\"key1\":\"value1\"}\n{\"key2\":\"value2\"}"; String expectedHash1 = Digest.shasum("{\"key1\":\"value1\"}"); String expectedHash2 = Digest.shasum("{\"key2\":\"value2\"}"); final String entry1 = "{\"entry\":{\"key1\":\"value1\"},\"hash\":\"" + expectedHash1 + "\"}"; final byte[] entry1Bytes = canonicalise(entry1); final String entry2 = "{\"entry\":{\"key2\":\"value2\"},\"hash\":\"" + expectedHash2 + "\"}"; final byte[] entry2Bytes = canonicalise(entry2); loadHandler.handle(payload); ArgumentCaptor<List> captor = ArgumentCaptor.forClass(List.class); verify(entriesUpdateDAO, times(1)).add(captor.capture()); final List<byte[]> payloadArray = captor.getValue(); assertThat(payloadArray.size(), equalTo(2)); assertThat(payloadArray.get(0), equalTo(entry1Bytes)); assertThat(payloadArray.get(1), equalTo(entry2Bytes)); verify(logStream, times(1)).notifyOfNewEntries(); }

Target:
public void handle_addsTheHashAndThenSavesInTheDatabase() throws Exception { LoadHandler loadHandler = new LoadHandler(entriesUpdateDAO, logStream); String payload = "{\"key1\":\"value1\"}\n{\"key2\":\"value2\"}"; String expectedHash1 = Digest.shasum("{\"key1\":\"value1\"}"); String expectedHash2 = Digest.shasum("{\"key2\":\"value2\"}"); final String entry1 = "{\"entry\":{\"key1\":\"value1\"},\"hash\":\"" + expectedHash1 + "\"}"; final byte[] entry1Bytes = canonicalise(entry1); final String entry2 = "{\"entry\":{\"key2\":\"value2\"},\"hash\":\"" + expectedHash2 + "\"}"; final byte[] entry2Bytes = canonicalise(entry2); loadHandler.handle(payload); verify(entriesUpdateDAO, times(1)).add(entriesCaptor.capture()); final List<byte[]> payloadArray = entriesCaptor.getValue(); assertThat(payloadArray.size(), equalTo(2)); assertThat(payloadArray.get(0), equalTo(entry1Bytes)); assertThat(payloadArray.get(1), equalTo(entry2Bytes)); verify(logStream, times(1)).notifyOfNewEntries(); }
Source:
protected ToStringBuilder appendAttributes(ToStringBuilder tsb) { return super.appendAttributes(tsb) .append("srcHost", getSrcHost()) .append("dstVdsId", getDstVdsId()) .append("dstHost", getDstHost()) .append("migrationMethod", getMigrationMethod()) .append("tunnelMigration", isTunnelMigration()) .append("migrationDowntime", getMigrationDowntime()) .append("autoConverge", getAutoConverge()) .append("migrateCompressed", getMigrateCompressed()) .append("consoleAddress", getConsoleAddress()) .append("maxBandwidth", getMaxBandwidth()) .append("enableGuestEvents", isEnableGuestEvents()) .append("convergenceSchedule", getConvergenceSchedule()); }

Target:
protected ToStringBuilder appendAttributes(ToStringBuilder tsb) { return super.appendAttributes(tsb) .append("srcHost", getSrcHost()) .append("dstVdsId", getDstVdsId()) .append("dstHost", getDstHost()) .append("migrationMethod", getMigrationMethod()) .append("tunnelMigration", isTunnelMigration()) .append("migrationDowntime", getMigrationDowntime()) .append("autoConverge", getAutoConverge()) .append("migrateCompressed", getMigrateCompressed()) .append("consoleAddress", getConsoleAddress()) .append("maxBandwidth", getMaxBandwidth()) .append("enableGuestEvents", isEnableGuestEvents()) .append("maxIncomingMigrations", getMaxIncomingMigrations()) .append("maxOutgoingMigrations", getMaxOutgoingMigrations()) .append("convergenceSchedule", getConvergenceSchedule()); }
Source:
boolean conditionsAreEqual(Rule that) { if (!Objects.equals(this.fileTypeCondition, that.getFileMIMETypeCondition())) { return false; } this.fileSizeConditions.sort(null); that.sortFileSizeConditions(); if (!this.fileSizeConditions.equals(that.getFileSizeConditions())) { return false; } this.artifactConditions.sort(null); that.sortArtifactConditions(); return this.artifactConditions.equals(that.getArtifactConditions()); }

Target:
boolean conditionsAreEqual(Rule that) { if (!Objects.equals(this.fileTypeCondition, that.getFileMIMETypeCondition())) { return false; } this.sortFileSizeConditions(); that.sortFileSizeConditions(); if (!this.fileSizeConditions.equals(that.getFileSizeConditions())) { return false; } this.sortArtifactConditions(); that.sortArtifactConditions(); return this.artifactConditions.equals(that.getArtifactConditions()); }
Source:
public Set<ThingTypeUID> getSupportedThingTypes() { Set<ThingTypeUID> supportedThingTypes = new HashSet<>(); supportedThingTypes.add(BluetoothBindingConstants.THING_TYPE_BEACON); for (BluetoothDiscoveryParticipant participant : participants) { supportedThingTypes.addAll(participant.getSupportedThingTypeUIDs()); } return supportedThingTypes; }

Target:
public Set<ThingTypeUID> getSupportedThingTypes() { return supportedThingTypes; }
Source:
public static boolean isPasswordEncrypted(String carbonHome) throws Exception { boolean foundEncryption = false; try { FileInputStream file = new FileInputStream(new File(carbonHome + File.separator + "repository" + File.separator + "conf" + File.separator + "datasources" + File.separator + "master-datasources.xml")); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse(file); XPath xPath = XPathFactory.newInstance().newXPath(); String expression = " "[@type='RDBMS']/configuration/password"; NodeList nodeList = ( NodeList) xPath.compile(expression).evaluate(xmlDocument, XPathConstants.NODESET); for (int i = 0; i < nodeList.getLength(); i++) { Element eElement = (Element) nodeList.item(i); if (eElement.getAttribute("svns:secretAlias").equals("Datasources.WSO2_CARBON_DB.Configuration.Password") && nodeList.item(i).getFirstChild().getNodeValue().equals("password")) { foundEncryption = true; break; } } } catch (Exception e) { handleException("Error when passing the master-datasources.xml file to create xmlDocument", e); } return foundEncryption; }

Target:
public static boolean isPasswordEncrypted(String carbonHome) throws Exception { boolean foundEncryption = false; try { FileInputStream file = new FileInputStream(new File(carbonHome + File.separator + "repository" + File.separator + "conf" + File.separator + "datasources" + File.separator + "master-datasources.xml")); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse(file); XPath xPath = XPathFactory.newInstance().newXPath(); NodeList nodeList = (NodeList) xPath.compile (ASIntegrationConstants.ENCRYPTED_PASSWD_URL).evaluate(xmlDocument, XPathConstants.NODESET); for (int i = 0; i < nodeList.getLength(); i++) { Element eElement = (Element) nodeList.item(i); if (eElement.getAttribute(ASIntegrationConstants.PASSWORD_PROPERTY_SECRET_ALIAS_KEY). equals(ASIntegrationConstants.PASSWORD_PROPERTY_SECRET_ALIAS_VALUE) && nodeList.item(i).getFirstChild().getNodeValue().equals("password")) { foundEncryption = true; break; } } } catch (Exception e) { log.error("Error when passing the master-datasources.xml file to create xmlDocument", e); throw new PasswordEncryptionIntegrationTestException("Error when passing the master-datasources.xml file to create xmlDocument", e); } return foundEncryption; }
Source:
private void fillDependencies(@Nonnull InputJackLibrary library, @Nonnull VPath dependencyVPath, @Nonnull Dependency dependency) throws CannotReadException, FileTypeDoesNotExistException { InputVFile dependenciesVFile = library.getFile(FileType.DEPENDENCIES, dependencyVPath); InputStreamReader fileReader = null; try { fileReader = new InputStreamReader(dependenciesVFile.getInputStream()); dependency.read(fileReader); } catch (NoSuchElementException | WrongPermissionException e) { throw new CannotReadException(dependenciesVFile, e); } catch (IOException e) { throw new CannotReadException(dependenciesVFile, e); } finally { if (fileReader != null) { try { fileReader.close(); } catch (IOException e) { } } } }

Target:
private void fillDependencies(@Nonnull InputJackLibrary library, @Nonnull VPath dependencyVPath, @Nonnull Dependency dependency) throws CannotReadException, FileTypeDoesNotExistException { InputVFile dependenciesVFile = library.getFile(FileType.DEPENDENCIES, dependencyVPath); InputStreamReader fileReader = null; try { fileReader = new InputStreamReader(dependenciesVFile.getInputStream()); dependency.read(fileReader); } catch (NoSuchElementException | WrongPermissionException | IOException e) { throw new CannotReadException(dependenciesVFile, e); } finally { if (fileReader != null) { try { fileReader.close(); } catch (IOException e) { } } } }
Source:
public void fetchCartInStoreById() { StoreFixtures.withStore(client(), store -> { final CartDraft cartDraft = CartDraft.of(DefaultCurrencyUnits.EUR).withStore(store.toResourceIdentifier()); final CartCreateCommand cartCreateCommand = CartCreateCommand.of(cartDraft); final Cart cart = client().executeBlocking(cartCreateCommand); final Cart cartInStore = client().executeBlocking(CartInStoreByIdGet.of(store.getKey(), cart.getId())); assertThat(cartInStore).isNotNull(); assertThat(cartInStore.getId()).isEqualTo(cart.getId()); client().executeBlocking(CartDeleteCommand.of(cart)); }); }

Target:
public void fetchCartInStoreById() { withStore(client(), store -> { final CartDraft cartDraft = CartDraft.of(DefaultCurrencyUnits.EUR).withStore(store.toResourceIdentifier()); final CartCreateCommand cartCreateCommand = CartCreateCommand.of(cartDraft); final Cart cart = client().executeBlocking(cartCreateCommand); final Cart cartInStore = client().executeBlocking(CartInStoreByIdGet.of(store.getKey(), cart.getId())); assertThat(cartInStore).isNotNull(); assertThat(cartInStore.getId()).isEqualTo(cart.getId()); client().executeBlocking(CartDeleteCommand.of(cart)); }); }
Source:
public void close() { if (dispatcher == null) { return; } try { dispatcher.unsubscribe(subject); } catch (IllegalStateException e) { LOGGER.warn("NATS transport could not unsubscribe from subscription: " + e.getMessage()); } dispatcher = null; super.close(); }

Target:
public void close() { if (dispatcher != null) { dispatcher.unsubscribe(subject); dispatcher = null; } super.close(); }
Source:
CheckpointBarrier parseCheckpointBarrierOrNull(Buffer buffer) throws IOException { if (buffer.isBuffer()) { return null; } AbstractEvent event = EventSerializer.fromBuffer(buffer, getClass().getClassLoader()); buffer.setReaderIndex(0); return event instanceof CheckpointBarrier ? (CheckpointBarrier) event : null; }

Target:
protected CheckpointBarrier parseCheckpointBarrierOrNull(Buffer buffer) throws IOException { if (buffer.isBuffer()) { return null; } AbstractEvent event = EventSerializer.fromBuffer(buffer, getClass().getClassLoader()); buffer.setReaderIndex(0); return event.getClass() == CheckpointBarrier.class ? (CheckpointBarrier) event : null; }
Source:
private static boolean isBlack(BufferedImage var) throws Exception { double[] varArr = new double[var.getWidth()*var.getHeight()*3]; for(int i = 0; i < var.getHeight(); i++) { for(int j = 0; j < var.getWidth(); j++) { varArr[i*var.getWidth() + j + 0] = new Color(var.getRGB(j, i)).getRed(); varArr[i*var.getWidth() + j + 1] = new Color(var.getRGB(j, i)).getGreen(); varArr[i*var.getWidth() + j + 2] = new Color(var.getRGB(j, i)).getBlue(); } } for(int i=0;i!=varArr.length;i++){ if(varArr[i] != 0) return false; } return true; }

Target:
private static boolean isBlack(BufferedImage var) { double[] varArr = new double[var.getWidth()*var.getHeight()*3]; for(int i = 0; i < var.getHeight(); i++) { for(int j = 0; j < var.getWidth(); j++) { varArr[i*var.getWidth() + j + 0] = new Color(var.getRGB(j, i)).getRed(); varArr[i*var.getWidth() + j + 1] = new Color(var.getRGB(j, i)).getGreen(); varArr[i*var.getWidth() + j + 2] = new Color(var.getRGB(j, i)).getBlue(); } } for(int i=0;i!=varArr.length;i++){ if(varArr[i] != 0) return false; } return true; }
Source:
private void checkReplTxnForTest(Long startTxnId, Long endTxnId, String replPolicy, List<Long> targetTxnId) throws Exception { int numReplTxns = TxnDbUtil.countQueryAgent(conf, "select count(*) from REPL_TXN_MAP where " + " RTM_SRC_TXN_ID >= " + startTxnId + "and RTM_SRC_TXN_ID <= " + endTxnId + " and RTM_REPL_POLICY = \'" + replPolicy + "\'"); assertEquals(numReplTxns, targetTxnId.size()); String[] output = TxnDbUtil.queryToString(conf, "select RTM_TARGET_TXN_ID from REPL_TXN_MAP where " + " RTM_SRC_TXN_ID >= " + startTxnId + "and RTM_SRC_TXN_ID <= " + endTxnId + " and RTM_REPL_POLICY = \'" + replPolicy + "\'").split("\n"); for (int idx = 1; idx < output.length; idx++) { long txnId = Long.parseLong(output[idx].trim()); assertEquals(txnId, targetTxnId.get(idx-1).longValue()); } }

Target:
private void checkReplTxnForTest(Long startTxnId, Long endTxnId, String replPolicy, List<Long> targetTxnId) throws Exception { String[] output = TxnDbUtil.queryToString(conf, "select RTM_TARGET_TXN_ID from REPL_TXN_MAP where " + " RTM_SRC_TXN_ID >= " + startTxnId + "and RTM_SRC_TXN_ID <= " + endTxnId + " and RTM_REPL_POLICY = \'" + replPolicy + "\'").split("\n"); assertEquals(output.length - 1, targetTxnId.size()); for (int idx = 1; idx < output.length; idx++) { long txnId = Long.parseLong(output[idx].trim()); assertEquals(txnId, targetTxnId.get(idx-1).longValue()); } }
Source:
FileTailerState getState() { FileTailerState finalState = events.get(0).getState(); for (FileTailerEvent event : events) { FileTailerState tmpState = event.getState(); if (tmpState.getLastModifyTime() >= finalState.getLastModifyTime() && tmpState.getPosition() > finalState.getPosition()) { finalState = tmpState; } } return finalState; }

Target:
FileTailerState getState() { if (events.isEmpty()) { return null; } FileTailerState finalState = events.get(0).getState(); for (FileTailerEvent event : events) { FileTailerState tmpState = event.getState(); if (tmpState.getLastModifyTime() > finalState.getLastModifyTime() || tmpState.getLastModifyTime() == finalState.getLastModifyTime() && tmpState.getPosition() > finalState.getPosition()) { finalState = tmpState; } } return finalState; }
Source:
public void Serialize(File outputFile) { try { JAXBContext context = JAXBContext.newInstance(ScenarioTemplate.class); JAXBElement<ScenarioTemplate> templateElement = new JAXBElement<>(new QName(ROOT_XML_ELEMENT_NAME), ScenarioTemplate.class, this); Marshaller m = context.createMarshaller(); m.setProperty("jaxb.formatted.output", true); m.marshal(templateElement, outputFile); } catch(Exception e) { MekHQ.getLogger().error(ScenarioTemplate.class, "Serialize", e.getMessage()); } }

Target:
public void Serialize(File outputFile) { try { JAXBContext context = JAXBContext.newInstance(ScenarioTemplate.class); JAXBElement<ScenarioTemplate> templateElement = new JAXBElement<>(new QName(ROOT_XML_ELEMENT_NAME), ScenarioTemplate.class, this); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(templateElement, outputFile); } catch(Exception e) { MekHQ.getLogger().error(ScenarioTemplate.class, "Serialize", e.getMessage()); } }
Source:
JobRecoveryTypeException(final String expectedType, final String actualType) { super(buildMessage(expectedType, actualType)); }

Target:
public JobRecoveryTypeException(final String expectedType, final String actualType) { super(buildMessage(expectedType, actualType)); }
Source:
public ProtocolVersion protocolVersion() { return protocolVersion; }

Target:
public String protocolVersion() { return protocolVersion.toString(); }
Source:
public ThreadedHistoryTreeBackendTest(Boolean reOpen) { super(reOpen); }

Target:
public ThreadedHistoryTreeBackendTest(Boolean reOpen) { super(false); }