auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void visit(PolygonSymbolizer poly) { super.visit(poly); PolygonSymbolizer copy = (PolygonSymbolizer) pages.peek(); Unit<Length> uom = copy.getUnitOfMeasure(); rescaleStroke(copy.getStroke(), uom); rescaleFill(copy.getFill(), uom); scaleIntArrayOption(copy.getOptions(), TextSymbolizer.GRAPHIC_MARGIN_KEY, uom); copy.setUnitOfMeasure(NonSI.PIXEL); }

Target:
public void visit(PolygonSymbolizer poly) { super.visit(poly); PolygonSymbolizer copy = (PolygonSymbolizer) pages.peek(); Unit<Length> uom = copy.getUnitOfMeasure(); rescaleStroke(copy.getStroke(), uom); rescaleFill(copy.getFill(), uom); scaleIntArrayOption(copy.getOptions(), PolygonSymbolizer.GRAPHIC_MARGIN_KEY, uom); copy.setUnitOfMeasure(NonSI.PIXEL); }
Source:
private Collection<IInstallableUnit> findUpdates(IInstallableUnit iu, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); Collection<IInstallableUnit> availableUpdates = new HashSet<>(); IQueryResult<IInstallableUnit> updatesAvailable = planner.updatesFor(iu, provisioningContext, subMonitor.split(1)); for (IInstallableUnit iuu : updatesAvailable) { availableUpdates.add(iuu); } return availableUpdates; }

Target:
private Collection<IInstallableUnit> findUpdates(IInstallableUnit iu, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); Collection<IInstallableUnit> availableUpdates = new HashSet<>(); IQueryResult<IInstallableUnit> updatesAvailable = planner.updatesFor(iu, provisioningContext, subMonitor.split(1)); for (IInstallableUnit unit : updatesAvailable) { availableUpdates.add(unit); } return availableUpdates; }
Source:
public void testRangeCountWithRangeMerge() { List<Token> tokens = updateTokens(Arrays.asList(100, 200, 300, 400)); Keyspace keyspace = Keyspace.open(KEYSPACE1); List<ReplicaPlan.ForRangeRead> ranges = new ArrayList<>(); for (int i = 0; i + 1 < tokens.size(); i++) { Range<PartitionPosition> range = Range.makeRowRange(tokens.get(i), tokens.get(i + 1)); ranges.add(ReplicaPlans.forRangeRead(keyspace, ConsistencyLevel.ONE, range, 1)); } StorageProxy.RangeMerger merge = new StorageProxy.RangeMerger(ranges.iterator(), keyspace, ConsistencyLevel.ONE); ReplicaPlan.ForRangeRead mergedRange = Iterators.getOnlyElement(merge); assertEquals(tokens.size() - 1, mergedRange.vnodeCount()); }

Target:
public void testRangeCountWithRangeMerge() { List<Token> tokens = setTokens(Arrays.asList(100, 200, 300, 400)); int vnodeCount = 0; Keyspace keyspace = Keyspace.open(KEYSPACE1); List<ReplicaPlan.ForRangeRead> ranges = new ArrayList<>(); for (int i = 0; i + 1 < tokens.size(); i++) { Range<PartitionPosition> range = Range.makeRowRange(tokens.get(i), tokens.get(i + 1)); ranges.add(ReplicaPlans.forRangeRead(keyspace, ConsistencyLevel.ONE, range, 1)); vnodeCount++; } StorageProxy.RangeMerger merge = new StorageProxy.RangeMerger(ranges.iterator(), keyspace, ConsistencyLevel.ONE); ReplicaPlan.ForRangeRead mergedRange = Iterators.getOnlyElement(merge); assertEquals(vnodeCount, mergedRange.vnodeCount()); }
Source:
private void createPaintListener(final Table rawTable) { rawTable.addListener(SWT.EraseItem, new Listener() { @Override public void handleEvent(final Event event) { if (0 <= event.index && event.index <= 5) event.detail &= ~SWT.FOREGROUND; } }); rawTable.addListener(SWT.PaintItem, new Listener() { @Override public void handleEvent(final Event event) { doPaint(event); } }); }

Target:
private void createPaintListener(final Table rawTable) { rawTable.addListener(SWT.EraseItem, new Listener() { @Override public void handleEvent(final Event event) { if (event.index == 1) { event.detail &= ~SWT.FOREGROUND; } } }); rawTable.addListener(SWT.PaintItem, new Listener() { @Override public void handleEvent(final Event event) { if (event.index == 1) { doPaint(event); } } }); }
Source:
private void rotate(final File file) throws IOException { if (suffix == null) { String filePath = file.getAbsolutePath(); File _file = new File(filePath + "." + maxBackupIndex); if (_file.exists()) _file.delete(); for (int i = maxBackupIndex - 1; i >= 1; i--) { final File src = new File(filePath + "." + i); if (src.exists()) { final File target = new File(filePath + "." + (i + 1)); FileMove.move(src, target); } } FileMove.move(file, new File(filePath + ".1")); } else { final String suffix = new SimpleDateFormat(this.suffix).format(new Date()); final String newBaseFilename = file.getAbsolutePath() + suffix; File newBaseFile = new File(newBaseFilename + "." + maxBackupIndex); if (newBaseFile.exists()) newBaseFile.delete(); for (int i = maxBackupIndex - 1; i >= 1; i--) { final File src = new File(newBaseFilename + "." + i); if (src.exists()) { final File target = new File(newBaseFilename + "." + (i + 1)); FileMove.move(src, target); } } FileMove.move(file, new File(newBaseFilename + ".1")); } }

Target:
private void rotate(final File file) throws IOException { if (suffix == null) { String filePath = file.getAbsolutePath(); new File(filePath + "." + maxBackupIndex).delete(); for (int i = maxBackupIndex - 1; i >= 1; i--) { final File src = new File(filePath + "." + i); if (src.exists()) { final File target = new File(filePath + "." + (i + 1)); FileMove.move(src, target); } } FileMove.move(file, new File(filePath + ".1")); } else { final String suffix = new SimpleDateFormat(this.suffix).format(new Date()); final String newBaseFilename = file.getAbsolutePath() + suffix; File newBaseFile = new File(newBaseFilename + "." + maxBackupIndex); if (newBaseFile.exists()) newBaseFile.delete(); for (int i = maxBackupIndex - 1; i >= 1; i--) { final File src = new File(newBaseFilename + "." + i); if (src.exists()) { final File target = new File(newBaseFilename + "." + (i + 1)); FileMove.move(src, target); } } FileMove.move(file, new File(newBaseFilename + ".1")); } }
Source:
public static PublicSuffixMatcher load(final InputStream in) throws IOException { Args.notNull(in, "InputStream"); final List<PublicSuffixList> lists = new PublicSuffixListParser().parseByType( new InputStreamReader(in, StandardCharsets.UTF_8)); return new PublicSuffixMatcher(lists); }

