auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<IProject> importToWorkspace(IProgressMonitor monitor) throws CoreException, InterruptedException { MavenPluginActivator mavenPlugin = MavenPluginActivator.getDefault(); IProjectConfigurationManager configurationManager = mavenPlugin.getProjectConfigurationManager(); MavenModelManager modelManager = mavenPlugin.getMavenModelManager(); Set<MavenProjectInfo> projectInfos = getMavenProjects(getProjectDirectory(), filters, modelManager, monitor); ProjectImportConfiguration projectImportConfiguration = new ProjectImportConfiguration(); if (overwriteMavenProjects(projectInfos, projectImportConfiguration, monitor)) { List<IMavenProjectImportResult> importResults = configurationManager.importProjects(projectInfos, projectImportConfiguration, monitor); return validate(toProjects(importResults)); } else { return Collections.EMPTY_LIST; } }

Target:
public List<IProject> importToWorkspace(IProgressMonitor monitor) throws CoreException, InterruptedException { MavenPluginActivator mavenPlugin = MavenPluginActivator.getDefault(); IProjectConfigurationManager configurationManager = mavenPlugin.getProjectConfigurationManager(); MavenModelManager modelManager = mavenPlugin.getMavenModelManager(); Set<MavenProjectInfo> projectInfos = getMavenProjects(getProjectDirectory(), filters, modelManager, monitor); ProjectImportConfiguration projectImportConfiguration = new ProjectImportConfiguration(); if (overwriteMavenProjects(projectInfos, projectImportConfiguration, monitor)) { List<IMavenProjectImportResult> importResults = configurationManager.importProjects(projectInfos, projectImportConfiguration, monitor); return validate(toProjects(importResults)); } else { return Collections.emptyList(); } }
Source:
public static Integer compareOncogenicity(Oncogenicity o1, Oncogenicity o2, Boolean asc) { if (o1 == null) { if (o2 == null) return 0; return 1; } if (o2 == null) return -1; return (PRIORITIZED_ONCOGENICITY.indexOf(o2) - PRIORITIZED_ONCOGENICITY.indexOf(o1)) * (asc ? 1 : -1); }

Target:
public static Integer compareOncogenicity(Oncogenicity o1, Oncogenicity o2, Boolean asc) { if (asc == null) { asc = true; } if (o1 == null) { if (o2 == null) return 0; return asc ? 1 : -1; } if (o2 == null) return asc ? -1 : 1; return (PRIORITIZED_ONCOGENICITY.indexOf(o2) - PRIORITIZED_ONCOGENICITY.indexOf(o1)) * (asc ? 1 : -1); }
Source:
public void testReplaceVariableWithTTLFirstCancelThenScheduleRestart() { EasyMock.expect(worker.herder()).andReturn(herder); EasyMock.expect(herder.restartConnector(eq(1L), eq(MY_CONNECTOR), anyObject())).andReturn(requestId); EasyMock.expect(worker.herder()).andReturn(herder); EasyMock.expectLastCall(); requestId.cancel(); EasyMock.expectLastCall(); EasyMock.expect(herder.restartConnector(eq(10L), eq(MY_CONNECTOR), anyObject())).andReturn(requestId); replayAll(); Map<String, String> result = configTransformer.transform(MY_CONNECTOR, Collections.singletonMap(MY_KEY, "${test:testPath:testKeyWithTTL}")); assertEquals(TEST_RESULT_WITH_TTL, result.get(MY_KEY)); result = configTransformer.transform(MY_CONNECTOR, Collections.singletonMap(MY_KEY, "${test:testPath:testKeyWithLongerTTL}")); assertEquals(TEST_RESULT_WITH_LONGER_TTL, result.get(MY_KEY)); }

Target:
public void testReplaceVariableWithTTLFirstCancelThenScheduleRestart() { EasyMock.expect(worker.herder()).andReturn(herder); EasyMock.expect(herder.restartConnector(eq(1L), eq(MY_CONNECTOR), notNull())).andReturn(requestId); EasyMock.expect(worker.herder()).andReturn(herder); EasyMock.expectLastCall(); requestId.cancel(); EasyMock.expectLastCall(); EasyMock.expect(herder.restartConnector(eq(10L), eq(MY_CONNECTOR), notNull())).andReturn(requestId); replayAll(); Map<String, String> result = configTransformer.transform(MY_CONNECTOR, Collections.singletonMap(MY_KEY, "${test:testPath:testKeyWithTTL}")); assertEquals(TEST_RESULT_WITH_TTL, result.get(MY_KEY)); result = configTransformer.transform(MY_CONNECTOR, Collections.singletonMap(MY_KEY, "${test:testPath:testKeyWithLongerTTL}")); assertEquals(TEST_RESULT_WITH_LONGER_TTL, result.get(MY_KEY)); }
Source:
private boolean isDuplicate(ChangeMessage msg) { try { ChangeMessage last = Iterables.getLast(db.changeMessages().byChange( msg.getPatchSetId().getParentKey()), null); if (last != null) { long lastMs = last.getWrittenOn().getTime(); long msgMs = msg.getWrittenOn().getTime(); if (last.getAuthor() == null && Objects.equal(last.getMessage(), msg.getMessage()) && msgMs - lastMs > DUPLICATE_MESSAGE_INTERVAL) { return true; } } } catch (OrmException err) { log.warn("Cannot check previous merge failure message", err); } return false; }

Target:
private boolean isDuplicate(ChangeMessage msg) { try { ChangeMessage last = Iterables.getLast(db.changeMessages().byChange( msg.getPatchSetId().getParentKey()), null); if (last != null) { long lastMs = last.getWrittenOn().getTime(); long msgMs = msg.getWrittenOn().getTime(); if (last.getAuthor() == null && Objects.equal(last.getMessage(), msg.getMessage()) && msgMs - lastMs < DUPLICATE_MESSAGE_INTERVAL) { return true; } } } catch (OrmException err) { log.warn("Cannot check previous merge failure message", err); } return false; }
Source:
public void registerFunction( @Nonnull final String name, @Nonnull final String description, @Nonnull final String outputType, @Nonnull final Boolean isMultiValued, @Nonnull final FunctionLanguage lang) throws CatalogException { Objects.requireNonNull(name, "function name"); Objects.requireNonNull(description, "function definition"); Objects.requireNonNull(outputType, "function output schema"); Objects.requireNonNull(isMultiValued, "is function a flatmap"); Objects.requireNonNull(lang, "function language"); if (isClosed) { throw new CatalogException("Catalog is closed."); } try { queue .execute( new SQLiteJob<Void>() { @Override protected Void job(final SQLiteConnection sqliteConnection) throws CatalogException, SQLiteException, IOException { try { SQLiteStatement statement = sqliteConnection.prepare( "INSERT OR REPLACE INTO registered_functions (function_name, function_description, function_outputType, function_isMultiValued, function_lang) VALUES (?,?,?,?,?);"); statement.bind(1, name); statement.bind(2, description); statement.bind(3, outputType); statement.bind(4, ((isMultiValued == true) ? 1 : 0)); statement.bind(5, lang.ordinal()); statement.stepThrough(); statement.dispose(); statement = null; } catch (final SQLiteException e) { throw new CatalogException(e); } return null; } }) .get(); } catch (InterruptedException | ExecutionException e) { throw new CatalogException(e); } }

