auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CTFStreamInput(CTFStream stream, File file) throws CTFReaderException { fStream = stream; fFile = file; fBitBuffer = BitBuffer.EMPTY_BITBUFFER; fByteOrder = getStream().getTrace().getByteOrder(); fBitBuffer.setByteOrder(fByteOrder); try { fFileInputStream = new FileInputStream(file); } catch (FileNotFoundException e) { throw new CTFReaderException(e); } fFileChannel = fFileInputStream.getChannel(); fIndex = new StreamInputPacketIndex(); }

Target:
public CTFStreamInput(CTFStream stream, File file) throws CTFReaderException { fStream = stream; fFile = file; try { fFileInputStream = new FileInputStream(file); } catch (FileNotFoundException e) { throw new CTFReaderException(e); } fFileChannel = fFileInputStream.getChannel(); fIndex = new StreamInputPacketIndex(); }
Source:
protected ResolveMerger(Repository local) { super(local); commitNames = new String[] { "BASE", "OURS", "THEIRS" }; oi = local.newObjectInserter(); }

Target:
protected ResolveMerger(Repository local) { super(local); commitNames = new String[] { "BASE", "OURS", "THEIRS" }; oi = getObjectInserter(); }
Source:
protected double convertPositionToAngle(double value) { return value * getServoAngleRange() + ServoSubsystem.kMinServoAngle; }

Target:
protected static double convertPositionToAngle(double value) { return value * ServoSubsystem.getServoAngleRange() + ServoSubsystem.MIN_SERVO_ANGLE; }
Source:
private static boolean isUnacceptableCharacter( char ch ) { return " .,:(){}[]\"`'*/+-".indexOf( ch ) != -1; }

Target:
private static boolean isUnacceptableCharacter( char ch ) { return MQL_RESERVED_CHARS.indexOf( ch ) != -1; }
Source:
public String toSerializable(final LogEvent loggingEvent) { JSONObject logstashEvent = new JSONObject(); JSONObject userFieldsEvent = new JSONObject(); HostData host = new HostData(); LayoutUtils.addUserFields(ADDITIONNAL_ATTRIBUTES, userFieldsEvent); Map<String, String> mdc = LayoutUtils.processMDCMetaFields(loggingEvent.getContextData().toMap(), logstashEvent, metaFields); logstashEvent.put(LayoutFields.VERSION, LayoutFields.VERSION_VALUE); logstashEvent.put(LayoutFields.TIME_STAMP, LayoutUtils.dateFormat(loggingEvent.getTimeMillis())); logstashEvent.put(LayoutFields.SEVERITY, loggingEvent.getLevel().toString()); logstashEvent.put(LayoutFields.THREAD_NAME, loggingEvent.getThreadName()); logstashEvent.put(LayoutFields.AGENT_TIME_STAMP, LayoutUtils.dateFormat(new Date().getTime())); if (loggingEvent.getMessage().getFormattedMessage() != null) { logstashEvent.put(LayoutFields.LOG_MESSAGE, loggingEvent.getMessage().getFormattedMessage()); } handleThrown(logstashEvent, loggingEvent); JSONObject logSourceEvent = createLogSourceEvent(loggingEvent, host); logstashEvent.put(LayoutFields.LOG_SOURCE, logSourceEvent); LayoutUtils.addMDC(mdc, userFieldsEvent, logstashEvent); if (!userFieldsEvent.isEmpty()) { logstashEvent.put(LayoutFields.CUSTOM_INFO, userFieldsEvent); } return logstashEvent.toString() + "\n"; }

Target:
public String toSerializable(final LogEvent loggingEvent) { JSONObject logstashEvent = new JSONObject(); JSONObject userFieldsEvent = new JSONObject(); HostData host = new HostData(); LayoutUtils.addUserFields(ADDITIONNAL_ATTRIBUTES, userFieldsEvent); Map<String, String> mdc = LayoutUtils.processMDCMetaFields(loggingEvent.getContextData().toMap(), logstashEvent, metaFields); logstashEvent.put(LayoutFields.VERSION, LayoutFields.VERSION_VALUE); logstashEvent.put(LayoutFields.TIME_STAMP, LayoutUtils.dateFormat(loggingEvent.getTimeMillis())); logstashEvent.put(LayoutFields.SEVERITY, loggingEvent.getLevel().toString()); logstashEvent.put(LayoutFields.THREAD_NAME, loggingEvent.getThreadName()); logstashEvent.put(LayoutFields.AGENT_TIME_STAMP, LayoutUtils.dateFormat(new Date().getTime())); final String formattedMessage = loggingEvent.getMessage().getFormattedMessage(); if (formattedMessage != null) { logstashEvent.put(LayoutFields.LOG_MESSAGE, formattedMessage); } handleThrown(logstashEvent, loggingEvent); JSONObject logSourceEvent = createLogSourceEvent(loggingEvent, host); logstashEvent.put(LayoutFields.LOG_SOURCE, logSourceEvent); LayoutUtils.addMDC(mdc, userFieldsEvent, logstashEvent); if (!userFieldsEvent.isEmpty()) { logstashEvent.put(LayoutFields.CUSTOM_INFO, userFieldsEvent); } return logstashEvent.toString() + "\n"; }
Source:
public void process() { if (renderingConfig.isEyeAdaptation()) { PerformanceMonitor.startActivity("rendering/updateExposure"); downSampleSceneInto1x1pixelsBuffer(); writeOnlyPBO.copyFromFBO(downSampledScene[0].fboId, 1, 1, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE); pixels = readOnlyPBO.readBackPixels(); swapPBOs(); if (pixels.limit() < 3) { logger.error("Failed to auto-update the exposure value."); return; } currentSceneLuminance = 0.2126f * (pixels.get(2) & 0xFF) / 255.f + 0.7152f * (pixels.get(1) & 0xFF) / 255.f + 0.0722f * (pixels.get(0) & 0xFF) / 255.f; targetExposure = hdrMaxExposure; if (currentSceneLuminance > 0) { targetExposure = hdrTargetLuminance / currentSceneLuminance; } maxExposure = hdrMaxExposure; if (backdropProvider.getDaylight() == 0.0) { maxExposure = hdrMaxExposureNight; } if (targetExposure > maxExposure) { targetExposure = maxExposure; } else if (targetExposure < hdrMinExposure) { targetExposure = hdrMinExposure; } screenGrabber.setExposure(TeraMath.lerp(screenGrabber.getExposure(), targetExposure, hdrExposureAdjustmentSpeed)); PerformanceMonitor.endActivity(); } else { if (backdropProvider.getDaylight() == 0.0) { screenGrabber.setExposure(hdrMaxExposureNight); } else { screenGrabber.setExposure(hdrExposureDefault); } } }