Target:
private static PublicSuffixMatcher load(final InputStream in) throws IOException { final List<PublicSuffixList> lists = new PublicSuffixListParser().parseByType( new InputStreamReader(in, StandardCharsets.UTF_8)); return new PublicSuffixMatcher(lists); }
Source:
private void paintColumnHeaderFooter(final WTable table, final WebXmlRenderContext renderContext, final boolean renderHeaders) { XmlStringBuilder xml = renderContext.getWriter(); int[] columnOrder = table.getColumnOrder(); TableModel model = table.getTableModel(); final int columnCount = columnOrder == null ? table.getColumnCount() : columnOrder.length; if (renderHeaders) { xml.appendTagOpen("ui:thead"); xml.appendOptionalAttribute("hidden", !table.isShowColumnHeaders(), "true"); xml.appendClose(); } else { xml.appendTag("tfoot"); xml.appendTag("tr"); if (table.getExpandMode() != ExpandMode.NONE) { xml.append("<td/>"); } if (table.getSelectMode() != SelectMode.NONE) { xml.append("<td/>"); } } for (int i = 0; i < columnCount; i++) { int colIndex = columnOrder == null ? i : columnOrder[i]; WTableColumn col = table.getColumn(colIndex); if (col.isVisible()) { if (renderHeaders) { boolean sortable = model.isSortable(colIndex); paintColumnHeading(col, sortable, renderContext); } else { paintColumnFooting(col, renderContext); } } } if (renderHeaders) { xml.appendEndTag("ui:thead"); } else { xml.appendEndTag("tr"); xml.appendEndTag("tfoot"); } }

Target:
private void paintColumnHeaderFooter(final WTable table, final WebXmlRenderContext renderContext, final boolean renderHeaders) { XmlStringBuilder xml = renderContext.getWriter(); int[] columnOrder = table.getColumnOrder(); TableModel model = table.getTableModel(); final int columnCount = columnOrder == null ? table.getColumnCount() : columnOrder.length; if (renderHeaders) { xml.appendTagOpen("ui:thead"); xml.appendOptionalAttribute("hidden", !table.isShowColumnHeaders(), "true"); xml.appendClose(); } else { xml.appendTag("tfoot"); xml.appendTag("tr"); if (table.getExpandMode() != ExpandMode.NONE) { xml.appendTag("td"); xml.appendEndTag("td"); } if (table.getSelectMode() != SelectMode.NONE) { xml.appendTag("td"); xml.appendEndTag("td"); } } for (int i = 0; i < columnCount; i++) { int colIndex = columnOrder == null ? i : columnOrder[i]; WTableColumn col = table.getColumn(colIndex); if (col.isVisible()) { if (renderHeaders) { boolean sortable = model.isSortable(colIndex); paintColumnHeading(col, sortable, renderContext); } else { paintColumnFooting(col, renderContext); } } } if (renderHeaders) { xml.appendEndTag("ui:thead"); } else { xml.appendEndTag("tr"); xml.appendEndTag("tfoot"); } }
Source:
private boolean comparer(IDeclaration obj,IFieldCompareHelper comparer ) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof StructDeclaration)) { return false; } StructDeclaration other = (StructDeclaration) obj; if (fFieldMap.size() != other.fFieldMap.size()) { return false; } List<String> localFieldNames = new ArrayList<>(); localFieldNames.addAll(fFieldMap.keySet()); List<IDeclaration> localDecs = new ArrayList<>(); localDecs.addAll(fFieldMap.values()); List<String> otherFieldNames = new ArrayList<>(); otherFieldNames.addAll(other.fFieldMap.keySet()); List<IDeclaration> otherDecs = new ArrayList<>(); otherDecs.addAll(other.fFieldMap.values()); for (int i = 0; i < fFieldMap.size(); i++) { if (!comparer.compareField(otherDecs.get(i),localDecs.get(i))|| (!localFieldNames.get(i).equals(otherFieldNames.get(i))) ) { return false; } } if (fMaxAlign != other.fMaxAlign) { return false; } return true; }

Target:
private boolean comparer(IDeclaration obj, IFieldCompareHelper comparer) { if (this == obj) { return true; } if (!(obj instanceof StructDeclaration)) { return false; } StructDeclaration other = (StructDeclaration) obj; if (fFieldMap.size() != other.fFieldMap.size()) { return false; } List<String> localFieldNames = new ArrayList<>(); localFieldNames.addAll(fFieldMap.keySet()); List<IDeclaration> localDecs = new ArrayList<>(); localDecs.addAll(fFieldMap.values()); List<String> otherFieldNames = new ArrayList<>(); otherFieldNames.addAll(other.fFieldMap.keySet()); List<IDeclaration> otherDecs = new ArrayList<>(); otherDecs.addAll(other.fFieldMap.values()); for (int i = 0; i < fFieldMap.size(); i++) { if (!comparer.compareField(otherDecs.get(i), localDecs.get(i)) || (!localFieldNames.get(i).equals(otherFieldNames.get(i)))) { return false; } } if (fMaxAlign != other.fMaxAlign) { return false; } return true; }
Source:
public void handleMessage(Message message) { if (!isRequestor(message) && message.get(SseInterceptor.class) == null) { message.put(SseInterceptor.class, this); final Exchange exchange = message.getExchange(); OperationResourceInfo ori = (OperationResourceInfo)exchange.get(OperationResourceInfo.class.getName()); if (ori != null) { final ServerProviderFactory providerFactory = ServerProviderFactory.getInstance(message); final ResponseImpl response = (ResponseImpl)Response.ok().build(); try { JAXRSUtils.runContainerResponseFilters(providerFactory, response, message, ori, ori.getAnnotatedMethod()); } catch (Throwable ex) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, ex.getMessage(), ex); } } } } }