Target:
public void registerFunction( @Nonnull final String name, @Nonnull final String description, @Nonnull final String outputType, @Nonnull final Boolean isMultiValued, @Nonnull final FunctionLanguage lang) throws CatalogException { Objects.requireNonNull(name, "function name"); Objects.requireNonNull(description, "function definition"); Objects.requireNonNull(outputType, "function output type"); Objects.requireNonNull(isMultiValued, "is function a flatmap"); Objects.requireNonNull(lang, "function language"); if (isClosed) { throw new CatalogException("Catalog is closed."); } try { queue .execute( new SQLiteJob<Void>() { @Override protected Void job(final SQLiteConnection sqliteConnection) throws CatalogException, SQLiteException, IOException { try { SQLiteStatement statement = sqliteConnection.prepare( "INSERT OR REPLACE INTO registered_functions (function_name, function_description, function_outputType, function_isMultiValued, function_lang) VALUES (?,?,?,?,?);"); statement.bind(1, name); statement.bind(2, description); statement.bind(3, outputType); statement.bind(4, ((isMultiValued == true) ? 1 : 0)); statement.bind(5, lang.ordinal()); statement.stepThrough(); statement.dispose(); statement = null; } catch (final SQLiteException e) { throw new CatalogException(e); } return null; } }) .get(); } catch (InterruptedException | ExecutionException e) { throw new CatalogException(e); } }
Source:
public OzoneAcl(ACLIdentityType type, String name, ACLType acl) { this.name = name; this.aclBitSet = new BitSet(ACLType.values().length); aclBitSet.set(acl.ordinal(), true); this.type = type; if (type == ACLIdentityType.WORLD && name.length() != 0) { throw new IllegalArgumentException("Unexpected name part in world type"); } if (((type == ACLIdentityType.USER) || (type == ACLIdentityType.GROUP)) && (name.length() == 0)) { throw new IllegalArgumentException("User or group name is required"); } }

Target:
public OzoneAcl(ACLIdentityType type, String name, ACLType acl) { this.name = name; this.aclBitSet = new BitSet(ACLType.getNoOfAcls()); aclBitSet.set(acl.ordinal(), true); this.type = type; if (type == ACLIdentityType.WORLD && name.length() != 0) { throw new IllegalArgumentException("Unexpected name part in world type"); } if (((type == ACLIdentityType.USER) || (type == ACLIdentityType.GROUP)) && (name.length() == 0)) { throw new IllegalArgumentException("User or group name is required"); } }
Source:
public void tick(MinecraftServer minecraftServer) { electricNetworks.addAll(pendingNetworks); pendingNetworks.clear(); electricNetworks.removeIf(network -> { network.tick(); if (network.isEmpty()) { TechReborn.LOGGER.debug("Electric Network is empty, removed", network); } return network.isEmpty(); }); }

Target:
public void tick(MinecraftServer minecraftServer) { electricNetworks.removeIf(network -> { network.tick(); if (network.isEmpty()) { TechReborn.LOGGER.debug("Electric Network is empty, removed", network); } return network.isEmpty(); }); }
Source:
public AuthenticationResult authenticate(HttpServletRequest request) { HttpSession session; AuthenticationResult authResult = null; try { session = request.getSession(); if (session != null) { if (session.isNew()) { session.setMaxInactiveInterval(MAX_SESSION_INACTIVITY_SECONDS); } authResult = (AuthenticationResult )session.getAttribute(AUTH_USER_SESSION_KEY); } } catch (Exception ex) { session = null; m_rate_limited_log.log(EstTime.currentTimeMillis(), Level.ERROR, ex, "failed to get or create HTTP Session. authenticating user explicitely."); } if (authResult == null) { authResult = getAuthenticationResult(request); if (!authResult.isAuthenticated()) { if (session != null) { session.removeAttribute(AUTH_USER_SESSION_KEY); } m_rate_limited_log.log("JSON interface exception: " + authResult.m_message, EstTime.currentTimeMillis()); } else { if (session != null) { session.setAttribute(AUTH_USER_SESSION_KEY, authResult); } } } return authResult; }

Target:
public AuthenticationResult authenticate(HttpServletRequest request) { HttpSession session = null; AuthenticationResult authResult = null; if (!HTTP_DONT_USE_SESSION) { try { session = request.getSession(); if (session != null) { if (session.isNew()) { session.setMaxInactiveInterval(MAX_SESSION_INACTIVITY_SECONDS); } authResult = (AuthenticationResult )session.getAttribute(AUTH_USER_SESSION_KEY); } } catch (Exception ex) { session = null; m_rate_limited_log.log(EstTime.currentTimeMillis(), Level.ERROR, ex, "Failed to get or create HTTP Session. authenticating user explicitely."); } } if (authResult == null) { authResult = getAuthenticationResult(request); if (!authResult.isAuthenticated()) { if (session != null) { session.removeAttribute(AUTH_USER_SESSION_KEY); } m_rate_limited_log.log("JSON interface exception: " + authResult.m_message, EstTime.currentTimeMillis()); } else { if (session != null) { session.setAttribute(AUTH_USER_SESSION_KEY, authResult); } } } return authResult; }
Source:
public static IPath getXmlFilesPath() { IPath path = Activator.getDefault().getStateLocation(); path = path.addTrailingSeparator().append(XML_DIRECTORY); File dir = path.toFile(); if (!dir.exists() || !dir.isDirectory()) { dir.mkdirs(); } dir.deleteOnExit(); return path; }

