auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Folder findFolderByPath(final String path, final Host host, final User user, final boolean respectFrontEndPermissions) throws DotStateException, DotDataException, DotSecurityException { final Folder folder = folderFactory.findFolderByPath(path, host); if (folder != null && InodeUtils.isSet(folder.getInode()) && !permissionAPI.doesUserHavePermission(folder, PermissionAPI.PERMISSION_READ, user, respectFrontEndPermissions)) { if(FolderAPI.SYSTEM_FOLDER.equals(folder.getInode())) { if(!Host.SYSTEM_HOST.equals(host.getIdentifier())){ if(!permissionAPI.doesUserHavePermission(host, PermissionAPI.PERMISSION_READ, user, respectFrontEndPermissions)) { throw new DotSecurityException("User " + (user.getUserId() != null ? user.getUserId() : "") + " does not have permission to read folder " + folder.getPath()); } } } } return folder; }

Target:
public Folder findFolderByPath(final String path, final Host host, final User user, final boolean respectFrontEndPermissions) throws DotStateException, DotDataException, DotSecurityException { final Folder folder = folderFactory.findFolderByPath(path, host); if (folder != null && InodeUtils.isSet(folder.getInode()) && !permissionAPI.doesUserHavePermission(folder, PermissionAPI.PERMISSION_READ, user, respectFrontEndPermissions)) { if(FolderAPI.SYSTEM_FOLDER.equals(folder.getInode())) { if(!Host.SYSTEM_HOST.equals(host.getIdentifier())){ if(!permissionAPI.doesUserHavePermission(host, PermissionAPI.PERMISSION_READ, user, respectFrontEndPermissions)) { throw new DotSecurityException("User " + (user.getUserId() != null ? user.getUserId() : BLANK) + " does not have permission to read folder " + folder.getPath()); } } } } return folder; }
Source:
public FileBasedConfig openSystemConfig(Config parent, FS fs) { systemConfig.compareAndSet(null, createSystemConfig(parent, fs)); return systemConfig.get(); }

Target:
public FileBasedConfig openSystemConfig(Config parent, FS fs) { if (systemConfig.get() == null) { systemConfig.compareAndSet(null, createSystemConfig(parent, fs)); } return systemConfig.get(); }
Source:
public void testParseRowWithConditional() throws IOException { final JsonInputFormat format = new JsonInputFormat( new JSONPathSpec( true, ImmutableList.of( new JSONPathFieldSpec(JSONPathFieldType.PATH, "foo", "$.[?(@.maybe_object)].maybe_object.foo.test"), new JSONPathFieldSpec(JSONPathFieldType.PATH, "baz", "$.maybe_object_2.foo.test"), new JSONPathFieldSpec(JSONPathFieldType.PATH, "bar", "$.[?(@.something_else)].something_else.foo") ) ), null ); final ByteSource source = new ByteSource( StringUtils.toUtf8("{\"timestamp\":\"2019-01-01\",\"something_else\": {\"foo\": \"test\"}}") ); final SplitReader reader = format.createReader( new TimestampSpec("timestamp", "iso", null), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("foo"))) ); try (CloseableIterator<InputRow> iterator = reader.read(source, null)) { while (iterator.hasNext()) { final InputRow row = iterator.next(); Assert.assertEquals("test", Iterables.getOnlyElement(row.getDimension("bar"))); Assert.assertEquals(Collections.emptyList(), row.getDimension("foo")); Assert.assertTrue(row.getDimension("baz").isEmpty()); } } }

Target:
public void testParseRowWithConditional() throws IOException { final JsonInputFormat format = new JsonInputFormat( new JSONPathSpec( true, ImmutableList.of( new JSONPathFieldSpec(JSONPathFieldType.PATH, "foo", "$.[?(@.maybe_object)].maybe_object.foo.test"), new JSONPathFieldSpec(JSONPathFieldType.PATH, "baz", "$.maybe_object_2.foo.test"), new JSONPathFieldSpec(JSONPathFieldType.PATH, "bar", "$.[?(@.something_else)].something_else.foo") ) ), null ); final ByteEntity source = new ByteEntity( StringUtils.toUtf8("{\"timestamp\":\"2019-01-01\",\"something_else\": {\"foo\": \"test\"}}") ); final InputEntityReader reader = format.createReader( new InputRowSchema( new TimestampSpec("timestamp", "iso", null), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("foo"))), Collections.emptyList() ) ); final int numExpectedIterations = 1; try (CloseableIterator<InputRow> iterator = reader.read(source, null)) { int numActualIterations = 0; while (iterator.hasNext()) { final InputRow row = iterator.next(); Assert.assertEquals("test", Iterables.getOnlyElement(row.getDimension("bar"))); Assert.assertEquals(Collections.emptyList(), row.getDimension("foo")); Assert.assertTrue(row.getDimension("baz").isEmpty()); numActualIterations++; } Assert.assertEquals(numExpectedIterations, numActualIterations); } }
Source:
private void mergeAll(Collection<? extends Diff> differences, boolean leftToRight, IBatchMerger merger, Registry mergerRegistry, Monitor emfMonitor) { if (leftToRight) { merger.copyAllLeftToRight(differences, emfMonitor); } else { merger.copyAllRightToLeft(differences, emfMonitor); } for (Diff difference : differences) { final IMerger diffMerger = mergerRegistry.getHighestRankingMerger(difference); if (LOGGER.isDebugEnabled()) { LOGGER.debug("mergeAll(Collection<? extends Diff>, boolean, IBatchMerger, Registry, Monitor) - Selected merger for diff " + difference.hashCode() + ": " + merger.getClass().getSimpleName()); } if (diffMerger instanceof IMerger2) { final Set<Diff> resultingMerges = MergeDependenciesUtil.getAllResultingMerges(difference, mergerRegistry, !leftToRight); addOrUpdateMergeData(resultingMerges, getMergeMode()); final Set<Diff> resultingRejections = MergeDependenciesUtil.getAllResultingRejections( difference, mergerRegistry, !leftToRight); addOrUpdateMergeData(resultingRejections, getMergeMode().inverse()); } else { addOrUpdateMergeData(Collections.singleton(difference), getMergeMode()); } } }