Target:
public void process() { if (renderingConfig.isEyeAdaptation()) { PerformanceMonitor.startActivity("rendering/updateExposure"); downSampleSceneInto1x1pixelsBuffer(); writeOnlyPBO.copyFromFBO(downSampledScene[0].fboId, 1, 1, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE); swapPBOs(); pixels = readOnlyPBO.readBackPixels(); if (pixels.limit() < 3) { logger.error("Failed to auto-update the exposure value."); return; } currentSceneLuminance = 0.2126f * (pixels.get(2) & 0xFF) / 255.f + 0.7152f * (pixels.get(1) & 0xFF) / 255.f + 0.0722f * (pixels.get(0) & 0xFF) / 255.f; targetExposure = hdrMaxExposure; if (currentSceneLuminance > 0) { targetExposure = hdrTargetLuminance / currentSceneLuminance; } maxExposure = hdrMaxExposure; if (backdropProvider.getDaylight() == 0.0) { maxExposure = hdrMaxExposureNight; } if (targetExposure > maxExposure) { targetExposure = maxExposure; } else if (targetExposure < hdrMinExposure) { targetExposure = hdrMinExposure; } screenGrabber.setExposure(TeraMath.lerp(screenGrabber.getExposure(), targetExposure, hdrExposureAdjustmentSpeed)); PerformanceMonitor.endActivity(); } else { if (backdropProvider.getDaylight() == 0.0) { screenGrabber.setExposure(hdrMaxExposureNight); } else { screenGrabber.setExposure(hdrExposureDefault); } } }
Source:
public T fromString(String string) { try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); ObjectReader reader = mapper.reader(clazz); return reader.readValue(string); } catch (IOException e) { Throwables.propagate(e); } return null; }

Target:
public T fromString(String string) { try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); ObjectReader reader = mapper.reader(clazz); return reader.readValue(string); } catch (IOException e) { throw Throwables.propagate(e); } }
Source:
public int hashCode() { int hash = 17; hash = hash * 31 + Objects.hashCode(_annotations); hash = hash * 31 + Objects.hashCode(_counterSamples); hash = hash * 31 + Objects.hashCode(_timerSamples); hash = hash * 31 + Objects.hashCode(_gaugeSamples); return hash; }

Target:
public int hashCode() { return Objects.hash(_annotations, _counterSamples, _timerSamples, _gaugeSamples); }
Source:
private void postFinish() { User user = User.getLoggedUser(); Session.setUser(user); try { Dhis2Application.getEventBus().post(new SyncProgressStatus()); } catch (Exception e) { e.printStackTrace(); } }

Target:
private void postFinish() { User user = User.getLoggedUser(); Session.setUser(user); Dhis2Application.getEventBus().post(new SyncProgressStatus()); }
Source:
protected List<OrderedPartitionableRecord<Integer, Long>> getRecords( RecordSupplier<Integer, Long> recordSupplier, TaskToolbox toolbox ) { return null; }

Target:
protected List<OrderedPartitionableRecord<Integer, Long>> getRecords( RecordSupplier<Integer, Long> recordSupplier, TaskToolbox toolbox ) { throw new UnsupportedOperationException(); }
Source:
protected void sendNotification(String msg, Intent cloudIntent) { mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); String activityName = getString(R.string.liger_main_activity_class); Class<? extends DefaultMainActivity> activityClass = null; activityClass = DefaultMainActivity.class; Intent appIntent = new Intent(this, DefaultMainActivity.class); appIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); appIntent.putExtra("cloudIntent", cloudIntent); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, appIntent, 0); Uri defaultSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.icon_android_notificaiton) .setContentTitle("Reach Push") .setLights(Color.YELLOW, 1, 2) .setAutoCancel(true) .setSound(defaultSound) .setStyle(new NotificationCompat.BigTextStyle() .bigText(msg)) .setContentText(msg); mBuilder.setContentIntent(contentIntent); mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); }

Target:
protected void sendNotification(String msg, Intent cloudIntent) { mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); String activityName = getString(R.string.liger_main_activity_class); Class<? extends DefaultMainActivity> activityClass = null; try { activityClass = (Class<? extends DefaultMainActivity>) Class.forName(activityName); } catch (ClassNotFoundException e) { Log.e(LIGER.TAG, "Failed to find class for main activity named " + activityName, e); } catch (ClassCastException e) { Log.e(LIGER.TAG, "Main activity class named " + activityName + " is not an Activity!", e); } Intent appIntent = new Intent(this, activityClass); appIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); appIntent.putExtra("cloudIntent", cloudIntent); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, appIntent, 0); Uri defaultSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.icon_android_notificaiton) .setContentTitle("Reach Push") .setLights(Color.YELLOW, 1, 2) .setAutoCancel(true) .setSound(defaultSound) .setStyle(new NotificationCompat.BigTextStyle() .bigText(msg)) .setContentText(msg); mBuilder.setContentIntent(contentIntent); mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); }
Source:
protected void executeCommand() { boolean isStorageDisconnectSucceeded = disconnectStorage(); if(isStorageDisconnectSucceeded) { String connectionId = getConnection().getid(); if(StringUtils.isNotEmpty(connectionId)) { getDbFacade().getStorageServerConnectionDao().remove(connectionId); setSucceeded(true); } } }

Target:
protected void executeCommand() { boolean isStorageDisconnectSucceeded = disconnectStorage(); if(isStorageDisconnectSucceeded) { String connectionId = getConnection().getid(); if(StringUtils.isNotEmpty(connectionId)) { getDbFacade().getStorageServerConnectionDao().remove(connectionId); } setSucceeded(true); } }
Source:
private void handleMinimizedStacks( @UIEventTopic(UIEvents.ApplicationElement.TOPIC_TAGS) Event event) { Object changedObj = event.getProperty(EventTags.ELEMENT); if (!(changedObj instanceof MToolControl)) return; final MToolControl minimizedStack = (MToolControl) changedObj; if (!(minimizedStack.getObject() instanceof TrimStack)) return; TrimStack ts = (TrimStack) minimizedStack.getObject(); if (!(ts.minimizedElement instanceof MPartStack)) return; MPartStack stack = (MPartStack) ts.minimizedElement; MUIElement stackSel = stack.getSelectedElement(); MPart thePart = null; if (stackSel instanceof MPart) { thePart = (MPart) stackSel; } else if (stackSel instanceof MPlaceholder) { MPlaceholder ph = (MPlaceholder) stackSel; if (ph.getRef() instanceof MPart) { thePart = (MPart) ph.getRef(); } } if (thePart == null) return; if (UIEvents.isADD(event)) { if (UIEvents.contains(event, UIEvents.EventTags.NEW_VALUE, TrimStack.MINIMIZED_AND_SHOWING)) { firePartVisible(thePart); } } else if (UIEvents.isREMOVE(event)) { if (UIEvents.contains(event, UIEvents.EventTags.OLD_VALUE, TrimStack.MINIMIZED_AND_SHOWING)) { firePartHidden(thePart); } } }