Target:
public void handleMessage(Message message) { if (!isRequestor(message) && message.get(SseInterceptor.class) == null) { message.put(SseInterceptor.class, this); final Exchange exchange = message.getExchange(); OperationResourceInfo ori = (OperationResourceInfo)exchange.get(OperationResourceInfo.class.getName()); if (ori != null) { Response.ResponseBuilder builder = Response.ok(); final ServerProviderFactory providerFactory = ServerProviderFactory.getInstance(message); final Object response = message.get(AbstractHTTPDestination.HTTP_RESPONSE); if (response instanceof HttpServletResponse) { final HttpServletResponse servletResponse = (HttpServletResponse)response; builder = Response.status(servletResponse.getStatus()); for (final String header: servletResponse.getHeaderNames()) { builder.header(header, servletResponse.getHeaders(header)); } } try { final ResponseImpl responseImpl = (ResponseImpl)builder.build(); JAXRSUtils.runContainerResponseFilters(providerFactory, responseImpl, message, ori, ori.getAnnotatedMethod()); } catch (Throwable ex) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, ex.getMessage(), ex); } } } } }
Source:
private String getValueForOptionalKey(JSONObject object, String key) { return object.has(key) ? object.optJSONObject(key).optString("value") : ""; }

Target:
private String getValueForOptionalKey(JSONObject object, String key) throws JSONException { return object.has(key) ? object.getJSONObject(key).getString("value") : ""; }
Source:
public void addCallable( World w, IWorldCallable<?> c ) { if( w == null ) { this.serverQueue.add( c ); } else { Queue<IWorldCallable<?>> queue = this.callQueue.get( w ); if( queue == null ) { this.callQueue.put( w, queue = new LinkedList<IWorldCallable<?>>() ); } queue.add( c ); } }

Target:
public void addCallable( World w, IWorldCallable<?> c ) { if( w == null ) { this.serverQueue.add( c ); } else { Queue<IWorldCallable<?>> queue = this.callQueue.get( w ); if( queue == null ) { queue = new LinkedList<IWorldCallable<?>>(); this.callQueue.put( w, queue ); } queue.add( c ); } }
Source:
public abstract void init(String url, String user, String pwd) throws SchedulerException, LoginException; public abstract void disconnect() throws PermissionException, NotConnectedException; @Override public boolean isConnected() { if (!initialized) { return false; } if (terminated) { return true; } return getScheduler().isConnected(); }

Target:
public abstract void init(String url, String user, String pwd) throws SchedulerException, LoginException; public abstract void disconnect() throws PermissionException, NotConnectedException; @Override public boolean isConnected() { if (!initialized) { return false; } if (terminated) { return false; } return getScheduler().isConnected(); }
Source:
public void multipleIteratorsNestedInterleavedExists() throws Exception { try ( Transaction tx = db.beginTx(); Statement statement = db.statement() ) { ReadOperations readOperations = statement.readOperations(); PrimitiveLongIterator iter1 = indexCoordinator.queryExists( readOperations ); List<Long> actual1 = new ArrayList<>(); PrimitiveLongIterator iter2 = indexCoordinator.queryExists( readOperations ); List<Long> actual2 = new ArrayList<>(); while ( iter1.hasNext() && iter2.hasNext() ) { if ( rnd.nextBoolean() ) { actual1.add( iter1.next() ); } else { actual2.add( iter2.next() ); } } while ( iter1.hasNext() ) { actual1.add( iter1.next() ); } while ( iter2.hasNext() ) { actual2.add( iter2.next() ); } indexCoordinator.assertExistsResult( actual1 ); indexCoordinator.assertExistsResult( actual2 ); tx.success(); } }

Target:
public void multipleIteratorsNestedInterleavedExists() throws Exception { try ( Transaction tx = db.beginTx(); Statement statement = db.statement() ) { ReadOperations readOperations = statement.readOperations(); PrimitiveLongIterator iter1 = indexCoordinator.queryExists( readOperations ); List<Long> actual1 = new ArrayList<>(); PrimitiveLongIterator iter2 = indexCoordinator.queryExists( readOperations ); List<Long> actual2 = new ArrayList<>(); exhaustInterleaved( iter1, actual1, iter2, actual2 ); indexCoordinator.assertExistsResult( actual1 ); indexCoordinator.assertExistsResult( actual2 ); tx.success(); } }
Source:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, List<String> messages) { if (vm.getRunOnVds() == null && vm.getDedicatedVmForVds() == null) { return hosts; } if (vm.getMigrationSupport() == MigrationSupport.PINNED_TO_HOST) { for (VDS host : hosts) { if (host.getId().equals(vm.getDedicatedVmForVds())) { return Arrays.asList(host); } } messages.add(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_PINNED_TO_HOST.toString()); return new ArrayList<>(); } return hosts; }

Target:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, List<String> messages) { if (vm.getMigrationSupport() == MigrationSupport.PINNED_TO_HOST) { if(vm.getDedicatedVmForVds() != null) { for (VDS host : hosts) { if (host.getId().equals(vm.getDedicatedVmForVds())) { return Arrays.asList(host); } } } else { if (vm.getRunOnVds() == null) { return hosts; } } return new ArrayList<>(); } return hosts; }
Source:
public String execGesture(String gesture) { lastGestureExecuted = gesture; String ret; if (python == null) { log.warn("execGesture : No jython engine..."); return null; } subscribe(python.getName(), "publishStatus", this.getName(), "onGestureStatus"); startedGesture(lastGestureExecuted); ret = Utils.execPy(gesture); return ret; }

Target:
public String execGesture(String gesture) { lastGestureExecuted = gesture; String ret; if (python == null) { log.warn("execGesture : No jython engine..."); return null; } subscribe(python.getName(), "publishStatus", this.getName(), "onGestureStatus"); startedGesture(lastGestureExecuted); return python.evalAndWait(gesture); }
Source:
private SearchResult parseToSearchResult(@Nonnull final IMAPResponse[] ir) throws ImapAsyncClientException { if (ir.length < 1) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final Response taggedResponse = ir[ir.length - 1]; if (!taggedResponse.isOK()) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final List<Long> v = new ArrayList<Long>(); long num; for (final IMAPResponse sr : ir) { if (sr.keyEquals("SEARCH")) { while ((num = sr.readLong()) != -1) { v.add(num); } } } return new SearchResult(v); }

