auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void parseOptions(String prefix, OptionSet options) { if ( options.has(prefix + "host")) this.host = (String) options.valueOf(prefix + "host"); if ( options.has(prefix + "password")) this.password = (String) options.valueOf(prefix + "password"); if ( options.has(prefix + "user")) this.user = (String) options.valueOf(prefix + "user"); if ( options.has(prefix + "port")) this.port = Integer.valueOf((String) options.valueOf(prefix + "port")); if ( options.has(prefix + "jdbc_options") ) { String[] opts = ((String) options.valueOf(prefix + "jdbc_options")).replaceAll("\\s+", "").split(","); for ( String opt : opts ) { this.jdbc_options.add(opt); } } }

Target:
public void parseOptions(String prefix, OptionSet options) { if ( options.has(prefix + "host")) this.host = (String) options.valueOf(prefix + "host"); if ( options.has(prefix + "password")) this.password = (String) options.valueOf(prefix + "password"); if ( options.has(prefix + "user")) this.user = (String) options.valueOf(prefix + "user"); if ( options.has(prefix + "port")) this.port = Integer.valueOf((String) options.valueOf(prefix + "port")); if ( options.has(prefix + "jdbc_options") ) { String[] opts = ((String) options.valueOf(prefix + "jdbc_options")).split("&"); for ( String opt : opts ) { this.jdbc_options.add(opt.trim()); } } }
Source:
public Response act(final Request req) throws IOException { int attempts = 0; IOException exeption = new IOException(); while (attempts < this.count) { try { return this.take.act(req); } catch (final IOException ex) { attempts = attempts + 1; exeption = ex; this.sleep(); } } throw exeption; }

Target:
public Response act(final Request req) throws IOException { if (this.count <= 0) { throw new IllegalArgumentException( "can't make less than one attempt" ); } int attempts = 0; final List<IOException> failures = new ArrayList<IOException>(this.count); while (attempts < this.count) { try { return this.take.act(req); } catch (final IOException ex) { ++attempts; failures.add(ex); this.sleep(); } } throw new IOException( String.format( "failed after %d attempts: %s", failures.size(), TkRetry.strings(failures) ), failures.get(failures.size() - 1) ); }
Source:
private void refreshReposIfNeeded(Guid storageDomainId, ImageFileType imageType, boolean forceRefresh) { AtomicLong lastRefreshed = domainsLastRefreshedTime.computeIfAbsent(storageDomainId, k -> new AtomicLong(-1)); if (forceRefresh || shouldInvalidateCache(lastRefreshed.longValue())) { synchronized (lastRefreshed) { if (forceRefresh || shouldInvalidateCache(lastRefreshed.longValue())) { boolean refreshSucceeded = refreshRepos(storageDomainId, imageType); lastRefreshed.set(System.currentTimeMillis()); if (forceRefresh && !refreshSucceeded) { throw new EngineException(EngineError.IMAGES_NOT_SUPPORTED_ERROR); } } } } }

Target:
private void refreshReposIfNeeded(Guid storageDomainId, ImageFileType imageType, boolean forceRefresh) { MutableLong lastRefreshed = domainsLastRefreshedTime.computeIfAbsent(storageDomainId, k -> new MutableLong(-1)); if (forceRefresh || shouldInvalidateCache(lastRefreshed.longValue())) { synchronized (lastRefreshed) { if (forceRefresh || shouldInvalidateCache(lastRefreshed.longValue())) { boolean refreshSucceeded = refreshRepos(storageDomainId, imageType); lastRefreshed.setValue(System.currentTimeMillis()); if (forceRefresh && !refreshSucceeded) { throw new EngineException(EngineError.IMAGES_NOT_SUPPORTED_ERROR); } } } } }
Source:
private boolean isNextSequenceForUnresolvedPartition(TopicPartition topicPartition, int sequence) { if (this.hasUnresolvedSequence(topicPartition)) { return sequence == this.partitionsWithUnresolvedSequences.get(topicPartition); } return false; }

Target:
private boolean isNextSequenceForUnresolvedPartition(TopicPartition topicPartition, int sequence) { return this.hasUnresolvedSequence(topicPartition) && sequence == this.partitionsWithUnresolvedSequences.get(topicPartition); }
Source:
private void addConfigsAndUpload(TestExecutionBuilder testExecutionBuilder, Report report, Report.Test test, PerfRepoClient perfRepoClient) throws Exception { addNormalizedConfigs(report, testExecutionBuilder); TestExecution testExecution = testExecutionBuilder.build(); if (testExecution.getParameters() != null) { for (TestExecutionParameter parameter : testExecution.getParameters()) { String value = parameter.getValue(); if (value != null && value.length() > 2047) { parameter.setValue(value.substring(0, 2044) + "..."); } } } try { Long executionId = perfRepoClient.createTestExecution(testExecution); if (executionId == null) { logAndThrowTestExecutionFailure(testExecution); } uploadAttachments(report, perfRepoClient, executionId); } catch (Exception e) { throw new Exception("Error while creating test execution for test " + test.name, e); } }

