auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public AndroidDocumentProvider( Application application, List<DescriptorProvider> descriptorProviders, ThreadBound enforcer) { super(enforcer); mApplication = Util.throwIfNull(application); mDocumentRoot = new AndroidDocumentRoot(application); mDescriptorMap = new DescriptorMap() .beginInit() .register(Activity.class, new ActivityDescriptor()) .register(AndroidDocumentRoot.class, mDocumentRoot) .register(Application.class, new ApplicationDescriptor()) .register(Dialog.class, new DialogDescriptor()); DialogFragmentDescriptor.register(mDescriptorMap); FragmentDescriptor.register(mDescriptorMap) .register(Object.class, new ObjectDescriptor()) .register(TextView.class, new TextViewDescriptor()) .register(View.class, new ViewDescriptor()) .register(ViewGroup.class, new ViewGroupDescriptor()) .register(Window.class, new WindowDescriptor()); for (DescriptorProvider descriptorProvider : descriptorProviders) { descriptorProvider.register(mDescriptorMap); } mDescriptorMap.setHost(this) .endInit(); mHighlighter = ViewHighlighter.newInstance(); mInspectModeHandler = new InspectModeHandler(); }

Target:
public AndroidDocumentProvider( Application application, List<DescriptorProvider> descriptorProviders, ThreadBound enforcer) { super(enforcer); mApplication = Util.throwIfNull(application); mDocumentRoot = new AndroidDocumentRoot(application); mDescriptorMap = new DescriptorMap() .beginInit() .registerDescriptor(Activity.class, new ActivityDescriptor()) .registerDescriptor(AndroidDocumentRoot.class, mDocumentRoot) .registerDescriptor(Application.class, new ApplicationDescriptor()) .registerDescriptor(Dialog.class, new DialogDescriptor()) .registerDescriptor(Object.class, new ObjectDescriptor()) .registerDescriptor(TextView.class, new TextViewDescriptor()) .registerDescriptor(View.class, new ViewDescriptor()) .registerDescriptor(ViewGroup.class, new ViewGroupDescriptor()) .registerDescriptor(Window.class, new WindowDescriptor()); DialogFragmentDescriptor.register(mDescriptorMap); FragmentDescriptor.register(mDescriptorMap); for (int i = 0, size = descriptorProviders.size(); i < size; ++i) { final DescriptorProvider descriptorProvider = descriptorProviders.get(i); descriptorProvider.registerDescriptor(mDescriptorMap); } mDescriptorMap.setHost(this).endInit(); mHighlighter = ViewHighlighter.newInstance(); mInspectModeHandler = new InspectModeHandler(); }
Source:
public void onPartitionBecomeLeaderFromStandby(String partitionName) { logger.info("Partition state change notification from Standby to Leader received for partition {}", partitionName); if (!partitionsToReplicate.isEmpty() && !partitionsToReplicate.contains(partitionName)) { logger.info("Ignoring state change of partition as it is not in recovery partition config", partitionName); return; } synchronized (notificationLock) { try { addCloudReplica(partitionName); } catch (ReplicationException rex) { logger.error("Exception while adding replication for partition {}", rex, partitionName); replicationMetrics.addCloudPartitionErrorCount.inc(); } } }

Target:
public void onPartitionBecomeLeaderFromStandby(String partitionName) { logger.info("Partition state change notification from Standby to Leader received for partition {}", partitionName); if (shouldReplicatePartition(partitionName)) { synchronized (notificationLock) { try { addCloudReplica(partitionName); } catch (ReplicationException rex) { logger.error("Exception while adding replication for partition {}", rex, partitionName); replicationMetrics.addCloudPartitionErrorCount.inc(); } } } }
Source:
public void test() { connect(); click(jq("$low")); waitResponse(); Assert.assertTrue(getBarWidth() == 998); click(jq("$reset")); waitResponse(); click(jq("$high")); waitResponse(); Assert.assertTrue(getBarWidth() >= 800); click(jq("$reset")); waitResponse(); click(jq("$veryhigh")); waitResponse(); Assert.assertTrue(getBarWidth() >= 800); }

Target:
public void test() { connect(); click(jq("$low")); waitResponse(); Assert.assertTrue(getBarWidth() == jq("$prog").width()); click(jq("$reset")); waitResponse(); click(jq("$high")); waitResponse(); Assert.assertTrue(getBarWidth() >= 800); click(jq("$reset")); waitResponse(); click(jq("$veryhigh")); waitResponse(); Assert.assertTrue(getBarWidth() >= 800); }
Source:
private String getAggrTransactionList(Collection<?> collection, int columnIndex) { Object headCursor = collection; Object tailCursor = collection; String columnText = ""; while (headCursor instanceof List<?> && !((List<?>) headCursor).isEmpty()) { headCursor = ((List<?>) headCursor).get(0); } while (tailCursor instanceof List<?> && !((List<?>) tailCursor).isEmpty()) { List<?> list = (List<?>) tailCursor; tailCursor = list.get(list.size() - 1); } if (headCursor instanceof TransactionRecord && tailCursor instanceof TransactionRecord) { TransactionRecord headTransaction = (TransactionRecord) headCursor; TransactionRecord tailTransaction = (TransactionRecord) tailCursor; if (columnIndex == 0) { columnText = String.valueOf(headTransaction.getId() + "..." + tailTransaction.getId()); } else if (columnIndex == 1) { DateFormat DATE_FORMAT = new SimpleDateFormat("MM/dd/yyyy hh:mm a"); columnText = DATE_FORMAT.format(headTransaction.getTimeStamp()); } } else { columnText = "Unexpected aggregation of " + headCursor.getClass().getSimpleName() + " and " + tailCursor.getClass().getSimpleName(); } return columnText; }