Target:
private SearchResult parseToSearchResult(@Nonnull final IMAPResponse[] ir) throws ImapAsyncClientException { if (ir.length < 1) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final Response taggedResponse = ir[ir.length - 1]; if (!taggedResponse.isOK()) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final List<Long> v = new ArrayList<Long>(); long num; for (final IMAPResponse sr : ir) { if (sr.keyEquals("SEARCH")) { while ((num = sr.readLong()) != -1) { v.add(Long.valueOf(num)); } } } return new SearchResult(v); }
Source:
private String getReleaseNotesFromScm(AbstractBuild build) { StringBuilder notes = new StringBuilder(); AbstractProject project = build.getProject(); AbstractBuild lastSuccessfulBuild = (AbstractBuild)project.getLastSuccessfulBuild(); AbstractBuild currentBuild = null; if (lastSuccessfulBuild == null) { AbstractBuild lastBuild = (AbstractBuild)project.getLastBuild(); currentBuild = lastBuild; } else { currentBuild = lastSuccessfulBuild.getNextBuild(); } if (currentBuild != null) { while (currentBuild != build) { String currBuildNotes = convertChangeSetToString(currentBuild); if (!currBuildNotes.isEmpty()) notes.append(currBuildNotes); currentBuild = currentBuild.getNextBuild(); } String currBuildNotes = convertChangeSetToString(build); if (!currBuildNotes.isEmpty()) notes.append(currBuildNotes); } return notes.toString(); }

Target:
private String getReleaseNotesFromScm(AbstractBuild build) { StringBuilder notes = new StringBuilder(); AbstractProject project = build.getProject(); AbstractBuild lastSuccessfulBuild = (AbstractBuild)project.getLastSuccessfulBuild(); AbstractBuild currentBuild = null; if (lastSuccessfulBuild == null) { AbstractBuild lastBuild = (AbstractBuild)project.getLastBuild(); currentBuild = lastBuild; } else { currentBuild = lastSuccessfulBuild.getNextBuild(); } if (currentBuild != null) { while (currentBuild != build) { String currBuildNotes = convertChangeSetToString(currentBuild); if (!currBuildNotes.isEmpty()) { notes.append(currBuildNotes); } currentBuild = currentBuild.getNextBuild(); } String currBuildNotes = convertChangeSetToString(build); if (!currBuildNotes.isEmpty()) { notes.append(currBuildNotes); } } return notes.toString(); }
Source:
public void newSubnet() { if (getWindow() != null) { return; } NewExternalSubnetModel model = new NewExternalSubnetModel(this); setWindow(model); initNetworkInModel(model); }

Target:
public void newSubnet() { if (getWindow() != null) { return; } NewExternalSubnetModel model = new NewExternalSubnetModel(getEntity(), this); setWindow(model); }
Source:
private void checkIfDDLStatementandMutationState(final CompilableStatement stmt, MutationState state) throws SQLException { boolean throwUncommittedMutation = connection.getQueryServices().getProps().getBoolean( QueryServices.PENDING_MUTATIONS_DDL_THROW_ATTRIB, QueryServicesOptions.DEFAULT_PENDING_MUTATIONS_DDL_THROW); if (stmt instanceof MutableStatement && !(stmt instanceof DMLStatement) && state.getNumRows() > 0) { if (throwUncommittedMutation) { throw new SQLExceptionInfo.Builder( SQLExceptionCode.CANNOT_PERFORM_DDL_WITH_PENDING_MUTATIONS).build() .buildException(); } else { LOGGER.info( "There are Uncommitted mutations, which will be dropped on the execution of this DDL statement."); } } }

Target:
private void checkIfDDLStatementandMutationState(final CompilableStatement stmt, MutationState state) throws SQLException { boolean throwUncommittedMutation = connection.getQueryServices().getProps().getBoolean( QueryServices.PENDING_MUTATIONS_DDL_THROW_ATTRIB, QueryServicesOptions.DEFAULT_PENDING_MUTATIONS_DDL_THROW); if (stmt instanceof MutableStatement && !(stmt instanceof DMLStatement) && state.getNumRows() > 0) { if (throwUncommittedMutation) { throw new SQLExceptionInfo.Builder( SQLExceptionCode.CANNOT_PERFORM_DDL_WITH_PENDING_MUTATIONS).build() .buildException(); } else { LOGGER.warn( "There are Uncommitted mutations, which will be dropped on the execution of this DDL statement."); } } }
Source:
private static PropertySource<?> loadPropertySource() { Properties properties = new Properties(); try (InputStream is = LdapAuthenticationProviderTest.class.getResourceAsStream("lapt.properties")) { properties.load(is); } catch (Exception ex) { throw new UndeclaredThrowableException(ex); } properties.put(BASE64_ENCODING_KEY, true); return new PropertiesPropertySource(STRONGBOX_AUTHENTICATION_PROVIDERS, properties); }

Target:
private static PropertySource<?> loadPropertySource() { Properties properties = new Properties(); try (InputStream is = LdapAuthenticationProviderTest.class.getResourceAsStream("labet.properties")) { properties.load(is); } catch (Exception ex) { throw new UndeclaredThrowableException(ex); } return new PropertiesPropertySource(STRONGBOX_AUTHENTICATION_PROVIDERS, properties); }
Source:
public static String waitForFileContents(String file, String desiredContent, Duration timeout, boolean failOnAbsent) { long secs = Math.max(timeout.toSeconds(), 1); List<String> commands = ImmutableList.of( "for i in {1.."+secs+"}", "do", " grep '"+desiredContent+"' "+file+" && result=0 || result=$?", " [ \"$result\" == 0 ] && break", " sleep 1", "done", "if test \"$result\" -ne 0; then", " "+ (failOnAbsent ? "echo \"Couldn't find "+desiredContent+" in "+file+"; aborting\" && exit 1" : "echo \"Couldn't find "+desiredContent+" in "+file+"; continuing\""), "fi"); return Joiner.on("\n").join(commands); }