Target:
private void addConfigsAndUpload(TestExecutionBuilder testExecutionBuilder, Report report, Report.Test test, PerfRepoClient perfRepoClient) throws Exception { addNormalizedConfigs(report, testExecutionBuilder); TestExecution testExecution = testExecutionBuilder.build(); if (testExecution.getParameters() != null) { for (TestExecutionParameter parameter : testExecution.getParameters()) { String value = parameter.getValue(); if (value != null && value.length() > MAX_VALUE_LENGTH) { parameter.setValue(value.substring(0, MAX_VALUE_LENGTH - 3) + "..."); } } } try { Long executionId = perfRepoClient.createTestExecution(testExecution); if (executionId == null) { logAndThrowTestExecutionFailure(testExecution); } uploadAttachments(report, perfRepoClient, executionId); } catch (Exception e) { throw new Exception("Error while creating test execution for test " + test.name, e); } }
Source:
public void testWriteToTsv() throws NoSuchMethodException, IOException { List<@NonNull ISegment> fixture = new ArrayList<>(); for (int i = 1; i <= 20; i++) { int start = i; final int delta = i; int end = start + delta * delta; fixture.add(new SystemCall(new SystemCall.InitialInfo(start, "left_pack"), end)); } assertNotNull(fTable); fTable.updateModel(fixture); SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable()); SWTBot bot = new SWTBot(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1", 0, 2)); SWTWorkbenchBot swtWorkbenchBot = new SWTWorkbenchBot(); SWTBotView viewBot = swtWorkbenchBot.viewById(VIEW_ID); List<String> actionResult = Arrays.asList(testToTsv(viewBot)); String absolutePath = TmfTraceManager.getTemporaryDirPath() + File.separator + "syscallLatencyTest.testWriteToTsv.tsv"; TmfFileDialogFactory.setOverrideFiles(absolutePath); SWTBotMenu menuBot = viewBot.viewMenu().menu("Export to TSV"); try { assertTrue(menuBot.isEnabled()); assertTrue(menuBot.isVisible()); menuBot.click(); try (BufferedReader br = new BufferedReader(new FileReader(absolutePath))) { List<String> lines = br.lines().collect(Collectors.toList()); assertEquals("Both reads", actionResult, lines); } } finally { new File(absolutePath).delete(); } }

Target:
public void testWriteToTsv() throws NoSuchMethodException, IOException { List<@NonNull ISegment> fixture = new ArrayList<>(); for (int i = 1; i <= 20; i++) { int start = i; final int delta = i; int end = start + delta * delta; fixture.add(new SystemCall(new SystemCall.InitialInfo(start, (start %3 != 0) ? "leftpad" : "rightpad"), end)); } assertNotNull(fTable); fTable.updateModel(fixture); SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable()); SWTBot bot = new SWTBot(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1", 0, 2)); SWTWorkbenchBot swtWorkbenchBot = new SWTWorkbenchBot(); SWTBotView viewBot = swtWorkbenchBot.viewById(VIEW_ID); List<String> actionResult = Arrays.asList(testToTsv(viewBot)); String absolutePath = TmfTraceManager.getTemporaryDirPath() + File.separator + "syscallLatencyTest.testWriteToTsv.tsv"; TmfFileDialogFactory.setOverrideFiles(absolutePath); SWTBotMenu menuBot = viewBot.viewMenu().menu("Export to TSV"); try { assertTrue(menuBot.isEnabled()); assertTrue(menuBot.isVisible()); menuBot.click(); try (BufferedReader br = new BufferedReader(new FileReader(absolutePath))) { List<String> lines = br.lines().collect(Collectors.toList()); assertEquals("Both reads", actionResult, lines); } } finally { new File(absolutePath).delete(); } }
Source:
@Test public void testCoalesceWithoutWriting() { tester(false, new JdbcTest.HrSchema()) .query("?") .withRel( builder -> builder .scan("s", "emps") .project(builder.field(4)) .filter( builder.call(SqlStdOperatorTable.GREATER_THAN_OR_EQUAL, builder.call(SqlStdOperatorTable.COALESCE, builder.field(0), builder.literal(0)), builder.literal(500))) .build() ) .planContains("" + " public boolean moveNext() {\n" + " while (inputEnumerator.moveNext()) {\n" + " final Integer inp4_ = (Integer) ((Object[]) inputEnumerator.current())[4];\n" + " if ((inp4_ != null ? inp4_.intValue() : 0) >= 500) {\n" + " return true;\n" + " }\n" + " }\n" + " return false;\n" + " }") .returnsUnordered( "commission=500", "commission=1000"); }

Target:
@Test public void testCoalesceWithoutWriting() { CalciteAssert.that() .with(CalciteConnectionProperty.FORCE_DECORRELATE, false) .withSchema("s", new ReflectiveSchema(new JdbcTest.HrSchema())) .query("?") .withRel( builder -> builder .scan("s", "emps") .project(builder.field(4)) .filter( builder.call(SqlStdOperatorTable.GREATER_THAN_OR_EQUAL, builder.call(SqlStdOperatorTable.COALESCE, builder.field(0), builder.literal(0)), builder.literal(500))) .build() ) .planContains("" + " public boolean moveNext() {\n" + " while (inputEnumerator.moveNext()) {\n" + " final Integer inp4_ = (Integer) ((Object[]) inputEnumerator.current())[4];\n" + " if ((inp4_ != null ? inp4_.intValue() : 0) >= 500) {\n" + " return true;\n" + " }\n" + " }\n" + " return false;\n" + " }") .returnsUnordered( "commission=500", "commission=1000"); }
Source:
public void setFailCaseString(String failCaseString) { if (failCaseString == null) { throw new IllegalArgumentException("failCaseString is null"); } if (!"".equals(failCaseString)) { Config.failCaseString = failCaseString; this.failCaseString = failCaseString; } }

Target:
void setFailCaseString(String failCaseString) { if(failCaseString == null) { throw new IllegalArgumentException("failCaseString is null"); } if(failCaseString.isEmpty()) { throw new IllegalArgumentException("failCaseString is empty"); } Config.failCaseString = failCaseString; this.failCaseString = failCaseString; getConfig().setProperty(FAIL_CASE_STRING, failCaseString); }
Source:
public void queryPageWithComplexStartEndKeyAndJsonArrayValue() { init(); View query = db.view("example/creator_boolean_total") .startKey("uuid" ,false, 1) .endKey("uuid" ,false, 2000); Page page = null; try { page = query.queryPage(30, null, Object.class); } catch (Exception e) { e.printStackTrace(); } assertThat(page.getResultList().size(), is(1)); }

Target:
public void queryPageWithComplexStartEndKeyAndJsonArrayValue() { init(); View query = db.view("example/creator_boolean_total") .startKey("uuid" ,true, 1) .endKey("uuid" ,true, 2000); Page page = query.queryPage(30, null, Object.class); assertThat(page.getResultList().size(), is(2)); Gson gson = new Gson(); ArrayList<JsonArray> expectedJsonArray = new ArrayList<JsonArray>(), actualJsonArray = new ArrayList<JsonArray>(); for(int i = 0; i < page.getResultList().size(); i++) { JsonArray expectedArray = new JsonArray(); expectedArray.add(gson.toJsonTree("key-" + (i + 2))); expectedArray.add(gson.toJsonTree(10.009999999999999787 + i + 1)); expectedJsonArray.add(expectedArray); JsonArray actualArray = new JsonArray(); JsonElement jsonTitleValue = (gson.toJsonTree(page.getResultList().get(i))) .getAsJsonObject().get("title"); actualArray.add(jsonTitleValue); JsonElement jsonTotalValue = (gson.toJsonTree(page.getResultList().get(i))) .getAsJsonObject().get("contentArray").getAsJsonArray().get(0) .getAsJsonObject().get("total"); actualArray.add(jsonTotalValue); actualJsonArray.add(actualArray); } assertJsonArrayKeysAndValues(expectedJsonArray, actualJsonArray); }
Source:
public void testSingleItemObject() { abvsResult.reset(); try { ob.reset(abvsResult); getTaggedValuePointable("id", tvp1); getTaggedValuePointable(1, tvp2); ob.addItem(tvp1, tvp2); ob.finish(); } catch (IOException e) { Assert.fail("Test failed to write the object pointable."); } tvp.set(abvsResult); if (tvp.getTag() != ValueTag.OBJECT_TAG) { Assert.fail("Type tag is incorrect. Expected: " + ValueTag.OBJECT_TAG + " Got: " + tvp.getTag()); } tvp.getValue(op); if (op.getEntryCount() != 1) { Assert.fail("Object size is incorrect. Expected: 1 Got: " + op.getEntryCount()); } try { op.getKeys(tvp); } catch (SystemException e) { Assert.fail("Test failed to write the object pointable."); } if (tvp.getTag() != ValueTag.XS_STRING_TAG) { Assert.fail("Type tag is incorrect. Expected: " + ValueTag.XS_STRING_TAG + " Got: " + tvp.getTag()); } if (!FunctionHelper.arraysEqual(tvp, tvp1)) { Assert.fail("Key is incorrect. Expected: id"); } op.getValue(tvp1, tvp); if (!FunctionHelper.arraysEqual(tvp, tvp2)) { Assert.fail("Value is incorrect for the given key."); } }

Target:
public void testSingleItemObject() { abvsResult.reset(); try { ob.reset(abvsResult); getTaggedValuePointable("id", false, tvpKey1); getTaggedValuePointable(1, tvpValue1); ob.addItem(tvpKey1, tvpValue1); ob.finish(); } catch (IOException e) { Assert.fail("Test failed to write the object pointable."); } tvp.set(abvsResult); if (tvp.getTag() != ValueTag.OBJECT_TAG) { Assert.fail("Type tag is incorrect. Expected: " + ValueTag.OBJECT_TAG + " Got: " + tvp.getTag()); } tvp.getValue(op); if (op.getEntryCount() != 1) { Assert.fail("Object size is incorrect. Expected: 1 Got: " + op.getEntryCount()); } try { op.getKeys(tvp); } catch (IOException e) { Assert.fail("Test failed to write the object pointable."); } if (tvp.getTag() != ValueTag.XS_STRING_TAG) { Assert.fail("Type tag is incorrect. Expected: " + ValueTag.XS_STRING_TAG + " Got: " + tvp.getTag()); } if (!compareKeys(tvp, tvpKey1)) { Assert.fail("Key is incorrect. Expected: id"); } if (!op.getValue(tvpKey1, tvp)) { Assert.fail("Value not found for the given key:id"); } if (!FunctionHelper.arraysEqual(tvp, tvpValue1)) { Assert.fail("Value is incorrect for the given key. Expected: 1 with valuetag: " + ValueTag.XS_INT_TAG + " Got valuetag: " + tvp.getTag()); } }
Source:
private void init() { _phaseListeners = new LinkedList<PhaseListener>(ZKBinderPhaseListeners.getSystemPhaseListeners()); String clz = Library.getProperty(PHASE_LISTENER_CLASS_KEY); if (!Strings.isEmpty(clz)) { try { addPhaseListener((PhaseListener) Classes.forNameByThread(clz).newInstance()); } catch (Exception e) { _log.error("Error when initial phase listener:" + clz, e); } } Executions.getCurrent().getDesktop().getWebApp().getConfiguration().registerCallBack("destroy", new DestroyCallback()); }

Target:
private void init() { _phaseListeners = new LinkedList<PhaseListener>(ZKBinderPhaseListeners.getSystemPhaseListeners()); String clz = Library.getProperty(PHASE_LISTENER_CLASS_KEY); if (!Strings.isEmpty(clz)) { try { addPhaseListener((PhaseListener) Classes.forNameByThread(clz).newInstance()); } catch (Exception e) { _log.error("Error when initial phase listener:" + clz, e); } } }
Source:
public void define(String title, final RbDefinition.Callback cb) { Call<Map<String, RbDefinition.Usage[]>> call = webService.define(title); call.enqueue(new Callback<Map<String, RbDefinition.Usage[]>>() { @Override public void onResponse(Call<Map<String, RbDefinition.Usage[]>> call, Response<Map<String, RbDefinition.Usage[]>> response) { if (response.isSuccessful()) { if (response.body() == null) { cb.success(null); return; } responseHeaderHandler.onHeaderCheck(response); cb.success(new RbDefinition(response.body())); } else { Throwable throwable = RetrofitException.httpError(response, retrofit); RbSwitch.INSTANCE.onRbRequestFailed(throwable); cb.failure(throwable); } } @Override public void onFailure(Call<Map<String, RbDefinition.Usage[]>> call, Throwable throwable) { RbSwitch.INSTANCE.onRbRequestFailed(throwable); cb.failure(throwable); } }); }

Target:
public void define(String title, final RbDefinition.Callback cb) { Call<Map<String, RbDefinition.Usage[]>> call = webService.define(title); call.enqueue(new Callback<Map<String, RbDefinition.Usage[]>>() { @Override public void onResponse(Call<Map<String, RbDefinition.Usage[]>> call, Response<Map<String, RbDefinition.Usage[]>> response) { if (response.isSuccessful()) { if (response.body() == null) { cb.failure(new JsonParseException("Response missing required fields")); return; } responseHeaderHandler.onHeaderCheck(response); cb.success(new RbDefinition(response.body())); } else { Throwable throwable = RetrofitException.httpError(response, retrofit); RbSwitch.INSTANCE.onRbRequestFailed(throwable); cb.failure(throwable); } } @Override public void onFailure(Call<Map<String, RbDefinition.Usage[]>> call, Throwable throwable) { RbSwitch.INSTANCE.onRbRequestFailed(throwable); cb.failure(throwable); } }); }
Source:
public final void rightClickBlock(GlowPlayer player, GlowBlock against, BlockFace face, ItemStack holding, Vector clickedLoc) { GlowBlock target = against.getRelative(face); GlowBlockState newState = target.getState(); BlockSlab.SlabPlaceable slabplaceable = BlockSlab.isSlabPlaceable(player, target, against, face, holding); if (against.getType() == Material.LONG_GRASS || slabplaceable == BlockSlab.SlabPlaceable.AGAINSTBLOCK) { target = against; newState = target.getState(); } else if (!target.isEmpty() && !target.isLiquid() && slabplaceable == BlockSlab.SlabPlaceable.NO) { return; } if (!EventFactory.onBlockCanBuild(target, getId(), face).isBuildable()) { return; } placeBlock(player, newState, face, holding, clickedLoc); BlockPlaceEvent event = EventFactory.onBlockPlace(target, newState, against, player); if (event.isCancelled() || !event.canBuild()) { return; } newState.update(true); target.getWorld().playSound(target.getLocation(), Sound.DIG_WOOD, 1, 1); afterPlace(player, target, holding); if (player.getGameMode() != GameMode.CREATIVE) { holding.setAmount(holding.getAmount() - 1); } }

Target:
public final void rightClickBlock(GlowPlayer player, GlowBlock against, BlockFace face, ItemStack holding, Vector clickedLoc) { GlowBlock target = against.getRelative(face); GlowBlockState newState = target.getState(); if (canAbsorb(against, face, holding, false)) { target = against; newState = target.getState(); } else if (!target.isEmpty() && !target.isLiquid()) { if (!canAbsorb(target, face.getOppositeFace(), holding, true)) { return; } } if (!EventFactory.onBlockCanBuild(target, getId(), face).isBuildable()) { return; } placeBlock(player, newState, face, holding, clickedLoc); BlockPlaceEvent event = EventFactory.onBlockPlace(target, newState, against, player); if (event.isCancelled() || !event.canBuild()) { return; } newState.update(true); target.getWorld().playSound(target.getLocation(), Sound.DIG_WOOD, 1, 1); afterPlace(player, target, holding); if (player.getGameMode() != GameMode.CREATIVE) { holding.setAmount(holding.getAmount() - 1); } }
Source:
private static boolean isX86(IVMInstall vm) { return (vm instanceof AbstractVMInstall) && PlatformUtil.ARCH_X86.equals(PreferencesUtil.getArchitecture((AbstractVMInstall) vm)); }

Target:
private static boolean isX86(IVMInstall vm) { return PlatformUtil.ARCH_X86.equals(PreferencesUtil.getArchitecture(vm)); }
Source:
public void testNormalOperation() throws Exception { int conns = 5; ArrayList<String> connectionIds = new ArrayList<String>(); for (int i = 0; i < conns; i++) { connectionIds.add(blockingSSLConnect(DEFAULT_SOCKET_BUF_SIZE)); } int responseCount = 0; List<NetworkSend> sends = new ArrayList<NetworkSend>(); for (int i = 0; i < conns; i++) { String connectionId = connectionIds.get(i); sends.add(SelectorTest.createSend(connectionId, connectionId + "&" + 0)); } while (responseCount < conns) { selector.poll(0L, sends); Thread.sleep(100); assertEquals("No disconnects should have occurred.", 0, selector.disconnected().size()); for (NetworkReceive receive : selector.completedReceives()) { ByteBuf payload = receive.getReceivedBytes().content(); String[] pieces = SelectorTest.asString(payload).split("&"); assertEquals("Should be in the form 'conn-counter'", 2, pieces.length); assertEquals("Check the source", receive.getConnectionId(), pieces[0]); assertTrue("Received connectionId is as expected ", connectionIds.contains(receive.getConnectionId())); assertEquals("Check the request counter", 0, Integer.parseInt(pieces[1])); responseCount++; } sends.clear(); for (NetworkSend send : selector.completedSends()) { String dest = send.getConnectionId(); sends.add(SelectorTest.createSend(dest, dest + "&" + 0)); } } }

Target:
public void testNormalOperation() throws Exception { int conns = 5; ArrayList<String> connectionIds = new ArrayList<String>(); for (int i = 0; i < conns; i++) { connectionIds.add(blockingSSLConnect(DEFAULT_SOCKET_BUF_SIZE)); } int responseCount = 0; List<NetworkSend> sends = new ArrayList<NetworkSend>(); for (int i = 0; i < conns; i++) { String connectionId = connectionIds.get(i); sends.add(SelectorTest.createSend(connectionId, connectionId + "&" + 0)); } while (responseCount < conns) { selector.poll(0L, sends); Thread.sleep(100); assertEquals("No disconnects should have occurred.", 0, selector.disconnected().size()); for (NetworkReceive receive : selector.completedReceives()) { ByteBuf payload = receive.getReceivedBytes().content(); String[] pieces = SelectorTest.asString(payload).split("&"); assertEquals("Should be in the form 'conn-counter'", 2, pieces.length); assertEquals("Check the source", receive.getConnectionId(), pieces[0]); assertTrue("Received connectionId is as expected ", connectionIds.contains(receive.getConnectionId())); assertEquals("Check the request counter", 0, Integer.parseInt(pieces[1])); responseCount++; receive.getReceivedBytes().release(); } sends.clear(); for (NetworkSend send : selector.completedSends()) { String dest = send.getConnectionId(); sends.add(SelectorTest.createSend(dest, dest + "&" + 0)); } } }
Source:
public final List<? extends Action> getAllActions() { List<Action> _actions = new ArrayList<Action>(getActions()); for (TransientActionFactory<?> taf : ExtensionList.lookup(TransientActionFactory.class)) { if (taf.type().isInstance(this)) { try { _actions.addAll(createFor(taf)); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Actionable#getAllActions: Could not load actions from " + taf + " for " + this, e); } } else if (taf == null) { LOGGER.log(Level.FINE, "Actionable#getAllActions: the Transient Action is null"); } else { LOGGER.log(Level.FINE, "Actionable#getAllActions: " + taf + "is not a Transient Action"); } } return Collections.unmodifiableList(_actions); }

Target:
public final List<? extends Action> getAllActions() { List<Action> _actions = new ArrayList<Action>(getActions()); for (TransientActionFactory<?> taf : ExtensionList.lookup(TransientActionFactory.class)) { if (taf.type().isInstance(this)) { try { Collection<? extends Action> newActions = createFor(taf); for (Action action : newActions) { if (action instanceof Action) { _actions.add(action); } else { LOGGER.log(Level.WARNING, "Not action found in " + this.getClass().getName() + "in TransientActionFactory " + taf.getClass().getName()); } } } catch (Exception e) { if (this instanceof Saveable) OldDataMonitor.report((Saveable) this, Collections.<Throwable>singleton(e)); LOGGER.log(Level.SEVERE, "Could not load actions from " + taf + " for " + this, e); } } } return Collections.unmodifiableList(_actions); }
Source:
private SortedSet<Type> getExtraImports(TypeElement element) { SortedSet<Type> extraImports = new TreeSet<Type>(); MapperConfiguration mapperConfiguration = MapperConfiguration.getInstanceOn( element ); for ( TypeMirror extraImport : mapperConfiguration.imports() ) { Type type = typeFactory.getType( extraImport ); extraImports.add( type ); } if ( !"*".equals( mapperConfiguration.implementationPackage() ) ) { extraImports.add( typeFactory.getType( element ) ); } return extraImports; }

Target:
private SortedSet<Type> getExtraImports(TypeElement element) { SortedSet<Type> extraImports = new TreeSet<Type>(); MapperConfiguration mapperConfiguration = MapperConfiguration.getInstanceOn( element ); for ( TypeMirror extraImport : mapperConfiguration.imports() ) { Type type = typeFactory.getType( extraImport ); extraImports.add( type ); } if ( !"default".equals( mapperConfiguration.implementationPackage() ) ) { extraImports.add( typeFactory.getType( element ) ); } return extraImports; }
Source:
public void testEntrySetAfterRemoveInBranchedTransaction() throws Exception { cache.put(1, "v1"); cache.put(2, "v2"); tm().begin(); try { assertEquals("v1", cache.get(1)); Transaction suspended = tm().suspend(); tm().begin(); try { cache.remove(1); } finally { tm().commit(); tm().resume(suspended); Set<Map.Entry<Object, Object>> entrySet = cache.entrySet(); assertEquals(2, entrySet.size()); for (Map.Entry<Object, Object> entry : entrySet) { Object key = entry.getKey(); Object value = entry.getValue(); if (entry.getKey().equals(1)) { assertEquals("v1", value); } else if (key.equals(2)) { assertEquals("v2", value); } else { fail("Unexpected entry found: " + entry); } } entrySet.contains(new ImmortalCacheEntry(1, "v1")); entrySet.contains(new ImmortalCacheEntry(2, "v2")); } } finally { tm().commit(); } }

Target:
public void testEntrySetAfterRemoveInBranchedTransaction() throws Exception { cache.put(1, "v1"); cache.put(2, "v2"); tm().begin(); try { assertEquals("v1", cache.get(1)); Transaction suspended = tm().suspend(); tm().begin(); try { cache.remove(1); } finally { tm().commit(); tm().resume(suspended); Set<Map.Entry<Object, Object>> entrySet = cache.entrySet(); assertEquals(2, entrySet.size()); for (Map.Entry<Object, Object> entry : entrySet) { Object key = entry.getKey(); Object value = entry.getValue(); if (entry.getKey().equals(1)) { assertEquals("v1", value); } else if (key.equals(2)) { assertEquals("v2", value); } else { fail("Unexpected entry found: " + entry); } } assertTrue(entrySet.contains(new ImmortalCacheEntry(1, "v1"))); assertTrue(entrySet.contains(new ImmortalCacheEntry(2, "v2"))); } } finally { tm().commit(); } }
Source:
public ValidationResult vmNotHavingPciPassthroughDevices() { for (VM vm : vms) { if (getHostDeviceManager().checkVmNeedsPciDevices(vm.getId())) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_HAS_ATTACHED_PCI_HOST_DEVICES, String.format("$VmName %s", vm.getName())); } } return ValidationResult.VALID; }

Target:
public ValidationResult vmNotHavingPciPassthroughDevices() { for (VM vm : vms) { if (getHostDeviceManager().checkVmNeedsPciDevices(vm.getId())) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_HAS_ATTACHED_PCI_HOST_DEVICES); } } return ValidationResult.VALID; }
Source:
protected boolean isJoinedCourse(String courseId) { if (student == null) { return logic.getStudentForGoogleId(courseId, account.googleId) != null; } else { return true; } }

Target:
protected boolean isJoinedCourse(String courseId) { if (student == null) { return logic.getStudentForGoogleId(courseId, account.googleId) != null; } return true; }
Source:
protected void updateProtocols() { protocols = new UniqueEList<>(); if (trigger != null) { for (Port port : trigger.getPorts()) { UMLRTPort facade = UMLRTPort.getInstance(port); UMLRTProtocol protocol = facade.getType(); if (protocol != null) { protocols.add(protocol); } } } }

Target:
protected void updateProtocols() { protocols = new UniqueEList<>(); if (trigger != null) { for (Port port : trigger.getPorts()) { UMLRTPort facade = UMLRTPort.getInstance(port); if (facade != null) { UMLRTProtocol protocol = facade.getType(); if (protocol != null) { protocols.add(protocol); } } } } }
Source:
public static TaskDefinition updateTaskProperties(TaskDefinition taskDefinition, DataSourceProperties dataSourceProperties, boolean setDatabaseCredentials) { Assert.notNull(taskDefinition, "taskDefinition must not be null"); Assert.notNull(dataSourceProperties, "dataSourceProperties must not be null"); TaskDefinition.TaskDefinitionBuilder builder = TaskDefinition.TaskDefinitionBuilder.from(taskDefinition); if(setDatabaseCredentials) { if (StringUtils.hasText(dataSourceProperties.getPassword())) { builder.setProperty("spring.datasource.password", dataSourceProperties.getPassword()); } builder.setProperty("spring.datasource.username", dataSourceProperties.getUsername()); } if(!taskDefinition.getProperties().containsKey("spring.datasource.url")) { builder.setProperty("spring.datasource.url", dataSourceProperties.getUrl()); } if(!(taskDefinition.getProperties().containsKey("spring.datasource.driverClassName") || taskDefinition.getProperties().containsKey("spring.datasource.driver-class-name"))) { builder.setProperty("spring.datasource.driverClassName", dataSourceProperties.getDriverClassName()); } builder.setTaskName(taskDefinition.getTaskName()); builder.setDslText(taskDefinition.getDslText()); return builder.build(); }

Target:
public static TaskDefinition updateTaskProperties(TaskDefinition taskDefinition, DataSourceProperties dataSourceProperties, boolean setDatabaseCredentials) { Assert.notNull(taskDefinition, "taskDefinition must not be null"); Assert.notNull(dataSourceProperties, "dataSourceProperties must not be null"); TaskDefinition.TaskDefinitionBuilder builder = TaskDefinition.TaskDefinitionBuilder.from(taskDefinition); if(setDatabaseCredentials) { if (StringUtils.hasText(dataSourceProperties.getPassword())) { builder.setProperty("spring.datasource.password", dataSourceProperties.getPassword()); } builder.setProperty("spring.datasource.username", dataSourceProperties.getUsername()); } if(!isPropertyPresent("spring.datasource.url", taskDefinition)) { builder.setProperty("spring.datasource.url", dataSourceProperties.getUrl()); } if(!isPropertyPresent("spring.datasource.driverClassName", taskDefinition)) { builder.setProperty("spring.datasource.driverClassName", dataSourceProperties.getDriverClassName()); } builder.setTaskName(taskDefinition.getTaskName()); builder.setDslText(taskDefinition.getDslText()); return builder.build(); }
Source:
public void test0() throws InterruptedException { log.info("Test1 table with cache"); SiddhiManager siddhiManager = new SiddhiManager(); String streams = "" + "define stream StockStream (symbol string, price float, volume long); " + "@Store(type=\"testWithCache\", @Cache(size=\"10\"))\n" + "define table StockTable (symbol string, price float, volume long); "; String query = "" + "@info(name = 'query1') " + "from StockStream " + "insert into StockTable ;"; SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query); InputHandler stockStream = siddhiAppRuntime.getInputHandler("StockStream"); siddhiAppRuntime.start(); stockStream.send(new Object[]{"WSO2", 55.6f, 100L}); stockStream.send(new Object[]{"IBM", 75.6f, 100L}); stockStream.send(new Object[]{"WSO3", 57.6f, 100L}); Thread.sleep(500); Event[] events = siddhiAppRuntime.query("" + "from StockTable "); EventPrinter.print(events); AssertJUnit.assertEquals(3, events.length); events = siddhiAppRuntime.query("" + "from StockTable " + "on price > 75 "); EventPrinter.print(events); AssertJUnit.assertEquals(1, events.length); events = siddhiAppRuntime.query("" + "from StockTable " + "on price > volume*3/4 "); EventPrinter.print(events); AssertJUnit.assertEquals(1, events.length); siddhiAppRuntime.shutdown(); }

Target:
public void test0() throws InterruptedException { log.info("Test0 table with cache"); SiddhiManager siddhiManager = new SiddhiManager(); String streams = "" + "define stream StockStream (symbol string, price float, volume long); " + "@Store(type=\"testWithCache\", @Cache(size=\"10\"))\n" + "define table StockTable (symbol string, price float, volume long); "; String query = "" + "@info(name = 'query1') " + "from StockStream " + "insert into StockTable ;"; SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query); InputHandler stockStream = siddhiAppRuntime.getInputHandler("StockStream"); siddhiAppRuntime.start(); stockStream.send(new Object[]{"WSO2", 55.6f, 100L}); stockStream.send(new Object[]{"IBM", 75.6f, 100L}); stockStream.send(new Object[]{"WSO3", 57.6f, 100L}); Thread.sleep(500); Event[] events = siddhiAppRuntime.query("" + "from StockTable "); EventPrinter.print(events); AssertJUnit.assertEquals(3, events.length); events = siddhiAppRuntime.query("" + "from StockTable " + "on price > 75 "); EventPrinter.print(events); AssertJUnit.assertEquals(1, events.length); events = siddhiAppRuntime.query("" + "from StockTable " + "on price > volume*3/4 "); EventPrinter.print(events); AssertJUnit.assertEquals(1, events.length); siddhiAppRuntime.shutdown(); }
Source:
public void importFileUpload(FileUploadEvent event) { importCertFile = event.getFile(); if (importCertFile != null) { importCertificate = new ArrayList<>(); Certificate cert = service.createCertificate(importCertFile.getContents()); cert.setAlias(ALIAS_PLACEHOLDER); checkCertValidity(cert); if (cert.getExpiresInDays() > 30 && cert.getExpiresInDays() <= 90) { HelperUtil.addMessageInfo(IMPORT_CERT_EXPIRY_MSG, "This Certificate is expiring soon."); } if (!expiredCert) { importCertificate.add(cert); } } }