Target:
private String getAggrTransactionList(Collection<?> collection, int columnIndex) { Object headCursor = collection; Object tailCursor = collection; String columnText = ""; while (headCursor instanceof List<?> && !((List<?>) headCursor).isEmpty()) { headCursor = ((List<?>) headCursor).get(0); } while (tailCursor instanceof List<?> && !((List<?>) tailCursor).isEmpty()) { List<?> list = (List<?>) tailCursor; tailCursor = list.get(list.size() - 1); } if (headCursor instanceof TransactionRecord && tailCursor instanceof TransactionRecord) { TransactionRecord headTransaction = (TransactionRecord) headCursor; TransactionRecord tailTransaction = (TransactionRecord) tailCursor; if (columnIndex == 0) { columnText = String.valueOf(headTransaction.getId() + "..." + tailTransaction.getId()); } else if (columnIndex == 1) { columnText = DATE_FORMAT.format(headTransaction.getTimeStamp()); } } else { columnText = "Unexpected aggregation of " + headCursor.getClass().getSimpleName() + " and " + tailCursor.getClass().getSimpleName(); } return columnText; }
Source:
public void undepend(final String... jids) throws IOException { final List<String> args = new ArrayList<>(); args.add(this.jid); args.add("off"); for (final String jid : jids) { args.add(jid); } final String[] array = new String[args.size()]; args.toArray(array); this.client.call( LuaCommand.DEPENDS.toString(), array); }

Target:
public void undepend(final String... jids) throws IOException { final List<String> args = new ArrayList<>(); args.add(this.jid); args.add("off"); Collections.addAll(args, jids); final String[] array = new String[args.size()]; args.toArray(array); this.client.call( LuaCommand.DEPENDS.toString(), array); }
Source:
public void checkSystemNotExists() throws IOException, XmlPullParserException { final File baseDir = new File("src/test/files/structure/test-suite-folders-exist/system-not-exists"); when(fs.baseDir()).thenReturn(baseDir); final TestSuiteFoldersExistCheck check = new TestSuiteFoldersExistCheck(fs); final Iterable<ConnectorIssue> pomIssues = check.analyze(null); assertThat(Iterables.size(pomIssues), is(1)); final ConnectorIssue first = Iterables.getFirst(pomIssues, null); assertThat(first.ruleKey(), is("test-suite-folders-exists")); assertThat(first.message(), is("System test suite directory doesn't exist.")); }

Target:
public void checkSystemNotExists() throws IOException, XmlPullParserException { final File baseDir = new File("src/test/files/structure/test-suite-folders-exist/system-not-exists"); when(fs.baseDir()).thenReturn(baseDir); final TestSuiteFoldersExistCheck check = new TestSuiteFoldersExistCheck(fs); final Iterable<ConnectorIssue> pomIssues = check.analyze(null); assertThat(Iterables.size(pomIssues), is(1)); final ConnectorIssue first = Iterables.getOnlyElement(pomIssues, null); assertThat(first.ruleKey(), is("test-suite-folders-exists")); assertThat(first.message(), is("System test suite directory doesn't exist.")); }
Source:
public void testRenameLimit() throws Exception { ObjectId aId = blob("foo\nbar\nbaz\nblarg\n"); ObjectId bId = blob("foo\nbar\nbaz\nblah\n"); DiffEntry a = DiffEntry.add(PATH_A, aId); DiffEntry b = DiffEntry.delete(PATH_Q, bId); ObjectId cId = blob("a\nb\nc\nd\n"); ObjectId dId = blob("a\nb\nc\n"); DiffEntry c = DiffEntry.add(PATH_B, cId); DiffEntry d = DiffEntry.delete(PATH_H, dId); rd.add(a); rd.add(b); rd.add(c); rd.add(d); rd.setRenameLimit(1); assertTrue(rd.isOverRenameLimit()); }

Target:
public void testRenameLimit() throws Exception { ObjectId aId = blob("foo\nbar\nbaz\nblarg\n"); ObjectId bId = blob("foo\nbar\nbaz\nblah\n"); DiffEntry a = DiffEntry.add(PATH_A, aId); DiffEntry b = DiffEntry.delete(PATH_B, bId); ObjectId cId = blob("a\nb\nc\nd\n"); ObjectId dId = blob("a\nb\nc\n"); DiffEntry c = DiffEntry.add(PATH_H, cId); DiffEntry d = DiffEntry.delete(PATH_Q, dId); rd.add(a); rd.add(b); rd.add(c); rd.add(d); rd.setRenameLimit(1); assertTrue(rd.isOverRenameLimit()); List<DiffEntry> entries = rd.compute(); assertEquals(4, entries.size()); assertSame(a, entries.get(0)); assertSame(b, entries.get(1)); assertSame(c, entries.get(2)); assertSame(d, entries.get(3)); }
Source:
public static void main(String[] args) throws ExecutionException, InterruptedException { if (args.length < 2) { LOG.error("Required at least two arguments, only python file or python module is available."); System.exit(1); } final CommandLineParser<PythonDriverOptions> commandLineParser = new CommandLineParser<>( new PythonDriverOptionsParserFactory()); PythonDriverOptions pythonDriverOptions = null; try { pythonDriverOptions = commandLineParser.parse(args); } catch (Exception e) { LOG.error("Could not parse command line arguments {}.", args, e); commandLineParser.printHelp(PythonDriver.class.getSimpleName()); System.exit(1); } Configuration config = ExecutionEnvironment.getExecutionEnvironment().getConfiguration(); GatewayServer gatewayServer = PythonEnvUtils.startGatewayServer(); final List<String> commands = constructPythonCommands(pythonDriverOptions); try { String tmpDir = System.getProperty("java.io.tmpdir") + File.separator + "pyflink" + File.separator + UUID.randomUUID(); Process pythonProcess = PythonEnvUtils.launchPy4jPythonClient( gatewayServer, config, commands, pythonDriverOptions.getEntryPointScript().orElse(null), tmpDir); setGatewayServer(gatewayServer); int exitCode = pythonProcess.waitFor(); if (exitCode != 0) { throw new RuntimeException("Python process exits with code: " + exitCode); } } catch (Throwable e) { LOG.error("Run python process failed", e); throw new ProgramAbortException(); } finally { gatewayServer.shutdown(); setGatewayServer(null); } }