Target:
private void handleMinimizedStacks( @UIEventTopic(UIEvents.ApplicationElement.TOPIC_TAGS) Event event) { Object changedObj = event.getProperty(EventTags.ELEMENT); if (!(changedObj instanceof MToolControl)) return; final MToolControl minimizedStack = (MToolControl) changedObj; if (!(minimizedStack.getObject() instanceof TrimStack)) return; TrimStack ts = (TrimStack) minimizedStack.getObject(); if (!(ts.getMinimizedElement() instanceof MPartStack)) return; MPartStack stack = (MPartStack) ts.getMinimizedElement(); MUIElement stackSel = stack.getSelectedElement(); MPart thePart = null; if (stackSel instanceof MPart) { thePart = (MPart) stackSel; } else if (stackSel instanceof MPlaceholder) { MPlaceholder ph = (MPlaceholder) stackSel; if (ph.getRef() instanceof MPart) { thePart = (MPart) ph.getRef(); } } if (thePart == null) return; if (UIEvents.isADD(event)) { if (UIEvents.contains(event, UIEvents.EventTags.NEW_VALUE, TrimStack.MINIMIZED_AND_SHOWING)) { firePartVisible(thePart); } } else if (UIEvents.isREMOVE(event)) { if (UIEvents.contains(event, UIEvents.EventTags.OLD_VALUE, TrimStack.MINIMIZED_AND_SHOWING)) { firePartHidden(thePart); } } }
Source:
public void onClick(View v) { if ( v != MenuButton && menuIsVisible() ) { hideMenu(true); } if ( v == MenuButton ) { if ( menuIsVisible() ) hideMenu(true); else showMenu(true); } else if ( v == GroupButton ) { int img; if (GroupButton.getTag() == Integer.valueOf(0)) { GroupButton.setTag(Integer.valueOf(1)); img = R.drawable.groupon; } else { GroupButton.setTag(Integer.valueOf(0)); img = R.drawable.groupoff; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { GroupButton.setBackground(getResources().getDrawable(img)); } else { GroupButton.setBackgroundDrawable(getResources().getDrawable(img)); } onGroupButtonTouch(img == R.drawable.groupon); } else if ( v == MiSettings || v == SettingsButton) { showCfg(this); } else if ( v == MiAbout || v == AboutButton ) { showAbout(); } else if ( v == MiAddDevice || v == AddDeviceButton ) { addDevice(); } else if ( v == MiDonate || v == DonateButton ) { donate(); } else if ( v == MiHelp || v == HelpButton ) { openForumpage(); } else if ( v == HomepageButton ) { openHomepage(); } else if ( v == EmptySpaceButton ) { } }

Target:
public void onClick(View v) { if ( v != MenuButton && menuIsVisible() ) { hideMenu(true); } if ( v == MenuButton ) { if ( menuIsVisible() ) hideMenu(true); else showMenu(true); } else if ( v == GroupButton ) { int img; if (GroupButton.getTag() == Integer.valueOf(0)) { GroupButton.setTag(Integer.valueOf(1)); img = R.drawable.groupon; } else { GroupButton.setTag(Integer.valueOf(0)); img = R.drawable.groupoff; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { GroupButton.setBackground(getResources().getDrawable(img)); } else { GroupButton.setBackgroundDrawable(getResources().getDrawable(img)); } onGroupButtonTouch(img == R.drawable.groupon); } else if ( v == MiSettings || v == SettingsButton) { showCfg(this); } else if ( v == MiAbout || v == AboutButton ) { showAbout(); } else if ( v == MiAddDevice || v == AddDeviceButton ) { addDevice(); } else if ( v == MiDonate || v == DonateButton ) { donate(); } else if ( v == MiHelp || v == HelpButton ) { openForumpage(); } else if ( v == HomepageButton ) { openHomepage(); } }
Source:
public String toString() { return "TITLE(" + getTitle() + "),YAXIS(" + yaxis + "),NUMSERIES(" + CollectionUtils.size(series) + "),GROUP(" + group + "),NUMBUILDS(" + numBuilds + "),RIGHTBUILDNUM(" + getRightBuildNum() + "),HASLEGEND(" + hasLegend() + "),ISLOGARITHMIC(" + isLogarithmic() + "),YAXISMINIMUM(" + yaxisMinimum + "),YAXISMAXIMUM(" + yaxisMaximum + "),FILENAME(" + getCsvFileName() + "),DESCRIPTION" + getDescription() + ")"; }

Target:
public String toString() { return "TITLE(" + getTitle() + "),YAXIS(" + yaxis + "),NUMSERIES(" + CollectionUtils.size(series) + "),GROUP(" + group + "),NUMBUILDS(" + numBuilds + "),RIGHTBUILDNUM(" + getRightBuildNum() + "),HASLEGEND(" + hasLegend() + "),ISLOGARITHMIC(" + isLogarithmic() + "),YAXISMINIMUM(" + yaxisMinimum + "),YAXISMAXIMUM(" + yaxisMaximum + "),FILENAME(" + getCsvFileName() + "),DESCRIPTION(" + getDescription() + ")"; }
Source:
public String getName() { return "HTML Render`er"; }

Target:
public String getName() { return "HTML Renderer"; }
Source:
public void testRecoveryIteration() throws Exception { XAResource xaResource_0 = xaResource(0); XAResource xaResource_1 = xaResource(1); remoteTM(0).begin(); remoteCache(0).put("k0", "v"); Xid xid_0 = xid(0); prepare(0); remoteTM(1).begin(); remoteCache(1).put("k1", "v"); Xid xid_1 = xid(1); prepare(1); timeService.advance(9000); assertBeforeTimeoutRecoveryIteration(xaResource_0, xid_0); assertBeforeTimeoutRecoveryIteration(xaResource_1, xid_1); timeService.advance(2000); assertRecoveryIteration(xaResource_0, xid_0, xid_1); assertRecoveryIteration(xaResource_1, xid_1, xid_0); xaResource_1.commit(xid_0, false); xaResource_1.rollback(xid_1); assertEquals("v", remoteCache(0).get("k0")); assertEquals(null, remoteCache(0).get("k1")); xaResource_0.forget(xid_0); xaResource_1.forget(xid_1); }

Target:
public void testRecoveryIteration() throws Exception { XAResource xaResource0 = xaResource(0); XAResource xaResource1 = xaResource(1); remoteTM(0).begin(); remoteCache(0).put("k0", "v"); Xid xid0 = xid(0); prepare(0); remoteTM(1).begin(); remoteCache(1).put("k1", "v"); Xid xid1 = xid(1); prepare(1); timeService.advance(9000); assertBeforeTimeoutRecoveryIteration(xaResource0, xid0); assertBeforeTimeoutRecoveryIteration(xaResource1, xid1); timeService.advance(2000); assertRecoveryIteration(xaResource0, xid0, xid1); assertRecoveryIteration(xaResource1, xid1, xid0); xaResource1.commit(xid0, false); xaResource1.rollback(xid1); assertEquals("v", remoteCache(0).get("k0")); assertEquals(null, remoteCache(0).get("k1")); xaResource0.forget(xid0); xaResource1.forget(xid1); }
Source:
private static Function<Number, Double> times(final double x) { return new Function<Number,Double>() { @Override public Double apply(Number input) { if (input==null) return null; return x*input.doubleValue(); } }; }

Target:
public static Function<Number, Double> times(final double x) { return MathFunctions.times(x); }
Source:
public Map<Long, EventDefinition> getEventDefs(StreamInput id) { return null; }

Target:
public Map<Long, EventDefinition> getEventDefs(StreamInput id) { return new HashMap<Long, EventDefinition>(); }
Source:
public void saveContainer(String id) { HashMap<String, String> map = new HashMap<>(); Optional.ofNullable(canvasHandler.getGraphIndex().get(id)).ifPresent(node -> { map.put(DEFAULT_NODE_ID, id); map.put(svgNodeId, id); }); context.saveGroup(map); }

Target:
public void saveContainer(String id) { HashMap<String, String> map = new HashMap<>(); if (canvasHandler.getGraphIndex().get(id) != null) { map.put(DEFAULT_NODE_ID, id); map.put(svgNodeId, id); } context.saveGroup(map); }
Source:
public MessageDecoder(int messageSize, int skipSize, SelectCumulator cumulator) { this.messageSize = messageSize; this.skipSize = skipSize; switch (cumulator) { case MERGE: setCumulator(MERGE_CUMULATOR); break; case COMPOSITE: setCumulator(COMPOSITE_CUMULATOR); break; case MESSAGE_AWARE_MERGE: setCumulator(new MessageAwareCumulator(messageSize)); break; } }

Target:
MessageDecoder(int messageSize, int skipSize, SelectCumulator cumulator) { this.messageSize = messageSize; this.skipSize = skipSize; switch (cumulator) { case MERGE: setCumulator(MERGE_CUMULATOR); break; case COMPOSITE: setCumulator(COMPOSITE_CUMULATOR); break; case MESSAGE_AWARE_MERGE: setCumulator(new MessageAwareCumulator(messageSize)); break; default: throw new IllegalStateException(); } }
Source:
protected boolean executeAnalysis(final IProgressMonitor monitor) throws TmfAnalysisException { Object workerObj = getParameter(PARAM_WORKER); if (workerObj == null) { return false; } if (!(workerObj instanceof IGraphWorker)) { throw new IllegalStateException("Worker parameter must be an IGraphWorker"); } IGraphWorker worker = (IGraphWorker) workerObj; TmfGraphBuilderModule graphModule = fGraphModule; graphModule.schedule(); SubMonitor subMonitor = SubMonitor.convert(monitor, 10); subMonitor.setTaskName(NLS.bind(Messages.CriticalPathModule_waitingForGraph, graphModule.getName())); if (!graphModule.waitForCompletion(subMonitor)) { Activator.getInstance().logInfo("Critical path execution: graph building was cancelled. Results may not be accurate."); return false; } subMonitor.worked(8); TmfGraph graph = graphModule.getGraph(); if (graph == null) { throw new TmfAnalysisException("Critical Path analysis: graph " + graphModule.getName() + " is null"); } TmfVertex head = graph.getHead(worker); if (head == null) { fCriticalPath = new TmfGraph(); return true; } subMonitor.worked(1); ICriticalPathAlgorithm cp = getAlgorithm(graph); try { fCriticalPath = cp.compute(head, null); return true; } catch (CriticalPathAlgorithmException e) { Activator.getInstance().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e); } subMonitor.done(); return false; }

Target:
protected boolean executeAnalysis(final IProgressMonitor monitor) throws TmfAnalysisException { Object workerObj = getParameter(PARAM_WORKER); if (workerObj == null) { return false; } if (!(workerObj instanceof IGraphWorker)) { throw new IllegalStateException("Worker parameter must be an IGraphWorker"); } IGraphWorker worker = (IGraphWorker) workerObj; TmfGraphBuilderModule graphModule = fGraphModule; graphModule.schedule(); SubMonitor subMonitor = SubMonitor.convert(monitor, 10); subMonitor.setTaskName(NLS.bind(Messages.CriticalPathModule_waitingForGraph, graphModule.getName())); if (!graphModule.waitForCompletion(subMonitor)) { Activator.getInstance().logInfo("Critical path execution: graph building was cancelled. Results may not be accurate."); return false; } subMonitor.worked(8); TmfGraph graph = graphModule.getGraph(); if (graph == null) { throw new TmfAnalysisException("Critical Path analysis: graph " + graphModule.getName() + " is null"); } TmfVertex head = graph.getHead(worker); if (head == null) { fCriticalPath = new TmfGraph(); return true; } subMonitor.worked(1); ICriticalPathAlgorithm cp = getAlgorithm(graph); try { fCriticalPath = cp.compute(head, null); subMonitor.done(); return true; } catch (CriticalPathAlgorithmException e) { Activator.getInstance().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e); } subMonitor.done(); return false; }
Source:
private String formatRecipient(User user) { Profile profile = user.getProfile(); if (profile != null && profile.getFirstName() != null && profile.getLastName() != null) { return profile.getFirstName() + " " + profile.getLastName(); } return "User"; }