Target:
public void importFileUpload(FileUploadEvent event) { importCertFile = event.getFile(); expiredCert = false; if (importCertFile != null) { importCertificate = new ArrayList<>(); Certificate cert = service.createCertificate(importCertFile.getContents()); cert.setAlias(ALIAS_PLACEHOLDER); checkCertValidity(cert); if (!expiredCert) { if (cert.getExpiresInDays() > 30 && cert.getExpiresInDays() <= 90) { HelperUtil.addMessageInfo(IMPORT_CERT_EXPIRY_MSG, "This Certificate is expiring soon."); } importCertificate.add(cert); } } }
Source:
private void writeCleanup() { JClassType editorType = model.getEditorType(); Set<String> fieldSet = new HashSet<>(); logger.log(Type.DEBUG, "Starting to write cleanup impl. for editor " + editorType.getQualifiedSourceName()); sw.println(); sw.println("@Override"); sw.println("public void cleanup() {"); sw.indent(); sw.println("getObject().cleanup();"); for (EditorData editorData : model.getEditorData()) { if (editorData.getPropertyOwnerType().isAssignableTo(hasCleanupType)) { fieldSet.add(String.format("getObject()%s", editorData.getBeanOwnerExpression())); } else { logger.log(Type.WARN, "Skipping non-model field for path " + editorData.getPath()); } } for (JField field : editorType.getFields()) { if (field.getType().isClassOrInterface() != null && field.getType().isClassOrInterface().isAssignableTo(hasCleanupType) && !field.getType().isClassOrInterface().isAssignableTo(baseModelType)) { fieldSet.add(String.format("getEditor().%s", field.getName())); if (!field.isPublic()) { logger.log(Type.ERROR, "Field " + field.getName() + " is not public, but needs to be cleaned up"); } } } for (String name: fieldSet) { sw.println("%s.cleanup();", name); } sw.outdent(); sw.println("}"); }