Target:
public static void main(String[] args) throws ExecutionException, InterruptedException { if (args.length < 2) { LOG.error("Required at least two arguments, only python file or python module is available."); System.exit(1); } final CommandLineParser<PythonDriverOptions> commandLineParser = new CommandLineParser<>( new PythonDriverOptionsParserFactory()); PythonDriverOptions pythonDriverOptions = null; try { pythonDriverOptions = commandLineParser.parse(args); } catch (Exception e) { LOG.error("Could not parse command line arguments {}.", args, e); commandLineParser.printHelp(PythonDriver.class.getSimpleName()); System.exit(1); } Configuration config = ExecutionEnvironment.getExecutionEnvironment().getConfiguration(); GatewayServer gatewayServer = PythonEnvUtils.startGatewayServer(); PythonEnvUtils.setGatewayServer(gatewayServer); final List<String> commands = constructPythonCommands(pythonDriverOptions); try { String tmpDir = System.getProperty("java.io.tmpdir") + File.separator + "pyflink" + File.separator + UUID.randomUUID(); Process pythonProcess = PythonEnvUtils.launchPy4jPythonClient( gatewayServer, config, commands, pythonDriverOptions.getEntryPointScript().orElse(null), tmpDir); int exitCode = pythonProcess.waitFor(); if (exitCode != 0) { throw new RuntimeException("Python process exits with code: " + exitCode); } } catch (Throwable e) { LOG.error("Run python process failed", e); throw new ProgramAbortException(); } finally { PythonEnvUtils.setGatewayServer(null); gatewayServer.shutdown(); } }
Source:
protected void handleGroupedCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { String[] cpu = { "cpu" }; String[] thread = { "thread" }; boolean isCpu = Arrays.deepEquals(aspect.getGroupIds(), cpu); boolean isThread = Arrays.deepEquals(aspect.getGroupIds(), thread); if (isCpu || isThread) { Integer id = isCpu ? TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event) : KernelTidAspect.INSTANCE.resolve(event); if (id != null) { int parentQuark = ss.getQuarkRelativeAndAdd(rootQuark, isCpu ? cpu[0] : thread[0]); int quark = ss.getQuarkRelativeAndAdd(parentQuark, Integer.toString(id)); quark = ss.getQuarkRelativeAndAdd(quark, aspect.getName()); Long resolve = aspect.resolve(event); ss.modifyAttribute(event.getTimestamp().toNanos(), resolve == null ? TmfStateValue.nullValue() : TmfStateValue.newValueLong(resolve), quark); } } }

Target:
protected void handleGroupedCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { String[] cpu = { "cpu" }; String[] thread = { "thread" }; boolean isCpu = Arrays.deepEquals(aspect.getGroupIds(), cpu); boolean isThread = Arrays.deepEquals(aspect.getGroupIds(), thread); if (isCpu || isThread) { Integer id = isCpu ? TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event) : TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), LinuxTidAspect.class, event); if (id != null) { int parentQuark = ss.getQuarkRelativeAndAdd(rootQuark, isCpu ? cpu[0] : thread[0]); int quark = ss.getQuarkRelativeAndAdd(parentQuark, Integer.toString(id)); quark = ss.getQuarkRelativeAndAdd(quark, aspect.getName()); Long eventContent = aspect.resolve(event); ss.modifyAttribute(event.getTimestamp().toNanos(), eventContent, quark); } } }
Source:
public VocabularyTreeNode get(String vocabularyName, boolean displayObsoleteEntries, char keySeparator, String orderingField) { if (treeModels == null) { treeModels = new HashMap<String, VocabularyTreeNode>(); } VocabularyTreeNode treeModel = treeModels.get(vocabularyName); if (treeModel != null) { return treeModel; } DirectoryService directoryService = DirectoryHelper.getDirectoryService(); try { Directory directory = Framework.getService(DirectoryService.class).getDirectory(vocabularyName); if (directory == null) { throw new DirectoryException(vocabularyName + " is not a registered directory"); } } catch (DirectoryException e) { throw new RuntimeException(e); } treeModel = new VocabularyTreeNode(0, "", "", "", vocabularyName, directoryService, displayObsoleteEntries, keySeparator, orderingField); treeModels.put(vocabularyName, treeModel); return treeModel; }

Target:
public VocabularyTreeNode get(String vocabularyName, boolean displayObsoleteEntries, char keySeparator, String orderingField) { if (treeModels == null) { treeModels = new HashMap<String, VocabularyTreeNode>(); } VocabularyTreeNode treeModel = treeModels.get(vocabularyName); if (treeModel != null) { return treeModel; } DirectoryService directoryService = Framework.getService(DirectoryService.class); try { Directory directory = Framework.getService(DirectoryService.class).getDirectory(vocabularyName); if (directory == null) { throw new DirectoryException(vocabularyName + " is not a registered directory"); } } catch (DirectoryException e) { throw new RuntimeException(e); } treeModel = new VocabularyTreeNode(0, "", "", "", vocabularyName, directoryService, displayObsoleteEntries, keySeparator, orderingField); treeModels.put(vocabularyName, treeModel); return treeModel; }
Source:
public void setLockStatePrefetchEnabled(boolean enabled) { checkActive(); IEvent event = null; synchronized (CDOViewImpl.this) { if (enabled != lockStatePrefetchEnabled) { lockStatePrefetchEnabled = enabled; if (enabled) { cdoLockStatePrefetcher = new CDOLockStatePrefetcher(CDOViewImpl.this); } else if (cdoLockStatePrefetcher != null) { cdoLockStatePrefetcher.dispose(); cdoLockStatePrefetcher = null; } event = new LockStatePrefetchEventImpl(enabled); } } fireEvent(event); }

Target:
public void setLockStatePrefetchEnabled(boolean enabled) { checkActive(); IEvent event = null; synchronized (CDOViewImpl.this) { if (enabled != lockStatePrefetchEnabled) { lockStatePrefetchEnabled = enabled; if (enabled) { cdoLockStatePrefetcher = new CDOLockStatePrefetcher(); } else { cdoLockStatePrefetcher.dispose(); cdoLockStatePrefetcher = null; } event = new LockStatePrefetchEventImpl(enabled); } } fireEvent(event); }
Source:
public E add(E element) { if (this.managedProvider != null) { this.managedProvider.add(element); } else { throw new IllegalStateException("ManagedProvider is not available"); } return element; }

Target:
public E add(E element) { if (this.managedProvider != null) { this.managedProvider.add(element); return element; } else { throw new IllegalStateException("ManagedProvider is not available"); } }
Source:
public void testExecuteQueryComplete() throws InterruptedException { AsyncQuery queryObj = mock(AsyncQuery.class); String query = "/group?sort=commonName&fields%5Bgroup%5D=commonName,description"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; UUID uuid = UUID.fromString("edc4a871-dff2-4054-804e-d80075cf827d"); when(queryObj.getQuery()).thenReturn(query); when(queryObj.getId()).thenReturn(id); when(queryObj.getRequestId()).thenReturn(uuid); when(queryObj.getQueryType()).thenReturn(QueryType.JSONAPI_V1_0); when(queryObj.getAsyncAfterSeconds()).thenReturn(10); service.executeQuery(queryObj, testUser, NO_VERSION); verify(queryObj, times(1)).setStatus(QueryStatus.PROCESSING); verify(queryObj, times(1)).setStatus(QueryStatus.COMPLETE); }