Target:
private String formatRecipient(User user) { Profile profile = user.getProfile(); if (profile != null && profile.getFirstName() != null && profile.getLastName() != null) { return String.format(" %s %s", profile.getFirstName(), profile.getLastName()); } return ""; }
Source:
public static void unloadFilters(Module module) { for (java.util.Iterator<ModuleFilterMapping> mapIter = moduleFilterMappings.iterator(); mapIter.hasNext();) { ModuleFilterMapping mapping = mapIter.next(); if (module.equals(mapping.getModule())) { mapIter.remove(); log.debug("Removed ModuleFilterMapping: " + mapping); } } Collection<Filter> filters = moduleFilters.get(module); if (filters != null) { try { for (Filter f : filters) { f.destroy(); } } catch (Exception e) { log.warn("An error occurred while trying to destroy and remove module Filter.", e); } log.debug("Module: " + module.getModuleId() + " successfully unloaded " + filters.size() + " filters."); moduleFilters.remove(module); for (Entry<String, Filter> entry: moduleFiltersByName.entrySet()) { Filter filterVal = entry.getValue(); if (filters.contains(filterVal)) { moduleFiltersByName.remove(entry.getKey()); } } } }

Target:
public static void unloadFilters(Module module) { for (java.util.Iterator<ModuleFilterMapping> mapIter = moduleFilterMappings.iterator(); mapIter.hasNext();) { ModuleFilterMapping mapping = mapIter.next(); if (module.equals(mapping.getModule())) { mapIter.remove(); log.debug("Removed ModuleFilterMapping: " + mapping); } } Collection<Filter> filters = moduleFilters.get(module); if (filters != null) { try { for (Filter f : filters) { f.destroy(); } } catch (Exception e) { log.warn("An error occurred while trying to destroy and remove module Filter.", e); } log.debug("Module: " + module.getModuleId() + " successfully unloaded " + filters.size() + " filters."); moduleFilters.remove(module); for (Iterator<String> i = moduleFiltersByName.keySet().iterator(); i.hasNext();) { String filterName = i.next(); Filter filterVal = moduleFiltersByName.get(filterName); if (filters.contains(filterVal)) { i.remove(); } } } }
Source:
public IntsRef handleWayTags(IntsRef edgeFlags, ReaderWay way, EncodingManager.Access access, long relationFlags) { if (access.canSkip()) { return edgeFlags; } if (!access.isFerry()) { String sacScale = way.getTag("sac_scale"); if (sacScale != null) { accessEnc.setBool(false, edgeFlags, false); accessEnc.setBool(true, edgeFlags, false); } else { speedEncoder.setDecimal(false, edgeFlags, MEAN_SPEED); accessEnc.setBool(false, edgeFlags, true); accessEnc.setBool(true, edgeFlags, true); } } else { double ferrySpeed = getFerrySpeed(way); setSpeed(false, edgeFlags, ferrySpeed); accessEnc.setBool(false, edgeFlags, true); accessEnc.setBool(true, edgeFlags, true); } return edgeFlags; }

