auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Object isSlaFailed() { final ExecutableFlow flow; try { flow = this.executorLoader.fetchExecutableFlow(this.execId); logger.info("Flow for execid " + this.execId + " is " + flow.toString()); } catch (final ExecutorManagerException e) { logger.error("Can't get executable flow.", e); // something wrong, send out alerts return true; } return isSlaMissed(flow); }

Target:
public Object isSlaFailed() { final ExecutableFlow flow; try { flow = this.executorLoader.fetchExecutableFlow(this.execId); logger.info("Flow for execid " + this.execId + " is " + flow.getId()); } catch (final ExecutorManagerException e) { logger.error("Can't get executable flow.", e); // something wrong, send out alerts return true; } return isSlaMissed(flow); }
Source:
private void write(final String string) { // If logs are looping, write message to system's stderr then rebind. if (logIsLooping()) { unbindStdOutAndErrToLog(); System.err.println(string); bindStdOutAndErrToLog(); } else { logger.log(this.level, string); } }

Target:
private void write(final String string) { logger.log(this.level, string); }
Source:
private static String getSqlScriptsDir() throws IOException { // Dummy because any resource file works. final String dummyResourcePath = getUserManagerXmlFile(); Path resources = Paths.get(dummyResourcePath).getParent(); Path azkabanRoot = resources.getParent().getParent().getParent().getParent(); File sqlScriptDir = Paths.get(azkabanRoot.toString(), AZKABAN_DB_SQL_PATH).toFile(); return props.getString(AzkabanDatabaseSetup.DATABASE_SQL_SCRIPT_DIR, sqlScriptDir.getCanonicalPath()); }

Target:
private static String getSqlScriptsDir() throws IOException { // Dummy because any resource file works. final String dummyResourcePath = getUserManagerXmlFile(); Path resources = Paths.get(dummyResourcePath).getParent(); Path azkabanRoot = resources.getParent().getParent().getParent().getParent(); File sqlScriptDir = Paths.get(azkabanRoot.toString(), AZKABAN_DB_SQL_PATH).toFile(); return sqlScriptDir.getCanonicalPath(); }
Source:
private void attachKafkaAppender(KafkaLog4jAppender appender) { // If present, remove the existing kafka appender if (kafkaAppender.isPresent()) { removeAppender(kafkaAppender); flowLogger.info("Removed old Kafka appender for job " + this.jobId); } kafkaAppender = Optional.of(appender); logger.addAppender(kafkaAppender.get()); logger.setAdditivity(false); flowLogger.info("Attached new Kafka appender for job " + this.jobId); }

Target:
private void attachKafkaAppender(KafkaLog4jAppender appender) { // This should only be called once assert(!kafkaAppender.isPresent()); kafkaAppender = Optional.of(appender); logger.addAppender(kafkaAppender.get()); logger.setAdditivity(false); flowLogger.info("Attached new Kafka appender for job " + this.jobId); }
Source:
public static boolean isCronExpressionValid(String cronExpression, DateTimeZone timezone) { if (!CronExpression.isValidExpression(cronExpression)) { return false; } else { CronExpression cronExecutionTime = parseCronExpression(cronExpression, timezone); if (cronExecutionTime == null || cronExecutionTime.getNextValidTimeAfter(new Date()) == null) { return false; } return true; } }

Target:
public static boolean isCronExpressionValid(String cronExpression, DateTimeZone timezone) { if (!CronExpression.isValidExpression(cronExpression)) { return false; } /* * The below code is aimed at checking some cases that the above code can not identify, * e.g. <0 0 3 ? * * 22> OR <0 0 3 ? * 8>. Under these cases, the below code is able to tell. */ CronExpression cronExecutionTime = parseCronExpression(cronExpression, timezone); if (cronExecutionTime == null || cronExecutionTime.getNextValidTimeAfter(new Date()) == null) { return false; } return true; }
Source:
protected synchronized void preTrackingEventMethod() { // nothing to finalize value is already updated }

Target:
protected void preTrackingEventMethod() { // nothing to finalize value is already updated }
Source:
private void persist(LocalDocument doc) throws IOException, JsonException { logger.debug("Saving document to RemotePipeline.."); if(!remotePipeline.save(doc)) { // TODO: Why are we cloning here? LocalDocument ld = new LocalDocument(doc); IOException e = new IOException("Unable to save changes to core"); if(!onException(ld, e)) { logger.error("Unable to persist an error to the database for doc '" + doc.getID() + "'", e); } } }

Target:
private void persist(LocalDocument doc) throws IOException, JsonException { logger.debug("Saving document to RemotePipeline.."); if(!remotePipeline.save(doc)) { IOException e = new IOException("Unable to save changes to core"); if(!onException(doc, e)) { logger.error("Unable to persist an error to the database for doc '" + doc.getID() + "'", e); } } }
Source:
public String getLeadingImageEditLang() { return isTranslation ? targetSummary.getPageTitle().getWikiSite().languageCode() : sourceSummary.getPageTitle().getWikiSite().languageCode(); }

Target:
public String getLeadingImageEditLang() { if (isTranslation ? (targetSummary == null || sourceSummary == null) : sourceSummary == null) { return null; } return isTranslation ? targetSummary.getPageTitle().getWikiSite().languageCode() : sourceSummary.getPageTitle().getWikiSite().languageCode(); }
Source:
void setFadeEnabled(boolean enabled) { fadeEnabled = enabled; // to avoid the toolbar applies the opacity before image loaded pageFragment.getWebView().postDelayed(this::update, DELAY_UPDATE_MS); }

Target:
void setFadeEnabled(boolean enabled) { fadeEnabled = enabled; update(); }
Source:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); getWindow().setStatusBarColor(Color.TRANSPARENT); // TODO: translucent status will affect the navigation bar color? getWindow().setNavigationBarColor(0); }

Target:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); getWindow().setStatusBarColor(Color.TRANSPARENT); }
Source:
public List<BranchProperty> getPropertiesFor(SCMHead head) { List<BranchProperty> properties = new ArrayList<>(); for (Named named : namedExceptions) { if (named.isMatch(head)) { properties.addAll(named.getProps()); } } if (properties.isEmpty()) { // if no one defined adds default properties.addAll(defaultProperties); } return properties; }

Target:
public List<BranchProperty> getPropertiesFor(SCMHead head) { for (Named named : namedExceptions) { if (named.isMatch(head)) { return new ArrayList<>(named.getProps()); } } return new ArrayList<>(defaultProperties); }
Source:
public FreeStyleProject newInstance(Branch branch) { FreeStyleProject job = new FreeStyleProject(getOwner(), branch.getName()); job.onCreatedFromScratch(); FreeStyleProject spied = spy(job); // Do nothing.. Running the actual build is not desired/required (and not possible) in this tests. when(spied.scheduleBuild()).thenReturn(false); setBranch(spied, branch); return spied; }

Target:
public FreeStyleProject newInstance(Branch branch) { FreeStyleProject job = new FreeStyleProject(getOwner(), branch.getName()); FreeStyleProject spied = spy(job); // Do nothing.. Running the actual build is not desired/required (and not possible) in this tests. when(spied.scheduleBuild()).thenReturn(false); setBranch(spied, branch); return spied; }
Source:
@Override protected boolean isApplicable(MultiBranchProjectDescriptor projectDescriptor) { for (BranchProjectFactoryDescriptor d : projectDescriptor.getProjectFactoryDescriptors()) { Type factoryType = Types.getBaseClass(d.clazz, BranchProjectFactory.class); Type jobType = Types.getTypeArgument(factoryType, 0, /* if using rawtypes, err on the conservative side */ Project.class); if (Project.class.isAssignableFrom(Types.erasure(jobType))) { return true; } } return false; }

Target:
protected boolean isApplicable(MultiBranchProjectDescriptor projectDescriptor) { for (BranchProjectFactoryDescriptor d : projectDescriptor.getProjectFactoryDescriptors()) { Type factoryType = Types.getBaseClass(d.clazz, BranchProjectFactory.class); Type jobType = Types.getTypeArgument(factoryType, 0, /* if using rawtypes, err on the conservative side */ Project.class); if (Project.class.isAssignableFrom(Types.erasure(jobType))) { return true; } } return false; }
Source:
StreamSession deriveSession(StreamMessage message) { // StreamInitMessage starts a new channel, and IncomingStreamMessage potentially, as well. // IncomingStreamMessage needs a session to be established a priori, though StreamSession streamSession = message.getOrCreateSession(channel); if (streamSession == null) throw new IllegalStateException(createLogTag(null, channel) + " no session found for message " + message); // Attach this channel to the session: this only happens upon receiving the first init message as a follower; // in all other cases, no new control channel will be added, as the proper control channel will be already attached. streamSession.attachInbound(channel, message instanceof StreamInitMessage); return streamSession; }

Target:
StreamSession deriveSession(StreamMessage message) { // StreamInitMessage starts a new channel here, but IncomingStreamMessage needs a session // to be established a priori StreamSession streamSession = message.getOrCreateSession(channel); // Attach this channel to the session: this only happens upon receiving the first init message as a follower; // in all other cases, no new control channel will be added, as the proper control channel will be already attached. streamSession.attachInbound(channel, message instanceof StreamInitMessage); return streamSession; }
Source:
public static void applyPartitioner() { /* Hashing strategy */ if (conf.partitioner == null) { throw new ConfigurationException("Missing directive: partitioner", false); } String partitionerName = conf.partitioner; try { partitionerName = System.getProperty(Config.PROPERTY_PREFIX + "partitioner", conf.partitioner); partitioner = FBUtilities.newPartitioner(partitionerName); } catch (Exception e) { throw new ConfigurationException("Invalid partitioner class " + partitionerName, e); } paritionerName = partitioner.getClass().getCanonicalName(); }

Target:
public static void applyPartitioner() { applyPartitioner(conf); }
Source:
public static void before() { // This only works because the way CI works // In CI a new JVM is spun up for each test file, so this doesn't have to worry about another test file // getting this set first System.setProperty("cassandra.nodetool.jmx_notification_poll_interval_seconds", "1"); DatabaseDescriptor.clientInitialization(); }

Target:
public static void before() { // This only works because the way CI works // In CI a new JVM is spun up for each test file, so this doesn't have to worry about another test file // getting this set first System.setProperty("cassandra.nodetool.jmx_notification_poll_interval_seconds", "1"); }
Source:
public InternalNodeProbe(boolean withNotifications) throws IOException { super("", 0); this.withNotifications = withNotifications; connect(); // need to double "connect" since constructor calls connect; withNotifications isn't visable the first time }

Target:
public InternalNodeProbe(boolean withNotifications) { this.withNotifications = withNotifications; connect(); }
Source:
public boolean permit(int from, int to, IMessage msg) { for (Filter filter : filters) { if (filter.matches(from, to, msg)) return filter.permitIfMatched; } return true; }

Target:
public boolean permit(int from, int to, IMessage msg) { for (Filter filter : filters) { if (filter.matches(from, to, msg)) return false; } return true; }
Source:
private static int roundKey(int point, int roundSeconds) { int d = point % roundSeconds; if (d > 0) { point += roundSeconds - d; if (point == Cell.MAX_DELETION_TIME) // the rounding should not be a reason to mark point as unexpirable point = Cell.MAX_DELETION_TIME; else if (point < 0) // math overflow happen because of point was close to max possible value return Cell.MAX_DELETION_TIME; return point; } else return point; }

Target:
private static int roundKey(int point, int roundSeconds) { int d = point % roundSeconds; if (d == 0) return point; point += roundSeconds - d; if (point > Cell.MAX_DELETION_TIME) // the rounding should not be a reason to mark point as unexpirable return Cell.MAX_DELETION_TIME; else if (point < 0) // math overflow happen because of point was close to max possible value return Cell.MAX_DELETION_TIME; return point; }
Source:
public void add(Replica replica) { // can only add to full array - if we have sliced it, we must be a snapshot assert begin == 0; if (size == contents.length) { int newSize; if (size < 3) newSize = 3; else if (size < 9) newSize = 9; else newSize = size * 2; contents = Arrays.copyOf(contents, newSize); } contents[size++] = replica; }

Target:
public void add(Replica replica) { // can only add to full array - if we have sliced it, we must be a snapshot if (begin != 0) throw new IllegalStateException(); if (size == contents.length) { int newSize; if (size < 3) newSize = 3; else if (size < 9) newSize = 9; else newSize = size * 2; contents = Arrays.copyOf(contents, newSize); } contents[size++] = replica; }
Source:
public GitHubSource(String organization, String project, HttpClient httpClient, GitHubLastUpdateCache gitHubLastUpdateCache) { this.httpClient = httpClient; this.projectUrl = String.format("https://api.github.com/repos/%s/%s", organization, project); this.uniqueKey = organization + "@" + project; this.gson = new Gson(); // TODO think if that should be really a field this.cache = gitHubLastUpdateCache; }

Target:
public GitHubSource(String organization, String project, HttpClient httpClient, GitHubLastUpdateCache gitHubLastUpdateCache) { this.httpClient = httpClient; this.projectUrl = String.format("https://api.github.com/repos/%s/%s", organization, project); this.uniqueKey = organization + "@" + project; this.cache = gitHubLastUpdateCache; }
Source:
public void onStart(@NonNull LifecycleOwner owner) { isAppVisible = true; android.util.Log.i(TAG, "App is now visible."); executePendingContactSync(); }

Target:
public void onStart(@NonNull LifecycleOwner owner) { isAppVisible = true; Log.i(TAG, "App is now visible."); executePendingContactSync(); }
Source:
public void onStop(@NonNull LifecycleOwner owner) { isAppVisible = false; android.util.Log.i(TAG, "App is no longer visible."); }

Target:
public void onStop(@NonNull LifecycleOwner owner) { isAppVisible = false; Log.i(TAG, "App is no longer visible."); }
Source:
protected final void onSend(MasterSecret masterSecret) throws Exception { if (TextSecurePreferences.getSignedPreKeyFailureCount(context) > 5) { ApplicationContext.getInstance(context) .getJobManager() .add(new RotateSignedPreKeyJob(context)); throw new TextSecureExpiredException("Too many signed prekey rotation failures"); } try { onPushSend(); TextSecurePreferences.setNeedsOutageCheck(context, false); } catch (Exception e) { TextSecurePreferences.setNeedsOutageCheck(context, true); throw e; } }

Target:
protected final void onSend(MasterSecret masterSecret) throws Exception { if (TextSecurePreferences.getSignedPreKeyFailureCount(context) > 5) { ApplicationContext.getInstance(context) .getJobManager() .add(new RotateSignedPreKeyJob(context)); throw new TextSecureExpiredException("Too many signed prekey rotation failures"); } onPushSend(); }
Source:
private static File getPlaintextExportFile() throws NoExternalStorageException { File backup = PlaintextBackupExporter.getPlaintextExportFile(); File oldBackup = new File(Environment.getExternalStorageDirectory(), "TextSecurePlaintextBackup.xml"); if (!backup.exists() && oldBackup.exists()) { return oldBackup; } return backup; }

Target:
private static File getPlaintextExportFile() throws NoExternalStorageException { File backup = PlaintextBackupExporter.getPlaintextExportFile(); File oldBackup = new File(Environment.getExternalStorageDirectory(), "TextSecurePlaintextBackup.xml"); return !backup.exists() && oldBackup.exists() ? oldBackup : backup; }
Source:
public static File getSignalStorageDir() throws NoExternalStorageException { final File storage = Environment.getExternalStorageDirectory(); if (!storage.canWrite()) throw new NoExternalStorageException(); return storage; }

Target:
private static File getSignalStorageDir() throws NoExternalStorageException { final File storage = Environment.getExternalStorageDirectory(); if (!storage.canWrite()) { throw new NoExternalStorageException(); } return storage; }
Source:
int getWidthAdjustment() { int width = recordButtonFab.getWidth() / 4; return ViewCompat.getLayoutDirection(recordButtonFab) == LAYOUT_DIRECTION_LTR ? -width : width; }

Target:
private int getWidthAdjustment() { int width = recordButtonFab.getWidth() / 4; return ViewCompat.getLayoutDirection(recordButtonFab) == ViewCompat.LAYOUT_DIRECTION_LTR ? -width : width; }
Source:
public static void setRegistered(Context context, boolean registered) { setBooleanPreference(context, REGISTERED_PREF, registered); if (isGooglePlayServicesAvailable(context)) { setPushRegistered(context, registered); } }

Target:
public static void setRegistered(Context context, boolean registered) { setBooleanPreference(context, REGISTERED_PREF, registered); }
Source:
public void setLed() { String ledColor = TextSecurePreferences.getNotificationLedColor(context); String ledBlinkPattern = TextSecurePreferences.getNotificationLedPattern(context); String ledBlinkPatternCustom = TextSecurePreferences.getNotificationLedPatternCustom(context); if (!ledColor.equals("none")) { String[] blinkPatternArray = parseBlinkPattern(ledBlinkPattern, ledBlinkPatternCustom); setLights(Color.parseColor(ledColor), Integer.parseInt(blinkPatternArray[0]), Integer.parseInt(blinkPatternArray[1])); } }

Target:
private void setLed() { String ledColor = TextSecurePreferences.getNotificationLedColor(context); String ledBlinkPattern = TextSecurePreferences.getNotificationLedPattern(context); String ledBlinkPatternCustom = TextSecurePreferences.getNotificationLedPatternCustom(context); if (!ledColor.equals("none")) { String[] blinkPatternArray = parseBlinkPattern(ledBlinkPattern, ledBlinkPatternCustom); setLights(Color.parseColor(ledColor), Integer.parseInt(blinkPatternArray[0]), Integer.parseInt(blinkPatternArray[1])); } }
Source:
protected void onResume() { dynamicTheme.onCreate(this); super.onResume(); }

Target:
protected void onResume() { dynamicTheme.onResume(this); super.onResume(); }
Source:
private synchronized void terminate() { Log.w(TAG, "termination stack", new Exception()); lockManager.updatePhoneState(LockManager.PhoneState.PROCESSING); NotificationBarManager.setCallEnded(this); incomingRinger.stop(); if (outgoingRinger.isLooping()) { outgoingRinger.stop(); } if (currentCallManager != null) { currentCallManager.terminate(); currentCallManager = null; } shutdownAudio(); state = STATE_IDLE; lockManager.updatePhoneState(LockManager.PhoneState.IDLE); }

Target:
private synchronized void terminate() { Log.w(TAG, "termination stack", new Exception()); lockManager.updatePhoneState(LockManager.PhoneState.PROCESSING); NotificationBarManager.setCallEnded(this); incomingRinger.stop(); outgoingRinger.stop(); if (currentCallManager != null) { currentCallManager.terminate(); currentCallManager = null; } shutdownAudio(); state = STATE_IDLE; lockManager.updatePhoneState(LockManager.PhoneState.IDLE); }
Source:
public void stop() { if( mediaPlayer == null ) return; try { mediaPlayer.release(); mediaPlayer = null; } catch( IllegalStateException e ) { } currentSoundID = -1; }

Target:
public void stop() { if (mediaPlayer == null) return; mediaPlayer.release(); mediaPlayer = null; currentSoundID = -1; }
Source:
private String getMessageBody(String body) { if (TextSecurePreferences.isUnicodeStrippingEnabled(context)) { return new UnicodeFilter().filter(body); } else { return body; } }

Target:
private String getMessageBody(String body) { if (TextSecurePreferences.isUnicodeStrippingEnabled(context)) { return UnicodeFilter.filter(body); } else { return body; } }
Source:
private void notifyAllListeners() { List<Listener<T>> localListeners; synchronized (this) { notifyAll(); localListeners = new LinkedList<>(listeners); } for (Listener<T> listener : localListeners) { notifyListener(listener); } }

Target:
private void notifyAllListeners() { List<Listener<T>> localListeners; synchronized (this) { localListeners = new LinkedList<>(listeners); } for (Listener<T> listener : localListeners) { notifyListener(listener); } }
Source:
private static String getPlaintextExportDirectoryPath() { File sdDirectory = Environment.getExternalStorageDirectory(); File signalBackup = new File(sdDirectory.getAbsolutePath() + File.separator, "SignalPlaintextBackup.xml"); if(signalBackup.exists()) { return sdDirectory.getAbsolutePath() + File.separator + "SignalPlaintextBackup.xml"; } else { return sdDirectory.getAbsolutePath() + File.separator + "TextSecurePlaintextBackup.xml"; } }

Target:
private static String getPlaintextExportDirectoryPath() { File sdDirectory = Environment.getExternalStorageDirectory(); File signalBackup = new File(sdDirectory.getAbsolutePath(), "SignalPlaintextBackup.xml"); if (signalBackup.exists()) { return sdDirectory.getAbsolutePath() + File.separator + "SignalPlaintextBackup.xml"; } else { return sdDirectory.getAbsolutePath() + File.separator + "TextSecurePlaintextBackup.xml"; } }
Source:
@Override protected void onDestroy() { super.onDestroy(); if (recipients != null) recipients.removeListener(this); }

Target:
protected void onDestroy() { super.onDestroy(); if (recipients != null) recipients.removeListener(this); }
Source:
private void onSecurityUpdated() { initializeDraft(); updateInviteReminder(); }

Target:
private void onSecurityUpdated() { updateInviteReminder(); }
Source:
public static GroupDescription getDescription(@NonNull Context context, @Nullable String encodedGroup) { if (encodedGroup == null) { return new GroupDescription(context, null); } try { GroupContext groupContext = GroupContext.parseFrom(Base64.decode(encodedGroup)); return new GroupDescription(context, groupContext); } catch (IOException e) { Log.w(TAG, e); return new GroupDescription(context, null); } }

Target:
public static @NonNull GroupDescription getDescription(@NonNull Context context, @Nullable String encodedGroup) { if (encodedGroup == null) { return new GroupDescription(context, null); } try { GroupContext groupContext = GroupContext.parseFrom(Base64.decode(encodedGroup)); return new GroupDescription(context, groupContext); } catch (IOException e) { Log.w(TAG, e); return new GroupDescription(context, null); } }
Source:
private String parsePath() throws URISyntaxException { String[] parts = uri.split("\\?")[0].split(":", 2); if (parts.length < 2 || parts[1].isEmpty()){ throw new URISyntaxException(uri, "invalid path"); } else if (parts[1].contains("%")){ return URLDecoder.decode(parts[1]); }else{ return parts[1]; } }

Target:
private String parsePath() throws URISyntaxException { String[] parts = uri.split("\\?")[0].split(":", 2); if (parts.length < 2 || parts[1].isEmpty()) throw new URISyntaxException(uri, "invalid path"); else return parts[1]; }
Source:
protected final void onCreate(Bundle savedInstanceState) { onPreCreate(); final MasterSecret masterSecret = KeyCachingService.getMasterSecret(this); routeApplicationState(masterSecret); super.onCreate(savedInstanceState); if (!isFinishing()) { Glide.get(this).register(Uri.class, InputStream.class, new EncryptedStreamUriLoader.Factory(masterSecret)); initializeClearKeyReceiver(); onCreate(savedInstanceState, masterSecret); } }

Target:
protected final void onCreate(Bundle savedInstanceState) { onPreCreate(); final MasterSecret masterSecret = KeyCachingService.getMasterSecret(this); routeApplicationState(masterSecret); super.onCreate(savedInstanceState); if (!isFinishing()) { initializeClearKeyReceiver(); onCreate(savedInstanceState, masterSecret); } }
Source:
public static Locale getSelectedLocale(Context context) { String language[] = TextUtils.split(TextSecurePreferences.getLanguage(context), "_"); if (language[0].equals(DEFAULT)) { return Locale.getDefault(); } else if (language.length == 2) { return new Locale(language[0], language[1]); } else { return new Locale(language[0]); } }

Target:
private static Locale getSelectedLocale(Context context) { String language[] = TextUtils.split(TextSecurePreferences.getLanguage(context), "_"); if (language[0].equals(DEFAULT)) { return Locale.getDefault(); } else if (language.length == 2) { return new Locale(language[0], language[1]); } else { return new Locale(language[0]); } }
Source:
public Locale getCurrentLocale() { return (currentLocale != null) ? currentLocale : Locale.getDefault(); }

Target:
public Locale getCurrentLocale() { return currentLocale; }
Source:
public void bindView(View view, Context context, Cursor cursor) { if (masterSecret != null && masterCipher != null) { ThreadDatabase.Reader reader = threadDatabase.readerFor(cursor, masterSecret, masterCipher); ThreadRecord record = reader.getCurrent(); ((ConversationListItem)view).set(masterSecret, record, batchSet, clickListener, batchMode); } }

Target:
public void bindView(View view, Context context, Cursor cursor) { if (masterSecret != null) { ThreadDatabase.Reader reader = threadDatabase.readerFor(cursor, masterSecret); ThreadRecord record = reader.getCurrent(); ((ConversationListItem)view).set(record, batchSet, batchMode); } }
Source:
private static CharSequence getPassphraseSummary(Context context) { final int passphraseResId = R.string.preferences__passphrase_summary; final String onRes = context.getString(R.string.ApplicationPreferencesActivity_on); final String offRes = context.getString(R.string.ApplicationPreferencesActivity_off); if (TextSecurePreferences.isPasswordDisabled(context)) return context.getString(passphraseResId, offRes); return context.getString(passphraseResId, onRes); }

Target:
private static CharSequence getPassphraseSummary(Context context) { final int passphraseResId = R.string.preferences__passphrase_summary; final String onRes = context.getString(R.string.ApplicationPreferencesActivity_on); final String offRes = context.getString(R.string.ApplicationPreferencesActivity_off); if (TextSecurePreferences.isPasswordDisabled(context)) { return context.getString(passphraseResId, offRes); } else { return context.getString(passphraseResId, onRes); } }
Source:
public MessageDetailsRecipientAdapter(Context context, MasterSecret masterSecret, MessageRecord record, Recipients recipients) { super(); this.context = context; this.masterSecret = masterSecret; this.record = record; this.recipients = recipients; }

Target:
public MessageDetailsRecipientAdapter(Context context, MasterSecret masterSecret, MessageRecord record, Recipients recipients) { this.context = context; this.masterSecret = masterSecret; this.record = record; this.recipients = recipients; }
Source:
public static Bitmap rotateBitmap(Bitmap bitmap, int angle) { Matrix matrix = new Matrix(); matrix.postRotate(angle); return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); }

Target:
private static Bitmap rotateBitmap(Bitmap bitmap, int angle) { Matrix matrix = new Matrix(); matrix.postRotate(angle); return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); }
Source:
public static byte[] toByteArray(Bitmap bitmap) { if (bitmap == null) return null; ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); return stream.toByteArray(); }

Target:
public static byte[] toByteArray(Bitmap bitmap) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); return stream.toByteArray(); }
Source:
public void afterTextChanged(Editable s) { calculateCharactersRemaining(); updateSendButtonState(); }

Target:
public void afterTextChanged(Editable s) { calculateCharactersRemaining(); }
Source:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); break; case R.id.add_menu_item: startContactPicker(); break; } return super.onOptionsItemSelected(item); }

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.add_menu_item: startContactPicker(); break; } return super.onOptionsItemSelected(item); }
Source:
private void initializePreferences() { if (!MmsDownloadHelper.isMmsConnectionParametersAvailable(this, null, false)) { PreferenceManager.getDefaultSharedPreferences(this).edit() .putBoolean(ApplicationPreferencesActivity.ENABLE_MANUAL_MMS_PREF, true).commit(); addPreferencesFromResource(R.xml.mms_preferences); this.findPreference(ApplicationPreferencesActivity.ENABLE_MANUAL_MMS_PREF).setOnPreferenceChangeListener(new OverrideMmsChangeListener()); } else addPreferencesFromResource(R.xml.mms_preferences); }

Target:
private void initializePreferences() { if (!MmsDownloadHelper.isMmsConnectionParametersAvailable(this, null, false)) { PreferenceManager.getDefaultSharedPreferences(this).edit() .putBoolean(ApplicationPreferencesActivity.ENABLE_MANUAL_MMS_PREF, true).commit(); addPreferencesFromResource(R.xml.mms_preferences); this.findPreference(ApplicationPreferencesActivity.ENABLE_MANUAL_MMS_PREF).setOnPreferenceChangeListener(new OverrideMmsChangeListener()); } else { addPreferencesFromResource(R.xml.mms_preferences); } }
Source:
private void initializeMmsEnabledCheck() { new AsyncTask<Void, Void, Boolean>() { @Override protected Boolean doInBackground(Void... params) { return MmsSendHelper.hasNecessaryApnDetails(ConversationActivity.this); } @Override protected void onPostExecute(Boolean isMmsEnabled) { ConversationActivity.this.isMmsEnabled = isMmsEnabled; } }.execute(); Intent downloadStalledMmsIntent = new Intent(SendReceiveService.DOWNLOAD_STALLED_MMS_ACTION, null, this, SendReceiveService.class); startService(downloadStalledMmsIntent); }

Target:
private void initializeMmsEnabledCheck() { new AsyncTask<Void, Void, Boolean>() { @Override protected Boolean doInBackground(Void... params) { return MmsSendHelper.hasNecessaryApnDetails(ConversationActivity.this); } @Override protected void onPostExecute(Boolean isMmsEnabled) { ConversationActivity.this.isMmsEnabled = isMmsEnabled; } }.execute(); }
Source:
public void onDestroyActionMode(ActionMode mode) { ((ConversationListAdapter)getListAdapter()).initializeBatchMode(false); if (actionMode != null) { actionMode = null; batchMode = false; } }

Target:
public void onDestroyActionMode(ActionMode mode) { ((ConversationListAdapter)getListAdapter()).initializeBatchMode(false); batchMode = false; }
Source:
protected void appendChangeTimestampToDescription(StringBuilder description, JiraSite site, long timestamp) { DateFormat df = null; if (!StringUtils.isBlank(site.getDateTimePattern())) { df = new SimpleDateFormat(site.getDateTimePattern()); } else { // default format for current locale df = new SimpleDateFormat("d/M/yy hh:mm a", Locale.getDefault()); } Date changeDate = new Date(timestamp); String dateTimeString = df.format(changeDate); description.append(dateTimeString); }

Target:
protected void appendChangeTimestampToDescription(StringBuilder description, JiraSite site, long timestamp) { DateFormat df = null; if (StringUtils.isBlank(site.getDateTimePattern())) { // default format for current locale df = new SimpleDateFormat("d/M/yy hh:mm a", Locale.getDefault()); } else { df = new SimpleDateFormat(site.getDateTimePattern()); } Date changeDate = new Date(timestamp); String dateTimeString = df.format(changeDate); description.append(dateTimeString); }
Source:
private X509CRL loadRevokedCertificates(CertificateFactory cf, String crlFile) throws IOException, CRLException { // load the CRL X509CRL crl = null; try { FileInputStream fis = new FileInputStream(crlFile); crl = (X509CRL) cf.generateCRL(fis); fis.close(); } catch (FileNotFoundException ex) { } return crl; }

Target:
private X509CRL loadRevokedCertificates(CertificateFactory cf, String crlFile) throws IOException, CRLException { // load the CRL X509CRL crl = null; FileInputStream fis = null; try { new FileInputStream(crlFile); crl = (X509CRL) cf.generateCRL(fis); fis.close(); } catch (FileNotFoundException ex) { } finally { if ( fis != null ) { fis.close(); } } return crl; }
Source:
public void setEncoding(Encoding encoding) throws IOException { // Close down any old writer. if (encodingWriter != null) { encodingWriter.close(); } this.encoding = encoding; // Intercept flush() downcalls from the writer; our caller // will call PGStream.flush() as needed. OutputStream interceptor = new FilterOutputStream(pg_output) { @Override public void flush() throws IOException { } @Override public void close() throws IOException { super.flush(); } }; encodingWriter = encoding.getEncodingWriter(interceptor); }

Target:
public void setEncoding(Encoding encoding) throws IOException { // Close down any old writer. if (encodingWriter != null) encodingWriter.close(); this.encoding = encoding; // Intercept flush() downcalls from the writer; our caller // will call PGStream.flush() as needed. OutputStream interceptor = new FilterOutputStream(pg_output) { public void flush() throws IOException { } public void close() throws IOException { super.flush(); } }; encodingWriter = encoding.getEncodingWriter(interceptor); }
Source:
public ActivateMavenProfileJob(Action action, IProject project) { super(NLS.bind("{0} maven profile \"openshift\" for project {1}", action == Action.ACTIVATE? "Activating" : "Deactivating", project.getName())); this.action = action; this.project = project; // need to lock the whole workspace to prevent dead locks with other, concurrent // jobs that escalate to the workspace lock. setRule(ResourcesPlugin.getWorkspace().getRuleFactory().createRule(ResourcesPlugin.getWorkspace().getRoot())); }

Target:
public ActivateMavenProfileJob(Action action, IProject project) { super(NLS.bind("{0} maven profile \"openshift\" for project {1}", action == Action.ACTIVATE? "Activating" : "Deactivating", project.getName())); this.action = action; this.project = project; // need to lock the whole workspace to prevent dead locks with other, concurrent // jobs that escalate to the workspace lock. setRule(ResourcesPlugin.getWorkspace().getRoot()); }
Source:
public static String getProjectAbsolutePath(String... path) { // Construct path StringBuilder builder = new StringBuilder(); for (String fragment : path) { builder.append("/" + fragment); } String filePath = ""; filePath = System.getProperty("user.dir"); File file = new File(filePath + builder.toString()); if (!file.exists()) { throw new RedDeerException("Resource file does not exists within project path " + filePath + builder.toString()); } return file.getAbsolutePath(); }

Target:
public static String getProjectAbsolutePath(String... path) { // Construct path StringBuilder builder = new StringBuilder(); for (String fragment : path) { builder.append("/" + fragment); } String filePath = System.getProperty("user.dir"); File file = new File(filePath + builder.toString()); if (!file.exists()) { throw new RedDeerException("Resource file does not exists within project path " + filePath + builder.toString()); } return file.getAbsolutePath(); }
Source:
public static String getKind(String uniqueId) { if (StringUtils.isEmpty(uniqueId)) { return null; } String[] comps = uniqueId.split(String.valueOf(UNIQUE_ID_PROJECT_NAME_DELIMITER)); if (comps.length == 2) { return ResourceKind.SERVICE; } else { return comps[1]; } }

Target:
public static String getKind(String uniqueId) { if (StringUtils.isEmpty(uniqueId)) { return null; } String[] comps = uniqueId.split(String.valueOf(UNIQUE_ID_PROJECT_NAME_DELIMITER)); if (comps.length == 2) { return ResourceKind.SERVICE; } else if (comps.length == 3) { return comps[1]; } else { return null; } }
Source:
public IConnection update(IConnection conn) { Assert.isLegal(conn instanceof Connection); final Connection connection = (Connection) conn; // might be called from job, switch to display thread to access observables Display.getDefault().syncExec(new Runnable() { @Override public void run() { connection.setAuthScheme(IAuthorizationContext.AUTHSCHEME_OAUTH); connection.setToken((String) tokenObservable.getValue()); connection.setRememberToken((boolean) rememberTokenObservable.getValue()); } }); return connection; }

Target:
public IConnection update(IConnection conn) { Assert.isLegal(conn instanceof Connection); final Connection connection = (Connection) conn; // might be called from job, switch to display thread to access observables Display.getDefault().syncExec(new Runnable() { @Override public void run() { connection.setAuthScheme(IAuthorizationContext.AUTHSCHEME_OAUTH); connection.setToken(tokenObservable.getValue()); connection.setRememberToken(rememberTokenObservable.getValue()); } }); return connection; }
Source:
protected boolean isEapProfile() { // quick and dirty String profile = ServerProfileModel.getProfile(getServer()); if( "openshift3.eap".equals(profile)) { return false; } return true; }

Target:
protected boolean isEapProfile() { // quick and dirty String profile = ServerProfileModel.getProfile(getServer()); if( "openshift3.eap".equals(profile)) { return true; } return false; }
Source:
protected void refreshViewer(final Object object) { asyncViewerRefresh(new Runnable() { public void run() { synchronized (viewer) { final TreePath[] treePaths = viewer.getExpandedTreePaths(); if (object != null) { viewer.refresh(object); } else { viewer.refresh(); } viewer.setExpandedTreePaths(treePaths); } } }); }

Target:
protected void refreshViewer(final Object object) { asyncViewerRefresh(new Runnable() { public void run() { synchronized (viewer) { //final TreePath[] treePaths = viewer.getExpandedTreePaths(); if (object != null) { viewer.refresh(object); } else { viewer.refresh(); } // This line causes an endless load on linux when a node has zero children. (JCantrill) //viewer.setExpandedTreePaths(treePaths); } } }); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { try { WizardUtils.openWizardDialog(new NewApplicationWizard(), HandlerUtil.getActiveShell(event)); // This technically sends the wrong event for the wrong 'command' id, // but the refresh resource handler only looks at the selection... new RefreshResourceHandler().execute(event); } catch (ConnectionNotFoundException e) { return new Status(Status.ERROR, OpenShiftUIActivator.PLUGIN_ID, "Unable to find the connection", e); } return Status.OK_STATUS; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { try { WizardUtils.openWizardDialog(new NewApplicationWizard(), HandlerUtil.getActiveShell(event)); } catch (ConnectionNotFoundException e) { return new Status(Status.ERROR, OpenShiftUIActivator.PLUGIN_ID, "Unable to find the connection", e); } return Status.OK_STATUS; }
Source:
public void remoteInit() throws IOException, ExchangeException { try { exchangeMetaData = ((CoinbeneMarketDataService) marketDataService).getMetadata(); } catch (IOException e) { throw new IOException("Retrieving MetaData for Coinbene failed", e); } }

Target:
public void remoteInit() throws IOException, ExchangeException { exchangeMetaData = ((CoinbeneMarketDataService) marketDataService).getMetadata(); }
Source:
public boolean cancelOrder(String orderId) throws IOException { // if it doesn't return an error and CoingiOrder is returned, then the cancellation is // successful CoingiCancelOrderRequest request = new CoingiCancelOrderRequest(); request.setOrderId(orderId); CoingiOrder order; try { order = cancelCoingiOrder(request); } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } return order != null; }

Target:
public boolean cancelOrder(String orderId) throws IOException { try { // if it doesn't return an error and CoingiOrder is returned, then the cancellation is // successful CoingiCancelOrderRequest request = new CoingiCancelOrderRequest(); request.setOrderId(orderId); return cancelCoingiOrder(request) != null; } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } }
Source:
public List<Integer> findAllIDs() throws DataException { List<Map<String, Object>> allDocuments = findAllDocuments(); List<Integer> allIds = new ArrayList<>(); for (Map<String, Object> document : allDocuments) { allIds.add(Integer.parseInt((String) document.get("id"))); } return allIds; }

Target:
public List<Integer> findAllIDs() throws DataException { List<Integer> allIds = new ArrayList<>(); for (Map<String, Object> document : findAllDocuments()) { allIds.add(Integer.parseInt((String) document.get("id"))); } return allIds; }
Source:
public List<TaskDTO> loadData(int first, int pageSize, String sortField, SortOrder sortOrder, Map filters) throws DataException { String filter = ""; try { filter = ServiceManager.getFilterService().parsePrimeFacesFilter(filters); } catch (IllegalArgumentException e) { logger.error(e.getMessage()); } return findByQuery(createUserTaskQuery(filter), getSortBuilder(sortField, sortOrder), first, pageSize, false); }

Target:
public List<TaskDTO> loadData(int first, int pageSize, String sortField, SortOrder sortOrder, Map filters) throws DataException { String filter = ServiceManager.getFilterService().parsePrimeFacesFilter(filters); return findByQuery(createUserTaskQuery(filter), getSortBuilder(sortField, sortOrder), first, pageSize, false); }
Source:
public FormRow(Optional<MetadataViewInterface> optionalKeyView, Collection<T> values) { this.optionalKeyView = optionalKeyView; this.values = values; }

Target:
FormRow(Optional<MetadataViewInterface> optionalKeyView, Collection<T> values) { this.optionalKeyView = optionalKeyView; this.values = values; }
Source:
public void setYearBegin(MonthDay yearBegin) { this.yearBegin = yearBegin; }

Target:
void setYearBegin(MonthDay yearBegin) { this.yearBegin = yearBegin; }
Source:
public List<String> getTemplateDetails() throws Exception { int index = triggerRowToggle(templatesTable, "First template"); Thread.sleep(5000); WebElement detailsTable = Browser.getDriver() .findElement(By.id(TEMPLATE_TABLE + ":" + index + ":templateDetailTable")); Thread.sleep(5000); //TODO: find way to read this table without excpetion... //List<String> details = getTableDataByColumn(detailsTable, 1); //details.addAll(getTableDataByColumn(detailsTable, 3)); return new ArrayList<>(); }

Target:
public List<String> getTemplateDetails() { int index = triggerRowToggle(templatesTable, "First template"); WebElement detailsTable = Browser.getDriver() .findElement(By.id(TEMPLATE_TABLE + ":" + index + ":templateDetailTable")); //TODO: find way to read this table without excpetion... //List<String> details = getTableDataByColumn(detailsTable, 1); //details.addAll(getTableDataByColumn(detailsTable, 3)); return new ArrayList<>(); }
Source:
for (String regex : regexList) { if (name.matches(regex)) { fileOk = true; } }

Target:
for (String regex : regexList) { if (name.matches(regex)) { return true; } }
Source:
public static FileformatInterface parsePicaFormat(Node pica, PrefsInterface prefs) throws ReadException, PreferencesException, TypeNotAllowedForParentException { PicaPlusInterface pp = UghImplementation.INSTANCE.createPicaPlus(prefs); pp.read(pica); DigitalDocumentInterface dd = pp.getDigitalDocument(); FileformatInterface ff = UghImplementation.INSTANCE.createXStream(prefs); ff.setDigitalDocument(dd); /* BoundBook hinzufügen */ DocStructTypeInterface dst = prefs.getDocStrctTypeByName("BoundBook"); DocStructInterface dsBoundBook = dd.createDocStruct(dst); dd.setPhysicalDocStruct(dsBoundBook); return ff; }

Target:
public static FileformatInterface parsePicaFormat(Node pica, PrefsInterface prefs) throws ReadException, PreferencesException { PicaPlusInterface pp = UghImplementation.INSTANCE.createPicaPlus(prefs); pp.read(pica); DigitalDocumentInterface dd = pp.getDigitalDocument(); FileformatInterface ff = UghImplementation.INSTANCE.createXStream(prefs); ff.setDigitalDocument(dd); /* BoundBook hinzufügen */ DocStructTypeInterface dst = prefs.getDocStrctTypeByName("BoundBook"); DocStructInterface dsBoundBook = dd.createDocStruct(dst); dd.setPhysicalDocStruct(dsBoundBook); return ff; }
Source:
private String redirectToEdit(String urlSuffix) { try { String referrer = FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap() .get("referer"); String callerViewId = referrer.substring(referrer.lastIndexOf("/") + 1); if (!callerViewId.isEmpty() && callerViewId.contains("projects.jsf")) { return "/pages/rulesetEdit" + urlSuffix; } else { return "/pages/RegelsaetzeBearbeiten" + urlSuffix; } } catch (NullPointerException e) { // This NPE gets thrown - and therefore must be caught - when "RulesetForm" is // used from it's integration test // class "RulesetFormIT", where no "FacesContext" is available! return "/pages/ProjekteBearbeiten" + urlSuffix; } }

Target:
private String redirectToEdit(String urlSuffix) { try { String referrer = FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap() .get("referer"); String callerViewId = referrer.substring(referrer.lastIndexOf("/") + 1); if (!callerViewId.isEmpty() && callerViewId.contains("projects.jsf")) { return "/pages/rulesetEdit" + urlSuffix; } else { return "/pages/RegelsaetzeBearbeiten" + urlSuffix; } } catch (NullPointerException e) { // This NPE gets thrown - and therefore must be caught - when "RulesetForm" is // used from it's integration test // class "RulesetFormIT", where no "FacesContext" is available! return "/pages/RegelsaetzeBearbeiten" + urlSuffix; } }
Source:
public static Boolean updateHistoryForProcess(Process inProc) { Boolean updated; try { //TODO: updateHistoryForSteps overwrites result of updateHistory updated = updateHistory(inProc); updated = updateHistoryForSteps(inProc); } catch (Exception ex) { logger.warn("Updating history failed.", ex); logger.error(ex.getStackTrace()); updated = false; } return updated; }

Target:
public static Boolean updateHistoryForProcess(Process inProc) { Boolean updated; try { //TODO: updateHistoryForSteps overwrites result of updateHistory updated = updateHistory(inProc); updated = updateHistoryForSteps(inProc); } catch (Exception ex) { logger.warn("Updating history failed.", ex); updated = false; } return updated; }
Source:
public void setTimeout(long timeout) { this.timeout = timeout; }

Target:
void setTimeout(long timeout) { this.timeout = timeout; }
Source:
public void doRender(EntityTropicraftWaterBase entityliving, double d, double d1, double d2, float f, float f1) { if(refreshModel && entityliving.ticksExisted % 20 == 0) { this.mainModel = new ModelDolphin(); this.dolphin = new ModelDolphin(); refreshModel = false; } //refreshModel = true; this.renderWaterMob((EntityTropicraftWaterBase) entityliving, d, d1, d2, f1); }

Target:
public void doRender(EntityTropicraftWaterBase entityliving, double d, double d1, double d2, float f, float f1) { this.renderWaterMob((EntityTropicraftWaterBase) entityliving, d, d1, d2, f1); }
Source:
protected void fillEdgesToUsingFilter(EdgeFilter edgeFilter) { // we temporarily ignore the additionalEdgeFilter EdgeFilter tmpFilter = additionalEdgeFilter; additionalEdgeFilter = edgeFilter; finishedTo = !fillEdgesTo(); additionalEdgeFilter = tmpFilter; }

Target:
protected void fillEdgesToUsingFilter(EdgeFilter edgeFilter) { additionalEdgeFilter = edgeFilter; finishedTo = !fillEdgesTo(); additionalEdgeFilter = null; }
Source:
public GraphHopper() { chFactoryDecorator.setEnabled(true); lmFactoryDecorator.setEnabled(false); arFactoryDecorator.setEnabled(true); // order is important to use CH as base algo and set the approximation in the followed lm factory decorator. // AR must be the last factory decorator because it need both other decorators during preparation algoDecorators.add(chFactoryDecorator); algoDecorators.add(lmFactoryDecorator); algoDecorators.add(arFactoryDecorator); }

Target:
public GraphHopper() { chFactoryDecorator.setEnabled(true); lmFactoryDecorator.setEnabled(false); arFactoryDecorator.setEnabled(false); // order is important to use CH as base algo and set the approximation in the followed lm factory decorator. // AR must be the last factory decorator because it need both other decorators during preparation algoDecorators.add(chFactoryDecorator); algoDecorators.add(lmFactoryDecorator); algoDecorators.add(arFactoryDecorator); }