Target:
public void testExecuteQueryComplete() throws InterruptedException { AsyncQuery queryObj = mock(AsyncQuery.class); String query = "/group?sort=commonName&fields%5Bgroup%5D=commonName,description"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; when(queryObj.getQuery()).thenReturn(query); when(queryObj.getId()).thenReturn(id); when(queryObj.getRequestId()).thenReturn(id); when(queryObj.getQueryType()).thenReturn(QueryType.JSONAPI_V1_0); when(queryObj.getAsyncAfterSeconds()).thenReturn(10); service.executeQuery(queryObj, testUser, NO_VERSION); verify(queryObj, times(1)).setStatus(QueryStatus.PROCESSING); verify(queryObj, times(1)).setStatus(QueryStatus.COMPLETE); }
Source:
public static ReplicationFilter all() { return new ReplicationFilter(ImmutableList.<String>of()); }

Target:
public static ReplicationFilter all() { return new ReplicationFilter(Collections.<String> emptyList()); }
Source:
private void maybeSplit(SolGame game) { if (MIN_SPLIT_SZ > size) { return; } float sclSum = 0; while (sclSum < .7f * size * size) { float speedAngle = SolRandom.randomFloat(180); Vector2 splittedSpeed = new Vector2(); SolMath.fromAl(splittedSpeed, speedAngle, SolRandom.randomFloat(0, .5f) * MAX_SPLIT_SPD); splittedSpeed.add(splittedSpeed); Vector2 newPos = new Vector2(); SolMath.fromAl(newPos, speedAngle, SolRandom.randomFloat(0, size / 2)); newPos.add(position); float sz = size * SolRandom.randomFloat(.25f, .5f); Asteroid a = game.getAsteroidBuilder().buildNew(game, newPos, splittedSpeed, sz, removeController); game.getObjectManager().addObjDelayed(a); sclSum += a.size * a.size; } float thrMoney = size * 40f * SolRandom.randomFloat(.3f, 1); List<MoneyItem> moneyItems = game.getItemMan().moneyToItems(thrMoney); for (MoneyItem mi : moneyItems) { throwLoot(game, mi); } }

Target:
private void maybeSplit(SolGame game) { if (MIN_SPLIT_SZ > size) { return; } float sclSum = 0; while (sclSum < .7f * size * size) { float speedAngle = SolRandom.randomFloat(180); Vector2 splitSpeed = new Vector2(); SolMath.fromAl(splitSpeed, speedAngle, SolRandom.randomFloat(0, .5f) * MAX_SPLIT_SPD); splitSpeed.add(splitSpeed); Vector2 newPos = new Vector2(); SolMath.fromAl(newPos, speedAngle, SolRandom.randomFloat(0, size / 2)); newPos.add(position); float sz = size * SolRandom.randomFloat(.25f, .5f); Asteroid a = game.getAsteroidBuilder().buildNew(game, newPos, splitSpeed, sz, removeController); game.getObjectManager().addObjDelayed(a); sclSum += a.size * a.size; } float thrMoney = size * 40f * SolRandom.randomFloat(.3f, 1); List<MoneyItem> moneyItems = game.getItemMan().moneyToItems(thrMoney); for (MoneyItem mi : moneyItems) { throwLoot(game, mi); } }
Source:
private void finishFetch() { try { int cursorLen = dis==null?0:dis.readInt(); if (cursorLen == 0) { close(); return; } if (this.cursorBin == null || cursorLen > this.cursorBin.length) { this.cursorBin = new byte[cursorLen]; } dis.readFully(this.cursorBin,0,cursorLen); } catch (IOException e) { prefetchException = new HpccFileException("Error during read block", e); try { close(); } catch(Exception ie){} } if (this.simulateFail) this.handle = -1; String readAheadTrans = (this.forceCursorUse) ? this.getCursorTrans() : this.getHandleTrans(); try { int lenTrans = readAheadTrans.length(); this.dos.writeInt(lenTrans); this.dos.write(readAheadTrans.getBytes(HPCCCharSet), 0, lenTrans); this.dos.flush(); } catch (IOException e) { prefetchException = new HpccFileException("Failure sending read ahead transaction", e); try { close(); } catch(Exception ie){} } }

Target:
private void finishFetch() { try { if (dis==null) { return; } int cursorLen = dis.readInt(); if (cursorLen == 0) { close(); return; } if (this.cursorBin == null || cursorLen > this.cursorBin.length) { this.cursorBin = new byte[cursorLen]; } dis.readFully(this.cursorBin,0,cursorLen); } catch (IOException e) { prefetchException = new HpccFileException("Error during read block", e); try { close(); } catch(Exception ie){} } if (this.simulateFail) this.handle = -1; String readAheadTrans = (this.forceCursorUse) ? this.getCursorTrans() : this.getHandleTrans(); try { int lenTrans = readAheadTrans.length(); this.dos.writeInt(lenTrans); this.dos.write(readAheadTrans.getBytes(HPCCCharSet), 0, lenTrans); this.dos.flush(); } catch (IOException e) { prefetchException = new HpccFileException("Failure sending read ahead transaction", e); try { close(); } catch(Exception ie){} } }
Source:
public Component getOwner() { Objects.requireNonNull(listenOnComponents, "listenOnComponents must be initialized " + "(by calling listenOn()) before calling this method!"); if (listenOnComponents.length <= 0 || listenOnComponents[0] == null) { throw new IllegalStateException("listenOnComponents must not be empty!"); } return listenOnComponents[0]; }

Target:
public Component getOwner() { if (listenOnComponents == null) { return null; } if (listenOnComponents.length <= 0 || listenOnComponents[0] == null) { throw new IllegalStateException("listenOnComponents must not be empty!"); } return listenOnComponents[0]; }
Source:
public static String getCPU() { if (!isPlatformAvailable()) throw new UnsupportedOperationException("JNR Platform class not loaded"); return PlatformLoader.PLATFORM.getCPU().toString(); }