Target:
public static String waitForFileContents(String file, String desiredContent, Duration timeout, boolean failOnAbsent) { long secs = Math.max(timeout.toSeconds(), 1); List<String> commands = ImmutableList.of( "for i in {1.."+secs+"}; do", " grep '"+desiredContent+"' "+file+" && result=0 || result=$?", " [ \"$result\" == 0 ] && break", " sleep 1", "done", "if test \"$result\" -ne 0; then", " "+ (failOnAbsent ? "echo \"Couldn't find "+desiredContent+" in "+file+"; aborting\" && exit 1" : "echo \"Couldn't find "+desiredContent+" in "+file+"; continuing\""), "fi"); return Joiner.on("\n").join(commands); }
Source:
public void saveScreenshot() { final ByteBuffer buffer = buffersManager.getSceneFinalRawData(); if (buffer == null) { logger.error("No screenshot data available. No screenshot will be saved."); return; } int width = buffersManager.getFBO("ocUndistorted").width(); int height = buffersManager.getFBO("sceneFinal").height(); Runnable task = () -> { SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss"); final String format = renderingConfig.getScreenshotFormat(); final String fileName = "Terasology-" + sdf.format(new Date()) + "-" + width + "x" + height + "." + format; Path path = PathManager.getInstance().getScreenshotPath().resolve(fileName); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int i = (x + width * y) * 4; int r = buffer.get(i) & 0xFF; int g = buffer.get(i + 1) & 0xFF; int b = buffer.get(i + 2) & 0xFF; image.setRGB(x, height - (y + 1), (0xFF << 24) | (r << 16) | (g << 8) | b); } } try (OutputStream out = new BufferedOutputStream(Files.newOutputStream(path))) { ImageIO.write(image, format, out); logger.info("Screenshot '" + fileName + "' saved! "); } catch (IOException e) { logger.warn("Failed to save screenshot!", e); } }; threadManager.submitTask("Write screenshot", task); isTakingScreenshot = false; }

Target:
public void saveScreenshot() { final ByteBuffer buffer = buffersManager.getSceneFinalRawData(); if (buffer == null) { logger.error("No screenshot data available. No screenshot will be saved."); return; } FBO sceneFinal = buffersManager.getFBO("sceneFinal"); int width = sceneFinal.width(); int height = sceneFinal.height(); Runnable task = () -> { SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss"); final String format = renderingConfig.getScreenshotFormat(); final String fileName = "Terasology-" + sdf.format(new Date()) + "-" + width + "x" + height + "." + format; Path path = PathManager.getInstance().getScreenshotPath().resolve(fileName); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int i = (x + width * y) * 4; int r = buffer.get(i) & 0xFF; int g = buffer.get(i + 1) & 0xFF; int b = buffer.get(i + 2) & 0xFF; image.setRGB(x, height - (y + 1), (0xFF << 24) | (r << 16) | (g << 8) | b); } } try (OutputStream out = new BufferedOutputStream(Files.newOutputStream(path))) { ImageIO.write(image, format, out); logger.info("Screenshot '" + fileName + "' saved! "); } catch (IOException e) { logger.warn("Failed to save screenshot!", e); } }; threadManager.submitTask("Write screenshot", task); isTakingScreenshot = false; }
Source:
private void createBranch(final String textForBranch, boolean doCheckout, RevCommit commit, IProgressMonitor monitor) throws CoreException, GitAPIException { monitor.setTaskName(UIText.FetchGerritChangePage_CreatingBranchTaskName); CreateLocalBranchOperation bop = new CreateLocalBranchOperation( repository, textForBranch, commit); bop.execute(monitor); if (doCheckout) { final CheckoutResult result = checkout(textForBranch); if (result.getStatus() == Status.CONFLICTS) { PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); CleanupUncomittedChangesDialog cleanupUncomittedChangesDialog = new CleanupUncomittedChangesDialog( shell, UIText.BranchResultDialog_CheckoutConflictsTitle, UIText.AbstractRebaseCommandHandler_cleanupDialog_text, repository, result.getConflictList()); cleanupUncomittedChangesDialog.open(); if (cleanupUncomittedChangesDialog.shouldContinue()) { try { checkout(textForBranch); } catch (GitAPIException e) { Activator.logError(e.getMessage(), e); } } }); } } monitor.worked(1); }

Target:
private void createBranch(final String textForBranch, boolean doCheckout, RevCommit commit, IProgressMonitor monitor) throws CoreException { monitor.setTaskName(UIText.FetchGerritChangePage_CreatingBranchTaskName); CreateLocalBranchOperation bop = new CreateLocalBranchOperation( repository, textForBranch, commit); bop.execute(monitor); if (doCheckout) { CheckoutResult result; try { result = checkout(textForBranch, monitor); } catch (OperationCanceledException | InterruptedException e1) { return; } if (result.getStatus() == Status.CONFLICTS) { PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); CleanupUncomittedChangesDialog cleanupUncomittedChangesDialog = new CleanupUncomittedChangesDialog( shell, UIText.BranchResultDialog_CheckoutConflictsTitle, UIText.AbstractRebaseCommandHandler_cleanupDialog_text, repository, result.getConflictList()); cleanupUncomittedChangesDialog.open(); if (cleanupUncomittedChangesDialog.shouldContinue()) { try { checkout(textForBranch, monitor); } catch (InterruptedException e) { Activator.logError(e.getMessage(), e); } } }); } } monitor.worked(1); }
Source:
public AppConfig() { register(StatusController.class); register(MachineController.class); register(TextController.class); register(MacrosController.class); register(SettingsController.class); register(FilesController.class); register(MultiPartFeature.class); BackendAPI backendAPI = BackendAPIFactory.getInstance().getBackendAPI(); JogService jogService = new JogService(backendAPI); register(new AbstractBinder() { @Override protected void configure() { bind(backendAPI).to(BackendAPI.class); bind(jogService).to(JogService.class); } }); }

Target:
public AppConfig() { register(ExceptionMapper.class); register(StatusResource.class); register(MachineResource.class); register(TextResource.class); register(MacrosResource.class); register(SettingsResource.class); register(FilesResource.class); register(MultiPartFeature.class); BackendAPI backendAPI = BackendAPIFactory.getInstance().getBackendAPI(); JogService jogService = new JogService(backendAPI); register(new AbstractBinder() { @Override protected void configure() { bind(backendAPI).to(BackendAPI.class); bind(jogService).to(JogService.class); } }); }
Source:
@Override public Connection getConnection() throws JMSException { return getConnection(null, null); }

Target:
public Connection getConnection() throws JMSException { return getConnection(null, null); }
Source:
private boolean satisfiesUpdatedHours(TurboIssue issue, UpdatedKind updatedKind) { NumberRange updatedRange; if (numberRange.isPresent()) { updatedRange = numberRange.get(); } else if (number.isPresent()) { updatedRange = new NumberRange(null, number.get(), true); } else { return false; } int hoursSinceUpdate = Integer.MIN_VALUE; LocalDateTime dateOfUpdate = LocalDateTime.ofEpochSecond(0, 0, ZoneOffset.ofHours(0)); if (hoursSinceUpdate == Integer.MIN_VALUE) { dateOfUpdate = issue.getUpdatedAt(); } switch (updatedKind){ case SELF_UPDATED: if (issue.getMetadata().isUpdatedBySelf()) { dateOfUpdate = issue.getMetadata().getSelfUpdatedAt(); } break; case OTHER_UPDATED: if (issue.getMetadata().isUpdatedByOthers()) { dateOfUpdate = issue.getMetadata().getNonSelfUpdatedAt(); } break; case ALL_UPDATED: if (issue.getMetadata().isUpdated()) { dateOfUpdate = issue.getUpdatedAt(); } } hoursSinceUpdate = Utility.safeLongToInt(dateOfUpdate.until(getCurrentTime(), ChronoUnit.HOURS)); return updatedRange.encloses(hoursSinceUpdate); }