Target:
public IntsRef handleWayTags(IntsRef edgeFlags, ReaderWay way, EncodingManager.Access access, long relationFlags) { if (access.canSkip()) { return edgeFlags; } accessEnc.setBool(false, edgeFlags, true); accessEnc.setBool(true, edgeFlags, true); if (!access.isFerry()) { setSpeed(edgeFlags, true, true, MEAN_SPEED); } else { double ferrySpeed = getFerrySpeed(way); setSpeed(edgeFlags, true, true, ferrySpeed); } return edgeFlags; }
Source:
public void updateFileMenuButtons(int view) { if (isReadOnly) { return; } if (view == 0) { fileDropDown.setItemEnabled(MESSAGES.deleteProjectButton(), false); fileDropDown.setItemEnabled(MESSAGES.deleteProjectMenuItem(), Ode.getInstance().getProjectManager().getProjects() == null); fileDropDown.setItemEnabled(MESSAGES.exportAllProjectsMenuItem(), Ode.getInstance().getProjectManager().getProjects().size() > 0); fileDropDown.setItemEnabled(MESSAGES.exportSelectedProjectsMenuItem(), Ode.getInstance().getProjectManager().getProjects().size() > 0); fileDropDown.setItemEnabled(MESSAGES.exportProjectMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.saveMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.saveAsMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.checkpointMenuItem(), false); buildDropDown.setItemEnabled(MESSAGES.showBarcodeMenuItem(), false); buildDropDown.setItemEnabled(MESSAGES.downloadToComputerMenuItem(), false); } else { fileDropDown.setItemEnabled(MESSAGES.deleteProjectButton(), true); fileDropDown.setItemEnabled(MESSAGES.exportAllProjectsMenuItem(), Ode.getInstance().getProjectManager().getProjects().size() > 0); fileDropDown.setItemEnabled(MESSAGES.exportSelectedProjectsMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.exportProjectMenuItem(), true); fileDropDown.setItemEnabled(MESSAGES.saveMenuItem(), true); fileDropDown.setItemEnabled(MESSAGES.saveAsMenuItem(), true); fileDropDown.setItemEnabled(MESSAGES.checkpointMenuItem(), true); buildDropDown.setItemEnabled(MESSAGES.showBarcodeMenuItem(), true); buildDropDown.setItemEnabled(MESSAGES.downloadToComputerMenuItem(), true); } updateKeystoreFileMenuButtons(true); }