Target:
public static String getCPU() { if (!isPlatformAvailable()) throw new IllegalStateException( "JNR Platform class not loaded. " + "Check isPlatformAvailable() before calling this method."); return PlatformLoader.PLATFORM.getCPU().toString(); }
Source:
public String executeRequest(String urlString, ParamsMap params, Method method, ContentType contentTypeFormat) throws MambuApiException { String applicationKey = MambuAPIFactory.getApplicationKey(); if (applicationKey != null) { if (params == null) params = new ParamsMap(); params.addParam(APPLICATION_KEY, applicationKey); if (LOGGER.isLoggable(Level.INFO)) { final int keyLength = applicationKey.length(); final int printLength = 3; if (keyLength >= printLength) { LOGGER.info("Added Application key=" + applicationKey.substring(0, printLength) + "..." + applicationKey.substring(keyLength - printLength, keyLength)); } } } String response = ""; try { switch (method) { case GET: response = executeGetRequest(urlString, params); break; case POST: response = executePostRequest(urlString, params, contentTypeFormat); break; case DELETE: response = executeDeleteRequest(urlString, params); break; default: throw new IllegalArgumentException("Only methods GET, POST and DELETE are supported, not " + method.name() + "."); } } catch (MalformedURLException e) { LOGGER.severe("MalformedURLException: " + e.getMessage()); throw new MambuApiException(e); } catch (IOException e) { LOGGER.warning("IOException: message= " + e.getMessage()); throw new MambuApiException(e); } return response; }

Target:
public String executeRequest(String urlString, ParamsMap params, Method method, ContentType contentTypeFormat) throws MambuApiException { logApiRequest(method, contentTypeFormat, urlString, params); String applicationKey = MambuAPIFactory.getApplicationKey(); if (applicationKey != null) { if (params == null) { params = new ParamsMap(); } params.addParam(APPLICATION_KEY, applicationKey); logAppKey(applicationKey); } String response = ""; try { switch (method) { case GET: response = executeGetRequest(urlString, params); break; case POST: response = executePostRequest(urlString, params, contentTypeFormat); break; case DELETE: response = executeDeleteRequest(urlString, params); break; default: throw new IllegalArgumentException("Only methods GET, POST and DELETE are supported, not " + method.name() + "."); } } catch (MalformedURLException e) { LOGGER.severe("MalformedURLException: " + e.getMessage()); throw new MambuApiException(e); } catch (IOException e) { LOGGER.warning("IOException: message= " + e.getMessage()); throw new MambuApiException(e); } return response; }
Source:
public static void main(String[] args) { System.out.println(" +----------------------------------------------+"); System.out.println(" | XBee Java Library Reset Module Data Sample |"); System.out.println(" +----------------------------------------------+\n"); ZigBeeDevice myDevice = new ZigBeeDevice(PORT, BAUD_RATE); try { myDevice.open(); myDevice.reset(); System.out.println(">> XBee module reset successfully"); } catch (XBeeException e) { e.printStackTrace(); System.exit(1); } finally { myDevice.close(); } }

Target:
public static void main(String[] args) { System.out.println(" +-----------------------------------------+"); System.out.println(" | XBee Java Library Reset Module Sample |"); System.out.println(" +-----------------------------------------+\n"); ZigBeeDevice myDevice = new ZigBeeDevice(PORT, BAUD_RATE); try { myDevice.open(); myDevice.reset(); System.out.println(">> XBee module reset successfully"); } catch (XBeeException e) { e.printStackTrace(); System.exit(1); } finally { myDevice.close(); } }
Source:
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { _collector = collector; }

Target:
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { this.collector = collector; }
Source:
private static boolean isSingleTopic(ReadableConfig tableOptions) { return tableOptions.getOptional(TOPIC).isPresent() && tableOptions.get(TOPIC).split(",").length == 1; }

Target:
private static boolean isSingleTopic(ReadableConfig tableOptions) { return tableOptions.getOptional(TOPIC).map(t -> t.size() == 1).orElse(false); }
Source:
protected void afterRead(final int n) throws IOException { if (n == EOF && !marked) { close(); } }

Target:
protected void afterRead(final int n) throws IOException { if (n == EOF) { close(); } }
Source:
private DBCursor prepareCursor(final FindOptions findOptions) { final DBObject query = getQueryObject(); if (LOG.isTraceEnabled()) { LOG.trace(String.format("Running query(%s) : %s, options: %s,", dbColl.getName(), query, findOptions)); } final DBCursor cursor = dbColl.find(query, findOptions.getOptions() .sort(getSortObject()) .projection(getFieldsObject())); cursor.setDecoderFactory(ds.getDecoderFact()); switch (findOptions.getCursorType()) { case TailableAwait: cursor.addOption(Bytes.QUERYOPTION_AWAITDATA); case Tailable: cursor.addOption(Bytes.QUERYOPTION_TAILABLE); break; default: break; } if (options.isSnapshot() && (findOptions.getSortDBObject() != null || findOptions.hasHint())) { LOG.warning("Snapshotted query should not have hint/sort."); } if (findOptions.getCursorType() != NonTailable && (findOptions.getSortDBObject() != null)) { LOG.warning("Sorting on tail is not allowed."); } return cursor; }

Target:
private DBCursor prepareCursor(final FindOptions findOptions) { final DBObject query = getQueryObject(); if (LOG.isTraceEnabled()) { LOG.trace(String.format("Running query(%s) : %s, options: %s,", dbColl.getName(), query, findOptions)); } final DBCursor cursor = dbColl.find(query, findOptions.getOptions() .sort(getSortObject()) .projection(getFieldsObject())); cursor.setDecoderFactory(ds.getDecoderFact()); switch (findOptions.getCursorType()) { case TailableAwait: cursor.addOption(Bytes.QUERYOPTION_AWAITDATA); cursor.addOption(Bytes.QUERYOPTION_TAILABLE); break; case Tailable: cursor.addOption(Bytes.QUERYOPTION_TAILABLE); break; default: break; } if (options.isSnapshot() && (findOptions.getSortDBObject() != null || findOptions.hasHint())) { LOG.warning("Snapshotted query should not have hint/sort."); } if (findOptions.getCursorType() != NonTailable && (findOptions.getSortDBObject() != null)) { LOG.warning("Sorting on tail is not allowed."); } return cursor; }
Source:
public Mediator createSpecificMediator(OMElement elem, Properties properties) { CallMediator callMediator = new CallMediator(); processAuditStatus(callMediator,elem); OMElement epElement = elem.getFirstChildWithName(ENDPOINT_Q); if (epElement != null) { Endpoint endpoint = EndpointFactory.getEndpointFromElement(epElement, true, properties); if (endpoint != null) { callMediator.setEndpoint(endpoint); } } OMAttribute blocking=elem.getAttribute(BLOCKING_Q); if (blocking!=null) { boolean EndpointType = epElement.toString().contains("endpoint key"); callMediator.setBlocking(Boolean.parseBoolean(blocking.getAttributeValue())); callMediator.setEndpointType(EndpointType); }else { callMediator.setBlocking(false); } return callMediator; }

