auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void resolveParameters(final Map<String, IElementParameter> settings) { final Iterator<PropertyDefinitionDecorator> expectedParameters = PropertyDefinitionDecorator.wrap(actionRef.getProperties()) .stream() .filter(p -> p.getParameter().isRoot()) .sorted(comparing(p -> p.getParameter().getIndex())) .iterator(); final List<String> relativePaths = getRelativePaths(); relativePaths.forEach(relativePath -> { if (expectedParameters.hasNext()) { final String absolutePath = pathResolver.resolvePath(getOwnerPath(), relativePath); if (absolutePath != null && !absolutePath.isEmpty()) { final List<TaCoKitElementParameter> parameters = findParameters(absolutePath, settings); final SimplePropertyDefinition parameterRoot = expectedParameters.next(); parameters.forEach(parameter -> { parameter.registerListener("value", listener); if (redrawParameter != null) { parameter.setRedrawParameter(redrawParameter); } final String callbackProperty = parameter.getName().replaceFirst(absolutePath, parameterRoot.getPath()); final IActionParameter actionParameter = parameter.createActionParameter(callbackProperty); action.addParameter(actionParameter); }); } } }); }

Target:
public void resolveParameters(final Map<String, IElementParameter> settings) { final Iterator<PropertyDefinitionDecorator> expectedParameters = PropertyDefinitionDecorator.wrap(actionRef.getProperties()) .stream() .filter(p -> p.getParameter().isRoot()) .sorted(comparing(p -> p.getParameter().getIndex())) .iterator(); final List<String> relativePaths = getRelativePaths(); relativePaths.forEach(relativePath -> { if (expectedParameters.hasNext()) { final Optional<String> absolutePath = pathResolver.resolvePath(getOwnerPath(), relativePath); if (absolutePath.isPresent()) { final List<TaCoKitElementParameter> parameters = findParameters(absolutePath.get(), settings); final SimplePropertyDefinition parameterRoot = expectedParameters.next(); parameters.forEach(parameter -> { parameter.registerListener("value", listener); if (redrawParameter != null) { parameter.setRedrawParameter(redrawParameter); } final String callbackProperty = parameter.getName().replaceFirst(absolutePath.get(), parameterRoot.getPath()); final IActionParameter actionParameter = parameter.createActionParameter(callbackProperty); action.addParameter(actionParameter); }); } } }); }
Source:
public MonetaryAmount deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException { final MoneyRepresentation moneyRepresentation = deserializationContext.readValue(jsonParser, MoneyRepresentation.class); final String currencyCode = moneyRepresentation.getCurrencyCode(); if(moneyRepresentation instanceof HighPrecisionMoneyRepresentation){ HighPrecisionMoneyRepresentation highPrecisionMoneyRepresentation = ((HighPrecisionMoneyRepresentation) moneyRepresentation); final int scale = highPrecisionMoneyRepresentation.getFractionDigits(); BigDecimal bigDecimal = highPrecisionMoneyRepresentation.getPreciseAmount().movePointLeft(scale); return HighPrecisionMoneyImpl.of(bigDecimal,currencyCode ,scale ); } else { return MoneyImpl.ofCents(moneyRepresentation.getCentAmount(), currencyCode); } }

Target:
public MonetaryAmount deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException { final MoneyRepresentation moneyRepresentation = deserializationContext.readValue(jsonParser, MoneyRepresentation.class); final String currencyCode = moneyRepresentation.getCurrencyCode(); if(moneyRepresentation instanceof HighPrecisionMoneyRepresentation){ final HighPrecisionMoneyRepresentation highPrecisionMoneyRepresentation = ((HighPrecisionMoneyRepresentation) moneyRepresentation); final int scale = highPrecisionMoneyRepresentation.getFractionDigits(); final BigDecimal bigDecimal = highPrecisionMoneyRepresentation.getPreciseAmount().movePointLeft(scale); return HighPrecisionMoneyImpl.of(bigDecimal,currencyCode ,scale ); } else { return MoneyImpl.ofCents(moneyRepresentation.getCentAmount(), currencyCode); } }
Source:
private void updateActionAvailability(GlusterVolumeEntity volumeEntity) { boolean allowStartSessionCommand = false; boolean allowResumeSessionCommand = false; boolean allowPauseSessionCommand = false; if(volumeEntity == null) return; if (getSelectedItem() == null) { allowStartSessionCommand = false; allowResumeSessionCommand = false; allowPauseSessionCommand = false; } else if(getSelectedItems().size() == 1) { GlusterGeoRepSession selectedSession = (GlusterGeoRepSession)getSelectedItem(); GeoRepSessionStatus sessionStatus = selectedSession.getStatus(); allowStartSessionCommand = sessionStatus == GeoRepSessionStatus.NOTSTARTED || sessionStatus == GeoRepSessionStatus.STOPPED; allowResumeSessionCommand = sessionStatus == GeoRepSessionStatus.PAUSED; allowPauseSessionCommand = sessionStatus == GeoRepSessionStatus.ACTIVE; } else allowStartSessionCommand = false; getNewSessionCommand().setIsAvailable(true); getRemoveSessionCommand().setIsAvailable(false); getStartSessionCommand().setIsExecutionAllowed(allowStartSessionCommand); getStopSessionCommand().setIsExecutionAllowed(!allowStartSessionCommand); getPauseSessionCommand().setIsExecutionAllowed(allowPauseSessionCommand); getResumeSessionCommand().setIsExecutionAllowed(allowResumeSessionCommand); getSessionOptionsCommand().setIsExecutionAllowed(true); getViewSessionDetailsCommand().setIsAvailable(false); getRefreshSessionsCommand().setIsAvailable(true); }