Target:
private boolean satisfiesUpdatedHours(TurboIssue issue, UpdatedKind updatedKind) { NumberRange updatedRange; if (numberRange.isPresent()) { updatedRange = numberRange.get(); } else if (number.isPresent()) { updatedRange = new NumberRange(null, number.get(), true); } else { return false; } LocalDateTime dateOfUpdate = null; switch (updatedKind){ case SELF_UPDATED: if (issue.getMetadata().isUpdatedBySelf()) { dateOfUpdate = issue.getMetadata().getSelfUpdatedAt(); } break; case OTHER_UPDATED: if (issue.getMetadata().isUpdatedByOthers()) { dateOfUpdate = issue.getMetadata().getNonSelfUpdatedAt(); } break; case ALL_UPDATED: dateOfUpdate = issue.getUpdatedAt(); } if (dateOfUpdate == null) { return false; } else { int hoursSinceUpdate = Utility.safeLongToInt(dateOfUpdate.until(getCurrentTime(), ChronoUnit.HOURS)); return updatedRange.encloses(hoursSinceUpdate); } }
Source:
private List<String> _getUniqueFastScan(MetricSchemaRecordQuery query, final int limit, final RecordType type) { requireNotDisposed(); SystemAssert.requireArgument(RecordType.METRIC.equals(type) || RecordType.SCOPE.equals(type), "This method is only for use with metric or scope."); final List<String> result = new ArrayList<>(); final ScanMetadata metadata = _constructScanMetadata(query); String namespace = _convertToRegex(query.getNamespace()); String scope = _convertToRegex(query.getScope()); String metric = _convertToRegex(query.getMetric()); String tagKey = _convertToRegex(query.getTagKey()); String tagValue = _convertToRegex(query.getTagValue()); String rowKeyRegex = "^" + _constructRowKey(namespace, scope, metric, tagKey, tagValue, metadata.type) + "$"; List<ScanFilter> filters = new ArrayList<ScanFilter>(); filters.add(new RowFilter(CompareOp.EQUAL, new RegexStringComparator(rowKeyRegex))); filters.add(new KeyOnlyFilter()); filters.add(new FirstKeyOnlyFilter()); FilterList fl = new FilterList(filters, FilterList.Operator.MUST_PASS_ALL); String start = Bytes.toString(metadata.startRow); String end = Bytes.toString(metadata.stopRow); ArrayList<ArrayList<KeyValue>> rows = _getSingleRow(start, end, fl, metadata.type.getTableName()); while(rows != null && !rows.isEmpty()) { for(ArrayList<KeyValue> row : rows) { String rowKey = Bytes.toString(row.get(0).key()); result.add(rowKey.split(":")[0]); } if(result.size() == limit) { break; } rows = _getSingleRow(_plusOne(result.get(result.size() - 1)), end, fl, metadata.type.getTableName()); } return result; }

Target:
private List<String> _getUniqueFastScan(MetricSchemaRecordQuery query, final int limit, final RecordType type) { requireNotDisposed(); SystemAssert.requireArgument(RecordType.METRIC.equals(type) || RecordType.SCOPE.equals(type), "This method is only for use with metric or scope."); final List<String> result = new ArrayList<>(); final ScanMetadata metadata = _constructScanMetadata(query); String namespace = _convertToRegex(query.getNamespace()); String scope = _convertToRegex(query.getScope()); String metric = _convertToRegex(query.getMetric()); String tagKey = _convertToRegex(query.getTagKey()); String tagValue = _convertToRegex(query.getTagValue()); String rowKeyRegex = "^" + _constructRowKey(namespace, scope, metric, tagKey, tagValue, metadata.type) + "$"; List<ScanFilter> filters = new ArrayList<ScanFilter>(); filters.add(new RowFilter(CompareOp.EQUAL, new RegexStringComparator(rowKeyRegex))); filters.add(new KeyOnlyFilter()); filters.add(new FirstKeyOnlyFilter()); FilterList filterList = new FilterList(filters, FilterList.Operator.MUST_PASS_ALL); String start = Bytes.toString(metadata.startRow); String end = Bytes.toString(metadata.stopRow); ArrayList<ArrayList<KeyValue>> rows = _getSingleRow(start, end, filterList, metadata.type.getTableName()); while(rows != null && !rows.isEmpty()) { for(ArrayList<KeyValue> row : rows) { String rowKey = Bytes.toString(row.get(0).key()); result.add(rowKey.split(":")[0]); } if(result.size() == limit) { break; } rows = _getSingleRow(_plusOne(result.get(result.size() - 1)), end, filterList, metadata.type.getTableName()); } return result; }
Source:
private void trackNodeError(Node node, Throwable error, long nodeResponseTimeNanos) { if (requestTracker instanceof NoopRequestTracker) { return; } if (nodeResponseTimeNanos < 0) { nodeResponseTimeNanos = System.nanoTime(); } long latencyNanos = nodeResponseTimeNanos - this.nodeStartTimeNanos; requestTracker.onNodeError(statement, error, latencyNanos, executionProfile, node); }

Target:
private void trackNodeError(Node node, Throwable error, long nodeResponseTimeNanos) { if (requestTracker instanceof NoopRequestTracker) { return; } if (nodeResponseTimeNanos == NANOTIME_NOT_MEASURED_YET) { nodeResponseTimeNanos = System.nanoTime(); } long latencyNanos = nodeResponseTimeNanos - this.nodeStartTimeNanos; requestTracker.onNodeError(statement, error, latencyNanos, executionProfile, node); }
Source:
public static JsonObject mergeTenantConfScopes(JsonElement existingTenantConfScopes, JsonElement newTenantConfScopes) { JsonArray existingTenantConfScopesArray = (JsonArray) existingTenantConfScopes.getAsJsonObject(). get(APIConstants.REST_API_SCOPE); JsonArray newTenantConfScopesArray = (JsonArray) newTenantConfScopes.getAsJsonObject(). get(APIConstants.REST_API_SCOPE); JsonArray mergedTenantConfScopesArray = newTenantConfScopesArray; for (int i = 0; i < existingTenantConfScopesArray.size(); i++) { JsonObject existingScopeRoleMapping = existingTenantConfScopesArray.get(i).getAsJsonObject(); String existingScopeName = existingScopeRoleMapping.get(APIConstants.REST_API_SCOPE_NAME).getAsString(); Boolean isExist = false; for (int j = 0; j < newTenantConfScopesArray.size(); j++) { JsonObject newScopeRoleMapping = newTenantConfScopesArray.get(j).getAsJsonObject(); String newScopeName = newScopeRoleMapping.get(APIConstants.REST_API_SCOPE_NAME).getAsString(); if (StringUtils.equals(existingScopeName, newScopeName)) { isExist = true; break; } } if (!isExist) { mergedTenantConfScopesArray.add(existingTenantConfScopesArray.get(i)); } } JsonObject mergedTenantConfScopes = new JsonObject(); mergedTenantConfScopes.add(APIConstants.REST_API_SCOPE, mergedTenantConfScopesArray); return mergedTenantConfScopes; }