Target:
private void mergeAll(Collection<? extends Diff> differences, boolean leftToRight, IBatchMerger merger, Registry mergerRegistry, Monitor emfMonitor) { if (leftToRight) { merger.copyAllLeftToRight(differences, emfMonitor); } else { merger.copyAllRightToLeft(differences, emfMonitor); } for (Diff difference : differences) { final IMerger diffMerger = mergerRegistry.getHighestRankingMerger(difference); if (LOGGER.isDebugEnabled()) { LOGGER.debug("mergeAll - Selected merger for diff " + difference.hashCode() + ": " + merger.getClass().getSimpleName()); } if (diffMerger instanceof IMerger2) { final Set<Diff> resultingMerges = MergeDependenciesUtil.getAllResultingMerges(difference, mergerRegistry, !leftToRight); addOrUpdateMergeData(resultingMerges, getMergeMode()); final Set<Diff> resultingRejections = MergeDependenciesUtil.getAllResultingRejections( difference, mergerRegistry, !leftToRight); addOrUpdateMergeData(resultingRejections, getMergeMode().inverse()); } else { addOrUpdateMergeData(Collections.singleton(difference), getMergeMode()); } } }
Source:
APIResult submitExtensionJob(String extensionName, String jobName, InputStream configStream, SortedMap<EntityType, List<Entity>> entityMap) throws FalconException, IOException { checkIfExtensionIsEnabled(extensionName); checkIfExtensionJobExists(jobName, extensionName); for (Map.Entry<EntityType, List<Entity>> entry : entityMap.entrySet()) { for (Entity entity : entry.getValue()) { submitInternal(entity, "falconUser"); } } storeExtension(extensionName, jobName, configStream, entityMap); return new APIResult(APIResult.Status.SUCCEEDED, "Extension job submitted successfully" + jobName); }

Target:
APIResult submitExtensionJob(String extensionName, String jobName, InputStream configStream, SortedMap<EntityType, List<Entity>> entityMap) throws FalconException, IOException { checkIfExtensionIsEnabled(extensionName); checkIfExtensionJobNameExists(jobName, extensionName); for (Map.Entry<EntityType, List<Entity>> entry : entityMap.entrySet()) { for (Entity entity : entry.getValue()) { submitInternal(entity, "falconUser"); } } storeExtension(extensionName, jobName, configStream, entityMap); return new APIResult(APIResult.Status.SUCCEEDED, "Extension job submitted successfully" + jobName); }
Source:
public VmReplicateDiskParameters(Guid vdsId, Guid vmId, Guid storagePoolId, Guid srcStorageDomainId, Guid targetStorageDomainId, Guid imageGroupId, Guid imageId, String diskType) { super(vdsId, vmId); this.storagePoolId = storagePoolId; this.srcStorageDomainId = srcStorageDomainId; this.targetStorageDomainId = targetStorageDomainId; this.imageGroupId = imageGroupId; this.imageId = imageId; }

Target:
public VmReplicateDiskParameters(Guid vdsId, Guid vmId, Guid storagePoolId, Guid srcStorageDomainId, Guid targetStorageDomainId, Guid imageGroupId, Guid imageId, String diskType) { super(vdsId, vmId); this.storagePoolId = storagePoolId; this.srcStorageDomainId = srcStorageDomainId; this.targetStorageDomainId = targetStorageDomainId; this.imageGroupId = imageGroupId; this.imageId = imageId; this.diskType = diskType; }
Source:
public static FxRate parse(String rateStr) { ArgChecker.notNull(rateStr, "rateStr"); Matcher matcher = REGEX_FORMAT.matcher(rateStr.toUpperCase(Locale.ENGLISH)); if (matcher.matches() == false) { throw new IllegalArgumentException("Invalid rate: " + rateStr); } Currency base = Currency.parse(matcher.group(1)); Currency counter = Currency.parse(matcher.group(2)); double rate = Double.parseDouble(matcher.group(3)); return new FxRate(CurrencyPair.of(base, counter), rate); }

Target:
public static FxRate parse(String rateStr) { ArgChecker.notNull(rateStr, "rateStr"); Matcher matcher = REGEX_FORMAT.matcher(rateStr.toUpperCase(Locale.ENGLISH)); if (matcher.matches() == false) { throw new IllegalArgumentException("Invalid rate: " + rateStr); } try { Currency base = Currency.parse(matcher.group(1)); Currency counter = Currency.parse(matcher.group(2)); double rate = Double.parseDouble(matcher.group(3)); return new FxRate(CurrencyPair.of(base, counter), rate); } catch (RuntimeException ex) { throw new IllegalArgumentException("Unable to parse rate: " + rateStr, ex); } }
Source:
public static boolean isNullOrEquivalent(@Nullable String value) { return INSTANCE.isUseDefaultValuesForNull() ? Strings.isNullOrEmpty(value) : value == null; }

Target:
public static boolean isNullOrEquivalent(@Nullable String value) { return replaceWithDefault() ? Strings.isNullOrEmpty(value) : value == null; }
Source:
public void cleanUp() { File folder = app.getExternalFilesDir(null); if (folder == null) return; Observable.just(folder) .flatMap(new Func1<File, Observable<File>>() { @Override public Observable<File> call(File folder) { return Observable.from(folder.listFiles()); } }) .filter(new Func1<File, Boolean>() { @Override public Boolean call(File file) { return file.getName().endsWith(".log"); } }) .subscribeOn(Schedulers.io()) .forEach(new Action1<File>() { @Override public void call(File file) { file.delete(); } }); }

Target:
public void cleanUp() { new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... folders) { File folder = app.getExternalFilesDir(null); if (folder != null) { for (File file : folder.listFiles()) { if (file.getName().endsWith(".log")) { file.delete(); } } } return null; } }.execute(); }
Source:
private GraphQLOutputType outputTypeOf(String type) { if (type == null) { return Scalars.GraphQLString; } type = type.trim(); if (type.startsWith("[")) { return new GraphQLList(inputTypeOf(type.substring(1, type.length() - 1))); } switch (type) { case "Int": return Scalars.GraphQLInt; case "String": return Scalars.GraphQLString; case "Boolean": return Scalars.GraphQLBoolean; case "Float": return Scalars.GraphQLBoolean; default: return new GraphQLTypeReference(type); } }