Target:
private void updateActionAvailability(GlusterVolumeEntity volumeEntity) { boolean allowStartSessionCommand = false; boolean allowStopSessionCommand = false; boolean allowResumeSessionCommand = false; boolean allowPauseSessionCommand = false; if(volumeEntity == null) { return; } if (getSelectedItem() == null) { allowStartSessionCommand = false; allowStopSessionCommand = false; allowResumeSessionCommand = false; allowPauseSessionCommand = false; } else if(getSelectedItems().size() == 1) { GlusterGeoRepSession selectedSession = (GlusterGeoRepSession)getSelectedItem(); GeoRepSessionStatus sessionStatus = selectedSession.getStatus(); allowStartSessionCommand = sessionStatus == GeoRepSessionStatus.NOTSTARTED || sessionStatus == GeoRepSessionStatus.STOPPED; allowStopSessionCommand = !allowStartSessionCommand; allowResumeSessionCommand = sessionStatus == GeoRepSessionStatus.PAUSED; allowPauseSessionCommand = sessionStatus == GeoRepSessionStatus.ACTIVE; } else { allowStartSessionCommand = false; } getNewSessionCommand().setIsAvailable(true); getRemoveSessionCommand().setIsAvailable(false); getStartSessionCommand().setIsExecutionAllowed(allowStartSessionCommand); getStopSessionCommand().setIsExecutionAllowed(allowStopSessionCommand); getPauseSessionCommand().setIsExecutionAllowed(allowPauseSessionCommand); getResumeSessionCommand().setIsExecutionAllowed(allowResumeSessionCommand); getSessionOptionsCommand().setIsExecutionAllowed(true); getViewSessionDetailsCommand().setIsAvailable(false); getRefreshSessionsCommand().setIsAvailable(true); }
Source:
public List<ModemPdpContext> getPdpContextInfo() throws KuraException { List<ModemPdpContext> pdpContextInfo = new ArrayList<>(); synchronized (atLock) { byte[] reply; CommConnection commAtConnection = openSerialPort(getAtPort()); if (!isAtReachable(commAtConnection)) { closeSerialPort(commAtConnection); throw new KuraException(KuraErrorCode.NOT_CONNECTED, MODEM_NOT_AVAILABLE_FOR_AT_CMDS_MSG + TelitHe910.class.getName()); } try { reply = commAtConnection.sendCommand(formGetPdpContextAtCommand().getBytes(), 1000, 100); } catch (IOException e) { closeSerialPort(commAtConnection); throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e); } closeSerialPort(commAtConnection); if (reply != null) { String sreply = this.getResponseString(reply); Scanner scanner = new Scanner(sreply); while (scanner.hasNextLine()) { String[] tokens = scanner.nextLine().split(","); int contextNo = Integer.parseInt(tokens[0].substring("+CGDCONT:".length()).trim()); ModemPdpContextType pdpType = ModemPdpContextType .getContextType(tokens[1].substring(1, tokens[1].length() - 1)); String apn = tokens[2].substring(1, tokens[2].length() - 1); ModemPdpContext modemPdpContext = new ModemPdpContext(contextNo, pdpType, apn); pdpContextInfo.add(modemPdpContext); } scanner.close(); } } return pdpContextInfo; }

Target:
public List<ModemPdpContext> getPdpContextInfo() throws KuraException { List<ModemPdpContext> pdpContextInfo = new ArrayList<>(); synchronized (this.atLock) { byte[] reply; CommConnection commAtConnection = openSerialPort(getAtPort()); if (!isAtReachable(commAtConnection)) { closeSerialPort(commAtConnection); throw new KuraException(KuraErrorCode.NOT_CONNECTED, MODEM_NOT_AVAILABLE_FOR_AT_CMDS_MSG + TelitHe910.class.getName()); } try { reply = commAtConnection.sendCommand(formGetPdpContextAtCommand().getBytes(), 1000, 100); } catch (IOException e) { closeSerialPort(commAtConnection); throw new KuraException(KuraErrorCode.CONNECTION_FAILED, e); } closeSerialPort(commAtConnection); if (reply != null) { String sreply = this.getResponseString(reply); Scanner scanner = new Scanner(sreply); while (scanner.hasNextLine()) { String[] tokens = scanner.nextLine().split(","); if (!tokens[0].startsWith("+CGDCONT:")) { continue; } int contextNo = Integer.parseInt(tokens[0].substring("+CGDCONT:".length()).trim()); ModemPdpContextType pdpType = ModemPdpContextType .getContextType(tokens[1].substring(1, tokens[1].length() - 1)); String apn = tokens[2].substring(1, tokens[2].length() - 1); ModemPdpContext modemPdpContext = new ModemPdpContext(contextNo, pdpType, apn); pdpContextInfo.add(modemPdpContext); } scanner.close(); } } return pdpContextInfo; }
Source:
public abstract void sendJob(LaserJob job, ProgressListener pl, List<String> warnings) throws IllegalJobException, Exception; public abstract void saveJob(LaserJob job) throws IllegalJobException, Exception; public boolean isAutoFocus() { return false; }

Target:
public abstract void sendJob(LaserJob job, ProgressListener pl, List<String> warnings) throws IllegalJobException, Exception; public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws NotImplementedException, IllegalJobException, Exception { System.err.println("Your driver does not implement saveJob(LaserJob job)"); throw new NotImplementedException(); }
Source:
public static DSMRPortSettings getPortSettingsFromString(String portSettings) { Matcher m = Pattern.compile(PORT_SETTING_REGEX).matcher(portSettings); if (m.find()) { int baudrate = Integer.parseInt(m.group(1)); int databits = Integer.parseInt(m.group(2)); int parity; int stopbits; char parityChar = m.group(3).toUpperCase().charAt(0); switch (parityChar) { case 'E': parity = SerialPort.PARITY_EVEN; break; case 'O': parity = SerialPort.PARITY_ODD; break; case 'N': parity = SerialPort.PARITY_NONE; break; default: logger.error("Invalid parity (" + parityChar + "), ignoring fixed port settings."); return null; } String stopbitsString = m.group(4); if (stopbitsString.equals("1")) { stopbits = SerialPort.STOPBITS_1; } else if (stopbitsString.equals("1.5")) { stopbits = SerialPort.STOPBITS_1_5; } else if (stopbitsString.equals("2")) { stopbits = SerialPort.STOPBITS_2; } else { logger.error("Invalid stop bits(" + stopbitsString + "), ignoring fixed port settings."); return null; } return new DSMRPortSettings(baudrate, databits, parity, stopbits); } else { return null; } }

Target:
public static DSMRPortSettings getPortSettingsFromString(String portSettings) { Matcher m = Pattern.compile(PORT_SETTING_REGEX).matcher(portSettings); if (m.find()) { int baudrate = Integer.parseInt(m.group(1)); int databits = Integer.parseInt(m.group(2)); int parity; int stopbits; char parityChar = m.group(3).toUpperCase().charAt(0); switch (parityChar) { case 'E': parity = SerialPort.PARITY_EVEN; break; case 'O': parity = SerialPort.PARITY_ODD; break; case 'N': parity = SerialPort.PARITY_NONE; break; default: logger.error("Invalid parity ({}), ignoring fixed port settings.", parityChar); return null; } String stopbitsString = m.group(4); if (stopbitsString.equals("1")) { stopbits = SerialPort.STOPBITS_1; } else if (stopbitsString.equals("1.5")) { stopbits = SerialPort.STOPBITS_1_5; } else if (stopbitsString.equals("2")) { stopbits = SerialPort.STOPBITS_2; } else { logger.error("Invalid stop bits({}), ignoring fixed port settings.", stopbitsString); return null; } return new DSMRPortSettings(baudrate, databits, parity, stopbits); } else { return null; } }
Source:
private String sendToZeppelinHubViaProxy(HttpRequestBase request, String json, String token, boolean withResponse) throws IOException { request.setHeader(ZEPPELIN_TOKEN_HEADER, token); if (request.getMethod().equals(HttpPost.METHOD_NAME)) { HttpPost post = (HttpPost) request; StringEntity content = new StringEntity(json, "application/json;charset=UTF-8"); post.setEntity(content); } if (request.getMethod().equals(HttpPut.METHOD_NAME)) { HttpPut put = (HttpPut) request; StringEntity content = new StringEntity(json, "application/json;charset=UTF-8"); put.setEntity(content); } String body = StringUtils.EMPTY; if (proxyClient != null) { body = proxyClient.sendToZeppelinHub(request, withResponse); } else { LOG.error("Proxy client request was submitted while not correctly initialized"); } return body; }