Target:
public static IPath getXmlFilesPath() { IPath path = Activator.getDefault().getStateLocation(); path = path.addTrailingSeparator().append(XML_DIRECTORY); File dir = path.toFile(); if (!dir.exists() || !dir.isDirectory()) { dir.mkdirs(); } return path; }
Source:
public void smokes() throws Exception { AtomicReference<Proc> proc = new AtomicReference<>(); try { JNLPLauncher launcher = new JNLPLauncher(true); launcher.setWebSocket(true); DumbSlave s = new DumbSlave("remote", tmp.newFolder("agent").getAbsolutePath(), launcher); r.jenkins.addNode(s); String secret = ((SlaveComputer) s.toComputer()).getJnlpMac(); File slaveJar = tmp.newFile(); FileUtils.copyURLToFile(new Slave.JnlpJar("slave.jar").getURL(), slaveJar); proc.set(r.createLocalLauncher().launch().cmds( JavaEnvUtils.getJreExecutable("java"), "-jar", slaveJar.getAbsolutePath(), "-jnlpUrl", r.getURL() + "computer/remote/slave-agent.jnlp", "-secret", secret ).stdout(System.out).start()); r.waitOnline(s); assertEquals("response", s.getChannel().call(new DummyTask())); assertNotNull(s.getChannel().call(new FatTask())); FreeStyleProject p = r.createFreeStyleProject(); p.setAssignedNode(s); p.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo hello") : new Shell("dd if=/dev/random of=file.txt count=1024 bs=200;cat file.txt")); r.buildAndAssertSuccess(p); s.toComputer().getLogText().writeLogTo(0, System.out); } finally { if (proc.get() != null) { proc.get().kill(); while (r.jenkins.getComputer("remote").isOnline()) { LOGGER.info("waiting for computer to go offline"); Thread.sleep(250); } } } }

Target:
public void smokes() throws Exception { AtomicReference<Proc> proc = new AtomicReference<>(); try { JNLPLauncher launcher = new JNLPLauncher(true); launcher.setWebSocket(true); DumbSlave s = new DumbSlave("remote", tmp.newFolder("agent").getAbsolutePath(), launcher); r.jenkins.addNode(s); String secret = ((SlaveComputer) s.toComputer()).getJnlpMac(); File slaveJar = tmp.newFile(); FileUtils.copyURLToFile(new Slave.JnlpJar("slave.jar").getURL(), slaveJar); proc.set(r.createLocalLauncher().launch().cmds( JavaEnvUtils.getJreExecutable("java"), "-jar", slaveJar.getAbsolutePath(), "-jnlpUrl", r.getURL() + "computer/remote/slave-agent.jnlp", "-secret", secret ).stdout(System.out).start()); r.waitOnline(s); assertEquals("response", s.getChannel().call(new DummyTask())); assertNotNull(s.getChannel().call(new FatTask())); FreeStyleProject p = r.createFreeStyleProject(); p.setAssignedNode(s); p.getBuildersList().add(Functions.isWindows() ? new BatchFile("echo hello") : new Shell("dd if=/dev/random count=1024 bs=200")); r.buildAndAssertSuccess(p); s.toComputer().getLogText().writeLogTo(0, System.out); } finally { if (proc.get() != null) { proc.get().kill(); while (r.jenkins.getComputer("remote").isOnline()) { LOGGER.info("waiting for computer to go offline"); Thread.sleep(250); } } } }
Source:
void merge(List<InputFile> inputFiles, final long maxRowGroupSize, ParquetFileWriter writer) throws IOException { SizeEstimator estimator = new SizeEstimator(compressor.getCodecName() != CompressionCodecName.UNCOMPRESSED); MutableMergedBlock mergedBlock = null; for (InputFile file : inputFiles) { try (ParquetFileReader reader = ParquetFileReader.open(file)) { for (BlockMetaData blockMeta : reader.getRowGroups()) { PageReadStore group = reader.readNextRowGroup(); Preconditions.checkState(group != null, "number of groups returned by FileReader does not match metadata"); if (mergedBlock != null && mergedBlock.getCompressedBytesSize() + estimator.estimate(blockMeta) > maxRowGroupSize) { saveBlockTo(mergedBlock, writer); mergedBlock = null; } if (mergedBlock == null && estimator.estimate(blockMeta) > maxRowGroupSize) { saveBlockTo(ReadOnlyMergedBlock.of(blockMeta, group, schema, compressor), writer); continue; } if (mergedBlock == null) { mergedBlock = new MutableMergedBlock(schema); } long sizeBeforeMerge = mergedBlock.getCompressedBytesSize(); mergedBlock.merge(blockMeta, group); long currentBlockEffect = mergedBlock.getCompressedBytesSize() - sizeBeforeMerge; estimator.update(currentBlockEffect, blockMeta); } } } if (mergedBlock != null) saveBlockTo(mergedBlock, writer); }

Target:
void merge(List<InputFile> inputFiles, final long maxRowGroupSize, ParquetFileWriter writer) throws IOException { SizeEstimator estimator = new SizeEstimator(compressor.getCodecName() != CompressionCodecName.UNCOMPRESSED); MutableMergedBlock mergedBlock = null; for (InputFile file : inputFiles) { try (ParquetFileReader reader = ParquetFileReader.open(file)) { for (BlockMetaData blockMeta : reader.getRowGroups()) { PageReadStore group = reader.readNextRowGroup(); Preconditions.checkState(group != null, "number of groups returned by FileReader does not match metadata"); if (mergedBlock != null && mergedBlock.getCompressedSize() + estimator.estimate(blockMeta) > maxRowGroupSize) { saveBlockTo(mergedBlock, writer); mergedBlock = null; } if (mergedBlock == null && estimator.estimate(blockMeta) > maxRowGroupSize) { saveBlockTo(ReadOnlyMergedBlock.of(blockMeta, group, schema, compressor), writer); continue; } if (mergedBlock == null) { mergedBlock = new MutableMergedBlock(schema); } long sizeBeforeMerge = mergedBlock.getCompressedSize(); mergedBlock.merge(blockMeta, group); long currentBlockEffect = mergedBlock.getCompressedSize() - sizeBeforeMerge; estimator.update(currentBlockEffect, blockMeta); } } } if (mergedBlock != null) saveBlockTo(mergedBlock, writer); }
Source:
AuroraHeronShellController( String jobName, String cluster, String role, String env, String auroraFilename, boolean isVerbose) { this.topologyName = jobName; this.cliController = new AuroraCLIController( jobName, cluster, role, env, auroraFilename, isVerbose); stateMgrAdaptor = null; Config config = Config.toClusterMode(Config.newBuilder().putAll(ConfigLoader.loadClusterConfig()).build()); String stateMgrClass = Context.stateManagerClass(config); IStateManager stateMgr = null; try { stateMgr = ReflectionUtils.newInstance(stateMgrClass); stateMgr.initialize(config); stateMgrAdaptor = new SchedulerStateManagerAdaptor(stateMgr, 5000); } catch (ClassNotFoundException e) { LOG.severe(e.getMessage()); } catch (InstantiationException e) { LOG.severe(e.getMessage()); } catch (IllegalAccessException e) { LOG.severe(e.getMessage()); } }

Target:
AuroraHeronShellController(String jobName, String cluster, String role, String env, String auroraFilename, boolean isVerbose) throws ClassNotFoundException, InstantiationException, IllegalAccessException { this.topologyName = jobName; this.cliController = new AuroraCLIController(jobName, cluster, role, env, auroraFilename, isVerbose); Config config = Config.toClusterMode(Config.newBuilder().putAll(ConfigLoader.loadClusterConfig()).build()); String stateMgrClass = Context.stateManagerClass(config); IStateManager stateMgr = ReflectionUtils.newInstance(stateMgrClass); stateMgr.initialize(config); stateMgrAdaptor = new SchedulerStateManagerAdaptor(stateMgr, 5000); }
Source:
public void testRegister() { ApplicationContext context = mock(ApplicationContext.class); DynamicRepositoryDecoratorRegistry repositoryDecoratorRegistry = mock(DynamicRepositoryDecoratorRegistry.class); DynamicRepositoryDecoratorFactory decoratorFactory1 = mock(DynamicRepositoryDecoratorFactory.class); DynamicRepositoryDecoratorFactory decoratorFactory2 = mock(DynamicRepositoryDecoratorFactory.class); Map<String, DynamicRepositoryDecoratorFactory> map = new HashMap<>(); map.put("decoratorFactory1", decoratorFactory1); map.put("decoratorFactory2", decoratorFactory2); when(context.getBeansOfType(DynamicRepositoryDecoratorFactory.class)).thenReturn(map); DynamicRepositoryDecoratorFactoryRegistrar dynamicRepositoryDecoratorFactoryRegistrar = new DynamicRepositoryDecoratorFactoryRegistrar( repositoryDecoratorRegistry); dynamicRepositoryDecoratorFactoryRegistrar.register(context); verify(repositoryDecoratorRegistry).addFactory(decoratorFactory1); verify(repositoryDecoratorRegistry).addFactory(decoratorFactory2); }

Target:
public void testRegister() { Map<String, DynamicRepositoryDecoratorFactory> map = new HashMap<>(); map.put("decoratorFactory1", decoratorFactory1); map.put("decoratorFactory2", decoratorFactory2); when(context.getBeansOfType(DynamicRepositoryDecoratorFactory.class)).thenReturn(map); DynamicRepositoryDecoratorFactoryRegistrar dynamicRepositoryDecoratorFactoryRegistrar = new DynamicRepositoryDecoratorFactoryRegistrar( repositoryDecoratorRegistry); dynamicRepositoryDecoratorFactoryRegistrar.register(context); verify(repositoryDecoratorRegistry).addFactory(decoratorFactory1); verify(repositoryDecoratorRegistry).addFactory(decoratorFactory2); }
Source:
public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingContentProviderAsCompletable() { final StorIOContentResolver storIOContentResolver = mock(StorIOContentResolver.class); final StorIOContentResolver.LowLevel lowLevel = mock(StorIOContentResolver.LowLevel.class); when(storIOContentResolver.lowLevel()).thenReturn(lowLevel); when(storIOContentResolver.delete()).thenReturn(new PreparedDelete.Builder(storIOContentResolver)); final TestSubscriber<DeleteResult> testSubscriber = new TestSubscriber<DeleteResult>(); storIOContentResolver .delete() .object(TestItem.newInstance()) .prepare() .asRxCompletable() .subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); testSubscriber.assertNoValues(); assertThat(testSubscriber.getOnErrorEvents().get(0)) .isInstanceOf(StorIOException.class) .hasCauseInstanceOf(IllegalStateException.class); verify(storIOContentResolver).delete(); verify(storIOContentResolver).lowLevel(); verify(lowLevel).typeMapping(TestItem.class); verify(lowLevel, never()).delete(any(DeleteQuery.class)); verifyNoMoreInteractions(storIOContentResolver, lowLevel); }

Target:
public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingContentProviderAsCompletable() { final StorIOContentResolver storIOContentResolver = mock(StorIOContentResolver.class); final StorIOContentResolver.LowLevel lowLevel = mock(StorIOContentResolver.LowLevel.class); when(storIOContentResolver.lowLevel()).thenReturn(lowLevel); when(storIOContentResolver.delete()).thenReturn(new PreparedDelete.Builder(storIOContentResolver)); final TestSubscriber<DeleteResult> testSubscriber = new TestSubscriber<DeleteResult>(); storIOContentResolver .delete() .object(TestItem.newInstance()) .prepare() .asRxCompletable() .subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); testSubscriber.assertNoValues(); assertThat(testSubscriber.getOnErrorEvents().get(0)) .isInstanceOf(StorIOException.class) .hasCauseInstanceOf(IllegalStateException.class) .hasMessage("Error has occurred during Delete operation. object = TestItem{data='null'}"); verify(storIOContentResolver).delete(); verify(storIOContentResolver).lowLevel(); verify(lowLevel).typeMapping(TestItem.class); verify(lowLevel, never()).delete(any(DeleteQuery.class)); verifyNoMoreInteractions(storIOContentResolver, lowLevel); }
Source:
public boolean isTrue(State state, String[] params) { if (!params[1].equalsIgnoreCase("")) { ObjectInstance container = state.getObject(params[1]); Set<String> contents = ContainerFactory.getContentNames(container); if (contents.isEmpty()) { return false; } ObjectInstance toPeel = null; for (String name : contents) { toPeel = state.getObject(name); boolean match = false; for (IngredientRecipe content : this.topLevelIngredient.getConstituentIngredients()) { if (content.getName().equals(toPeel.getName())) { if (!content.hasToolAttribute("peeled")) { return false; } match = true; break; } } if (!match) { AbstractMap<String, IngredientRecipe> necessaryTraits = this.topLevelIngredient.getNecessaryTraits(); Set<String> toMeltTraits = IngredientFactory.getTraits(toPeel); for (String trait : necessaryTraits.keySet()) { if (toMeltTraits.contains(trait)) { if (necessaryTraits.get(trait).hasToolAttribute("peeled")) { match = true; break; } } } if (!match) { return false; } } } return true; } else { for (IngredientRecipe content : topLevelIngredient.getConstituentIngredients()) { if (content.hasToolAttribute("peeled")) { return true; } } AbstractMap<String, IngredientRecipe> traitMap = topLevelIngredient.getConstituentNecessaryTraits(); for (String trait : traitMap.keySet()) { if (traitMap.get(trait).hasToolAttribute("peeled")) { return true; } } return false; } }