Target:
public static JsonObject mergeTenantConfScopes(JsonElement existingTenantConfScopes, JsonElement newTenantConfScopes) { JsonArray existingTenantConfScopesArray = (JsonArray) existingTenantConfScopes.getAsJsonObject(). get(APIConstants.REST_API_SCOPE); JsonArray newTenantConfScopesArray = (JsonArray) newTenantConfScopes.getAsJsonObject(). get(APIConstants.REST_API_SCOPE); JsonArray mergedTenantConfScopesArray = new JsonParser().parse(newTenantConfScopesArray.toString()). getAsJsonArray(); for (JsonElement existingScopeRoleMapping : existingTenantConfScopesArray) { String existingScopeName = existingScopeRoleMapping.getAsJsonObject().get(APIConstants.REST_API_SCOPE_NAME). getAsString(); Boolean scopeRoleMappingExists = false; for (JsonElement newScopeRoleMapping : newTenantConfScopesArray) { String newScopeName = newScopeRoleMapping.getAsJsonObject().get(APIConstants.REST_API_SCOPE_NAME). getAsString(); if (StringUtils.equals(existingScopeName, newScopeName)) { scopeRoleMappingExists = true; break; } } if (!scopeRoleMappingExists) { mergedTenantConfScopesArray.add(existingScopeRoleMapping); } } JsonObject mergedTenantConfScopes = new JsonObject(); mergedTenantConfScopes.add(APIConstants.REST_API_SCOPE, mergedTenantConfScopesArray); return mergedTenantConfScopes; }
Source:
private int filterWithDictionary(Page page, int[] positions, int positionCount, RuntimeException[] errors) { int outputCount = 0; DictionaryBlock block = (DictionaryBlock) page.getBlock(0); Block dictionary = block.getDictionary(); if (dictionary != previousDictionary) { previousDictionary = dictionary; int numEntries = dictionary.getPositionCount(); dictionaryPage = new Page(numEntries, dictionary); if (dictionaryResults == null || dictionaryResults.length < numEntries) { dictionaryResults = new byte[numEntries]; } else { fill(dictionaryResults, 0, numEntries, FILTER_NOT_EVALUATED); } } for (int i = 0; i < positionCount; i++) { int position = positions[i]; int dictionaryPosition = block.getId(position); byte result = dictionaryResults[dictionaryPosition]; if (result == FILTER_FAILED) { continue; } if (result == FILTER_PASSED) { positions[outputCount++] = position; continue; } try { if (predicate.evaluate(session, page, position)) { positions[outputCount++] = position; dictionaryResults[dictionaryPosition] = FILTER_PASSED; } else { dictionaryResults[dictionaryPosition] = FILTER_FAILED; } } catch (RuntimeException e) { positions[outputCount] = position; errors[outputCount] = e; outputCount++; } } return outputCount; }

Target:
private int filterWithDictionary(Page page, int[] positions, int positionCount, RuntimeException[] errors) { int outputCount = 0; DictionaryBlock block = (DictionaryBlock) page.getBlock(0); Block dictionary = block.getDictionary(); if (dictionary != previousDictionary) { previousDictionary = dictionary; int numEntries = dictionary.getPositionCount(); dictionaryPage = new Page(numEntries, dictionary); dictionaryResults = ensureCapacity(dictionaryResults, numEntries); fill(dictionaryResults, 0, numEntries, FILTER_NOT_EVALUATED); } for (int i = 0; i < positionCount; i++) { int position = positions[i]; int dictionaryPosition = block.getId(position); byte result = dictionaryResults[dictionaryPosition]; switch (result) { case FILTER_FAILED: continue; case FILTER_PASSED: positions[outputCount] = position; errors[outputCount] = errors[i]; outputCount++; continue; case FILTER_NOT_EVALUATED: try { if (predicate.evaluate(session, dictionaryPage, dictionaryPosition)) { positions[outputCount] = position; errors[outputCount] = errors[i]; outputCount++; dictionaryResults[dictionaryPosition] = FILTER_PASSED; } else { dictionaryResults[dictionaryPosition] = FILTER_FAILED; } } catch (RuntimeException e) { positions[outputCount] = position; errors[outputCount] = e; outputCount++; } break; default: verify(false, "Unexpected filter result: " + result); } } return outputCount; }
Source:
protected Range doSetCell(final int rowIndex, final int columnIndex, final Function<Pair<Integer, Integer>, GridCell<?>> cellSupplier) { if (rowIndex < 0 || rowIndex > rows.size() - 1) { return new Range(rowIndex); } if (columnIndex < 0 || columnIndex > columns.size() - 1) { return new Range(rowIndex); } final int _columnIndex = columns.get(columnIndex).getIndex(); if (!isMerged) { ((BaseGridRow) rows.get(rowIndex)).setCell(_columnIndex, cellSupplier.apply(new Pair<>(rowIndex, columnIndex))); return new Range(rowIndex); } final int minRowIndex = findMinRowIndexForCellUpdate(rowIndex, _columnIndex); final int maxRowIndex = findMaxRowIndexForCellUpdate(rowIndex, _columnIndex); final Range range = new Range(minRowIndex, maxRowIndex); for (int i = minRowIndex; i <= maxRowIndex; i++) { final GridRow row = rows.get(i); ((BaseGridRow) row).setCell(_columnIndex, cellSupplier.apply(new Pair<>(i, columnIndex))); } indexManager.onSetCell(range, _columnIndex); return range; }