Target:
private String sendToZeppelinHubViaProxy(HttpRequestBase request, String json, String token, boolean withResponse) throws IOException { request.setHeader(ZEPPELIN_TOKEN_HEADER, token); if (request.getMethod().equals(HttpPost.METHOD_NAME)) { HttpPost post = (HttpPost) request; StringEntity content = new StringEntity(json, "application/json;charset=UTF-8"); post.setEntity(content); } if (request.getMethod().equals(HttpPut.METHOD_NAME)) { HttpPut put = (HttpPut) request; StringEntity content = new StringEntity(json, "application/json;charset=UTF-8"); put.setEntity(content); } String body = StringUtils.EMPTY; if (proxyClient != null) { body = proxyClient.sendToZeppelinHub(request, withResponse); } else { LOG.warn("Proxy client request was submitted while not correctly initialized"); } return body; }
Source:
private List<DiffCommitFile> getCommitDiffFiles(RevCommit revCommit, String pattern) throws IOException { TreeWalk tw = null; List<DiffEntry> diffs = null; TreeFilter filter = null; if (pattern != null && !pattern.isEmpty()) { filter = AndTreeFilter.create(PathFilterGroup.createFromStrings(Collections.singleton(pattern)), TreeFilter.ANY_DIFF); } List<DiffCommitFile> commitFilesList = new ArrayList<DiffCommitFile>(); try { tw = new TreeWalk(repository); tw.setRecursive(true); if (revCommit.getParentCount() > 0) { RevCommit parent = parseCommit(revCommit.getParent(0)); tw.reset(parent.getTree(), revCommit.getTree()); if (filter != null) { tw.setFilter(filter); } else { tw.setFilter(TreeFilter.ANY_DIFF); } diffs = DiffEntry.scan(tw); } else { RevWalk rw = null; DiffFormatter diffFormat = null; try { rw = new RevWalk(repository); diffFormat = new DiffFormatter(NullOutputStream.INSTANCE); diffFormat.setRepository(repository); if (filter != null) { diffFormat.setPathFilter(filter); } diffs = diffFormat.scan(new EmptyTreeIterator(), new CanonicalTreeParser(null, rw.getObjectReader(), revCommit.getTree())); } finally { if (diffFormat != null) { diffFormat.close(); } if (rw != null) { rw.close(); } } } } finally { if (tw != null) { tw.close(); } } if (diffs != null) { commitFilesList.addAll(diffs.stream().map(diff -> newDto(DiffCommitFile.class).withOldPath(diff.getOldPath()) .withNewPath(diff.getNewPath()) .withChangeType(diff.getChangeType().name())) .collect(Collectors.toList())); } return commitFilesList; }

Target:
private List<DiffCommitFile> getCommitDiffFiles(RevCommit revCommit, String pattern) throws IOException { List<DiffEntry> diffs; TreeFilter filter = null; if (!isNullOrEmpty(pattern)) { filter = AndTreeFilter.create(PathFilterGroup.createFromStrings(Collections.singleton(pattern)), TreeFilter.ANY_DIFF); } List<DiffCommitFile> commitFilesList = new ArrayList<>(); try (TreeWalk tw = new TreeWalk(repository)){ tw.setRecursive(true); if (revCommit.getParentCount() > 0) { RevCommit parent = parseCommit(revCommit.getParent(0)); tw.reset(parent.getTree(), revCommit.getTree()); if (filter != null) { tw.setFilter(filter); } else { tw.setFilter(TreeFilter.ANY_DIFF); } diffs = DiffEntry.scan(tw); } else { try (RevWalk rw = new RevWalk(repository); DiffFormatter diffFormat = new DiffFormatter(NullOutputStream.INSTANCE)) { diffFormat.setRepository(repository); if (filter != null) { diffFormat.setPathFilter(filter); } diffs = diffFormat.scan(new EmptyTreeIterator(), new CanonicalTreeParser(null, rw.getObjectReader(), revCommit.getTree())); } } } if (diffs != null) { commitFilesList.addAll(diffs.stream().map(diff -> newDto(DiffCommitFile.class).withOldPath(diff.getOldPath()) .withNewPath(diff.getNewPath()) .withChangeType(diff.getChangeType().name())) .collect(Collectors.toList())); } return commitFilesList; }
Source:
public TableDefinition refresh( Connection connection, TableId tableId ) throws SQLException { TableDefinition dbTable = dialect.describeTable(connection, tableId); if (dbTable != null) { log.info("Refreshing metadata for table to {}", tableId, dbTable); cache.put(dbTable.id(), dbTable); } return dbTable; }

Target:
public TableDefinition refresh( Connection connection, TableId tableId ) throws SQLException { TableDefinition dbTable = dialect.describeTable(connection, tableId); if (dbTable != null) { log.info("Refreshing metadata for table to {}", tableId, dbTable); cache.put(dbTable.id(), dbTable); } else { log.warn("Failed to refresh metadata for table {}", tableId); } return dbTable; }
Source:
public List<String> getAcceptedEvents() { if (acceptedEvents == null) { synchronized (this) { if (acceptedEvents == null) { DirectoryService directoryService = Framework.getService(DirectoryService.class); Directory dir = directoryService.getDirectory(RetentionConstants.EVENTS_DIRECTORY_NAME); try (Session session = dir.getSession()) { Map<String, Serializable> filter = new HashMap<>(); filter.put(RetentionConstants.OBSOLETE_FIELD_ID, Long.valueOf(0)); List<String> evts = session.getProjection(filter, session.getIdField()); if (evts.isEmpty()) { log.trace("Empty accepted events, not chaching anything"); return evts; } acceptedEvents = evts; log.debug("Accepted events {}", acceptedEvents::toString); } } } } return acceptedEvents; }