Target:
private GraphQLOutputType outputTypeOf(String type) { if (type == null) { return Scalars.GraphQLString; } type = type.trim(); if (type.startsWith("[")) { return new GraphQLList(inputTypeOf(type.substring(1, type.length() - 1))); } switch (type) { case "Int": return Scalars.GraphQLInt; case "String": return Scalars.GraphQLString; case "Boolean": return Scalars.GraphQLBoolean; case "Float": return Scalars.GraphQLFloat; default: return new GraphQLTypeReference(type); } }
Source:
private void startServer(int id, String config) throws Exception { peers[id] = new MainThread(id, clientPorts[id], config); peers[id].start(); Assert.assertTrue("Server " + id + " is not up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[id], CONNECTION_TIMEOUT)); Assert.assertTrue("Error- Server started in Standalone Mode!", peers[id].isQuorumPeerRunning()); zkHandles[id] = ClientBase.createZKClient("127.0.0.1:" + clientPorts[id]); zkAdminHandles[id] = new ZooKeeperAdmin("127.0.0.1:" + clientPorts[id], CONNECTION_TIMEOUT, this); zkAdminHandles[id].addAuthInfo("digest", "super:test".getBytes()); LOG.info(String.format("Started server id %d with config:\n%s\nStat output:\n%s", id, config, FourLetterWordMain.send4LetterWord("127.0.0.1", clientPorts[id], "stat"))); }

Target:
private void startServer(int id, String config) throws Exception { peers[id] = new MainThread(id, clientPorts[id], config); peers[id].start(); Assert.assertTrue("Server " + id + " is not up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[id], CONNECTION_TIMEOUT)); Assert.assertTrue("Error- Server started in Standalone Mode!", peers[id].isQuorumPeerRunning()); zkHandles[id] = ClientBase.createZKClient("127.0.0.1:" + clientPorts[id]); zkAdminHandles[id] = new ZooKeeperAdmin("127.0.0.1:" + clientPorts[id], CONNECTION_TIMEOUT, this); zkAdminHandles[id].addAuthInfo("digest", "super:test".getBytes()); String statCommandOut = FourLetterWordMain.send4LetterWord("127.0.0.1", clientPorts[id], "stat"); LOG.info(String.format("Started server id %d with config:\n%s\nStat output:\n%s", id, config, statCommandOut)); }
Source:
protected int getTraversalId(EdgeIteratorState edge, int origEdgeId, boolean reverse) { int baseNode = graph.getBaseNode(origEdgeId, edge.getAdjNode()); return GHUtility.createEdgeKey(baseNode, edge.getAdjNode(), origEdgeId, reverse); }

Target:
protected int getTraversalId(EdgeIteratorState edge, int origEdgeId, boolean reverse) { int baseNode = graph.getOtherNode(origEdgeId, edge.getAdjNode()); return GHUtility.createEdgeKey(baseNode, edge.getAdjNode(), origEdgeId, reverse); }
Source:
public void testGetInvalidTxSize() throws Exception { Transaction tx1 = txClient.startShort(); txClient.startLong(); txClient.invalidate(tx1.getWritePointer()); ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); TransactionAdmin txAdmin = new TransactionAdmin(new PrintStream(out), new PrintStream(err)); txAdmin.doMain(new String[]{"--get-invalid-tx-size"}, conf); List<String> expected = ImmutableList.of("Invalid list size: 1", ""); Assert.assertEquals(Joiner.on("\n").join(expected), Bytes.toString(out.toByteArray())); Assert.assertEquals(0, err.toByteArray().length); }

Target:
public void testGetInvalidTxSize() throws Exception { Transaction tx1 = txClient.startShort(); txClient.startLong(); txClient.invalidate(tx1.getWritePointer()); ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); TransactionAdmin txAdmin = new TransactionAdmin(new PrintStream(out), new PrintStream(err)); int status = txAdmin.doMain(new String[]{"--get-invalid-tx-size"}, conf); Assert.assertEquals(0, status); Assert.assertTrue(out.toString("UTF-8").contains("Invalid list size: 1\n")); }
Source:
static String generateAndRetrieveIsoAsBase64Iso(String isoFileName, String driveLabel, String tempDirName) throws IOException { File tmpIsoStore = new File(tempDirName, isoFileName); Script command = new Script("/usr/bin/genisoimage", Duration.standardSeconds(300), LOG); command.add("-o", tmpIsoStore.getAbsolutePath()); command.add("-ldots"); command.add("-allow-lowercase"); command.add("-allow-multidot"); command.add("-cache-inodes"); command.add("-l"); command.add("-quiet"); command.add("-J"); command.add("-r"); command.add("-V", driveLabel); command.add(tempDirName); LOG.debug("Executing config drive creation command: " + command.toString()); String result = command.execute(); if (StringUtils.isNotBlank(result)) { String errMsg = "Unable to create iso file: " + isoFileName + " due to " + result; LOG.warn(errMsg); throw new CloudRuntimeException(errMsg); } File tmpIsoFile = new File(tmpIsoStore.getAbsolutePath()); if (tmpIsoFile.length() > (64L * 1024L * 1024L)) { throw new CloudRuntimeException("Config drive file exceeds maximum allowed size of 64MB"); } return fileToBase64String(tmpIsoFile); }

Target:
static String generateAndRetrieveIsoAsBase64Iso(String isoFileName, String driveLabel, String tempDirName) throws IOException { File tmpIsoStore = new File(tempDirName, isoFileName); Script command = new Script(getProgramToGenerateIso(), Duration.standardSeconds(300), LOG); command.add("-o", tmpIsoStore.getAbsolutePath()); command.add("-ldots"); command.add("-allow-lowercase"); command.add("-allow-multidot"); command.add("-cache-inodes"); command.add("-l"); command.add("-quiet"); command.add("-J"); command.add("-r"); command.add("-V", driveLabel); command.add(tempDirName); LOG.debug("Executing config drive creation command: " + command.toString()); String result = command.execute(); if (StringUtils.isNotBlank(result)) { String errMsg = "Unable to create iso file: " + isoFileName + " due to ge" + result; LOG.warn(errMsg); throw new CloudRuntimeException(errMsg); } File tmpIsoFile = new File(tmpIsoStore.getAbsolutePath()); if (tmpIsoFile.length() > (64L * 1024L * 1024L)) { throw new CloudRuntimeException("Config drive file exceeds maximum allowed size of 64MB"); } return fileToBase64String(tmpIsoFile); }
Source:
public void adjustQuestionNumbers(int oldQuestionNumber, int newQuestionNumber, List<FeedbackQuestionAttributes> questions) { if (oldQuestionNumber > newQuestionNumber && oldQuestionNumber >= 1) { for (int i = oldQuestionNumber - 1; i >= newQuestionNumber; i--) { FeedbackQuestionAttributes question = questions.get(i - 1).getCopy(); question.questionNumber += 1; try { updateFeedbackQuestion(question, false); } catch (InvalidParametersException e) { Assumption.fail("Invalid question. " + e); } catch (EntityDoesNotExistException e) { Assumption.fail("Question disappeared. " + e); } } } else if (oldQuestionNumber < newQuestionNumber && oldQuestionNumber < questions.size()) { for (int i = oldQuestionNumber + 1; i <= newQuestionNumber; i++) { FeedbackQuestionAttributes question = questions.get(i - 1).getCopy(); question.questionNumber -= 1; try { updateFeedbackQuestion(question, false); } catch (InvalidParametersException e) { Assumption.fail("Invalid question." + e); } catch (EntityDoesNotExistException e) { Assumption.fail("Question disappeared. " + e); } } } }

Target:
public void adjustQuestionNumbers(int oldQuestionNumber, int newQuestionNumber, List<FeedbackQuestionAttributes> questions) { if (oldQuestionNumber < 0 || newQuestionNumber < 0) { Assumption.fail("Invalid question number"); } if (oldQuestionNumber > newQuestionNumber) { increaseQuestionNumber(newQuestionNumber, oldQuestionNumber, questions); } else if (oldQuestionNumber < newQuestionNumber) { decreaseQuestionNumber(oldQuestionNumber, newQuestionNumber, questions); } }
Source:
public static void fireChunkWatch(boolean wasLoaded, boolean load, ServerPlayerEntity entity, ChunkPos chunkpos, ServerWorld world) { if (!wasLoaded && load) MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.Watch(entity, chunkpos, world)); else if (wasLoaded && !load) MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(entity, chunkpos, world)); }