Target:
public boolean isTrue(State state, String[] params) { if (!params[1].equalsIgnoreCase("")) { ObjectInstance container = state.getObject(params[1]); Set<String> contents = ContainerFactory.getContentNames(container); if (contents.isEmpty()) { return false; } ObjectInstance toPeel = null; for (String name : contents) { toPeel = state.getObject(name); boolean match = false; List<IngredientRecipe> ingredientContents = this.topLevelIngredient.getConstituentIngredients(); for (IngredientRecipe content: ingredientContents) { if (content.getName().equals(toPeel.getName())) { if (!content.hasToolAttribute(PeelAction.PEELED)) { return false; } match = true; break; } } if (!match) { AbstractMap<String, IngredientRecipe> necessaryTraits = this.topLevelIngredient.getNecessaryTraits(); Set<String> toMeltTraits = IngredientFactory.getTraits(toPeel); for (Entry<String, IngredientRecipe> entry : necessaryTraits.entrySet()) { String trait = entry.getKey(); if (toMeltTraits.contains(trait)) { if (entry.getValue().hasToolAttribute(PeelAction.PEELED)) { match = true; break; } } } if (!match) { return false; } } } return true; } else { List<IngredientRecipe> contents = topLevelIngredient.getConstituentIngredients(); for (IngredientRecipe content : contents) { if (content.hasToolAttribute(PeelAction.PEELED)) { return true; } } AbstractMap<String, IngredientRecipe> traitMap = topLevelIngredient.getConstituentNecessaryTraits(); for (IngredientRecipe ing : traitMap.values()) { if (ing.hasToolAttribute(PeelAction.PEELED)) { return true; } } return false; } }
Source:
public boolean[] findOpticalDuplicates(final List<? extends PhysicalLocation> list, final PhysicalLocation keeper) { final int length = list.size(); final boolean[] opticalDuplicateFlags = new boolean[length]; Collections.sort(list, new Comparator<PhysicalLocation>() { public int compare(final PhysicalLocation lhs, final PhysicalLocation rhs) { int retval = lhs.getReadGroup() - rhs.getReadGroup(); if (retval == 0) retval = lhs.getTile() - rhs.getTile(); if (retval == 0) retval = lhs.getX() - rhs.getX(); if (retval == 0) retval = lhs.getY() - rhs.getY(); return retval; } }); outer: for (int i = 0; i < length; ++i) { final PhysicalLocation lhs = list.get(i); if (lhs.getTile() < 0) continue; for (int j = i + 1; j < length; ++j) { final PhysicalLocation rhs = list.get(j); if ((rhs == keeper && opticalDuplicateFlags[i]) || opticalDuplicateFlags[j]) continue; if (lhs.getReadGroup() != rhs.getReadGroup()) continue outer; if (lhs.getTile() != rhs.getTile()) continue outer; if (rhs.getX() > lhs.getX() + this.opticalDuplicatePixelDistance) continue outer; if (Math.abs(lhs.getY() - rhs.getY()) <= this.opticalDuplicatePixelDistance) { if (rhs == keeper) opticalDuplicateFlags[i] = true; else opticalDuplicateFlags[j] = true; } } } return opticalDuplicateFlags; }