Target:
public List<String> getAcceptedEvents() { if (acceptedEvents == null) { synchronized (this) { if (acceptedEvents == null) { DirectoryService directoryService = Framework.getService(DirectoryService.class); Directory dir = directoryService.getDirectory(RetentionConstants.EVENTS_DIRECTORY_NAME); try (Session session = dir.getSession()) { Map<String, Serializable> filter = new HashMap<>(); filter.put(RetentionConstants.OBSOLETE_FIELD_ID, Long.valueOf(0)); List<String> evts = session.getProjection(filter, session.getIdField()); if (evts.isEmpty()) { log.trace("Empty accepted events, not catching anything"); return evts; } acceptedEvents = evts; log.debug("Accepted events {}", acceptedEvents::toString); } } } } return acceptedEvents; }
Source:
private static final boolean attributeNotBinary(AttributeDescriptor attributeDescriptor) { return !AttributeType.AttributeFormat.BINARY.equals( attributeDescriptor.getType().getAttributeFormat()); }

Target:
private static boolean attributeNotBinary(AttributeDescriptor attributeDescriptor) { return !AttributeType.AttributeFormat.BINARY.equals( attributeDescriptor.getType().getAttributeFormat()); }
Source:
public PersistenceConfiguration create() { List<StoreConfiguration> stores = new LinkedList<StoreConfiguration>(); for (StoreConfigurationBuilder<?, ?> loader : this.stores) stores.add(loader.create()); return new PersistenceConfiguration(passivation, stores); }

Target:
public PersistenceConfiguration create() { List<StoreConfiguration> stores = new ArrayList<StoreConfiguration>(this.stores.size()); for (StoreConfigurationBuilder<?, ?> loader : this.stores) stores.add(loader.create()); return new PersistenceConfiguration(passivation, stores); }
Source:
public TimeBoundary getTimeBoundaryForTable(String table) { try { String responseBody = sendHttpGetToBroker(table, String.format(TIME_BOUNDARY_API_TEMPLATE, table)); return timeBoundaryJsonCodec.fromJson(responseBody); } catch (Exception e) { if ((e instanceof PinotException)) { String[] errMsgSplits = e.getMessage().split(" "); if (errMsgSplits.length >= 4 && errMsgSplits[3].equalsIgnoreCase(TIME_BOUNDARY_NOT_FOUND_ERROR_CODE)) { return timeBoundaryJsonCodec.fromJson("{}"); } } throw e; } }

Target:
public TimeBoundary getTimeBoundaryForTable(String table) { try { String responseBody = sendHttpGetToBroker(table, String.format(TIME_BOUNDARY_API_TEMPLATE, table)); return timeBoundaryJsonCodec.fromJson(responseBody); } catch (Exception e) { if ((e instanceof PinotException)) { String[] errorMessageSplits = e.getMessage().split(" "); if (errorMessageSplits.length >= 4 && errorMessageSplits[3].equalsIgnoreCase(TIME_BOUNDARY_NOT_FOUND_ERROR_CODE)) { return timeBoundaryJsonCodec.fromJson("{}"); } } throw e; } }
Source:
public void updateHash(String newHash) { if (processed) { this.oldHash = this.hash; this.hash = newHash; if (!StringUtils.equals(this.oldHash, this.hash)) { processed = false; } } else { this.hash = newHash; } }

Target:
public void updateHash(String newHash) { if (processed) { this.oldHash = this.hash; this.hash = newHash; if (!StringUtils.equals(this.oldHash, this.hash)) { processed = false; } } else { this.hash = newHash; if (StringUtils.equals(this.oldHash, this.hash)) { processed = true; } } }
Source:
@Override public int selectString(Options options) throws IOException { Object peeked = (stackSize != 0 ? stack[stackSize - 1] : null); String peekedString; if ((peeked instanceof String)) { peekedString = (String) peeked; } else { if (peeked == JSON_READER_CLOSED) { throw new IllegalStateException("JsonReader is closed"); } return -1; } for (int i = 0, length = options.strings.length; i < length; i++) { if (options.strings[i].equals(peekedString)) { remove(); return i; } } return -1; }

Target:
@Override public int selectString(Options options) throws IOException { Object peeked = (stackSize != 0 ? stack[stackSize - 1] : null); if (!(peeked instanceof String)) { if (peeked == JSON_READER_CLOSED) { throw new IllegalStateException("JsonReader is closed"); } return -1; } String peekedString = (String) peeked; for (int i = 0, length = options.strings.length; i < length; i++) { if (options.strings[i].equals(peekedString)) { remove(); return i; } } return -1; }
Source:
protected void initPreferences() { configureSharingAndMoreButtonsPreferences(); mLabelPreference = (SummaryEditTextPreference) findPreference(getString(R.string.publicize_label)); mButtonStylePreference = (DetailListPreference) findPreference(getString(R.string.publicize_button_style)); setDetailListPreferenceValue(mButtonStylePreference, mSiteSettings.getSharingButtonStyle(getActivity()), mSiteSettings.getSharingButtonStyleDisplayText(getActivity())); mButtonStylePreference.setEntries(getResources().getStringArray(R.array.sharing_button_style_display_array)); mButtonStylePreference.setEntryValues(getResources().getStringArray(R.array.sharing_button_style_array)); mReblogButtonPreference = (WPSwitchPreference) findPreference(getString(R.string.pref_key_reblog)); mLikeButtonPreference = (WPSwitchPreference) findPreference(getString(R.string.pref_key_like)); mCommentLikesPreference = (WPSwitchPreference) findPreference(getString(R.string.pref_key_comment_likes)); mTwitterUsernamePreference = (SummaryEditTextPreference) findPreference(getString(R.string.pref_key_twitter_username)); mTwitterPreferenceCategory = (PreferenceCategory) findPreference(getString(R.string.pref_key_twitter_category)); }

Target:
public void initPreferences() { configureSharingAndMoreButtonsPreferences(); mLabelPreference = (SummaryEditTextPreference) findPreference(getString(R.string.publicize_label)); mButtonStylePreference = (DetailListPreference) findPreference(getString(R.string.publicize_button_style)); setDetailListPreferenceValue(mButtonStylePreference, mSiteSettings.getSharingButtonStyle(getActivity()), mSiteSettings.getSharingButtonStyleDisplayText(getActivity())); mButtonStylePreference.setEntries(getResources().getStringArray(R.array.sharing_button_style_display_array)); mButtonStylePreference.setEntryValues(getResources().getStringArray(R.array.sharing_button_style_array)); mReblogButtonPreference = (WPSwitchPreference) findPreference(getString(R.string.pref_key_reblog)); mLikeButtonPreference = (WPSwitchPreference) findPreference(getString(R.string.pref_key_like)); mCommentLikesPreference = (WPSwitchPreference) findPreference(getString(R.string.pref_key_comment_likes)); mTwitterUsernamePreference = (SummaryEditTextPreference) findPreference(getString(R.string.pref_key_twitter_username)); mTwitterPreferenceCategory = (PreferenceCategory) findPreference(getString(R.string.pref_key_twitter_category)); }
Source:
public static void addHyperLink(XWPFParagraph paragraph, String hyperlinkAnchor, String hyperlinkText) { CTHyperlink cLink = paragraph.getCTP().addNewHyperlink(); cLink.setAnchor(hyperlinkAnchor.replaceAll(" ", "_")); CTText ctText = CTText.Factory.newInstance(); ctText.setStringValue(hyperlinkText); CTR ctr = CTR.Factory.newInstance(); ctr.setTArray(new CTText[]{ctText}); cLink.setRArray(new CTR[]{ctr}); }