Target:
private void writeCleanup() { JClassType editorType = model.getEditorType(); Set<String> hasCleanupSet = new HashSet<>(); logger.log(Type.DEBUG, "Starting to write cleanup impl. for editor " + editorType.getQualifiedSourceName()); sw.println(); sw.println("@Override"); if (model.getProxyType().isAssignableTo(hasCleanupType)) { sw.println("public void cleanup() {"); } sw.indent(); sw.println("getObject().cleanup();"); for (EditorData editorData : model.getEditorData()) { if (editorData.getPropertyOwnerType().isAssignableTo(hasCleanupType)) { hasCleanupSet.add(String.format("getObject()%s", editorData.getBeanOwnerExpression())); } else { logger.log(Type.WARN, "Skipping non-model field for path " + editorData.getPath()); } } for (JField field : editorType.getFields()) { JClassType fieldType = field.getType().isClassOrInterface(); if (fieldType != null && fieldType.isAssignableTo(hasCleanupType) && !field.getType().isClassOrInterface().isAssignableTo(baseModelType)) { hasCleanupSet.add(String.format("getEditor().%s", field.getName())); if (!field.isPublic()) { logger.log(Type.ERROR, "Field " + field.getName() + " is not public, but needs to be cleaned up"); } } } for (String name: hasCleanupSet) { sw.println("%s.cleanup();", name); } sw.outdent(); sw.println("}"); }
Source:
public String toString() { if (this.jsonAsString == null && this.node != null) { return getJsonAsString(); } return this.jsonAsString; }