Target:
public boolean[] findOpticalDuplicates(final List<? extends PhysicalLocation> list, final PhysicalLocation keeper) { if (list.size() < 2) return new boolean[list.size()]; final int length = list.size(); final boolean[] opticalDuplicateFlags = new boolean[length]; final int distance = this.opticalDuplicatePixelDistance; final PhysicalLocation actualKeeper = keeperOrNull(list, keeper); if (actualKeeper != null) { for (int i=0; i<length; ++i) { final PhysicalLocation other = list.get(i); opticalDuplicateFlags[i] = closeEnough(actualKeeper, other, distance); } } for (int i=0; i<length; ++i) { final PhysicalLocation lhs = list.get(i); if (lhs == actualKeeper) continue; for (int j =i+1; j<length; ++j) { final PhysicalLocation rhs = list.get(j); if (rhs == actualKeeper) continue; if (opticalDuplicateFlags[i] && opticalDuplicateFlags[j]) continue; if (closeEnough(lhs, rhs, distance)) { final int index = opticalDuplicateFlags[j] ? i : j; opticalDuplicateFlags[index] = true; } } } return opticalDuplicateFlags; }
Source:
private Example createExample(JsonNode node) { if (node instanceof ObjectNode) { ObjectExample obj = new ObjectExample(); ObjectNode on = (ObjectNode) node; for (Iterator<Entry<String, JsonNode>> x = on.fields(); x.hasNext(); ) { Entry<String, JsonNode> i = x.next(); String key = i.getKey(); JsonNode value = i.getValue(); obj.put(key, createExample(value)); } return obj; } else if (node instanceof ArrayNode) { ArrayExample arr = new ArrayExample(); ArrayNode an = (ArrayNode) node; for (JsonNode childNode : an) { arr.add(createExample(childNode)); } return arr; } else if (node instanceof DoubleNode) { return new DoubleExample(node.doubleValue()); } else if (node instanceof IntNode || node instanceof ShortNode) { return new IntegerExample(node.intValue()); } else if (node instanceof FloatNode) { return new FloatExample(node.floatValue()); } else if (node instanceof BigIntegerNode) { return new BigIntegerExample(node.bigIntegerValue()); } else if (node instanceof DecimalNode) { return new DecimalExample(node.decimalValue()); } else if (node instanceof LongNode) { return new LongExample(node.longValue()); } else if (node instanceof NullNode) { return new NullExample(); } else if (node instanceof BooleanNode) { return new BooleanExample(node.booleanValue()); } else { return new StringExample(node.asText()); } }

Target:
private Example createExample(JsonNode node) { if (node instanceof ObjectNode) { ObjectExample obj = new ObjectExample(); ObjectNode on = (ObjectNode) node; for (Iterator<Entry<String, JsonNode>> x = on.fields(); x.hasNext(); ) { Entry<String, JsonNode> i = x.next(); String key = i.getKey(); JsonNode value = i.getValue(); obj.put(key, createExample(value)); } return obj; } else if (node instanceof ArrayNode) { ArrayExample arr = new ArrayExample(); ArrayNode an = (ArrayNode) node; for (JsonNode childNode : an) { arr.add(createExample(childNode)); } return arr; } else if (node instanceof DoubleNode) { return new DoubleExample(node.doubleValue()); } else if (node instanceof IntNode || node instanceof ShortNode) { return new IntegerExample(node.intValue()); } else if (node instanceof FloatNode) { return new FloatExample(node.floatValue()); } else if (node instanceof BigIntegerNode) { return new BigIntegerExample(node.bigIntegerValue()); } else if (node instanceof DecimalNode) { return new DecimalExample(node.decimalValue()); } else if (node instanceof LongNode) { return new LongExample(node.longValue()); } else if (node instanceof BooleanNode) { return new BooleanExample(node.booleanValue()); } else { return new StringExample(node.asText()); } }
Source:
public Access(String accessType) { value = accessType; }