Target:
public static void fireChunkWatch(boolean wasLoaded, boolean load, ServerPlayerEntity entity, ChunkPos chunkpos, ServerWorld world) { if (wasLoaded != load) fireChunkWatch(load, entity, chunkpos, world); }
Source:
public void removeBrokerConnection(String brokerName) { synchronized (brokerConnections) { MqttBrokerConnection connection = brokerConnections.get(brokerName.toLowerCase()); if (connection == null) { return; } brokerConnections.remove(brokerName); for (MqttBrokersObserver o : brokersObservers) { o.brokerRemoved(connection); } } }

Target:
public MqttBrokerConnection removeBrokerConnection(String brokerName) { synchronized (brokerConnections) { MqttBrokerConnection connection = brokerConnections.remove(brokerName.toLowerCase()); if (connection != null) { for (MqttBrokersObserver o : brokersObservers) { o.brokerRemoved(connection); } } return connection; } }
Source:
public static String getFileNameFromURL(String url) { int extension = url.lastIndexOf('.'); int path = Math.max(url.substring(0, extension).lastIndexOf('/'), 0) + 1; int param1 = url.indexOf('&', extension); int param2 = url.indexOf('?', extension); int param = (param2 >= 0 && param2 < param1) || (param1 == -1) ? param2 : param1; return param >= 0 ? url.substring(path, param) : url.substring(path); }

Target:
public static String getFileNameFromURL(String url) { int fileExtensionIndex = url.lastIndexOf('.'); int fileNameIndex = Math.max(url.substring(0, fileExtensionIndex).lastIndexOf('/'), 0) + 1; String fileName = url.substring(fileNameIndex); fileName = fileName.split("[?&#]")[0]; return fileName.contains(":") ? fileName.split(":")[1] : fileName; }
Source:
protected void validateReleaseResources(Collection<YarnWorkerNode> workerNodes) throws Exception { assertThat(workerNodes.size(), is(1)); verifyFutureCompleted(addContainerRequestFutures.get(0)); verifyFutureCompleted(removeContainerRequestFuture); verifyFutureCompleted(startContainerAsyncFuture); verifyFutureCompleted(stopContainerAsyncFuture); verifyFutureCompleted(releaseAssignedContainerFuture); assertFalse(addContainerRequestFutures.get(1).isDone()); }

Target:
protected void validateReleaseResources(Collection<YarnWorkerNode> workerNodes) throws Exception { assertThat(workerNodes.size(), is(1)); verifyFutureCompleted(stopContainerAsyncFuture); verifyFutureCompleted(releaseAssignedContainerFuture); }
Source:
private static void checkSkipFailed(Object input1, Object input2) { ChannelOutboundHandlerAdapter failFirst = new ChannelOutboundHandlerAdapter() { private boolean alreadyFailed; @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { if (alreadyFailed) { ctx.write(msg, promise); } else { promise.tryFailure(new RuntimeException()); this.alreadyFailed = true; } } }; EmbeddedChannel ch = new EmbeddedChannel(failFirst, new ChunkedWriteHandler()); ChannelFuture r1 = ch.write(input1); ChannelFuture r2 = ch.writeAndFlush(input2).awaitUninterruptibly(); ch.close(); assertTrue(r1.cause() instanceof RuntimeException); assertTrue(r2.isSuccess()); int i = 0; int read = 0; for (;;) { ByteBuf buffer = ch.readOutbound(); if (buffer == null) { break; } while (buffer.isReadable()) { assertEquals(BYTES[i++], buffer.readByte()); read++; if (i == BYTES.length) { i = 0; } } buffer.release(); } assertEquals(BYTES.length, read); }

Target:
private static void checkSkipFailed(Object input1, Object input2) { ChannelOutboundHandlerAdapter failFirst = new ChannelOutboundHandlerAdapter() { private boolean alreadyFailed; @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { if (alreadyFailed) { ctx.write(msg, promise); } else { this.alreadyFailed = true; ReferenceCountUtil.release(msg); promise.tryFailure(new RuntimeException()); } } }; EmbeddedChannel ch = new EmbeddedChannel(failFirst, new ChunkedWriteHandler()); ChannelFuture r1 = ch.write(input1); ChannelFuture r2 = ch.writeAndFlush(input2).awaitUninterruptibly(); assertTrue(ch.finish()); assertTrue(r1.cause() instanceof RuntimeException); assertTrue(r2.isSuccess()); int i = 0; int read = 0; for (;;) { ByteBuf buffer = ch.readOutbound(); if (buffer == null) { break; } while (buffer.isReadable()) { assertEquals(BYTES[i++], buffer.readByte()); read++; if (i == BYTES.length) { i = 0; } } buffer.release(); } assertEquals(BYTES.length, read); }
Source:
private Type type() { switch (operator) { case "IS_NULL": case "NOT_NULL": case "DISTINCT": return Type.UNARY_OPERAND; case "MIN": case "MAX": case "SUM": case "AVERAGE": case "COUNT": return Type.AGGREGATE; case "EQUALS_TO": case "NOT_EQUALS_TO": case "LIKE_TO": case "GREATER_THAN": case "LESS_THAN": case "GREATER_OR_EQUALS_TO": case "LESS_OR_EQUALS_TO": return Type.BINARY_OPERAND; case "BETWEEN": return Type.LIST_OPERAND; case "IN": case "NOT_IN": return Type.LIST_OPERAND; default: return Type.DEFAULT; } }