Target:
public static void addHyperLink(XWPFParagraph paragraph, String hyperlinkAnchor, String hyperlinkText) { CTHyperlink cLink = paragraph.getCTP().addNewHyperlink(); cLink.setAnchor(hyperlinkAnchor); CTText ctText = CTText.Factory.newInstance(); ctText.setStringValue(hyperlinkText); CTR ctr = CTR.Factory.newInstance(); ctr.setTArray(new CTText[]{ctText}); CTRPr rpr = ctr.addNewRPr(); CTColor colour = CTColor.Factory.newInstance(); colour.setVal("0000FF"); rpr.setColor(colour); CTRPr rpr1 = ctr.addNewRPr(); rpr1.addNewU().setVal(STUnderline.SINGLE); cLink.setRArray(new CTR[]{ctr}); }
Source:
public void testMultiSitePartitionedRead() throws IOException { long txnId = 1234l; int batch_size = 3; Iv2InitiateTaskMessage taskmsg = new Iv2InitiateTaskMessage( 0, -1, (txnId -1), txnId, System.currentTimeMillis(), true, false, new StoredProcedureInvocation(), 0, 0, false); int hsids = 6; buddyHSId = 0; long[] non_local = configureHSIds(hsids); MpTestPlan plan = createTestPlan(batch_size, true, false, false, non_local); Mailbox mailbox = mock(Mailbox.class); SiteProcedureConnection siteConnection = mock(SiteProcedureConnection.class); MpTransactionState dut = new MpTransactionState(mailbox, taskmsg, allHsids, partMasters, buddyHSId, false); dut.setupProcedureResume(true, plan.depsToResume); dut.createLocalFragmentWork(plan.localWork, false); dut.createAllParticipatingFragmentWork(plan.remoteWork); non_local = configureHSIdsForMailbox(hsids, buddyHSId); verify(mailbox).send(eq(non_local), (VoltMessage)any()); verify(mailbox).send(eq(new long[] {buddyHSId}), (VoltMessage)any()); for (FragmentResponseMessage msg : plan.generatedResponses) { dut.offerReceivedFragmentResponse(msg); } Map<Integer, List<VoltTable>> results = dut.recursableRun(siteConnection); verify(mailbox).send(eq(buddyHSId), (BorrowTaskMessage)any()); assertEquals(batch_size, results.size()); System.out.println(results); }

Target:
public void testMultiSitePartitionedRead() throws IOException { long txnId = 1234l; int batch_size = 3; Iv2InitiateTaskMessage taskmsg = new Iv2InitiateTaskMessage( 0, -1, (txnId -1), txnId, System.currentTimeMillis(), true, false, new StoredProcedureInvocation(), 0, 0, false); int hsids = 6; buddyHSId = 0; long[] non_local = configureHSIds(hsids); MpTestPlan plan = createTestPlan(batch_size, true, false, false, non_local); Mailbox mailbox = mock(Mailbox.class); SiteProcedureConnection siteConnection = mock(SiteProcedureConnection.class); MpTransactionState dut = new MpTransactionState(mailbox, taskmsg, allHsids, partMasters, buddyHSId, false); dut.setupProcedureResume(true, plan.depsToResume); dut.createLocalFragmentWork(plan.localWork, false); dut.createAllParticipatingFragmentWork(plan.remoteWork); verify(mailbox).send(eq(non_local), (VoltMessage)any()); for (FragmentResponseMessage msg : plan.generatedResponses) { dut.offerReceivedFragmentResponse(msg); } Map<Integer, List<VoltTable>> results = dut.recursableRun(siteConnection); verify(mailbox).send(eq(buddyHSId), (BorrowTaskMessage)any()); assertEquals(batch_size, results.size()); System.out.println(results); }
Source:
protected boolean processEntry(CanonicalTreeParser base, CanonicalTreeParser ours, CanonicalTreeParser theirs, DirCacheBuildIterator index, WorkingTreeIterator work, boolean ignoreConflicts) throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException, IOException { return processEntry(base, ours, theirs, index, work, ignoreConflicts, null); }

Target:
protected boolean processEntry(CanonicalTreeParser base, CanonicalTreeParser ours, CanonicalTreeParser theirs, DirCacheBuildIterator index, WorkingTreeIterator work, boolean ignoreConflicts) throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException, IOException { return processEntry(base, ours, theirs, index, work, ignoreConflicts, new Attributes()); }
Source:
public void testIsResourcesFolderContainsCorrectNumberOfJsonFiles() { List<File> jsonFiles = findFilesByFileFilter(getEndWithFileFilter(JSON_FILE_EXTENSION)); Assert.assertEquals(10, jsonFiles.size()); }

Target:
public void testIsResourcesFolderContainsCorrectNumberOfJsonFiles() { List<File> jsonFiles = findFilesByFileFilter(getEndWithFileFilter(JSON_FILE_EXTENSION)); Assert.assertEquals(JSON_FILES_NUMBER, jsonFiles.size()); }
Source:
public static int getEstimatedWorkerCountForRASTopo(Map<String, Object> topoConf, StormTopology topology) throws InvalidTopologyException { Double defaultWorkerMaxHeap = ObjectReader.getDouble(topoConf.get(Config.WORKER_HEAP_MEMORY_MB)); Double topologyWorkerMaxHeap = ObjectReader.getDouble(topoConf.get(Config.TOPOLOGY_WORKER_MAX_HEAP_SIZE_MB)); Double maxHeapSize = topologyWorkerMaxHeap != null && topologyWorkerMaxHeap != 0 ? topologyWorkerMaxHeap : defaultWorkerMaxHeap; return (int) Math.ceil(getEstimatedTotalHeapMemoryRequiredByTopo(topoConf, topology) / maxHeapSize); }