Target:
public Access(String accessType) { if (Strings.isNullOrEmpty(accessType) || accessType.equalsIgnoreCase("null")) { value = CONTROLLED; } else { value = accessType; } }
Source:
protected void unfoldModules(JSONObject modules, String[] resultArray) throws IOException, JSONException { final String sourceMethod = "unfoldModules"; if (isTraceLogging) { log.entering(RequestedModuleNames.class.getName(), sourceMethod, new Object[]{modules, Arrays.asList(resultArray)}); } Iterator<?> it = modules.keys(); String[] prefixes = null; if (modules.has(PLUGIN_PREFIXES_PROP_NAME)) { @SuppressWarnings("unchecked") Map<String, String> oPrefixes = (Map<String, String>) modules.get(PLUGIN_PREFIXES_PROP_NAME); prefixes = new String[oPrefixes.size()]; for (String key : oPrefixes.keySet()) { prefixes[Integer.parseInt(oPrefixes.get(key))] = key; } } while (it.hasNext()) { String key = (String) it.next(); if (!NON_PATH_PROP_PATTERN.matcher(key).find()) { unfoldModulesHelper(modules.get(key), key, prefixes, resultArray); } } if (isTraceLogging) { log.exiting(RequestedModuleNames.class.getName(), sourceMethod, Arrays.asList(resultArray)); } }

Target:
protected void unfoldModules(JSONObject modules, String[] resultArray) throws IOException, JSONException { final String sourceMethod = "unfoldModules"; if (isTraceLogging) { log.entering(RequestedModuleNames.class.getName(), sourceMethod, new Object[]{modules, Arrays.asList(resultArray)}); } Iterator<?> it = modules.keys(); String[] prefixes = null; if (modules.containsKey(PLUGIN_PREFIXES_PROP_NAME)) { @SuppressWarnings("unchecked") Map<String, String> oPrefixes = (Map<String, String>) modules.get(PLUGIN_PREFIXES_PROP_NAME); prefixes = new String[oPrefixes.size()]; for (String key : oPrefixes.keySet()) { prefixes[Integer.parseInt(oPrefixes.get(key))] = key; } } while (it.hasNext()) { String key = (String) it.next(); if (!NON_PATH_PROP_PATTERN.matcher(key).find()) { unfoldModulesHelper(modules.get(key), key, prefixes, resultArray); } } if (isTraceLogging) { log.exiting(RequestedModuleNames.class.getName(), sourceMethod, Arrays.asList(resultArray)); } }
Source:
public static By byAttribute(String attributeName, String attributeValue) { return By.cssSelector(String.format("[%s=\"%s\"]", attributeName, attributeValue)); }

Target:
public static By byAttribute(String attributeName, String attributeValue) { return By.cssSelector(String.format("[%s=\"%s\"]", attributeName, attributeValue.replaceAll("\"", "\\\\\""))); }
Source:
public void run(String step, MigrationContext migrationContext) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); state = "after"; }

Target:
public void run(String step, MigrationContext migrationContext) { state = "after"; }
Source:
public DecoratableResourceMapping(ResourceMapping mapping) throws IOException { super(null); this.mapping = mapping; IProject[] projects = mapping.getProjects(); if(projects == null || projects.length == 0) return; Set<String> repoNames = new HashSet<String>(projects.length); String lastBranch = null; String lastBranchStatus = null; for(IProject prj : projects) { RepositoryMapping repoMapping = RepositoryMapping.getMapping(prj); if(repoMapping == null) continue; IndexDiffData diffData = GitLightweightDecorator.getIndexDiffDataOrNull(prj); if(diffData == null) continue; tracked = true; Repository repository = repoMapping.getRepository(); String repoRelative = makeRepoRelative(repository, prj) + "/"; Set<String> modified = diffData.getModified(); Set<String> conflicting = diffData.getConflicting(); if(containsPrefix(modified, repoRelative)) dirty = true; if(containsPrefix(conflicting, repoRelative)) conflicts = true; repoNames.add(DecoratableResourceHelper .getRepositoryName(repository)); lastBranch = DecoratableResourceHelper.getShortBranch(repository); lastBranchStatus = DecoratableResourceHelper .getBranchStatus(repository); } if(repoNames.size() == 1) { repositoryName = repoNames.iterator().next(); branch = lastBranch; branchStatus = lastBranchStatus; } }

Target:
public DecoratableResourceMapping(ResourceMapping mapping) throws IOException { super(null); this.mapping = mapping; IProject[] projects = mapping.getProjects(); if(projects == null || projects.length == 0) return; Set<String> repoNames = new HashSet<String>(projects.length); String discoveredBranch = null; String discoveredBranchStatus = null; for(IProject prj : projects) { RepositoryMapping repoMapping = RepositoryMapping.getMapping(prj); if(repoMapping == null) continue; IndexDiffData diffData = GitLightweightDecorator.getIndexDiffDataOrNull(prj); if(diffData == null) continue; tracked = true; Repository repository = repoMapping.getRepository(); String repoRelative = makeRepoRelative(repository, prj) + "/"; Set<String> modified = diffData.getModified(); Set<String> conflicting = diffData.getConflicting(); if(containsPrefix(modified, repoRelative)) dirty = true; if(containsPrefix(conflicting, repoRelative)) conflicts = true; repoNames.add(DecoratableResourceHelper .getRepositoryName(repository)); if (discoveredBranch == null) { discoveredBranch = DecoratableResourceHelper .getShortBranch(repository); discoveredBranchStatus = DecoratableResourceHelper .getBranchStatus(repository); } } if(repoNames.size() == 1) { repositoryName = repoNames.iterator().next(); branch = discoveredBranch; branchStatus = discoveredBranchStatus; } }
Source:
public static @CheckForNull User get(String idOrFullName, boolean create) { return get(idOrFullName, create, Collections.emptyMap()); }

Target:
public static @Nullable User get(String idOrFullName, boolean create) { return get(idOrFullName, create, Collections.emptyMap()); }
Source:
private Script getScript(byte[] scriptBytes) { Script script = null; try { script = new Script(scriptBytes); } catch (Exception e) { log.warn("Enable to parse script. ", scriptBytes); } return script; }