Target:
private Type type() { switch (operator) { case "IS_NULL": case "NOT_NULL": case "DISTINCT": return Type.UNARY_OPERAND; case "MIN": case "MAX": case "SUM": case "AVERAGE": case "COUNT": return Type.AGGREGATE; case "EQUALS_TO": case "NOT_EQUALS_TO": case "LIKE_TO": case "GREATER_THAN": case "LESS_THAN": case "GREATER_OR_EQUALS_TO": case "LESS_OR_EQUALS_TO": return Type.BINARY_OPERAND; case "BETWEEN": return Type.RANGE_OPERAND; case "IN": case "NOT_IN": return Type.LIST_OPERAND; default: return Type.DEFAULT; } }
Source:
private List<InterpreterResultMessage> replacePasswords(List<InterpreterResultMessage> original) { List<InterpreterResultMessage> replaced = new ArrayList<>(); for (InterpreterResultMessage msg : original) { String replacedMessages = replacePasswords(msg.getData()); replaced.add(new InterpreterResultMessage(msg.getType(), replacedMessages)); } return replaced; }

Target:
private List<InterpreterResultMessage> replacePasswords(List<InterpreterResultMessage> original) { List<InterpreterResultMessage> replaced = new ArrayList<>(); for (InterpreterResultMessage msg : original) { switch(msg.getType()) { case HTML: case TEXT: case TABLE: { String replacedMessages = replacePasswords(msg.getData()); replaced.add(new InterpreterResultMessage(msg.getType(), replacedMessages)); break; } default: replaced.add(msg); } } return replaced; }
Source:
public static void init() throws IOException { TestDirectoryStructureUtil.generateTraceStructure(TEST_TRACES_PATH); SWTBotUtils.initialize(); SWTBotPreferences.TIMEOUT = 20000; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; fLogger.removeAllAppenders(); fLogger.addAppender(new NullAppender()); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("Welcome", fBot); SWTBotUtils.switchToTracingPerspective(); WaitUtils.waitForJobs(); SWTBotUtils.createProject(TRACE_PROJECT_NAME); test3_00Preparation(); }

Target:
public static void init() throws IOException { TestDirectoryStructureUtil.generateTraceStructure(TEST_TRACES_PATH); SWTBotUtils.initialize(); SWTBotPreferences.TIMEOUT = 20000; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; fLogger.removeAllAppenders(); fLogger.addAppender(new NullAppender()); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("Welcome", fBot); SWTBotUtils.switchToTracingPerspective(); WaitUtils.waitForJobs(); SWTBotUtils.createProject(TRACE_PROJECT_NAME); importCustomParsers(); }
Source:
private List<String> executeSystemTemplateRemoval(List<String> metacardList) throws IngestException, SourceUnavailableException { LOGGER.debug("Preparing to removing the following system form metacards", metacardList); DeleteResponse deleteResponse = catalogFramework.delete(new DeleteRequestImpl(metacardList.toArray(new String[0]))); if (!deleteResponse.getProcessingErrors().isEmpty()) { console.println(ansi().fgBrightRed().a("Error removing system forms").reset()); throw new IngestException("Failed to delete list of system form metacards"); } List<String> deletedMetacardIds = retrieveListMetacardIds(deleteResponse.getDeletedMetacards()); LOGGER.debug("System forms deleted successfully", deletedMetacardIds); return deletedMetacardIds; }

Target:
private List<String> executeSystemTemplateRemoval(List<String> metacardList) throws IngestException, SourceUnavailableException { LOGGER.debug("Preparing to remove the following system form metacards: {}", metacardList); DeleteResponse deleteResponse = catalogFramework.delete(new DeleteRequestImpl(metacardList.toArray(new String[0]))); if (deleteResponse.getProcessingErrors() != null && !deleteResponse.getProcessingErrors().isEmpty()) { for (ProcessingDetails details : deleteResponse.getProcessingErrors()) { if (details.hasException()) { throw new IngestException( "Failed to delete list of system form metacards", details.getException()); } } throw new IngestException("Failed to delete list of system form metacards"); } List<String> deletedMetacardIds = retrieveMetacardIds(deleteResponse.getDeletedMetacards()); LOGGER.debug("System forms deleted successfully {}", deletedMetacardIds); return deletedMetacardIds; }
Source:
private void init() { if (task.isWindowableTask() && windowMs > 0L) { workerTimer.scheduleAtFixedRate(new Runnable() { @Override public void run() { log.trace("Task need window", task.taskName()); state.needWindow(); resume(); } }, windowMs, windowMs, TimeUnit.MILLISECONDS); } if (commitMs > 0L) { workerTimer.scheduleAtFixedRate(new Runnable() { @Override public void run() { log.trace("Task need commit", task.taskName()); state.needCommit(); resume(); } }, commitMs, commitMs, TimeUnit.MILLISECONDS); } final SystemTimerScheduler timerScheduler = task.context().getTimerScheduler(); if (timerScheduler != null) { timerScheduler.registerListener(() -> { state.needScheduler(); }); } }