Target:
public String toString() { return this.jsonAsString; }
Source:
NatsTask(NatsPollingConsumer natsPollingConsumer, long interval) { printDebugLog("Initializing."); this.natsPollingConsumer = natsPollingConsumer; this.interval = interval; }

Target:
NatsTask(NatsPollingConsumer natsPollingConsumer, long interval) { printDebugLog("Initializing NATS Task."); this.natsPollingConsumer = natsPollingConsumer; this.interval = interval; }
Source:
public void patchAnnotation(String annotationId, Annotation annotation) throws MendeleyException { try { String json = JsonParser.jsonFromAnnotation(annotation); Procedure proc = new PatchAnnotationProcedure(annotationId, json, authenticationManager); proc.checkedRun(); } catch (JSONException e) { throw new JsonParsingException(e.getMessage()); } }

Target:
public void patchAnnotation(String annotationId, Annotation annotation) throws MendeleyException { try { String json = JsonParser.jsonFromAnnotation(annotation); Procedure proc = new PatchAnnotationProcedure(annotationId, json, authenticationManager); proc.checkedRun(); } catch (JSONException e) { throw new JsonParsingException("Error parsing annotation", e); } }
Source:
public PrivateKey decode(byte[] der, String password, Map<String, String> headers) throws IOException { ASN1Sequence seq = ASN1Sequence.getInstance(der); Enumeration asn1 = seq.getObjects(); BigInteger v = ((ASN1Integer) asn1.nextElement()).getValue(); if (v.intValue() != 0 && v.intValue() != 1) { throw new IllegalArgumentException("wrong version for RSA private key"); } BigInteger version = v; BigInteger modulus = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger publicExponent = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger privateExponent = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeP = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeQ = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeExponentP = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeExponentQ = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger coefficient = ((ASN1Integer) asn1.nextElement()).getValue(); if (asn1.hasMoreElements()) { ASN1Sequence otherPrimeInfos = (ASN1Sequence) asn1.nextElement(); } RSAPrivateCrtKeySpec spec = new RSAPrivateCrtKeySpec(modulus, publicExponent, privateExponent, primeP, primeQ, primeExponentP, primeExponentQ, coefficient); try { KeyFactory kf = KeyFactory.getInstance("RSA"); return kf.generatePrivate(spec); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { throw new IOException("Could not read key", e); } }

Target:
public PrivateKey decode(byte[] der, String password, Map<String, String> headers) throws IOException { ASN1Sequence seq = ASN1Sequence.getInstance(der); Enumeration asn1 = seq.getObjects(); BigInteger version = ((ASN1Integer) asn1.nextElement()).getValue(); if (version.intValue() != 0 && version.intValue() != 1) { throw new IllegalArgumentException("wrong version for RSA private key"); } BigInteger modulus = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger publicExponent = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger privateExponent = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeP = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeQ = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeExponentP = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger primeExponentQ = ((ASN1Integer) asn1.nextElement()).getValue(); BigInteger coefficient = ((ASN1Integer) asn1.nextElement()).getValue(); if (asn1.hasMoreElements()) { throw new IOException("RSA multi-prime keys are not supported"); } RSAPrivateCrtKeySpec spec = new RSAPrivateCrtKeySpec(modulus, publicExponent, privateExponent, primeP, primeQ, primeExponentP, primeExponentQ, coefficient); try { KeyFactory kf = KeyFactory.getInstance("RSA"); return kf.generatePrivate(spec); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { throw new IOException("Could not read key", e); } }
Source:
public void testGetTransactionInfo() { Trace trace1 = new Trace(); trace1.setId("1"); trace1.setBusinessTransaction("trace1"); trace1.setStartTime(System.currentTimeMillis() - 4000); Component c1 = new Component(); c1.getProperties().add(new Property("prop1", "value1")); trace1.getNodes().add(c1); Trace trace2 = new Trace(); trace2.setId("2"); trace2.setBusinessTransaction("trace2"); trace2.setStartTime(System.currentTimeMillis() - 2000); Component c2 = new Component(); c2.getProperties().add(new Property("prop2", "value2")); trace2.getNodes().add(c2); try { publisher.publish(null, Arrays.asList(trace1, trace2)); } catch (Exception e1) { fail("Failed to store: " + e1); } Wait.until(() -> service.searchFragments(null, new Criteria()).size() == 2); Wait.until(() -> analytics.getTraceCompletionTimes(null, new Criteria()).size() == 2); List<TransactionInfo> tis = analytics.getTransactionInfo(null, new Criteria()); assertNotNull(tis); assertEquals(2, tis.size()); assertTrue(tis.get(0).getName().equals("trace1")); assertTrue(tis.get(1).getName().equals("trace2")); }

Target:
public void testGetTransactionInfo() throws Exception { Trace trace1 = new Trace(); trace1.setId("1"); trace1.setBusinessTransaction("trace1"); trace1.setStartTime(System.currentTimeMillis() - 4000); Component c1 = new Component(); c1.getProperties().add(new Property("prop1", "value1")); trace1.getNodes().add(c1); Trace trace2 = new Trace(); trace2.setId("2"); trace2.setBusinessTransaction("trace2"); trace2.setStartTime(System.currentTimeMillis() - 2000); Component c2 = new Component(); c2.getProperties().add(new Property("prop2", "value2")); trace2.getNodes().add(c2); publisher.publish(null, Arrays.asList(trace1, trace2)); Wait.until(() -> service.searchFragments(null, new Criteria()).size() == 2); Wait.until(() -> analytics.getTraceCompletionTimes(null, new Criteria()).size() == 2); List<TransactionInfo> tis = analytics.getTransactionInfo(null, new Criteria()); assertNotNull(tis); assertEquals(2, tis.size()); assertEquals("trace1", tis.get(0).getName()); assertEquals("trace2", tis.get(1).getName()); }
Source:
public ConnectionPoolConfiguration getValue() throws IllegalStateException, IllegalArgumentException { return new ConfigurationBuilder().connectionPool() .exhaustedAction(this.exhaustedAction) .lifo(ConnectionPoolStrategy.LIFO.equals(this.connectionPoolStrategy)) .maxActive(this.maxActive) .maxIdle(this.maxIdle) .maxTotal(this.maxTotal) .maxWait(this.maxWait) .minEvictableIdleTime(this.minEvictableIdleTime) .minIdle(this.minIdle) .numTestsPerEvictionRun(this.numTestsPerEvictionRun) .testOnBorrow(this.testOnBorrow) .testOnReturn(this.testOnReturn) .testWhileIdle(this.testWhileIdle) .timeBetweenEvictionRuns(this.timeBetweenEvictionRuns) .create(); }

Target:
public ConnectionPoolConfiguration getValue() throws IllegalStateException, IllegalArgumentException { return new ConfigurationBuilder().connectionPool() .exhaustedAction(this.exhaustedAction) .maxActive(this.maxActive) .maxWait(this.maxWait) .minEvictableIdleTime(this.minEvictableIdleTime) .minIdle(this.minIdle) .create(); }
Source:
public void testDecodeMultipleLiteralResponse() throws Exception { final String literalResponse = "* 1 FETCH {15}\r\n" + "abc\r\n" + "defghijklm {5}\r\n" + "hij\r\n" + "\r\n"; final byte[] responseBytes = literalResponse.getBytes(StandardCharsets.US_ASCII); final ByteBuf buffer = Unpooled.copiedBuffer(responseBytes, 0, responseBytes.length); final ImapClientRespReader respReader = new ImapClientRespReader(Integer.MAX_VALUE); final ByteBuf resultBuf = (ByteBuf) respReader.decode(null, buffer); final String result = resultBuf.toString(StandardCharsets.US_ASCII); Assert.assertEquals(result, literalResponse); }

Target:
public void testDecodeMultipleLiteralResponse() throws Exception { final String literalResponse = "* 1 FETCH BODY {15}\r\n" + "abc\r\n" + "defghijklm BODY[HEADER] {5}\r\n" + "h:j\r\n" + "\r\n"; final byte[] responseBytes = literalResponse.getBytes(StandardCharsets.US_ASCII); final ByteBuf buffer = Unpooled.copiedBuffer(responseBytes, 0, responseBytes.length); final ImapClientRespReader respReader = new ImapClientRespReader(Integer.MAX_VALUE); final ByteBuf resultBuf = (ByteBuf) respReader.decode(null, buffer); final String result = resultBuf.toString(StandardCharsets.US_ASCII); Assert.assertEquals(result, literalResponse); }
Source:
private static void checkTuples(SubscriptionContext ctx, StringFormat format, Tuple tuple) { if (format.hasNamedFields()) { ctx.addIssue(tuple, "Replace this formatting argument with a mapping."); return; } if (format.numExpectedArguments() != tuple.elements().size()) { reportInvalidArgumentSize(ctx, tuple, format.numExpectedArguments(), tuple.elements().size()); return; } for (int i = 0; i < tuple.elements().size(); ++i) { format.replacementFields().get(i).validateArgument(tuple.elements().get(i)); } }

Target:
private static void checkTuples(SubscriptionContext ctx, StringFormat format, Tuple tuple) { if (tuple.elements().stream().anyMatch(expression -> expression.is(Tree.Kind.UNPACKING_EXPR))) { return; } if (format.numExpectedArguments() != tuple.elements().size()) { reportInvalidArgumentSize(ctx, tuple, format.numExpectedArguments(), tuple.elements().size()); return; } for (int i = 0; i < tuple.elements().size(); ++i) { format.replacementFields().get(i).validateArgument(tuple.elements().get(i)); } }
Source:
public static Branch getBranch(Long branchId, ArtifactId view) throws OseeCoreException { if (branchId == null) { throw new BranchDoesNotExist("Branch Uuid is null"); } Branch branch = null; if (view.notEqual(ArtifactId.SENTINEL)) { List<Branch> views = getCache().getViews(); for (Branch branchView : views) { if (branchView.getId().equals(branchId) && branchView.getView().equals(view)) { branch = branchView; } } } else { branch = getCache().getById(branchId); if (branch == null) { branch = loadBranchToCache(branchId); } } return branch; }

Target:
public static Branch getBranch(Long branchId, ArtifactId view) throws OseeCoreException { if (branchId == null) { throw new BranchDoesNotExist("Branch Uuid is null"); } Branch branch = null; if (view.notEqual(ArtifactId.SENTINEL)) { List<Branch> views = getCache().getViews(); for (Branch branchView : views) { if (branchView.getId().equals(branchId) && branchView.getView().equals(view)) { branch = branchView; break; } } } else { branch = getCache().getById(branchId); if (branch == null) { branch = loadBranchToCache(branchId); } } return branch; }
Source:
private ReferenceContext getDerivedReferenceContextFromSlices(final List<Slice> containerSlices) { final Set<ReferenceContext> sliceRefContexts = containerSlices.stream() .map(s -> s.getAlignmentContext().getReferenceContext()) .collect(Collectors.toSet()); if (sliceRefContexts.isEmpty()) { throw new CRAMException("Cannot construct a container without any slices"); } else if (sliceRefContexts.size() > 1) { return ReferenceContext.MULTIPLE_REFERENCE_CONTEXT; } return sliceRefContexts.iterator().next(); }

Target:
private static ReferenceContext getDerivedReferenceContextFromSlices(final List<Slice> containerSlices) { final Set<ReferenceContext> sliceRefContexts = containerSlices.stream() .map(s -> s.getAlignmentContext().getReferenceContext()) .collect(Collectors.toSet()); if (sliceRefContexts.isEmpty()) { throw new CRAMException("Cannot construct a container without any slices"); } else if (sliceRefContexts.size() > 1) { return ReferenceContext.MULTIPLE_REFERENCE_CONTEXT; } return sliceRefContexts.iterator().next(); }
Source:
public String getAuthorEmail() { try { return getPullRequest(false).getUser().getEmail(); } catch (IOException e) { logger.log(Level.SEVERE, "Unable to fetch author info for " + id); } return ""; }

Target:
public String getAuthorEmail() { if (StringUtils.isEmpty(authorEmail)) { try { GHUser user = getPullRequestAuthor(); authorEmail = user.getEmail(); } catch (IOException e) { logger.log(Level.SEVERE, "Unable to fetch author info for " + id); } } authorEmail = StringUtils.isEmpty(authorEmail) ? "" : authorEmail; return authorEmail; }