Target:
private Script getScript(byte[] scriptBytes) { Script script = null; try { script = new Script(scriptBytes); } catch (Exception e) { log.warn("Unable to parse script"); } return script; }
Source:
public static void main(String[] args) { final String STREAM_NAME = "exampleStream"; try { StreamClient streamClient = RestStreamClient.builder("localhost", 10000).build(); StreamWriter streamWriter = null; try { streamClient.create(STREAM_NAME); streamWriter = streamClient.createWriter(STREAM_NAME); long currentTTL = streamClient.getTTL(STREAM_NAME); LOG.info("Get TTL for stream: {}", currentTTL, STREAM_NAME); long newTTL = 18000; streamClient.setTTL(STREAM_NAME, newTTL); LOG.info("Set new TTL for stream: {}", newTTL, STREAM_NAME); currentTTL = streamClient.getTTL(STREAM_NAME); LOG.info("Was TTL updated successfully? {}", currentTTL == newTTL ? "YES" : "NO"); String log = "192.0.2.0 - - [09/Apr/2012:08:40:43 -0400] \"GET /NoteBook/ HTTP/1.0\" 201 809 \"-\" " + "\"Example v0.0.0 (www.example.org)\""; ListenableFuture<Void> future = streamWriter.write(log, null); LOG.info("Future {}", future.get()); Futures.addCallback(future, new FutureCallback<Void>() { @Override public void onSuccess(Void contents) { LOG.info("Success write stream {}", STREAM_NAME); } @Override public void onFailure(Throwable throwable) { LOG.error("Exception in stream write process", throwable); } }); } finally { if (streamWriter != null) { streamWriter.close(); } streamClient.close(); } } catch (Exception e) { LOG.error(e.getMessage(), e); } }

Target:
public static void main(String[] args) { try { StreamClient streamClient = RestStreamClient.builder("localhost", 10000).build(); StreamWriter streamWriter = null; try { streamClient.create(STREAM_NAME); streamWriter = streamClient.createWriter(STREAM_NAME); long currentTTL = streamClient.getTTL(STREAM_NAME); LOG.info("Get TTL for stream: {}", currentTTL, STREAM_NAME); long newTTL = 18000; streamClient.setTTL(STREAM_NAME, newTTL); LOG.info("Set new TTL for stream: {}", newTTL, STREAM_NAME); currentTTL = streamClient.getTTL(STREAM_NAME); LOG.info("Was TTL updated successfully? {}", currentTTL == newTTL ? "YES" : "NO"); String log = "192.0.2.0 - - [09/Apr/2012:08:40:43 -0400] \"GET /NoteBook/ HTTP/1.0\" 201 809 \"-\" " + "\"Example v0.0.0 (www.example.org)\""; ListenableFuture<Void> future = streamWriter.write(log, null); LOG.info("Future {}", future.get()); Futures.addCallback(future, new FutureCallback<Void>() { @Override public void onSuccess(Void contents) { LOG.info("Success write stream {}", STREAM_NAME); } @Override public void onFailure(Throwable throwable) { LOG.error("Exception in stream write process", throwable); } }); } finally { if (streamWriter != null) { streamWriter.close(); } streamClient.close(); } } catch (Exception e) { LOG.error(e.getMessage(), e); } }
Source:
public static int ceilPowerOfTwo(int val) { if(val == Integer.MIN_VALUE) return 0; int result = val - 1; result = (result >> 1) | result; result = (result >> 2) | result; result = (result >> 4) | result; result = (result >> 8) | result; result = (result >> 16) | result; result++; return result; }

Target:
public static int ceilPowerOfTwo(int val) { int result = val - 1; result = (result >> 1) | result; result = (result >> 2) | result; result = (result >> 4) | result; result = (result >> 8) | result; result = (result >> 16) | result; result++; return (result & ~(Integer.MIN_VALUE)); }
Source:
public PipelineResult run() throws IOException { boolean runInParallel = true; if (isLocal(from.getDataset()) || isLocal(to.getDataset())) { runInParallel = false; } if (runInParallel) { TaskUtil.configure(getConf()) .addJarPathForClass(HiveConf.class) .addJarForClass(AvroKeyInputFormat.class); Pipeline pipeline = new MRPipeline(getClass(), getConf()); PCollection<E> collection = pipeline.read( CrunchDatasets.asSource(from, entityClass)); if (compact) { collection = TaskUtil.partition(collection, to.getDataset().getDescriptor(), numWriters); } pipeline.write(collection, CrunchDatasets.asTarget(to)); PipelineResult result = pipeline.done(); StageResult sr = Iterables.getFirst(result.getStageResults(), null); if (sr != null && MAP_INPUT_RECORDS != null) { this.count = sr.getCounterValue(MAP_INPUT_RECORDS); } return result; } else { Pipeline pipeline = MemPipeline.getInstance(); PCollection<E> collection = pipeline.read( CrunchDatasets.asSource(from, entityClass)); boolean threw = true; DatasetWriter<E> writer = to.newWriter(); try { writer.open(); for (E entity : collection.materialize()) { writer.write(entity); count += 1; } threw = false; } finally { Closeables.close(writer, threw); } return pipeline.done(); } }

Target:
public PipelineResult run() throws IOException { boolean runInParallel = true; if (isLocal(from.getDataset()) || isLocal(to.getDataset())) { runInParallel = false; } if (runInParallel) { TaskUtil.configure(getConf()) .addJarPathForClass(HiveConf.class) .addJarForClass(AvroKeyInputFormat.class); Pipeline pipeline = new MRPipeline(getClass(), getConf()); PCollection<E> collection = pipeline.read( CrunchDatasets.asSource(from, entityClass)); if (compact) { collection = partition(collection, to.getDataset().getDescriptor(), numWriters); } pipeline.write(collection, CrunchDatasets.asTarget(to)); PipelineResult result = pipeline.done(); StageResult sr = Iterables.getFirst(result.getStageResults(), null); if (sr != null && MAP_INPUT_RECORDS != null) { this.count = sr.getCounterValue(MAP_INPUT_RECORDS); } return result; } else { Pipeline pipeline = MemPipeline.getInstance(); PCollection<E> collection = pipeline.read( CrunchDatasets.asSource(from, entityClass)); boolean threw = true; DatasetWriter<E> writer = to.newWriter(); try { writer.open(); for (E entity : collection.materialize()) { writer.write(entity); count += 1; } threw = false; } finally { Closeables.close(writer, threw); } return pipeline.done(); } }
Source:
public void actionPerformed(ActionEvent e) { Preferences prefs = NbPreferences.forModule(CloudStorageSettingsPanel.class); String id = prefs.get(S3_ID, ""); String secret = prefs.get(S3_SECRET, ""); try { S3FileSystemView viewer = new S3FileSystemView(id, secret); JFileChooser chooser = new JFileChooser("", viewer); int returnVal = chooser.showOpenDialog(new JFrame()); if (returnVal == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); System.out.println("Found a file! It is " + f); copyAndOpenFile(viewer, f); } else { System.out.println("No file selected..."); } } catch (Exception ex) { GUIHelpers.displayErrorDialog("There was a problem setting up the S3 viewer, check your settings."); logger.log(Level.WARNING, "Problem working with S3.", ex); } }