Target:
private void init() { if (task.isWindowableTask() && windowMs > 0L) { workerTimer.scheduleAtFixedRate(new Runnable() { @Override public void run() { log.trace("Task need window", task.taskName()); state.needWindow(); resume(); } }, windowMs, windowMs, TimeUnit.MILLISECONDS); } if (commitMs > 0L) { workerTimer.scheduleAtFixedRate(new Runnable() { @Override public void run() { log.trace("Task need commit", task.taskName()); state.needCommit(); resume(); } }, commitMs, commitMs, TimeUnit.MILLISECONDS); } final EpochTimeScheduler epochTimeScheduler = task.context().getTimerScheduler(); if (epochTimeScheduler != null) { epochTimeScheduler.registerListener(() -> { state.needScheduler(); }); } }
Source:
public boolean verifyByPolling(long timeout, long period) { try { if (_coolDown != 0) { Thread.sleep(_coolDown); } } catch (InterruptedException e) { LOG.error("cooldown in verifyByPolling interrupted"); } try { long start = System.currentTimeMillis(); boolean success; do { success = verifyState(); if (success) { return true; } TimeUnit.MILLISECONDS.sleep(period); } while ((System.currentTimeMillis() - start) <= timeout); LOG.error("verifier timeout out with timeout {}", timeout); } catch (Exception e) { LOG.error("Exception in verifier", e); } return false; }

Target:
public boolean verifyByPolling(long timeout, long period) { waitTillVerify(); try { long start = System.currentTimeMillis(); boolean success; do { success = verifyState(); if (success) { return true; } TimeUnit.MILLISECONDS.sleep(period); } while ((System.currentTimeMillis() - start) <= timeout); LOG.error("verifier timeout out with timeout {}", timeout); } catch (Exception e) { LOG.error("Exception in verifier", e); } return false; }
Source:
public String getCommandUsage(CommandSender sender) { return "return the current version of this server"; }

Target:
public String getCommandUsage(CommandSender sender) { return "Displays version information about the server"; }
Source:
public String ocr(BufferedImage image) throws IOException { File temp = File.createTempFile("tesseract", ".png"); FileOutputStream fos = new FileOutputStream(temp); ImageIO.write(image, "png", fos); temp.deleteOnExit(); return ocr(temp.getAbsolutePath()); }

Target:
public String ocr(BufferedImage image) throws IOException { String tempFilename = "tesseract." + UUID.randomUUID().toString() + ".png"; File tempFile = new File(getDataDir(), tempFilename); FileOutputStream fos = new FileOutputStream(tempFile); ImageIO.write(image, "png", fos); String result = ocr(tempFile.getAbsolutePath()); tempFile.delete(); return result; }
Source:
private void handleAdd() { IPluginModelBase model = (IPluginModelBase) getPage().getModel(); PluginSelectionDialog dialog = new PluginSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), getAvailablePlugins(model), getExistingImports(model), true); dialog.create(); if (dialog.open() == Window.OK) { Object[] models = dialog.getResult(); IPluginImport[] imports = new IPluginImport[models.length]; try { for (int i = 0; i < models.length; i++) { IPluginModel candidate = (IPluginModel) models[i]; String pluginId = candidate.getPlugin().getId(); IPluginImport importNode = createImport(model.getPluginFactory(), pluginId); String version = VersionUtil.computeInitialPluginVersion(candidate.getPlugin().getVersion()); importNode.setVersion(version); imports[i] = importNode; } addImports(model.getPluginBase(), imports); } catch (CoreException e) { } } }

Target:
private void handleAdd() { IPluginModelBase model = (IPluginModelBase) getPage().getModel(); PluginSelectionDialog dialog = new PluginSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), getAvailablePlugins(model), getAvailablePluginImports(model), true); dialog.create(); if (dialog.open() == Window.OK) { Object[] models = dialog.getResult(); IPluginImport[] imports = new IPluginImport[models.length]; try { for (int i = 0; i < models.length; i++) { IPluginModel candidate = (IPluginModel) models[i]; String pluginId = candidate.getPlugin().getId(); IPluginImport importNode = createImport(model.getPluginFactory(), pluginId); String version = VersionUtil.computeInitialPluginVersion(candidate.getPlugin().getVersion()); importNode.setVersion(version); imports[i] = importNode; } addImports(model.getPluginBase(), imports); } catch (CoreException e) { } } }
Source:
public com.sequenceiq.cloudbreak.cloud.model.Image convert(ImageEntity source) { com.sequenceiq.cloudbreak.cloud.model.Image image = new com.sequenceiq.cloudbreak.cloud.model.Image(source.getImageName(), Map.of(InstanceGroupType.GATEWAY, Optional.ofNullable(source.getUserdata()).orElse("")), source.getOs(), source.getOsType(), source.getImageCatalogUrl(), source.getImageCatalogName(), source.getImageId(), Collections.emptyMap()); return image; }

Target:
public Image convert(ImageEntity source) { Image image = new Image(source.getImageName(), Map.of(InstanceGroupType.GATEWAY, Optional.ofNullable(source.getUserdata()).orElse("")), source.getOs(), source.getOsType(), source.getImageCatalogUrl(), source.getImageCatalogName(), source.getImageId(), Collections.emptyMap()); return image; }
Source:
public Optional tileentityinventory$getTileEntity() { return Optional.of(this); }

Target:
public Optional<? extends TileEntityCarrier> tileentityinventory$getTileEntity() { return Optional.of(this); }
Source:
protected void appendToTablePopupMenu(IMenuManager manager, IStructuredSelection sel) { final ISegment segment = (ISegment) sel.getFirstElement(); if (segment != null) { IAction gotoStartTime = new Action(Messages.SegmentStoreTableViewer_goToStartEvent) { @Override public void run() { broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, TmfTimestamp.fromNanos(segment.getStart()), TmfTimestamp.fromNanos(segment.getStart()), fTrace)); } }; IAction gotoEndTime = new Action(Messages.SegmentStoreTableViewer_goToEndEvent) { @Override public void run() { broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, TmfTimestamp.fromNanos(segment.getEnd()), TmfTimestamp.fromNanos(segment.getEnd()), fTrace)); } }; IAction openCallsiteAction = new Action("Lookup source") { @Override public void run() { TableViewer table = getTableViewer(); ISelection items = table.getSelection(); if(items.isEmpty() || !(items instanceof StructuredSelection)) { return; } StructuredSelection sItems = ((StructuredSelection)items); final Object data = sItems.getFirstElement(); if (data instanceof ITmfSourceLookup) { TmfSourceLookupAction.lookupCallsite((ITmfSourceLookup) data); } } }; manager.add(gotoStartTime); manager.add(gotoEndTime); if(segment instanceof ITmfSourceLookup) { manager.add(openCallsiteAction); } } }