Target:
public void updateFileMenuButtons(int view) { if (isReadOnly) { return; } if (view == 0) { fileDropDown.setItemEnabled(MESSAGES.deleteProjectButton(), false); fileDropDown.setItemEnabled(MESSAGES.deleteProjectMenuItem(), Ode.getInstance().getProjectManager().getProjects() == null); fileDropDown.setItemEnabled(MESSAGES.exportAllProjectsMenuItem(), Ode.getInstance().getProjectManager().getProjects().size() > 0); fileDropDown.setItemEnabledById(WIDGET_NAME_EXPORTPROJECT, false); fileDropDown.setItemEnabled(MESSAGES.saveMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.saveAsMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.checkpointMenuItem(), false); buildDropDown.setItemEnabled(MESSAGES.showBarcodeMenuItem(), false); buildDropDown.setItemEnabled(MESSAGES.downloadToComputerMenuItem(), false); } else { fileDropDown.setItemEnabled(MESSAGES.deleteProjectButton(), true); fileDropDown.setItemEnabled(MESSAGES.exportAllProjectsMenuItem(), Ode.getInstance().getProjectManager().getProjects().size() > 0); fileDropDown.setItemEnabledById(WIDGET_NAME_EXPORTPROJECT, true); fileDropDown.setItemEnabled(MESSAGES.saveMenuItem(), true); fileDropDown.setItemEnabled(MESSAGES.saveAsMenuItem(), true); fileDropDown.setItemEnabled(MESSAGES.checkpointMenuItem(), true); buildDropDown.setItemEnabled(MESSAGES.showBarcodeMenuItem(), true); buildDropDown.setItemEnabled(MESSAGES.downloadToComputerMenuItem(), true); } updateKeystoreFileMenuButtons(true); }
Source:
private void setValueForTextInput(WebElement element, String text) { if (text == null || text.isEmpty()) { element.clear(); } else if (fastSetValue) { text = truncateMaxLength(element, text); String error = executeJavaScript( "if (arguments[0].getAttribute('readonly') != undefined) " + " return 'Cannot change value of readonly element';" + "arguments[0].value = arguments[1];" + "return null;", element, text); if (error != null) throw new InvalidStateException(error); events.fireEvent(element, "focus", "keydown", "keypress", "input", "keyup", "change"); } else { element.clear(); element.sendKeys(text); events.fireChangeEvent(element); } }

Target:
private void setValueForTextInput(WebElement element, String text) { if (text == null || text.isEmpty()) { element.clear(); } else if (fastSetValue) { String error = setValueByJs(element, text); if (error != null) throw new InvalidStateException(error); events.fireEvent(element, "focus", "keydown", "keypress", "input", "keyup", "change"); } else { element.clear(); element.sendKeys(text); events.fireChangeEvent(element); } }
Source:
public boolean isSimCardReady() throws KuraException { boolean simReady = false; String port = null; if (isGpsEnabled() && getAtPort().equals(getGpsPort()) && !getAtPort().equals(getDataPort())) { port = getDataPort(); } else { port = getAtPort(); } synchronized (this.atLock) { s_logger.debug("sendCommand getSimStatus :: command to port {}", QuectelBG96AtCommands.getSimStatus.getCommand(), port); byte[] reply = null; CommConnection commAtConnection = null; try { commAtConnection = openSerialPort(port); if (!isAtReachable(commAtConnection)) { throw new KuraException(KuraErrorCode.NOT_CONNECTED, "Modem not available for AT commands: " + QuectelBG96.class.getName()); } reply = commAtConnection.sendCommand(QuectelBG96AtCommands.getSimStatus.getCommand().getBytes(), 1000, 100); if (reply != null) { String simStatus = getResponseString(reply); String[] simStatusSplit = simStatus.split(","); if (simStatusSplit.length > 1 && Integer.valueOf(simStatusSplit[1]) > 0) { simReady = true; } } if (!simReady) { } } catch (IOException e) { throw new KuraException(KuraErrorCode.UNAVAILABLE_DEVICE, e); } catch (KuraException e) { throw e; } finally { closeSerialPort(commAtConnection); } } return simReady; }

Target:
public boolean isSimCardReady() throws KuraException { boolean simReady = false; String port = null; if (isGpsEnabled() && getAtPort().equals(getGpsPort()) && !getAtPort().equals(getDataPort())) { port = getDataPort(); } else { port = getAtPort(); } synchronized (this.atLock) { logger.debug("sendCommand getSimStatus :: command to port {}", QuectelBG96AtCommands.getSimStatus.getCommand(), port); byte[] reply = null; CommConnection commAtConnection = null; try { commAtConnection = openSerialPort(port); if (!isAtReachable(commAtConnection)) { throw new KuraException(KuraErrorCode.NOT_CONNECTED, "Modem not available for AT commands: " + QuectelBG96.class.getName()); } reply = commAtConnection.sendCommand(QuectelBG96AtCommands.getSimStatus.getCommand().getBytes(), 1000, 100); if (reply != null) { String simStatus = getResponseString(reply); String[] simStatusSplit = simStatus.split(","); if (simStatusSplit.length > 1 && Integer.valueOf(simStatusSplit[1]) > 0) { simReady = true; } } } catch (IOException e) { throw new KuraException(KuraErrorCode.UNAVAILABLE_DEVICE, e); } catch (KuraException e) { throw e; } finally { closeSerialPort(commAtConnection); } } return simReady; }
Source:
public static Long pingNode(Node node) { final int ATTEMPS = 10; long minPing = Long.MAX_VALUE; for (int i = 0; i < ATTEMPS; i++) { long start = System.nanoTime(); try { node.getNumberOfActiveObjects(); } catch (Exception e) { return (long) -1; } long ping = (System.nanoTime() - start) / 1000; if (ping < minPing) minPing = ping; } return minPing; }

Target:
private Long pingNode(Node node) { final int ATTEMPS = 10; long minPing = Long.MAX_VALUE; for (int i = 0; i < ATTEMPS; i++) { long start = System.nanoTime(); try { node.getNumberOfActiveObjects(); } catch (Exception e) { return (long) -1; } long ping = (System.nanoTime() - start) / 1000; if (ping < minPing) minPing = ping; } return minPing; }
Source:
private void handleSubquery(ExpressionContext expression, List<IndexSegment> indexSegments, TimerContext timerContext, ExecutorService executorService, long endTimeMs) throws Exception { FunctionContext function = expression.getFunction(); if (function == null) { return; } List<ExpressionContext> arguments = function.getArguments(); if (StringUtils.remove(function.getFunctionName(), '_').equalsIgnoreCase(IN_PARTITIONED_SUBQUERY)) { Preconditions .checkState(arguments.size() == 2, "IN_PARTITIONED_SUBQUERY requires 2 arguments: expression, subquery"); ExpressionContext subqueryExpression = arguments.get(1); Preconditions.checkState(subqueryExpression.getType() == ExpressionContext.Type.LITERAL, "Second argument of IN_PARTITIONED_SUBQUERY must be a literal (subquery)"); QueryContext subquery = QueryContextConverterUtils.getQueryContextFromSQL(subqueryExpression.getLiteral()); DataTable dataTable = processQuery(indexSegments, subquery, timerContext, executorService, null, endTimeMs, false); IdSet idSet = dataTable.getObject(0, 0); String serializedIdSet = idSet.toBase64String(); function.setFunctionName(TransformFunctionType.INIDSET.name()); arguments.set(1, ExpressionContext.forLiteral(serializedIdSet)); } else { for (ExpressionContext argument : arguments) { handleSubquery(argument, indexSegments, timerContext, executorService, endTimeMs); } } }