Target:
public void actionPerformed(ActionEvent e) { Preferences prefs = NbPreferences.forModule(CloudStorageSettingsPanel.class); String id = prefs.get(S3_ID, ""); String secret = prefs.get(S3_SECRET, ""); try { S3FileSystemView viewer = new S3FileSystemView(id, secret); JFileChooser chooser = new JFileChooser("", viewer); int returnVal = chooser.showOpenDialog(new JFrame()); if (returnVal == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); logger.log(Level.INFO, "Opened S3 file", f); copyAndOpenFile(viewer, f); } } catch (Exception ex) { GUIHelpers.displayErrorDialog("There was a problem setting up the S3 viewer, check your settings."); logger.log(Level.WARNING, "Problem working with S3.", ex); } }
Source:
public boolean canExecute(@NonNull ITmfTrace trace) { if (trace instanceof IKernelTrace) { IKernelTrace kernelTrace = (IKernelTrace) trace; if (kernelTrace instanceof ITmfTraceWithPreDefinedEvents) { ITmfTraceWithPreDefinedEvents traceWithPreDefinedEvents = (ITmfTraceWithPreDefinedEvents) kernelTrace; IKernelAnalysisEventLayout layout = kernelTrace.getKernelEventLayout(); Set<@NonNull ? extends ITmfEventType> containedEventTypes = traceWithPreDefinedEvents.getContainedEventTypes(); Set<@NonNull String> eventNames = containedEventTypes.stream().map(eventType -> eventType.getName()).collect(Collectors.toSet()); if (eventNames.contains(layout.eventNetworkSend())) { return true; } eventNames.retainAll(layout.eventNetworkReceive()); return !eventNames.isEmpty(); } return true; } return false; }

Target:
public boolean canExecute(@NonNull ITmfTrace trace) { if (trace instanceof IKernelTrace) { IKernelTrace kernelTrace = (IKernelTrace) trace; if (kernelTrace instanceof ITmfTraceWithPreDefinedEvents) { ITmfTraceWithPreDefinedEvents traceWithPreDefinedEvents = (ITmfTraceWithPreDefinedEvents) kernelTrace; IKernelAnalysisEventLayout layout = kernelTrace.getKernelEventLayout(); Set<@NonNull ? extends ITmfEventType> containedEventTypes = traceWithPreDefinedEvents.getContainedEventTypes(); Set<@NonNull String> eventNames = containedEventTypes.stream().map(eventType -> eventType.getName()).collect(Collectors.toSet()); if (eventNames.contains(layout.eventsNetworkSend())) { return true; } eventNames.retainAll(layout.eventsNetworkReceive()); return !eventNames.isEmpty(); } return true; } return false; }
Source:
private static InputSource[] loadXsds(String beansXmlAsString) { List<InputSource> xsds = new ArrayList<InputSource>(); String beans11 = "beans_1_1.xsd"; for (XmlSchema schema : XmlSchema.getSchemas(beansXmlAsString != null && beansXmlAsString.contains(beans11))) { InputSource source = loadXsd(schema.getFileName(), schema.getClassLoader()); if (source != null) { xsds.add(source); } } return xsds.toArray(EMPTY_INPUT_SOURCE_ARRAY); }

Target:
private static InputSource[] loadXsds(String beansXmlAsString) { List<InputSource> xsds = new ArrayList<InputSource>(); for (XmlSchema schema : XmlSchema.getSchemas(beansXmlAsString != null && beansXmlAsString.contains(XmlSchema.CDI11.getFileName()))) { InputSource source = loadXsd(schema.getFileName(), schema.getClassLoader()); if (source != null) { xsds.add(source); } } return xsds.toArray(EMPTY_INPUT_SOURCE_ARRAY); }
Source:
private void setText(final String value) { if (isEmpty(value)) { valueText.classList.add("none"); valueText.textContent = none(); } else { valueText.classList.remove("none"); valueText.textContent = value; } }

Target:
private void setText(final String value) { if (isNULL(value)) { valueText.classList.add(NONE_CSS_CLASS); valueText.textContent = none(); } else { valueText.classList.remove(NONE_CSS_CLASS); valueText.textContent = value; } }
Source:
public List<NamespaceWithPrefix> getNamespacesAsJSONlist( @ApiParam(value = "if set all namespaces are returned otherwise the list will be filtered by disallowed namespaces", required = false) @QueryParam("all") String allNamespaces) { Collection<Namespace> namespaces = this.getNamespaces(); List<NamespaceWithPrefix> namespacesList = new ArrayList<>(); for (Namespace ns : namespaces) { if (allNamespaces != null) { namespacesList.add(new NamespaceWithPrefix(ns, this.namespaceManager.getPrefix(ns.getDecoded()))); } else { if (!Namespaces.getDisallowedNamespaces().contains(ns.getDecoded())) { namespacesList.add(new NamespaceWithPrefix(ns, this.namespaceManager.getPrefix(ns.getDecoded()))); } } } Collections.sort(namespacesList); return namespacesList; }

Target:
public List<NamespaceWithPrefix> getNamespacesAsJSONlist( @ApiParam(value = "if set all namespaces are returned otherwise the list will be filtered by disallowed namespaces", required = false) @QueryParam("all") String allNamespaces) { Collection<Namespace> namespaces = this.getNamespaces(); List<NamespaceWithPrefix> namespacesList = new ArrayList<>(); for (Namespace ns : namespaces) { if (allNamespaces == null) { if (!Namespaces.getDisallowedNamespaces().contains(ns.getDecoded())) { namespacesList.add(new NamespaceWithPrefix(ns, this.namespaceManager.getPrefix(ns.getDecoded()))); } } else { namespacesList.add(new NamespaceWithPrefix(ns, this.namespaceManager.getPrefix(ns.getDecoded()))); } } Collections.sort(namespacesList); return namespacesList; }
Source:
} catch (Exception e) { }

Target:
} catch (Exception e) { System.err.print("exception adding property to JsonObject = " + e.getMessage()); }