Target:
public Mediator createSpecificMediator(OMElement elem, Properties properties) { CallMediator callMediator = new CallMediator(); processAuditStatus(callMediator, elem); OMElement epElement = elem.getFirstChildWithName(ENDPOINT_Q); if (epElement != null) { Endpoint endpoint = EndpointFactory.getEndpointFromElement(epElement, true, properties); if (endpoint != null) { callMediator.setEndpoint(endpoint); } } OMAttribute blocking = elem.getAttribute(BLOCKING_Q); if (blocking != null) { callMediator.setBlocking(Boolean.parseBoolean(blocking.getAttributeValue())); } else { callMediator.setBlocking(false); } return callMediator; }
Source:
public CompletableFuture<CoordinationResponse> handleCoordinationRequest(CoordinationRequest request) { Preconditions.checkArgument( request instanceof CollectCoordinationRequest, "Coordination request must be a CollectCoordinationRequest"); CompletableFuture<CoordinationResponse> responseFuture = new CompletableFuture<>(); executorService.submit(() -> handleRequestImpl((CollectCoordinationRequest) request, responseFuture)); return responseFuture; }

Target:
public CompletableFuture<CoordinationResponse> handleCoordinationRequest(CoordinationRequest request) { Preconditions.checkArgument( request instanceof CollectCoordinationRequest, "Coordination request must be a CollectCoordinationRequest"); CollectCoordinationRequest collectRequest = (CollectCoordinationRequest) request; CompletableFuture<CoordinationResponse> responseFuture = new CompletableFuture<>(); if (address == null) { completeWithEmptyResponse(collectRequest, responseFuture); return responseFuture; } executorService.submit(() -> handleRequestImpl(collectRequest, responseFuture, address)); return responseFuture; }
Source:
public static ObjectElement marshalFrom(Attribute attribute) throws CatalogTransformerException { ObjectElement element = new ObjectElement(); element.setName(attribute.getName()); if (attribute.getValue() != null) { for (Serializable value : attribute.getValues()) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos; try { oos = new ObjectOutputStream(baos); oos.writeObject(value); oos.close(); } catch (IOException e) { throw new CatalogTransformerException( "Could not transform Metacard to XML. Could not serialize Attribute Object value.", e); } (element).getValue().add(baos.toByteArray()); } } return element; }

Target:
public static ObjectElement marshalFrom(Attribute attribute) throws CatalogTransformerException { ObjectElement element = new ObjectElement(); element.setName(attribute.getName()); if (attribute.getValue() != null) { for (Serializable value : attribute.getValues()) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos; try { oos = new ObjectOutputStream(baos); oos.writeObject(value); oos.close(); } catch (IOException e) { throw new CatalogTransformerException( "Could not transform Metacard to XML. Could not serialize Attribute Object value.", e); } element.getValue().add(baos.toByteArray()); } } return element; }
Source:
public void testGetRequiredTokens() { final MatchXpathCheck matchXpathCheck = new MatchXpathCheck(); assertThat("Expected empty array", matchXpathCheck.getRequiredTokens(), is(CommonUtil.EMPTY_INT_ARRAY)); }

Target:
public void testGetRequiredTokens() { final MatchXpathCheck matchXpathCheck = new MatchXpathCheck(); assertWithMessage("Expected empty array") .that(matchXpathCheck.getRequiredTokens()) .isEmpty(); }
Source:
switch (platform) { case "win32": COLUMN_TRIM= 4; break; case "carbon": COLUMN_TRIM= 24; break; case "cocoa": default: COLUMN_TRIM= 3; break; }

Target:
switch (platform) { case "win32": COLUMN_TRIM= 4; break; case "cocoa": COLUMN_TRIM= 24; break; default: COLUMN_TRIM= 3; break; }
Source:
public void init(HelixManager manager, String workflowName, String jobName, String taskName) { if (participant != null) { participant.registerRunningTask(this); } super.init(manager, workflowName, jobName, taskName); try { TaskUtil.deserializeTaskData(this, this.callbackContext.getTaskConfig().getConfigMap()); } catch (IllegalAccessException | InstantiationException e) { e.printStackTrace(); } }

Target:
public void init(HelixManager manager, String workflowName, String jobName, String taskName) { if (participant != null) { participant.registerRunningTask(this); } else { logger.warn("Task with id: " + taskId + " is not registered since the participant is not set"); } super.init(manager, workflowName, jobName, taskName); try { TaskUtil.deserializeTaskData(this, this.callbackContext.getTaskConfig().getConfigMap()); } catch (IllegalAccessException | InstantiationException e) { e.printStackTrace(); } }
Source:
private Node reduceTrueFalse(Node n) { switch (n.getParent().getType()) { case Token.EQ: case Token.GT: case Token.GE: case Token.LE: case Token.LT: case Token.NE: Node number = IR.number(n.isTrue() ? 1 : 0); n.getParent().replaceChild(n, number); reportCodeChange(); return number; } if (late) { Node not = IR.not(IR.number(n.isTrue() ? 0 : 1)); not.copyInformationFromForTree(n); n.getParent().replaceChild(n, not); reportCodeChange(); return not; } return n; }

Target:
private Node reduceTrueFalse(Node n) { if (late) { switch (n.getParent().getType()) { case Token.EQ: case Token.GT: case Token.GE: case Token.LE: case Token.LT: case Token.NE: Node number = IR.number(n.isTrue() ? 1 : 0); n.getParent().replaceChild(n, number); reportCodeChange(); return number; } Node not = IR.not(IR.number(n.isTrue() ? 0 : 1)); not.copyInformationFromForTree(n); n.getParent().replaceChild(n, not); reportCodeChange(); return not; } return n; }
Source:
private void sendPostJoinOperationsBackToMaster() { final ClusterServiceImpl clusterService = getService(); final NodeEngineImpl nodeEngine = clusterService.getNodeEngine(); Collection<Operation> postJoinOperations = nodeEngine.getPostJoinOperations(); if (postJoinOperations != null && !postJoinOperations.isEmpty()) { final OperationService operationService = nodeEngine.getOperationService(); final Collection<Member> members = clusterService.getMembers(); Address masterAddress = clusterService.getMasterAddress(); OnJoinOp operation = new OnJoinOp(postJoinOperations); operationService.invokeOnTarget(ClusterServiceImpl.SERVICE_NAME, operation, masterAddress); } }