Target:
private void handleSubquery(ExpressionContext expression, List<IndexSegment> indexSegments, TimerContext timerContext, ExecutorService executorService, long endTimeMs) throws Exception { FunctionContext function = expression.getFunction(); if (function == null) { return; } List<ExpressionContext> arguments = function.getArguments(); if (StringUtils.remove(function.getFunctionName(), '_').equalsIgnoreCase(IN_PARTITIONED_SUBQUERY)) { Preconditions .checkState(arguments.size() == 2, "IN_PARTITIONED_SUBQUERY requires 2 arguments: expression, subquery"); ExpressionContext subqueryExpression = arguments.get(1); Preconditions.checkState(subqueryExpression.getType() == ExpressionContext.Type.LITERAL, "Second argument of IN_PARTITIONED_SUBQUERY must be a literal (subquery)"); QueryContext subquery = QueryContextConverterUtils.getQueryContextFromSQL(subqueryExpression.getLiteral()); AggregationFunction[] aggregationFunctions = subquery.getAggregationFunctions(); Preconditions.checkState(aggregationFunctions != null && aggregationFunctions.length == 1 && aggregationFunctions[0].getType() == AggregationFunctionType.IDSET && subquery.getGroupByExpressions() == null, "Subquery in IN_PARTITIONED_SUBQUERY should be an ID_SET aggregation only query, found: %s", subqueryExpression.getLiteral()); DataTable dataTable = processQuery(indexSegments, subquery, timerContext, executorService, null, endTimeMs, false); IdSet idSet = dataTable.getObject(0, 0); String serializedIdSet = idSet.toBase64String(); function.setFunctionName(TransformFunctionType.INIDSET.name()); arguments.set(1, ExpressionContext.forLiteral(serializedIdSet)); } else { for (ExpressionContext argument : arguments) { handleSubquery(argument, indexSegments, timerContext, executorService, endTimeMs); } } }
Source:
public Query.Builder projection(Query.SelectExpression... expression) { if (expression == null || expression.length == 0) throw new IllegalArgumentException(); if (projection != null) throw new IllegalStateException("Projection already set"); this.projection = Arrays.stream(expression).map(e -> e.attribute).toArray(size -> new String[size]); return this; }

Target:
public Query.Builder projection(Query.SelectExpression... expression) { if (expression == null || expression.length == 0) throw new IllegalArgumentException(); if (projection != null) throw new IllegalStateException("Projection already set"); this.projection = Arrays.stream(expression).map(Query.SelectExpression::attribute).toArray(String[]::new); return this; }
Source:
void initialize() { SchedulerUtilQuartzImpl.getInstance().scheduleACronJob(this, "onTimer", new Class<?>[] {}, new Object[] {}, Config.<String> GetValue(ConfigValues.AutoRecoverySchedule)); interval = buildInterval(); }

Target:
void initialize() { prevRunTime = new Date(); SchedulerUtilQuartzImpl.getInstance().scheduleACronJob(this, "onTimer", new Class<?>[] {}, new Object[] {}, Config.<String> GetValue(ConfigValues.AutoRecoverySchedule)); }
Source:
private void removeAlwaysOn(IActionSetDescriptor descriptor) { if (descriptor == null) { return; } if (!alwaysOnActionSets.contains(descriptor)) { return; } alwaysOnActionSets.remove(descriptor); if (page != null) { page.perspectiveActionSetChanged(this, descriptor, ActionSetManager.CHANGE_HIDE); } }

Target:
private void removeAlwaysOn(IActionSetDescriptor descriptor) { if (!alwaysOnActionSets.contains(descriptor)) { return; } alwaysOnActionSets.remove(descriptor); page.perspectiveActionSetChanged(this, descriptor, ActionSetManager.CHANGE_HIDE); }
Source:
public FieldWrapper(HighlightExecutionContext executionContext, HighlighterContext context, BasicQueryWeigher weigher) { this.executionContext = executionContext; this.context = context; this.weigher = weigher; this.positionGap = 1; }

Target:
public FieldWrapper(HighlightExecutionContext executionContext, HighlighterContext context, BasicQueryWeigher weigher) { this.executionContext = executionContext; this.context = context; this.weigher = weigher; }
Source:
public PdpFeedGroupEntry buildPdpFeedGroupEntry(ConcurStandardAccountingExtractDetailLine line) { PdpFeedGroupEntry currentGroup = new PdpFeedGroupEntry(); currentGroup.setPayeeName(buildPayeeName(line.getEmployeeLastName(), line.getEmployeeFirstName(), line.getEmployeeMiddleInitital())); currentGroup.setPayeeId(buildPayeeIdEntry(line)); currentGroup.setPaymentDate(formatDate(line.getBatchDate())); currentGroup.setCombineGroupInd(ConcurConstants.StandardAccountingExtractPdpConstants.COMBINDED_GROUP_INDICATOR); currentGroup.setBankCode(ConcurConstants.StandardAccountingExtractPdpConstants.BANK_CODE); currentGroup.setCustomerInstitutionIdentifier(""); return currentGroup; }

Target:
public PdpFeedGroupEntry buildPdpFeedGroupEntry(ConcurStandardAccountingExtractDetailLine line) { PdpFeedGroupEntry currentGroup = new PdpFeedGroupEntry(); currentGroup.setPayeeName(buildPayeeName(line.getEmployeeLastName(), line.getEmployeeFirstName(), line.getEmployeeMiddleInitital())); currentGroup.setPayeeId(buildPayeeIdEntry(line)); currentGroup.setPaymentDate(formatDate(line.getBatchDate())); currentGroup.setCombineGroupInd(ConcurConstants.StandardAccountingExtractPdpConstants.COMBINED_GROUP_INDICATOR); currentGroup.setBankCode(ConcurConstants.StandardAccountingExtractPdpConstants.BANK_CODE); currentGroup.setCustomerInstitutionIdentifier(StringUtils.EMPTY); return currentGroup; }
Source:
public void handle(Request request, Response response) { try (DbSession dbSession = dbClient.openSession(false)) { long conditionId = request.mandatoryParamAsLong(PARAM_ID); OrganizationDto organization = wsSupport.getOrganization(dbSession); userSession.checkPermission(ADMINISTER_QUALITY_GATES, organization); dbClient.gateConditionDao().delete(wsSupport.getCondition(dbSession, conditionId), dbSession); dbSession.commit(); response.noContent(); } }