Target:
public static int getEstimatedWorkerCountForRASTopo(Map<String, Object> topoConf, StormTopology topology) throws InvalidTopologyException { Double defaultWorkerMaxHeap = ObjectReader.getDouble(topoConf.get(Config.WORKER_HEAP_MEMORY_MB), 768d); Double topologyWorkerMaxHeap = ObjectReader.getDouble(topoConf.get(Config.TOPOLOGY_WORKER_MAX_HEAP_SIZE_MB), defaultWorkerMaxHeap); return (int) Math.ceil(getEstimatedTotalHeapMemoryRequiredByTopo(topoConf, topology) / topologyWorkerMaxHeap); }
Source:
public void run() { log.startedClouderaManagerConfigMonitor(interval); isActive = true; while (isActive) { try { final List<String> clustersToStopMonitoring = new ArrayList<>(); for (Map.Entry<String, List<String>> entry : configCache.getClusterNames().entrySet()) { String address = entry.getKey(); for (String clusterName : entry.getValue()) { log.checkingClusterConfiguration(clusterName, address); if (!clusterReferencesExist(address, clusterName)) { clustersToStopMonitoring.add(address + FQCN_DELIM + clusterName); continue; } final List<StartEvent> relevantEvents = getRelevantEvents(address, clusterName); if (!relevantEvents.isEmpty()) { if (hasConfigChanged(address, clusterName, relevantEvents)) { notifyChangeListener(address, clusterName); } } } } for (String fqcn : clustersToStopMonitoring) { String[] parts = fqcn.split(FQCN_DELIM); stopMonitoring(parts[0], parts[1]); } clustersToStopMonitoring.clear(); waitFor(interval); } catch (Throwable t) { log.clouderaManagerConfigurationChangesMonitoringError(t); } } log.stoppedClouderaManagerConfigMonitor(); }

Target:
public void run() { log.startedClouderaManagerConfigMonitor(interval); isActive = true; while (isActive) { try { final List<String> clustersToStopMonitoring = new ArrayList<>(); for (Map.Entry<String, List<String>> entry : configCache.getClusterNames().entrySet()) { String address = entry.getKey(); for (String clusterName : entry.getValue()) { log.checkingClusterConfiguration(clusterName, address); if (!clusterReferencesExist(address, clusterName)) { clustersToStopMonitoring.add(address + FQCN_DELIM + clusterName); continue; } final List<StartEvent> relevantEvents = getRelevantEvents(address, clusterName); if (!relevantEvents.isEmpty()) { if (hasConfigChanged(address, clusterName, relevantEvents)) { notifyChangeListener(address, clusterName); } } } } for (String fqcn : clustersToStopMonitoring) { String[] parts = fqcn.split(FQCN_DELIM); stopMonitoring(parts[0], parts[1]); } clustersToStopMonitoring.clear(); waitFor(interval); } catch (Exception e) { log.clouderaManagerConfigurationChangesMonitoringError(e); } } log.stoppedClouderaManagerConfigMonitor(); }
Source:
@DataBoundSetter public void setExcludes(String excludes) { this.excludes = excludes; }

Target:
@DataBoundSetter public void setExcludes(String excludes) { this.excludes = Util.fixEmpty(excludes); }
Source:
public Optional<PlanNodeStatsEstimate> calculate(UnnestNode node, StatsProvider statsProvider, Lookup lookup, Session session, TypeProvider types) { PlanNodeStatsEstimate sourceStats = statsProvider.getStats(node.getSource()); PlanNodeStatsEstimate.Builder calculatedStats = PlanNodeStatsEstimate.builder(); if (sourceStats.getOutputRowCount() <= UPPER_BOUND_ROW_COUNT_FOR_ESTIMATION) { calculatedStats.setOutputRowCount(sourceStats.getOutputRowCount()); } else { calculatedStats.setOutputRowCount(NaN); } for (Symbol symbol : node.getReplicateSymbols()) { calculatedStats.addSymbolStatistics(symbol, sourceStats.getSymbolStatistics(symbol)); } for (Map.Entry<Symbol, List<Symbol>> entry : node.getUnnestSymbols().entrySet()) { List<Symbol> unnestToSymbols = entry.getValue(); SymbolStatsEstimate stats = sourceStats.getSymbolStatistics(entry.getKey()); for (Symbol symbol : unnestToSymbols) { calculatedStats.addSymbolStatistics( symbol, SymbolStatsEstimate.builder() .setNullsFraction(stats.getNullsFraction()) .setAverageRowSize(stats.getAverageRowSize()) .setDistinctValuesCount(stats.getDistinctValuesCount()) .build()); } } if (node.getOrdinalitySymbol().isPresent()) { calculatedStats.addSymbolStatistics( node.getOrdinalitySymbol().get(), SymbolStatsEstimate.builder() .setAverageRowSize(8) .setLowValue(0) .setNullsFraction(0) .build()); } return Optional.of(calculatedStats.build()); }

Target:
public Optional<PlanNodeStatsEstimate> calculate(UnnestNode node, StatsProvider statsProvider, Lookup lookup, Session session, TypeProvider types) { PlanNodeStatsEstimate sourceStats = statsProvider.getStats(node.getSource()); PlanNodeStatsEstimate.Builder calculatedStats = PlanNodeStatsEstimate.builder(); if (sourceStats.getOutputRowCount() > UPPER_BOUND_ROW_COUNT_FOR_ESTIMATION) { return Optional.empty(); } calculatedStats.setOutputRowCount(sourceStats.getOutputRowCount()); for (Symbol symbol : node.getReplicateSymbols()) { calculatedStats.addSymbolStatistics(symbol, sourceStats.getSymbolStatistics(symbol)); } for (Map.Entry<Symbol, List<Symbol>> entry : node.getUnnestSymbols().entrySet()) { List<Symbol> unnestToSymbols = entry.getValue(); SymbolStatsEstimate stats = sourceStats.getSymbolStatistics(entry.getKey()); for (Symbol symbol : unnestToSymbols) { calculatedStats.addSymbolStatistics( symbol, SymbolStatsEstimate.builder() .setAverageRowSize(stats.getAverageRowSize()) .build()); } } if (node.getOrdinalitySymbol().isPresent()) { calculatedStats.addSymbolStatistics( node.getOrdinalitySymbol().get(), SymbolStatsEstimate.builder() .setLowValue(0) .setNullsFraction(0) .build()); } return Optional.of(calculatedStats.build()); }
Source:
private <C extends org.atlasapi.content.Content> C setContentFields(C c, Content input) { c.setYear(input.getYear()); c.setLanguages(input.getLanguages()); c.setTags(translateTopicRefs(input.getTopicRefs())); c.setGenericDescription(input.getGenericDescription()); c.setEventRefs(translateEventRefs(input.events())); c.setCertificates(Iterables.transform( input.getCertificates(), new Function<Certificate, org.atlasapi.content.Certificate>() { @Override public org.atlasapi.content.Certificate apply(Certificate input) { return new org.atlasapi.content.Certificate( input.classification(), input.country() ); } } )); c.setClips( Optional.ofNullable(input.getClips()).orElse(ImmutableList.of()).stream().map( legacyClip -> { org.atlasapi.content.Clip newClip = new org.atlasapi.content.Clip( legacyClip.getCanonicalUri(), legacyClip.getCanonicalUri(), legacyClip.getPublisher() ); newClip.setClipOf(legacyClip.getClipOf()); return newClip; } ).collect(Collectors.toList()) ); c.setPeople( input.people().stream() .map(legacyCrewMemberTransformer::apply) .filter(java.util.Objects::isNull) .collect(Collectors.toList()) ); transformEncodings(c, input.getVersions()); return c; }