Target:
protected Range doSetCell(final int rowIndex, final int columnIndex, final Function<Pair<Integer, Integer>, GridCell<?>> cellSupplier) { if (rowIndex < 0 || rowIndex > rows.size() - 1) { return new Range(rowIndex); } if (columnIndex < 0 || columnIndex > columns.size() - 1) { return new Range(rowIndex); } final int _columnIndex = columns.get(columnIndex).getIndex(); if (!isMerged) { ((BaseGridRow) rows.get(rowIndex)).setCell(_columnIndex, cellSupplier.apply(Pair.newPair(rowIndex, columnIndex))); return new Range(rowIndex); } final int minRowIndex = findMinRowIndexForCellUpdate(rowIndex, _columnIndex); final int maxRowIndex = findMaxRowIndexForCellUpdate(rowIndex, _columnIndex); final Range range = new Range(minRowIndex, maxRowIndex); for (int i = minRowIndex; i <= maxRowIndex; i++) { final GridRow row = rows.get(i); ((BaseGridRow) row).setCell(_columnIndex, cellSupplier.apply(Pair.newPair(i, columnIndex))); } indexManager.onSetCell(range, _columnIndex); return range; }
Source:
public static ConfiguredTarget incompatibleConfiguredTarget( RuleContext ruleContext, OrderedSetMultimap<DependencyKind, ConfiguredTargetAndData> prerequisiteMap) throws ActionConflictException { if ("toolchain".equals(ruleContext.getRule().getRuleClass())) { return null; } if (ruleContext.attributes().has("target_compatible_with")) { Iterable<ConstraintValueInfo> constraintValues = PlatformProviderUtils.constraintValues( ruleContext.getPrerequisites("target_compatible_with")); for (ConstraintValueInfo constraintValue : constraintValues) { if (!ruleContext.targetPlatformHasConstraint(constraintValue)) { return createIncompatibleConfiguredTarget(ruleContext, null, constraintValue); } } } for (ConfiguredTargetAndData infoCollection : prerequisiteMap.values()) { ConfiguredTarget dependency = infoCollection.getConfiguredTarget(); if (dependency instanceof OutputFileConfiguredTarget) { dependency = ((OutputFileConfiguredTarget) dependency).getGeneratingRule(); } if (dependency.getProvider(IncompatiblePlatformProvider.class) != null) { return createIncompatibleConfiguredTarget(ruleContext, dependency, null); } } return null; }

Target:
public static ConfiguredTarget incompatibleConfiguredTarget( RuleContext ruleContext, OrderedSetMultimap<DependencyKind, ConfiguredTargetAndData> prerequisiteMap) throws ActionConflictException { if (!ruleContext.getRule().getRuleClassObject().useToolchainResolution()) { return null; } if (ruleContext.attributes().has("target_compatible_with")) { ImmutableList<ConstraintValueInfo> invalidConstraintValues = Streams.stream( PlatformProviderUtils.constraintValues( ruleContext.getPrerequisites("target_compatible_with"))) .filter(cv -> !ruleContext.targetPlatformHasConstraint(cv)) .collect(ImmutableList.toImmutableList()); if (!invalidConstraintValues.isEmpty()) { return createIncompatibleConfiguredTarget(ruleContext, null, invalidConstraintValues); } } ImmutableList.Builder<ConfiguredTarget> incompatibleDependenciesBuilder = ImmutableList.builder(); for (ConfiguredTargetAndData infoCollection : prerequisiteMap.values()) { ConfiguredTarget dependency = infoCollection.getConfiguredTarget(); if (dependency instanceof OutputFileConfiguredTarget) { dependency = ((OutputFileConfiguredTarget) dependency).getGeneratingRule(); } if (dependency.getProvider(IncompatiblePlatformProvider.class) != null) { incompatibleDependenciesBuilder.add(dependency); } } ImmutableList<ConfiguredTarget> incompatibleDependencies = incompatibleDependenciesBuilder.build(); if (!incompatibleDependencies.isEmpty()) { return createIncompatibleConfiguredTarget(ruleContext, incompatibleDependencies, null); } return null; }
Source:
public void findRoleTestIdNull() { Role returedRole = roleManagerImpl.findRole(null); Assert.assertNull(returedRole); }

Target:
public void findRoleTestIdNull() { Role returnedRole = roleManagerImpl.findRole(null); Assert.assertNull(returnedRole); }
Source:
public final void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) { Configuration config = new Configuration(metaDataMap); try { ResourceResolver resourceResolver = workflowHelper.getResourceResolver(workflowSession); TagManager tagManager = resourceResolver.adaptTo(TagManager.class); if (tagManager == null) { log.error("Unable to adapt to Tag Manager. This step can't do it's work"); return; } final List<String> payloads = workflowPackageManager.getPaths(resourceResolver, (String) workItem.getWorkflowData().getPayload()); for (final String payload : payloads) { log.debug("Processing {}", payload); Resource payloadResource = resourceResolver.resolve(payload); Asset asset = DamUtil.resolveToAsset(payloadResource); Resource assetResource = asset.adaptTo(Resource.class); if (assetResource != null) { AssetDetails assetDetails = new AssetDetails(assetResource); String tagId = getOrientation(assetDetails, config); log.debug("Orientation tag is {}", tagId); if (tagId != null) { Tag tag = tagManager.resolve(tagId); if (tag != null) { addTagToResource(assetResource, tag, tagManager); log.debug("Orientation tag set"); } else { log.warn("Unable to resolve tag - check configuration for Set Image Orientation workflow step", tagId); } } else { log.warn("Unable to set tag."); } } } } catch (RepositoryException re) { log.error("Repository Exception", re); } }

Target:
public final void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) { Configuration config = new Configuration(metaDataMap); try { ResourceResolver resourceResolver = workflowHelper.getResourceResolver(workflowSession); TagManager tagManager = resourceResolver.adaptTo(TagManager.class); if (tagManager == null) { log.error("Unable to adapt to Tag Manager. This step can't do it's work"); return; } final List<String> payloads = workflowPackageManager.getPaths(resourceResolver, (String) workItem.getWorkflowData().getPayload()); for (final String payload : payloads) { log.debug("Processing {}", payload); Resource payloadResource = resourceResolver.resolve(payload); Asset asset = DamUtil.resolveToAsset(payloadResource); Resource assetResource = null; if (asset != null) { assetResource = asset.adaptTo(Resource.class); } if (assetResource != null) { processAsset(assetResource, config, tagManager); } else { log.warn("Unable to access asset resource for payload [ ]", payload); } } } catch (RepositoryException re) { log.error("Unable to apply orientation tags for workflow payload [ ]", workItem.getWorkflowData().getPayload(), re); } }