Target:
protected void appendToTablePopupMenu(IMenuManager manager, IStructuredSelection sel) { final ISegment segment = (ISegment) sel.getFirstElement(); if (segment != null) { IAction gotoStartTime = new Action(Messages.SegmentStoreTableViewer_goToStartEvent) { @Override public void run() { broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, TmfTimestamp.fromNanos(segment.getStart()), TmfTimestamp.fromNanos(segment.getStart()), fTrace)); } }; IAction gotoEndTime = new Action(Messages.SegmentStoreTableViewer_goToEndEvent) { @Override public void run() { broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, TmfTimestamp.fromNanos(segment.getEnd()), TmfTimestamp.fromNanos(segment.getEnd()), fTrace)); } }; IContributionItem openCallsiteAction = OpenSourceCodeAction.create("Lookup source", getTableViewer()); manager.add(gotoStartTime); manager.add(gotoEndTime); if (openCallsiteAction != null) { manager.add(openCallsiteAction); } } }
Source:
public void testUnknownStatistic() throws Throwable { assertStatisticUnknown(stats, "anything"); assertStatisticUntracked(stats, "anything"); assertThatThrownBy(() -> assertStatisticTracked(stats, "anything")); assertThatThrownBy(() -> assertStatisticHasValue(stats, "anything", 0)); }

Target:
public void testUnknownStatistic() throws Throwable { assertStatisticIsUnknown(stats, "anything"); assertStatisticIsUntracked(stats, "anything"); }
Source:
private String readClasspathResource(String c) throws IOException { InputStream is = getClass().getResourceAsStream(c); try { return Util.read(is); } finally { if (is != null) { is.close(); } } }

Target:
private String readClasspathResource(String c) throws IOException { InputStream is = getClass().getResourceAsStream(c); return Util.read(is); }
Source:
private static boolean isBuildPlanFinished(final NodeTemplateInstance nodeTemplateInstance) { if (nodeTemplateInstance != null) { final PlanInstance buildPlan = nodeTemplateInstance.getServiceTemplateInstance().getPlanInstances().stream() .filter((plan) -> plan.getType().equals(PlanType.BUILD)).findFirst().orElse(null); return buildPlan != null && buildPlan.getState().equals(PlanInstanceState.FINISHED); } else { return false; } }

Target:
private static boolean isBuildPlanFinished(final NodeTemplateInstance nodeTemplateInstance) { if (Objects.isNull(nodeTemplateInstance)) { return false; } final PlanInstance buildPlan = nodeTemplateInstance.getServiceTemplateInstance().getPlanInstances().stream() .filter((plan) -> plan.getType().equals(PlanType.BUILD)).findFirst().orElse(null); return Objects.nonNull(buildPlan) && buildPlan.getState().equals(PlanInstanceState.FINISHED); }
Source:
public int writeSubscriptionBatch(final OutputStream os, final SubscriptionCursor cursor, final List<ConsumedEvent> events, final Optional<String> metadata) throws IOException { int byteCount = B_FIXED_BYTE_COUNT_SUBSCRIPTION; os.write(B_CURSOR_PARTITION_BEGIN); final byte[] partition = cursor.getPartition().getBytes(StandardCharsets.UTF_8); os.write(partition); byteCount += partition.length; os.write(B_OFFSET_BEGIN); final byte[] offset = cursor.getOffset().getBytes(StandardCharsets.UTF_8); os.write(offset); byteCount += offset.length; os.write(B_EVENT_TYPE_BEGIN); final byte[] eventType = cursor.getEventType().getBytes(StandardCharsets.UTF_8); os.write(eventType); byteCount += eventType.length; os.write(B_CURSOR_TOKEN_BEGIN); final byte[] cursorToken = cursor.getCursorToken().getBytes(StandardCharsets.UTF_8); os.write(cursorToken); byteCount += cursorToken.length; os.write(B_CURSOR_PARTITION_END); if (!events.isEmpty()) { os.write(B_EVENTS_ARRAY_BEGIN); for (int i = 0; i < events.size(); i++) { final byte[] event = events.get(i).getEvent().getBytes(StandardCharsets.UTF_8); os.write(event); byteCount += event.length; if (i < (events.size() - 1)) { os.write(B_COMMA_DELIM); } else { os.write(B_CLOSE_BRACKET); } } } if (metadata.isPresent()) { os.write(B_DEBUG_BEGIN); byteCount += B_DEBUG_BEGIN.length; final byte[] debug = metadata.get().getBytes(StandardCharsets.UTF_8); os.write(debug); byteCount += debug.length; os.write(B_DEBUG_END); byteCount += B_DEBUG_END.length; } os.write(B_CLOSE_CURLY_BRACKET); os.write(B_BATCH_SEPARATOR); return byteCount; }

Target:
public int writeSubscriptionBatch(final OutputStream os, final SubscriptionCursor cursor, final List<ConsumedEvent> events, final Optional<String> metadata) throws IOException { int byteCount = B_FIXED_BYTE_COUNT_SUBSCRIPTION; os.write(B_CURSOR_PARTITION_BEGIN); final byte[] partition = cursor.getPartition().getBytes(UTF_8); os.write(partition); byteCount += partition.length; os.write(B_OFFSET_BEGIN); final byte[] offset = cursor.getOffset().getBytes(UTF_8); os.write(offset); byteCount += offset.length; os.write(B_EVENT_TYPE_BEGIN); final byte[] eventType = cursor.getEventType().getBytes(UTF_8); os.write(eventType); byteCount += eventType.length; os.write(B_CURSOR_TOKEN_BEGIN); final byte[] cursorToken = cursor.getCursorToken().getBytes(UTF_8); os.write(cursorToken); byteCount += cursorToken.length; os.write(B_CURSOR_PARTITION_END); if (!events.isEmpty()) { os.write(B_EVENTS_ARRAY_BEGIN); for (int i = 0; i < events.size(); i++) { final byte[] event = events.get(i).getEvent(); os.write(event); byteCount += event.length; if (i < (events.size() - 1)) { os.write(B_COMMA_DELIM); } else { os.write(B_CLOSE_BRACKET); } } } if (metadata.isPresent()) { os.write(B_DEBUG_BEGIN); byteCount += B_DEBUG_BEGIN.length; final byte[] debug = metadata.get().getBytes(UTF_8); os.write(debug); byteCount += debug.length; os.write(B_DEBUG_END); byteCount += B_DEBUG_END.length; } os.write(B_CLOSE_CURLY_BRACKET); os.write(B_BATCH_SEPARATOR); os.flush(); return byteCount; }
Source:
public static StatusFactory statusFactory() { return new StatusFactory(PLUGIN_ID); }