Target:
private <C extends org.atlasapi.content.Content> C setContentFields(C c, Content input) { c.setYear(input.getYear()); c.setLanguages(input.getLanguages()); c.setTags(translateTopicRefs(input.getTopicRefs())); c.setGenericDescription(input.getGenericDescription()); c.setEventRefs(translateEventRefs(input.events())); c.setCertificates(Iterables.transform( input.getCertificates(), new Function<Certificate, org.atlasapi.content.Certificate>() { @Override public org.atlasapi.content.Certificate apply(Certificate input) { return new org.atlasapi.content.Certificate( input.classification(), input.country() ); } } )); c.setClips( Optional.ofNullable(input.getClips()).orElse(ImmutableList.of()).stream().map( legacyClip -> { org.atlasapi.content.Clip newClip = new org.atlasapi.content.Clip( legacyClip.getCanonicalUri(), legacyClip.getCanonicalUri(), legacyClip.getPublisher() ); newClip.setClipOf(legacyClip.getClipOf()); return newClip; } ).collect(Collectors.toList()) ); c.setPeople( input.people().stream() .map(legacyCrewMemberTransformer::apply) .filter(java.util.Objects::nonNull) .collect(Collectors.toList()) ); transformEncodings(c, input.getVersions()); return c; }
Source:
public void testAsFastqRecord() throws Exception { final SAMRecord record = new SAMRecordSetBuilder().addFrag("test", 0, 1, false, false, "10M", null, 2); record.setReadPairedFlag(true); record.setFirstOfPairFlag(true); testRecord(record.getReadName() + FastqConstants.FIRST_OF_PAIR, FastqEncoder.asFastqRecord(record), record); record.setFirstOfPairFlag(false); record.setSecondOfPairFlag(true); testRecord(record.getReadName() + FastqConstants.SECOND_OF_PAIR, FastqEncoder.asFastqRecord(record), record); record.setSecondOfPairFlag(false); testRecord(record.getReadName(), FastqEncoder.asFastqRecord(record), record); record.setAttribute("CO", "Comment in SAM tag"); testRecord(record.getReadName(), FastqEncoder.asFastqRecord(record), record); }

Target:
public void testAsFastqRecord() throws Exception { final SAMRecord record = new SAMRecordSetBuilder().addFrag("test", 0, 1, false, false, "10M", null, 2); record.setReadPairedFlag(true); record.setFirstOfPairFlag(true); testRecord(record.getReadName() + FastqConstants.FIRST_OF_PAIR, FastqEncoder.asFastqRecord(record), record); record.setFirstOfPairFlag(false); record.setSecondOfPairFlag(true); testRecord(record.getReadName() + FastqConstants.SECOND_OF_PAIR, FastqEncoder.asFastqRecord(record), record); record.setSecondOfPairFlag(false); testRecord(record.getReadName(), FastqEncoder.asFastqRecord(record), record); record.setAttribute(SAMTag.CO.name(), "Comment in SAM tag"); testRecord(record.getReadName(), FastqEncoder.asFastqRecord(record), record); }
Source:
private String readContent(HttpResponse response) { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); } catch (IOException e) { e.printStackTrace(); } return reader.lines().collect(Collectors.joining()); }

Target:
private String readContent(HttpResponse response) throws IOException { BufferedReader reader = new BufferedReader( new InputStreamReader(response.getEntity().getContent())); return reader.lines().collect(Collectors.joining()); }
Source:
private boolean endResponse(LastHttpContent trailer) { synchronized (conn) { HttpClientRequestImpl req = request; if (conn.metrics != null) { Object reqMetric = req.metric(); if (req.exceptionOccurred != null) { conn.metrics.requestReset(reqMetric); } else { conn.metrics.responseEnd(reqMetric, response); } } VertxTracer tracer = context.tracer(); if (tracer != null) { List<Map.Entry<String, String>> tags = Collections.singletonList(new AbstractMap.SimpleEntry<>("http.status_code", "" + response.statusCode())); tracer.receiveResponse(context, response, trace, null, tags); } trailers = new HeadersAdaptor(trailer.trailingHeaders()); if (queue.isEmpty() && !queue.isPaused()) { response.handleEnd(trailers); } responseEnded = true; conn.close |= !conn.options.isKeepAlive(); conn.doResume(); return requestEnded; } }

Target:
private boolean endResponse(LastHttpContent trailer) { synchronized (conn) { HttpClientRequestImpl req = request; if (conn.metrics != null) { Object reqMetric = req.metric(); if (req.exceptionOccurred != null) { conn.metrics.requestReset(reqMetric); } else { conn.metrics.responseEnd(reqMetric, response); } } VertxTracer tracer = context.tracer(); if (tracer != null) { tracer.receiveResponse(context, response, trace, null, HttpUtils.CLIENT_RESPONSE_TAG_EXTRACTOR); } trailers = new HeadersAdaptor(trailer.trailingHeaders()); if (queue.isEmpty() && !queue.isPaused()) { response.handleEnd(trailers); } responseEnded = true; conn.close |= !conn.options.isKeepAlive(); conn.doResume(); return requestEnded; } }
Source:
private <K, V> void forward(final ProcessorNode<K, V> child, final K key, final V value) { setCurrentNode(child); child.process(key, value); if (child.children().isEmpty()) { streamTask.maybeRecordE2ELatency(timestamp(), child.name()); } }

Target:
private <K, V> void forward(final ProcessorNode<K, V> child, final K key, final V value) { setCurrentNode(child); child.process(key, value); if (child.isTerminalNode()) { streamTask.maybeRecordE2ELatency(timestamp(), child.name()); } }
Source:
public ASTNode visit(Configuration node, Void _) { Cell cell = new Cell(); cell.setLabel(MetaK.Constants.pathCondition); cell.setEllipses(Ellipses.NONE); if (PC) { Variable pc = new Variable(PC_VAR, Sort.of("Bool")); cell.setContents(pc); context.configVarSorts.put(pc.getName(), pc.getSort()); } else cell.setContents(BoolBuiltin.TRUE); Term body = node.getBody(); if (body instanceof Cell) { Cell topCell = (Cell) body; if (topCell.getLabel() .equals(MetaK.Constants.generatedTopCellLabel)) { node = node.shallowCopy(); node.setBody(addSubcellToCell(topCell, cell)); return node; } } return node; }