Target:
private void sendPostJoinOperationsBackToMaster() { final ClusterServiceImpl clusterService = getService(); final NodeEngineImpl nodeEngine = clusterService.getNodeEngine(); Collection<Operation> postJoinOperations = nodeEngine.getPostJoinOperations(); if (postJoinOperations != null && !postJoinOperations.isEmpty()) { final OperationService operationService = nodeEngine.getOperationService(); Address masterAddress = clusterService.getMasterAddress(); OnJoinOp operation = new OnJoinOp(postJoinOperations); operationService.invokeOnTarget(ClusterServiceImpl.SERVICE_NAME, operation, masterAddress); } }
Source:
public void testCreateDataCenterWithIllegalArguments() throws Exception { String[] names = {"JCl@ouds", "JC|ouds", "^clouds", ""}; for (String name : names) try { DataCenter.Request.CreatePayload.create(name, Location.US_LAS); fail("Should have failed for name: ".concat(name)); } catch (Exception ex) { assertTrue(ex instanceof IllegalArgumentException); } }

Target:
public void testCreateDataCenterWithIllegalArguments() throws Exception { String[] names = {"JCl@ouds", "JC|ouds", "^clouds", ""}; for (String name : names) { try { DataCenter.Request.CreatePayload.create(name, Location.US_LAS); fail("Should have failed for name: ".concat(name)); } catch (IllegalArgumentException ex) { } } }
Source:
public String toString() { return getName() + ": " + getType() + " = " + getValue(); }

Target:
public String toString() { return toString(false); }
Source:
void addPathParam(String name, String value, boolean encoded) { if (relativeUrl == null) { throw new AssertionError(); } String replacement = canonicalizeForPath(value, encoded); if (PATH_TRAVERSAL.matcher(replacement).matches()) { throw new IllegalArgumentException( "@Path parameters shouldn't perform path traversal ('.' or '..'): " + value); } relativeUrl = relativeUrl.replace("{" + name + "}", replacement); }

Target:
void addPathParam(String name, String value, boolean encoded) { if (relativeUrl == null) { throw new AssertionError(); } String replacement = canonicalizeForPath(value, encoded); String newRelativeUrl = relativeUrl.replace("{" + name + "}", replacement); if (PATH_TRAVERSAL.matcher(newRelativeUrl).matches()) { throw new IllegalArgumentException( "@Path parameters shouldn't perform path traversal ('.' or '..'): " + value); } relativeUrl = newRelativeUrl; }
Source:
public void auditLogMacInUse(final VmNetworkInterface iface) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { AuditLogableBase logable = new AuditLogableBase(); logable.addCustomValue("MACAddr", iface.getMacAddress()); log(logable, AuditLogType.MAC_ADDRESS_IS_IN_USE); log.warnFormat("VmInterfaceManager::Network Interface {0} has MAC address {1} which is in use, " + "therefore the action failed.", iface.getName(), iface.getMacAddress()); return null; } }); }

Target:
public void auditLogMacInUse(final VmNetworkInterface iface) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { AuditLogableBase logable = createAuditLog(iface); log(logable, AuditLogType.MAC_ADDRESS_IS_IN_USE); log.warnFormat("Network Interface {0} has MAC address {1} which is in use, " + "therefore the action for VM {2} failed.", iface.getName(), iface.getMacAddress(), iface.getVmId()); return null; } }); }
Source:
public int intermediateComputeSizeBytes() { int sizeBytesConfigured = intermediateComputeSizeBytesConfigured(); if (sizeBytesConfigured != DEFAULT_PROCESSING_BUFFER_SIZE_BYTES) { return sizeBytesConfigured; } else if (computedBufferSizeBytes.get() != null) { return computedBufferSizeBytes.get(); } long directSizeBytes = JvmUtils.getRuntimeInfo().getDirectMemorySizeBytes(); int numProcessingThreads = getNumThreads(); int numMergeBuffers = getNumMergeBuffers(); int totalNumBuffers = numMergeBuffers + numProcessingThreads; int sizePerBuffer = (int) ((double) directSizeBytes / (double) (totalNumBuffers + 1)); int rem = sizePerBuffer % (1 << 16); sizePerBuffer -= rem; final int computedSizePerBuffer = Math.min(sizePerBuffer, (1 << 31) - 1); if (computedBufferSizeBytes.compareAndSet(null, computedSizePerBuffer)) { log.info( "Auto sizing buffers to [%,d] bytes for [%,d] processing buffers and [%,d] merge buffers", computedSizePerBuffer, numProcessingThreads, numMergeBuffers ); } return computedSizePerBuffer; }

Target:
public int intermediateComputeSizeBytes() { int sizeBytesConfigured = intermediateComputeSizeBytesConfigured(); if (sizeBytesConfigured != DEFAULT_PROCESSING_BUFFER_SIZE_BYTES) { return sizeBytesConfigured; } else if (computedBufferSizeBytes.get() != null) { return computedBufferSizeBytes.get(); } long directSizeBytes = JvmUtils.getRuntimeInfo().getDirectMemorySizeBytes(); int numProcessingThreads = getNumThreads(); int numMergeBuffers = getNumMergeBuffers(); int totalNumBuffers = numMergeBuffers + numProcessingThreads; int sizePerBuffer = (int) ((double) directSizeBytes / (double) (totalNumBuffers + 1)); final int computedSizePerBuffer = Math.min(sizePerBuffer, MAX_DEFAULT_PROCESSING_BUFFER_SIZE_BYTES); if (computedBufferSizeBytes.compareAndSet(null, computedSizePerBuffer)) { log.info( "Auto sizing buffers to [%,d] bytes each for [%,d] processing and [%,d] merge buffers " + "out of [%,d] max direct memory", computedSizePerBuffer, numProcessingThreads, numMergeBuffers, directSizeBytes ); } return computedSizePerBuffer; }
Source:
private void trackCampaignOpenedIfNeeded(Intent intent) { if (intent == null) { return; } try { if (intent.hasExtra("campaignId") && intent.hasExtra("messageId")) { String campaignId = intent.getStringExtra("campaignId"); String messageId = intent.getStringExtra("messageId"); String extraLogData = intent.getStringExtra("extraLogData"); try { JSONObject pushProps; if (extraLogData != null) { pushProps = new JSONObject(extraLogData); } else { pushProps = new JSONObject(); } pushProps.put("campaign_id", Integer.valueOf(campaignId).intValue()); pushProps.put("message_id", Integer.valueOf(messageId).intValue()); pushProps.put("message_type", "push"); mMpInstance.track("$app_open", pushProps); } catch (JSONException e) } } catch (BadParcelableException e) { } }