Target:
public static StatusFactory statusFactory() { return getDefault().getStatusFactory(); }
Source:
void parseHeaders(final RevWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException { ObjectId sha1 = this.toObjectId(); byte[] raw = commitCache.get(sha1); if (raw == null) { raw = walk.getCachedBytes(this); commitCache.put(sha1, raw); } parseCanonical(walk, raw); }

Target:
void parseHeaders(final RevWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException { byte[] raw; synchronized (commitCache) { raw = commitCache.get(this); } if (raw == null) { raw = walk.getCachedBytes(this); ObjectId sha1 = this.toObjectId(); synchronized (commitCache) { commitCache.put(sha1, raw); } } parseCanonical(walk, raw); }
Source:
private void handleInconsistent() { log.warn("Could not freeze VM guest filesystems, resuming with inconsistent snapshot."); addCustomValue("SnapshotName", getSnapshotName()); addCustomValue("VmName", getVmName()); auditLogDirector.log(this, AuditLogType.FAILED_TO_FREEZE_VM); }

Target:
private void handleInconsistent() { log.warn("Could not freeze VM guest filesystems, proceeding with an inconsistent snapshot."); addCustomValue("SnapshotName", getSnapshotName()); addCustomValue("VmName", getVmName()); auditLogDirector.log(this, AuditLogType.FAILED_TO_FREEZE_VM); }
Source:
public Field getField(Class<?> clazz, String fieldName) throws IllegalStateException { Map<String, Field> stringFieldMap = classFields.get(clazz); if(stringFieldMap==null){ stringFieldMap = new HashMap<>(); classFields.put(clazz, stringFieldMap); } Field field = stringFieldMap.get(fieldName); if(field!=null){ return field; }else { DynamicEntityDao dynamicEntityDao = getPersistenceManager(clazz).getDynamicEntityDao(); SessionFactory sessionFactory = dynamicEntityDao.getDynamicDaoHelper(). getSessionFactory((HibernateEntityManager) dynamicEntityDao.getStandardEntityManager()); BLCFieldUtils fieldUtils = new BLCFieldUtils(sessionFactory, true, dynamicEntityDao.useCache(), dynamicEntityDao.getEjb3ConfigurationDao(), entityConfiguration, dynamicEntityDao.getDynamicDaoHelper()); Field fld = fieldUtils.getField(clazz, fieldName); stringFieldMap.put(fieldName, fld); return fld; } }

Target:
public Field getField(Class<?> clazz, String fieldName) throws IllegalStateException { DynamicEntityDao dynamicEntityDao = getPersistenceManager(clazz).getDynamicEntityDao(); SessionFactory sessionFactory = dynamicEntityDao.getDynamicDaoHelper(). getSessionFactory((HibernateEntityManager) dynamicEntityDao.getStandardEntityManager()); if(fieldUtils==null) { fieldUtils = new BLCFieldUtils(sessionFactory, true, dynamicEntityDao.useCache(), dynamicEntityDao.getEjb3ConfigurationDao(), entityConfiguration, dynamicEntityDao.getDynamicDaoHelper()); } Field fld = fieldUtils.getField(clazz, fieldName); return fld; }
Source:
Grid createRow(final HostVLan hostVLan) { Grid row = new Grid(1, 4); row.getColumnFormatter().setWidth(0, VLanPanel.CHECK_BOX_COLUMN_WIDTH); row.getColumnFormatter().setWidth(1, VLanPanel.NETWORK_NAME_COLUMN_WIDTH); row.getColumnFormatter().setWidth(2, VLanPanel.OUT_OF_SYNC_WIDTH); row.getColumnFormatter().setWidth(3, VLanPanel.ADDRESS_COLUMN_WIDTH); row.setWidth("100%"); row.setHeight("100%"); Style gridStyle = row.getElement().getStyle(); gridStyle.setBorderColor("white"); gridStyle.setBorderWidth(1, Unit.PX); gridStyle.setBorderStyle(BorderStyle.SOLID); HorizontalPanel chekboxPanel = new HorizontalPanel(); chekboxPanel.setWidth("100%"); if (isSelectionAvailable) { chekboxPanel.add(getCheckBox()); } chekboxPanel.add(new Image(ClientGinjectorProvider.getApplicationResources().splitRotateImage())); chekboxPanel.add(new Label(new HostVLanNameRenderer().render(hostVLan))); row.setWidget(0, 0, chekboxPanel); Label networkName = new Label(hostVLan.getNetworkName()); if (hostVLan.getInterface().getIsManagement()) { networkName.getElement().getStyle().setFontWeight(FontWeight.BOLD); networkName.setText("* " + hostVLan.getNetworkName()); } row.setWidget(0, 1, networkName); row.setWidget(0, 2, getSyncPanel(hostVLan.getInterface().getNetworkImplementationDetails().isInSync())); row.setWidget(0, 3, new Label(hostVLan.getAddress())); return row; }

Target:
Grid createRow(final HostVLan hostVLan) { HorizontalPanel checkboxPanel = new HorizontalPanel(); checkboxPanel.setWidth("100%"); if (isSelectionAvailable) { checkboxPanel.add(getCheckBox()); } checkboxPanel.add(new Image(resources.splitRotateImage())); checkboxPanel.add(new Label(new HostVLanNameRenderer().render(hostVLan))); Grid row = createVlanRowColumn(checkboxPanel, hostVLan.getInterface().getIsManagement(), hostVLan.getNetworkName(), createSyncPanel(hostVLan.getInterface().getNetworkImplementationDetails().isInSync()), new Label(hostVLan.getAddress())); Style gridStyle = row.getElement().getStyle(); gridStyle.setBorderColor("white"); gridStyle.setBorderWidth(1, Unit.PX); gridStyle.setBorderStyle(BorderStyle.SOLID); return row; }
Source:
public boolean allowAutostitching() { return ((DefaultMetadataOptions) getMetadataOptions()).getBoolean( ALLOW_AUTOSTITCHING_KEY, ALLOW_AUTOSTITCHING_DEFAULT); }

Target:
public boolean allowAutostitching() { MetadataOptions options = getMetadataOptions(); if (options instanceof DynamicMetadataOptions) { return ((DynamicMetadataOptions) options).getBoolean( ALLOW_AUTOSTITCHING_KEY, ALLOW_AUTOSTITCHING_DEFAULT); } return ALLOW_AUTOSTITCHING_DEFAULT; }