Target:
public ASTNode visit(Configuration node, Void _) { Cell cell = new Cell(); cell.setLabel(MetaK.Constants.pathCondition); cell.setEllipses(Ellipses.NONE); if (PC) { Variable pc = new Variable(PC_VAR, Sort.BOOL); cell.setContents(pc); context.configVarSorts.put(pc.getName(), pc.getSort()); } else cell.setContents(BoolBuiltin.TRUE); Term body = node.getBody(); if (body instanceof Cell) { Cell topCell = (Cell) body; if (topCell.getLabel() .equals(MetaK.Constants.generatedTopCellLabel)) { node = node.shallowCopy(); node.setBody(addSubcellToCell(topCell, cell)); return node; } } return node; }
Source:
public static JSONObject expandKeysInPlace (JSONObject base) throws JSONException { for (String key: JSONObject.getNames(base)) { Object value = base.get(key); if (value == null) { System.out.println("Key: " + key + "Base: " + base); } if (value instanceof JSONObject) expandKeysInPlace((JSONObject) value); if (value instanceof JSONArray) expandKeysInPlace((JSONArray) value); String[] subKeys = key.split("\\."); if (subKeys.length > 1) { base.remove(key); JSONObject target = base; for (int i=0; i<subKeys.length-1; ++i) { if (!target.has(subKeys[i])) target.put(subKeys[i], new JSONObject()); if (!(target.get(subKeys[i]) instanceof JSONObject)) throw new JSONException("Impossible to expand keys - location "+subKeys[i]+" already exists, and is not an object."); target = target.getJSONObject(subKeys[i]); } target.put(subKeys[subKeys.length-1], value); } } return base; }

Target:
public static JSONObject expandKeysInPlace (JSONObject base) throws JSONException { for (String key: JSONObject.getNames(base)) { Object value = base.get(key); if (value instanceof JSONObject) expandKeysInPlace((JSONObject) value); if (value instanceof JSONArray) expandKeysInPlace((JSONArray) value); String[] subKeys = key.split("\\."); if (subKeys.length > 1) { base.remove(key); JSONObject target = base; for (int i=0; i<subKeys.length-1; ++i) { if (!target.has(subKeys[i])) target.put(subKeys[i], new JSONObject()); if (!(target.get(subKeys[i]) instanceof JSONObject)) throw new JSONException("Impossible to expand keys - location "+subKeys[i]+" already exists, and is not an object."); target = target.getJSONObject(subKeys[i]); } target.put(subKeys[subKeys.length-1], value); } } return base; }
Source:
private AuditLogable createAuditLogable(AnsibleCommandConfig command, String taskName) { return AuditLogableImpl.createHostEvent( command.hosts().get(0), command.correlationId(), new HashMap<>() { { put("Message", taskName); put("PlayAction", command.playAction()); } } ); }

Target:
private AuditLogable createAuditLogable(AnsibleCommandConfig command, String taskName) { return AuditLogableImpl.createHostEvent( command.hosts().get(0), command.correlationId(), Map.of("Message", taskName, "PlayAction", command.playAction()) ); }
Source:
public void execute() throws MojoExecutionException { Log log = getLog(); ClassLoader cl = getMavenRuntimeClasspathClassLoader(); Properties userProps = loadPropertiesFromFile(cl, CHECKSTYLE_PROPERTIES_FILE); String ruleset = CHECKSTYLE_RULESET_DIR + "/" + rulesetType + ".xml"; String key = CHECKSTYLE_RULESET_USER_PROPERTY; URL rulesetLocation = cl.getResource(ruleset); String absoluteLocation = rulesetLocation.toString(); log.debug("Config file found at " + absoluteLocation); userProps.setProperty(key, absoluteLocation); Dependency dep = dependency(SMARTHOME_TOOLS_GROUP_ID, SMARTHOME_TOOLS_ARTIFACT_ID, mavenProject.getVersion()); Dependency checktyle = dependency("com.puppycrawl.tools", "checkstyle", "7.2"); Xpp3Dom config = configuration(element("sourceDirectory", mavenProject.getBasedir().toString())); executeCheck(MAVEN_CHECKSTYLE_PLUGIN_GROUP_ID, MAVEN_CHECKSTYLE_PLUGIN_ARTIFACT_ID, checkstyleMavenVersion, MAVEN_CHECKSTYLE_PLUGIN_GOAL, config, dep,checktyle); log.debug("Checkstyle execution has been finished."); }

Target:
public void execute() throws MojoExecutionException { Log log = getLog(); ClassLoader cl = getMavenRuntimeClasspathClassLoader(); Properties userProps = loadPropertiesFromFile(cl, CHECKSTYLE_PROPERTIES_FILE); String ruleset = CHECKSTYLE_RULESET_DIR + "/" + rulesetType + ".xml"; String key = CHECKSTYLE_RULESET_USER_PROPERTY; URL rulesetLocation = cl.getResource(ruleset); String absoluteLocation = rulesetLocation.toString(); log.debug("Config file found at " + absoluteLocation); userProps.setProperty(key, absoluteLocation); Dependency checktyle = dependency("com.puppycrawl.tools", "checkstyle", "7.2"); Dependency[] allDependencies = getDependencies(checkstylePlugins, checktyle); Xpp3Dom config = configuration(element("sourceDirectory", mavenProject.getBasedir().toString())); executeCheck(MAVEN_CHECKSTYLE_PLUGIN_GROUP_ID, MAVEN_CHECKSTYLE_PLUGIN_ARTIFACT_ID, checkstyleMavenVersion, MAVEN_CHECKSTYLE_PLUGIN_GOAL, config, allDependencies); log.debug("Checkstyle execution has been finished."); }
Source:
public void addEvent(ITimeEvent event) { if (!(event instanceof TimeLineEvent)) { throw new IllegalArgumentException("Need to be a TimeLineEvent"); } super.addEvent(event); }

Target:
public void addEvent(ITimeEvent event) { if (!(event instanceof TimeLineEvent)) { throw new IllegalArgumentException("Needs to be a TimeLineEvent"); } super.addEvent(event); }
Source:
public boolean equals(final Object o) { if (!super.equals(o)) { return false; } final ArrayOfDoublesSketchMultiPostAggregator that = (ArrayOfDoublesSketchMultiPostAggregator) o; return fields.equals(that.fields); }

Target:
public boolean equals(final Object o) { if (!super.equals(o)) { return false; } if (o == null || getClass() != o.getClass()) { return false; } final ArrayOfDoublesSketchMultiPostAggregator that = (ArrayOfDoublesSketchMultiPostAggregator) o; return fields.equals(that.fields); }