Target:
private void trackCampaignOpenedIfNeeded(Intent intent) { if (intent == null) { return; } if (intent.hasExtra("mp_campaign_id") && intent.hasExtra("mp_message_id")) { MixpanelAPI.trackPushNotificationEventFromIntent(mMpInstance.getContext(), intent, "$app_open"); } }
Source:
public FSDataInputStream openFile(Path path, HiveFileContext hiveFileContext) throws Exception { return dataTier.openFile(path, hiveFileContext); }

Target:
public FSDataInputStream openFile(Path path, HiveFileContext hiveFileContext) throws Exception { if (hiveFileContext.isCacheable()) { return new CachingInputStream(dataTier.openFile(path, hiveFileContext), cacheManager, path, cacheValidationEnabled); } return dataTier.openFile(path, hiveFileContext); }
Source:
public NakadiCursor(final String topic, final String partition, final String offset) { assert null != topic && null != partition && null != offset; this.topic = topic; this.partition = partition; this.offset = offset; }

Target:
public NakadiCursor(final String topic, final String partition, final String offset) { this.topic = topic; this.partition = partition; this.offset = offset; }
Source:
protected String removeRelation(String edgeName){ if(edgeName != null && edgeName.contains(", ")){ edgeName = edgeName.substring(0, edgeName.lastIndexOf(',')); } return edgeName; }

Target:
private String removeRelation(String edgeName){ if(edgeName != null && edgeName.contains(", ")){ edgeName = edgeName.substring(0, edgeName.lastIndexOf(',')); } return edgeName; }
Source:
private final Map<String, S> newStrategyMap() { final Map<String, S> map = new TreeMap<String, S>(); final List<P> providers = getProviderFinder().find(); Collections.sort(providers, ProviderPriority.COMPARATOR); for (final P provider : providers) { try { map.putAll(getStrategies(provider)); } catch (final Exception e) { LOG.warn("Could not load strategies for provider: {}, because of: {}. It will be skipped.", provider, e.getMessage()); } } overrideDefaultStrategyMap(map); return map; }

Target:
private final Map<String, S> newStrategyMap() { final Map<String, S> map = new TreeMap<String, S>(); final List<P> providers = getProviderFinder().find(); for (final P provider : providers) { try { map.putAll(getStrategies(provider)); } catch (final Exception e) { LOG.warn("Could not load strategies for provider: {}, because of: {}. It will be skipped.", provider, e.getMessage()); } } overrideDefaultStrategyMap(map); return map; }
Source:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); extensionHook.addOptionsParamSet(getOptions()); extensionHook.addAddonFilesChangedListener(addonFilesChangedListener); if (getView() != null) { extensionHook.getHookView().addOptionPanel(getOptionsPanel()); extensionHook.getHookMenu().addPopupMenuItem(new PopupMenuOpenInBrowser(this)); } extensionHook.addApiImplementor(seleniumApi); ExtensionScript extScript = Control.getSingleton().getExtensionLoader().getExtension(ExtensionScript.class); if (extScript != null) { extScript.registerScriptType( new ScriptType( SCRIPT_TYPE_SELENIUM, "selenium.scripts.type.selenium", createScriptIcon(), true)); } }

Target:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); extensionHook.addOptionsParamSet(getOptions()); extensionHook.addAddonFilesChangedListener(addonFilesChangedListener); if (getView() != null) { extensionHook.getHookView().addOptionPanel(getOptionsPanel()); extensionHook.getHookMenu().addPopupMenuItem(new PopupMenuOpenInBrowser(this)); } extensionHook.addApiImplementor(seleniumApi); if (getExtScript() != null) { seleniumScriptType = new ScriptType( SCRIPT_TYPE_SELENIUM, "selenium.scripts.type.selenium", createScriptIcon(), true); extScript.registerScriptType(seleniumScriptType); } }
Source:
protected void basicClear(RegionEventImpl regionEvent) { getDataView().checkSupportsRegionClear(); basicClear(regionEvent, false); }

Target:
protected void basicClear(RegionEventImpl regionEvent) { basicClear(regionEvent, false); }
Source:
private void disposeImages() { for (Image image : images) { image.dispose(); } images = null; }

Target:
private void disposeImages() { images.forEach(i -> i.dispose()); images.clear(); }
Source:
public void removeCompareInputChangeListener(ICompareInputChangeListener listener) { if (containsListener(listener)) { listeners.remove(listener); } }

Target:
public void removeCompareInputChangeListener(ICompareInputChangeListener listener) { listeners.remove(listener); }
Source:
public void testStoreResults() { String responseBody = "responseBody"; byte[] testResponse = responseBody.getBytes(); Blob result = null; try { result = new SerialBlob(testResponse); } catch (SQLException throwables) { throwables.printStackTrace(); } URL url = defaultResultStorageEngine.storeResults( asyncQueryResultStorage.getId(), testResponse); assertEquals(url.getClass(), URL.class); }

Target:
public void testStoreResults() throws SerialException, SQLException { String responseBody = "responseBody"; byte[] testResponse = responseBody.getBytes(); AsyncQueryResult result = new AsyncQueryResult(); result = defaultResultStorageEngine.storeResults(result, responseBody, "ID"); assertEquals(new SerialBlob(testResponse), result.getAttachment()); }
Source:
private static String ensureEndsWithSlash(String path) { if (path.charAt(path.length() - 1) == '/') { return path; } else { return path + '/'; } }

Target:
private static String ensureEndsWithSlash(String path) { return path.endsWith("/") ? path : path + '/'; }