Target:
public void handle(Request request, Response response) { long conditionId = request.mandatoryParamAsLong(PARAM_ID); try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto organization = wsSupport.getOrganization(dbSession); userSession.checkPermission(ADMINISTER_QUALITY_GATES, organization); dbClient.gateConditionDao().delete(wsSupport.getCondition(dbSession, conditionId), dbSession); dbSession.commit(); response.noContent(); } }
Source:
public ClusterProfile clusterProfile() { Gson gson = new Gson(); Map map = gson.fromJson(clusterProfileMetadata, LinkedHashMap.class); if (map.isEmpty()) { return null; } String pluginId = (String) map.get("pluginId"); String id = (String) map.get("id"); Map<String, String> properties = (Map<String, String>) map.get("properties"); Collection<ConfigurationProperty> configProperties = properties.entrySet().stream().map(entry -> new ConfigurationProperty(new ConfigurationKey(entry.getKey()), new ConfigurationValue(entry.getValue()))).collect(Collectors.toList()); return new ClusterProfile(id, pluginId, configProperties); }

Target:
public ClusterProfile clusterProfile() { Map map = GSON.fromJson(clusterProfileMetadata, LinkedHashMap.class); if (map.isEmpty()) { return null; } String pluginId = (String) map.get("pluginId"); String id = (String) map.get("id"); Map<String, String> properties = (Map<String, String>) map.get("properties"); Collection<ConfigurationProperty> configProperties = properties.entrySet().stream().map(entry -> new ConfigurationProperty(new ConfigurationKey(entry.getKey()), new ConfigurationValue(entry.getValue()))).collect(Collectors.toList()); return new ClusterProfile(id, pluginId, configProperties); }
Source:
private boolean isOverloadedOperator(String name) { if (!name.startsWith("operator")) return false; int operatorCharIndex = 9; if (operatorCharIndex < name.length() && isOperatorChar(name.charAt(operatorCharIndex))) { return true; } return false; }

Target:
private boolean isOverloadedOperator(String name) { if (name.startsWith("operator ")) return true; return false; }
Source:
private void refreshDriveList() { List<String> listData = new ArrayList<>(); File[] roots = File.listRoots(); int firstRemovableDrive = -1; int i = 0; for (File root : roots) { if (DriveListUtils.isNetworkDrive(root.toString().replace(":\\", ""))) { continue; } String description = FileSystemView.getFileSystemView().getSystemTypeDescription(root); long spaceInBytes = root.getTotalSpace(); String sizeWithUnit = DriveListUtils.humanReadableByteCount(spaceInBytes, false); String fileSystem = getFileSystemName(root.toString()); listData.add(root + " (" + description + ") (" + sizeWithUnit + ") - " + Bundle.ConfigVisualPanel1_fileSystem() + ": " + fileSystem); if (firstRemovableDrive == -1) { try { FileStore fileStore = Files.getFileStore(root.toPath()); if ((boolean) fileStore.getAttribute("volume:isRemovable")) { firstRemovableDrive = i; } } catch (IOException ignored) { logger.log(Level.INFO, String.format("Unable to select first removable drive found %s", root.toString())); } } i++; } driveList.setListData(listData.toArray(new String[listData.size()])); if (!listData.isEmpty()) { driveList.setSelectedIndex(firstRemovableDrive == -1 ? 0 : firstRemovableDrive); firePropertyChange(UPDATE_UI_EVENT_NAME, false, true); driveList.requestFocusInWindow(); warningLabel.setText(""); } else { warningLabel.setText(Bundle.ConfigVisualPanel1_messageLabel_noExternalDriveFound()); } }

Target:
private void refreshDriveList() { List<String> listData = new ArrayList<>(); File[] roots = File.listRoots(); int firstRemovableDrive = -1; int i = 0; for (File root : roots) { if (DriveListUtils.isNetworkDrive(root.toString().replace(":\\", ""))) { continue; } String description = FileSystemView.getFileSystemView().getSystemTypeDescription(root); long spaceInBytes = root.getTotalSpace(); String sizeWithUnit = DriveListUtils.humanReadableByteCount(spaceInBytes, false); String fileSystem = getFileSystemName(root.toString()); listData.add(Bundle.ConfigVisualPanel1_driveListItem(root, description, sizeWithUnit, fileSystem)); if (firstRemovableDrive == -1) { try { FileStore fileStore = Files.getFileStore(root.toPath()); if ((boolean) fileStore.getAttribute("volume:isRemovable")) { firstRemovableDrive = i; } } catch (IOException ignored) { logger.log(Level.INFO, String.format("Unable to select first removable drive found %s", root.toString())); } } i++; } driveList.setListData(listData.toArray(new String[listData.size()])); if (!listData.isEmpty()) { driveList.setSelectedIndex(firstRemovableDrive == -1 ? 0 : firstRemovableDrive); firePropertyChange(UPDATE_UI_EVENT_NAME, false, true); driveList.requestFocusInWindow(); warningLabel.setText(""); } else { warningLabel.setText(Bundle.ConfigVisualPanel1_messageLabel_noExternalDriveFound()); } }
Source:
private Interval getInterval(DateTime from, DateTime to){ if (from.getYear() > 2100 || to.getYear() > 2100) { throw new IllegalArgumentException("You cannot request schedule for after 2100"); } Interval interval = new Interval(from, to); if (interval.toDuration().isLongerThan(MAX_DURATION)) { throw new IllegalArgumentException("You cannot request more than " + PeriodFormat.getDefault().print(MAX_DURATION.toPeriod()) + " of schedule"); } return interval; }

Target:
private Interval getInterval(DateTime from, DateTime to){ if (from.getYear() > MAX_ALLOWED_YEAR || to.getYear() > MAX_ALLOWED_YEAR) { throw new IllegalArgumentException("You cannot request schedule for after year "+MAX_ALLOWED_YEAR); } Interval interval = new Interval(from, to); if (interval.toDuration().isLongerThan(MAX_DURATION)) { throw new IllegalArgumentException("You cannot request more than " + PeriodFormat.getDefault().print(MAX_DURATION.toPeriod()) + " of schedule"); } return interval; }