auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setArmed(boolean newState) { if (this.armed != newState) { this.armed = newState; myDrone.notifyDroneEvent(DroneEventsType.ARMING); if (newState) { myDrone.getWaypointManager().getWaypoints(); }else{ <START> if (mode == ApmModes.ROTOR_RTL | mode == ApmModes.ROTOR_LAND) { <END> changeFlightMode(ApmModes.ROTOR_LOITER); } } } }</code><technical_language>a bitwise inclusive (|) operator a logical (||) operator used</technical_language>

Target:
public void setArmed(boolean newState) { if (this.armed != newState) { this.armed = newState; myDrone.notifyDroneEvent(DroneEventsType.ARMING); if (newState) { myDrone.getWaypointManager().getWaypoints(); }else{ if (mode == ApmModes.ROTOR_RTL || mode == ApmModes.ROTOR_LAND) { changeFlightMode(ApmModes.ROTOR_LOITER); } } } }
Source:
<code>private static boolean hasIgnoreAsCallingClassAnnotation(String className) { try { <START> Class< ? > clazz = Class.forName(className); <END> return clazz.isAnnotationPresent(IgnoreAsCallingClass.class); } catch (ClassNotFoundException ignore) { return false; } }</code><technical_language>please instead Context.getClassLoader()? try Class.forName SciJava codebase; thread context class loader is in places ImageJ, return null, need a fallback. cd67323c13678c931cb5e1e798149c45ef5b21a9</technical_language>

Target:
private static boolean hasIgnoreAsCallingClassAnnotation(String className) { try { Class< ? > clazz = Context.getClassLoader().loadClass(className); return clazz.isAnnotationPresent(IgnoreAsCallingClass.class); } catch (ClassNotFoundException ignore) { return false; } }
Source:
<code>public static ResourceBundle findResourceBundle(String aBundleName, Locale locale) { String key = createMissesKey(aBundleName, locale); ResourceBundle bundle = null; ClassLoader classLoader = getThreadCurrentThreadGetContextClassLoader(); try { <START> key = classLoader.hashCode()+key; <END> if (!bundlesMap.containsKey(key)) { bundle = ResourceBundle.getBundle(aBundleName, locale, classLoader); bundlesMap.putIfAbsent(key, bundle); } else { bundle = bundlesMap.get(key); } } catch (MissingResourceException ex) { if (delegatedClassLoaderMap.containsKey(classLoader.hashCode())) { try { if (!bundlesMap.containsKey(key)) { bundle = ResourceBundle.getBundle(aBundleName, locale, delegatedClassLoaderMap.get(classLoader.hashCode())); bundlesMap.putIfAbsent(key, bundle); } else { bundle = bundlesMap.get(key); } } catch (MissingResourceException e) { } } } return bundle; }</code><technical_language>inline createMissesKey instead duplicated key</technical_language>

Target:
public static ResourceBundle findResourceBundle(String aBundleName, Locale locale) { ResourceBundle bundle = null; ClassLoader classLoader = getCurrentThreadContextClassLoader(); String key = createMissesKey(String.valueOf(classLoader.hashCode()), aBundleName, locale); try { if (!bundlesMap.containsKey(key)) { bundle = ResourceBundle.getBundle(aBundleName, locale, classLoader); bundlesMap.putIfAbsent(key, bundle); } else { bundle = bundlesMap.get(key); } } catch (MissingResourceException ex) { if (delegatedClassLoaderMap.containsKey(classLoader.hashCode())) { try { if (!bundlesMap.containsKey(key)) { bundle = ResourceBundle.getBundle(aBundleName, locale, delegatedClassLoaderMap.get(classLoader.hashCode())); bundlesMap.putIfAbsent(key, bundle); } else { bundle = bundlesMap.get(key); } } catch (MissingResourceException e) { } } } return bundle; }
Source:
<code>protected void startAdapter(BootstrapProperties bootProperties) throws Exception { boolean startQuietly = bootProperties.isEnabled(CFG_KEY_START_QUIETLY); final UnifiedBootstrap bootstrap = new UnifiedBootstrap(bootProperties); if (!configCheckOnly()) { if (jettyOnly) { System.err.println("Starting Jetty/UI without a local adapter"); bootstrap.init(null); } else { bootstrap.init(bootstrap.createAdapter()); } Runtime.getRuntime().addShutdownHook(new ShutdownHandler(bootProperties)); launchAdapter(bootstrap, startQuietly); } else { new ConfigurationCheckRunner().runChecks(bootProperties, bootstrap).forEach(report -> { System.err.println("\n********************"); System.err.println(report.toString()); System.err.println("\n"); }); LoggingConfigurator.newConfigurator().requestShutdown(); <START> <END> System.err.println("\nConfig check only; terminating"); } }</code><technical_language>logClasspathIssues removed call chain, removed source</technical_language>

Target:
protected void startAdapter(BootstrapProperties bootProperties) throws Exception { boolean startQuietly = bootProperties.isEnabled(CFG_KEY_START_QUIETLY); final UnifiedBootstrap bootstrap = new UnifiedBootstrap(bootProperties); if (!configCheckOnly()) { if (jettyOnly) { System.err.println("Starting Jetty/UI without a local adapter"); bootstrap.init(null); } else { bootstrap.init(bootstrap.createAdapter()); } Runtime.getRuntime().addShutdownHook(new ShutdownHandler(bootProperties)); launchAdapter(bootstrap, startQuietly); } else { final List<Exception> fatals = new ArrayList<>(); new ConfigurationCheckRunner().runChecks(bootProperties, bootstrap).forEach(report -> { System.err.println("\n" + report.toString()); if(report.getFailureExceptions().size() > 0) fatals.addAll(report.getFailureExceptions()); }); LoggingConfigurator.newConfigurator().requestShutdown(); System.err.println("\nConfig check only; terminating"); System.exit(fatals.size() > 0 ? 1 : 0); } }
Source:
<code><START> public void setFlushSize(int flushSize) { <END> this.flushSize = flushSize; }</code><technical_language>Add assertion prevent negative values</technical_language>

Target:
public void setFlushSize(int flushSize) { Assert.state(flushSize >= 0, "'flushSize' cannot be less than '0'."); this.flushSize = flushSize; }
Source:
<code>public HTableInterface getTable(ImmutableBytesPtr tablename) throws IOException { <START> String tableName = Bytes.toString(tablename.copyBytesIfNecessary()); <END> if (LOG.isDebugEnabled()) { LOG.debug("Creating new HTable: " + tableName); } return this.e.getTable(TableName.valueOf(tablename.copyBytesIfNecessary())); }</code><technical_language>need convert byte[] -> String byte[]</technical_language>

Target:
public HTableInterface getTable(ImmutableBytesPtr tablename) throws IOException { String tableName = Bytes.toString(tablename.copyBytesIfNecessary()); if (LOG.isDebugEnabled()) { LOG.debug("Creating new HTable: " + tableName); } return this.e.getTable(TableName.valueOf(tableName)); }
Source:
<code><START> public void initializeShallowCommits() throws IOException { <END> assertNotStarted(); ((StartGenerator) pending).initializeShallowCommits(); }</code><technical_language>callers call this parseCommit() if repository is shallow. needs hidden RevWalk. I shallow data caller set a flag ObjectReader "DO shallow data"</technical_language>

Target:
private void initializeShallowCommits() throws IOException { if (shallowCommitsInitialized) return; shallowCommitsInitialized = true; for (ObjectId id : reader.getShallowCommits()) { final RevCommit commit = lookupCommit(id); commit.parents = new RevCommit[0]; } }
Source:
<code>public RespondingGatewayCrossGatewayBatchSubmissionResponseMessageRequestType batchSubmitTransaction(RespondingGatewayCrossGatewayBatchSubmissionRequestType body, WebServiceContext context) { RespondingGatewayCrossGatewayBatchSubmissionResponseMessageRequestType oResponse = null; try { COREEnvelopeBatchSubmissionResponse oBatchSubmissionResponse = outboundCORE_X12DSGenericBatchRequest.batchSubmitTransaction(body.getCOREEnvelopeBatchSubmission(), body.getAssertion(), body.getNhinTargetCommunities(), null); oResponse = new RespondingGatewayCrossGatewayBatchSubmissionResponseMessageRequestType(); oResponse.setCOREEnvelopeBatchSubmissionResponse(oBatchSubmissionResponse); oResponse.setAssertion(body.getAssertion()); oResponse.setNhinTargetCommunities(body.getNhinTargetCommunities()); } catch (Exception e) { <START> e.printStackTrace(); <END> LOG.error("Failed to send X12DS request to Nwhin. " + e); } return oResponse; }</code><technical_language>remove</technical_language>

Target:
public RespondingGatewayCrossGatewayBatchSubmissionResponseMessageRequestType batchSubmitTransaction(RespondingGatewayCrossGatewayBatchSubmissionRequestType body, WebServiceContext context) { RespondingGatewayCrossGatewayBatchSubmissionResponseMessageRequestType oResponse = null; try { COREEnvelopeBatchSubmissionResponse oBatchSubmissionResponse = outboundCORE_X12DSGenericBatchRequest.batchSubmitTransaction(body.getCOREEnvelopeBatchSubmission(), body.getAssertion(), body.getNhinTargetCommunities(), null); oResponse = new RespondingGatewayCrossGatewayBatchSubmissionResponseMessageRequestType(); oResponse.setCOREEnvelopeBatchSubmissionResponse(oBatchSubmissionResponse); oResponse.setAssertion(body.getAssertion()); oResponse.setNhinTargetCommunities(body.getNhinTargetCommunities()); } catch (Exception e) { LOG.error("Failed to send X12DS request to Nwhin. " + e); } return oResponse; }
Source:
<code>public PreferenceMultiLine(Context ctx, AttributeSet attrs) { <START> this(ctx, <END> attrs, 0); }</code><technical_language>Ideally call super() in cases, put setLayoutResource() call init() method is called constructors</technical_language>

Target:
public PreferenceMultiLine(Context ctx, AttributeSet attrs) { super(ctx, attrs); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } StreamEdge that = (StreamEdge) o; <START> return edgeId != null && edgeId.equals(that.edgeId) && <END> ((outputTag == null && that.outputTag == null) || (outputTag != null && that.outputTag != null && outputTag.equals(that.outputTag))); }</code><technical_language>This Objects.equals()</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } StreamEdge that = (StreamEdge) o; return Objects.equals(edgeId, that.edgeId) && Objects.equals(outputTag, that.outputTag); }
Source:
<code>public void publishWithBadHostShouldNotRethrowExceptions() { <START> StandardSlackService service = new StandardSlackService("", "foo", false, "#general", false,"token"); <END> service.setHost("hostvaluethatwillcausepublishtofail"); service.publish("message"); }</code><technical_language>suggestion StandardSlackService service = new StandardSlackService("", "foo", false, "#general", false, "token");</technical_language>

Target:
public void publishWithBadHostShouldNotRethrowExceptions() { StandardSlackService service = new StandardSlackService( StandardSlackService.builder() .withBaseUrl("") .withTeamDomain("foo") .withBotUser(false) .withRoomId("#general") .withReplyBroadcast(false) .withPopulatedToken("token")); service.setHost("hostvaluethatwillcausepublishtofail"); service.publish("message"); }
Source:
<code>public void samRecordFactoryTest(final String inputFile) { final File input = new File(TEST_DATA_DIR, inputFile); final SAMRecordFactoryTester factory = new SAMRecordFactoryTester(); final SamReader reader = SamReaderFactory.makeDefault().samRecordFactory(factory).open(input); int i = 0; for (final SAMRecord rec : reader) { ++i; } CloserUtil.close(reader); Assert.assertTrue(i > 0); <START> if (inputFile.endsWith(".sam") || inputFile.endsWith(".sam.gz")) <END> Assert.assertEquals(factory.samRecordsCreated, i); else if (inputFile.endsWith(".bam")) Assert.assertEquals(factory.bamRecordsCreated, i); }</code><technical_language>add { } if body</technical_language>

Target:
public void samRecordFactoryTest(final String inputFile) throws IOException { final File input = new File(TEST_DATA_DIR, inputFile); final SAMRecordFactoryTester factory = new SAMRecordFactoryTester(); int i = 0; try(final SamReader reader = SamReaderFactory.makeDefault().samRecordFactory(factory).open(input)){ for (final SAMRecord rec : reader) { ++i; } } Assert.assertTrue(i > 0); if (inputFile.endsWith(".sam") || inputFile.endsWith(".sam.gz")) { Assert.assertEquals(factory.samRecordsCreated, i); } else if (inputFile.endsWith(".bam")) { Assert.assertEquals(factory.bamRecordsCreated, i); } }
Source:
<code>public void init(EmptyAssetsScreen presenter) { this.presenter = presenter; <START> if (!this.presenter.canUpdateProject()) { <END> this.addAsset.disabled = true; } }</code><technical_language>IMO this move presenter in place.. i.e. call view.init( this ) add next line calls if(this.canUpdateProject()) { view.enableAddAssetButton( false ); }</technical_language>

Target:
public void init(EmptyAssetsScreen presenter) { this.presenter = presenter; }
Source:
<code>private static List<String> getAddressHierarchyLevels() { List<String> l = new ArrayList<String>(); try { <START> Class<?> svcClass = Context.loadClass("org.openmrs.module.addresshierarchy.service.AddressHierarchyService"); <END> Object svc = Context.getService(svcClass); List<Object> levels = (List<Object>) svcClass.getMethod("getOrderedAddressHierarchyLevels", Boolean.class, Boolean.class).invoke(svc, true, true); Class<?> levelClass = Context.loadClass("org.openmrs.module.addresshierarchy.AddressHierarchyLevel"); Class<?> fieldClass = Context.loadClass("org.openmrs.module.addresshierarchy.AddressField"); for (Object o : levels) { Object addressField = levelClass.getMethod("getAddressField").invoke(o); String fieldName = (String) fieldClass.getMethod("getName").invoke(addressField); l.add(fieldName); } if (l.size() > 1) { Collections.reverse(l); } } catch (Exception e) { throw new APIException("Error obtaining address hierarchy levels", e); } return l; }</code><technical_language>@mogoodrich do this reflection? @wluyima , in general rely Address Hierarchy in dashboard, if available, core OpenMRS address layout</technical_language>

Target:
private static List<String> getAddressHierarchyLevels() { List<String> l = new ArrayList<String>(); try { Class<?> svcClass = Context.loadClass("org.openmrs.module.addresshierarchy.service.AddressHierarchyService"); Object svc = Context.getService(svcClass); List<Object> levels = (List<Object>) svcClass.getMethod("getOrderedAddressHierarchyLevels", Boolean.class, Boolean.class).invoke(svc, true, true); Class<?> levelClass = Context.loadClass("org.openmrs.module.addresshierarchy.AddressHierarchyLevel"); Class<?> fieldClass = Context.loadClass("org.openmrs.module.addresshierarchy.AddressField"); for (Object o : levels) { Object addressField = levelClass.getMethod("getAddressField").invoke(o); String fieldName = (String) fieldClass.getMethod("getName").invoke(addressField); l.add(fieldName); } if (l.size() > 1) { Collections.reverse(l); } } catch (ClassNotFoundException cnfe) { } catch (Exception e) { throw new APIException("Error obtaining address hierarchy levels", e); } return l; }
Source:
<code>public void findImplementations() { ResolverUtil<VFS> resolverUtil = new ResolverUtil<>(); resolverUtil.findImplementations(VFS.class, "org.apache.ibatis.io"); <START> Set<Class<? extends VFS>> classSets = resolverUtil.getClasses(); <END> classSets.forEach(c -> Assert.assertTrue(VFS.class.isAssignableFrom(c))); }</code><technical_language>verify size of resolved classes</technical_language>

Target:
void findImplementations() { ResolverUtil<VFS> resolverUtil = new ResolverUtil<>(); resolverUtil.findImplementations(VFS.class, "org.apache.ibatis.io"); Set<Class<? extends VFS>> classSets = resolverUtil.getClasses(); assertEquals(classSets.size(), 3); classSets.forEach(c -> assertTrue(VFS.class.isAssignableFrom(c))); }
Source:
<code>public Iterable<User> users( @NotNull(message = "Search keywords can't be NULL") final String keywords, @NotNull(message = "Sort field can't be NULL") final String sort, @NotNull(message = "Sort order can't be NULL") final String order) throws IOException { return new RtSearchPagination<User>( <START> this.entry, "/search/users", keywords, sort, order, <END> new RtPagination.Mapping<User>() { @Override public User map(final JsonObject object) { return new RtUser( RtSearch.this.ghub, RtSearch.this.entry, object.getString("login") ); } } ); }</code><technical_language>/search is a common component in URIs in this class. more convenient store in this.request, done in other classes, RtIssues</technical_language>

Target:
public Iterable<User> users( @NotNull(message = "Search keywords can't be NULL") final String keywords, @NotNull(message = "Sort field can't be NULL") final String sort, @NotNull(message = "Sort order can't be NULL") final String order) throws IOException { return new RtSearchPagination<User>( this.request, "users", keywords, sort, order, new RtPagination.Mapping<User, JsonObject>() { @Override public User map(final JsonObject object) { return RtSearch.this.ghub.users().get( object.getString("login") ); } } ); }
Source:
<code>public int compress(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if (off < 0 || len < 0 || off > b.length - len) { throw new ArrayIndexOutOfBoundsException(); } int n = compressedDirectBuf.remaining(); if (n > 0) { n = Math.min(n, len); ((ByteBuffer) compressedDirectBuf).get(b, off, n); bytesWritten += n; return n; } compressedDirectBuf.clear(); compressedDirectBuf.limit(0); if (0 == uncompressedDirectBuf.position()) { setInputFromSavedData(); if (0 == uncompressedDirectBuf.position()) { finished = true; return 0; } } n = compressBytesDirect(); compressedDirectBuf.limit(n); uncompressedDirectBuf.clear(); if (0 == userBufLen) { finished = true; } bytesWritten += n; <START> ((ByteBuffer) compressedDirectBuf).get(b, off, n); <END> return n; }</code><technical_language>Do need this change? This IndexOutOfBoundsException [consuming compressed data](<LINK_0></technical_language>

Target:
public int compress(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } if (off < 0 || len < 0 || off > b.length - len) { throw new ArrayIndexOutOfBoundsException(); } int n = compressedDirectBuf.remaining(); if (n > 0) { n = Math.min(n, len); ((ByteBuffer) compressedDirectBuf).get(b, off, n); bytesWritten += n; return n; } compressedDirectBuf.clear(); compressedDirectBuf.limit(0); if (0 == uncompressedDirectBuf.position()) { setInputFromSavedData(); if (0 == uncompressedDirectBuf.position()) { finished = true; return 0; } } n = compressBytesDirect(); compressedDirectBuf.limit(n); uncompressedDirectBuf.clear(); if (0 == userBufLen) { finished = true; } n = Math.min(n, len); bytesWritten += n; ((ByteBuffer) compressedDirectBuf).get(b, off, n); return n; }
Source:
<code>public Executor createExecutor() { <START> return Runnable::run; <END> }</code><technical_language>show-off</technical_language>

Target:
public Executor createExecutor() { return ForkJoinPool.commonPool(); }
Source:
<code>public double simpleOptionPrice(SimpleOptionData option) { <START> return BlackFormulaRepository.price(option, _surface.getZValue(option.getTimeToExpiry(), option.getStrike())); <END> }</code><technical_language>Check arg</technical_language>

Target:
public double simpleOptionPrice(SimpleOptionData option) { ArgumentChecker.notNull(option, "option"); return BlackFormulaRepository.price(option, _surface.getZValue(option.getTimeToExpiry(), option.getStrike())); }
Source:
<code>public void join(GlowSession session, PlayerReader reader) { String type = world.getWorldType().getName().toLowerCase(); int gameMode = getGameMode().getValue(); if (server.isHardcore()) { gameMode |= 0x8; } session.send(new JoinGameMessage(SELF_ID, gameMode, world.getEnvironment().getId(), world.getDifficulty().getValue(), session.getServer().getMaxPlayers(), type, world.getGameRuleMap().getBoolean("reducedDebugInfo"))); setGameModeDefaults(); <START> try { <END> session.send(PluginMessage.fromString("MC|Brand", server.getName())); } catch (NullPointerException e) { session.send(PluginMessage.fromString("MC|Brand", "Glowstone")); } sendSupportedChannels(); joinTime = System.currentTimeMillis(); reader.readData(this); reader.close(); getServer().setPlayerOnline(this, true); saveData(); streamBlocks(); setCompassTarget(world.getSpawnLocation()); sendTime(); sendWeather(); sendRainDensity(); sendSkyDarkness(); sendAbilities(); scoreboard = server.getScoreboardManager().getMainScoreboard(); scoreboard.subscribe(this); invMonitor = new InventoryMonitor(getOpenInventory()); updateInventory(); session.send(new PositionRotationMessage(location)); if (!server.getResourcePackURL().isEmpty()) { setResourcePack(server.getResourcePackURL(), server.getResourcePackHash()); } }</code><technical_language>Move this fix actual method, please</technical_language>

Target:
public void join(GlowSession session, PlayerReader reader) { String type = world.getWorldType().getName().toLowerCase(); int gameMode = getGameMode().getValue(); if (server.isHardcore()) { gameMode |= 0x8; } session.send(new JoinGameMessage(SELF_ID, gameMode, world.getEnvironment().getId(), world.getDifficulty().getValue(), session.getServer().getMaxPlayers(), type, world.getGameRuleMap().getBoolean("reducedDebugInfo"))); setGameModeDefaults(); session.send(PluginMessage.fromString("MC|Brand", server.getName())); sendSupportedChannels(); joinTime = System.currentTimeMillis(); reader.readData(this); reader.close(); getServer().setPlayerOnline(this, true); saveData(); streamBlocks(); setCompassTarget(world.getSpawnLocation()); sendTime(); sendWeather(); sendRainDensity(); sendSkyDarkness(); sendAbilities(); scoreboard = server.getScoreboardManager().getMainScoreboard(); scoreboard.subscribe(this); invMonitor = new InventoryMonitor(getOpenInventory()); updateInventory(); session.send(new PositionRotationMessage(location)); if (!server.getResourcePackURL().isEmpty()) { setResourcePack(server.getResourcePackURL(), server.getResourcePackHash()); } }
Source:
<code>public String getText(Object element) { String label = <START> UNKNOWN_LABEL_TEXT; <END> if (element instanceof IStorage) { label = ((IStorage) element).getName(); } else { label = super.getText(element); } return label; }</code><technical_language>This is returned</technical_language>

Target:
public String getText(Object element) { String label = null; if (element instanceof IStorage) { label = ((IStorage) element).getName(); } else { label = super.getText(element); } return label; }
Source:
<code>public PatientPreferencesType deserialize(String sPtPref) throws AdapterPIPException { PatientPreferencesType oPtPref = null; ByteArrayInputStream baIsStrm = null; try { JAXBUnmarshallingUtil util = new JAXBUnmarshallingUtil(); JAXBContextHandler oHandler = new JAXBContextHandler(); JAXBContext oJaxbContext = oHandler.getJAXBContext("gov.hhs.fha.nhinc.common.nhinccommonadapter"); Unmarshaller oUnmarshaller = oJaxbContext.createUnmarshaller(); baIsStrm = new ByteArrayInputStream(sPtPref.getBytes()); JAXBElement oJAXBElementConsent = (JAXBElement) oUnmarshaller.unmarshal(util.getSafeStreamReaderFromInputStream(baIsStrm)); if (oJAXBElementConsent.getValue() instanceof PatientPreferencesType) { oPtPref = (PatientPreferencesType) oJAXBElementConsent.getValue(); } } catch (JAXBException e) { String sErrorMessage = "Failed to deserialize the patient preferences string: " + sPtPref + " Error: " + e.getMessage(); LOG.error(sErrorMessage, e); throw new AdapterPIPException(sErrorMessage, e); <START> } catch (XMLStreamException e) { <END> String sErrorMessage = "Failed to deserialize the patient preferences string: " + sPtPref + " Error: " + e.getMessage(); LOG.error(sErrorMessage, e); throw new AdapterPIPException(sErrorMessage, e); } return oPtPref; }</code><technical_language>missing finally block</technical_language>

Target:
public PatientPreferencesType deserialize(String sPtPref) throws AdapterPIPException { PatientPreferencesType oPtPref = null; ByteArrayInputStream baIsStrm = null; try { JAXBUnmarshallingUtil util = new JAXBUnmarshallingUtil(); JAXBContextHandler oHandler = new JAXBContextHandler(); JAXBContext oJaxbContext = oHandler.getJAXBContext("gov.hhs.fha.nhinc.common.nhinccommonadapter"); Unmarshaller oUnmarshaller = oJaxbContext.createUnmarshaller(); baIsStrm = new ByteArrayInputStream(sPtPref.getBytes()); JAXBElement oJAXBElementConsent = (JAXBElement) oUnmarshaller.unmarshal(util.getSafeStreamReaderFromInputStream(baIsStrm)); if (oJAXBElementConsent.getValue() instanceof PatientPreferencesType) { oPtPref = (PatientPreferencesType) oJAXBElementConsent.getValue(); } } catch (JAXBException e) { String sErrorMessage = "Failed to deserialize the patient preferences string: " + sPtPref + " Error: " + e.getMessage(); LOG.error(sErrorMessage, e); throw new AdapterPIPException(sErrorMessage, e); } catch (XMLStreamException e) { String sErrorMessage = "Failed to deserialize the patient preferences string: " + sPtPref + " Error: " + e.getMessage(); LOG.error(sErrorMessage, e); throw new AdapterPIPException(sErrorMessage, e); } finally { StreamUtils.closeStreamSilently(baIsStrm); } return oPtPref; }
Source:
<code>public void write(DataOutput out) throws IOException { Class<? extends InputSplit> clazz = (Class<? extends InputSplit>) realSplit.getClass(); Text.writeString(out, clazz.getName()); SerializationFactory factory = new SerializationFactory(conf); Serializer serializer = factory.getSerializer(clazz); serializer.open((DataOutputStream) out); serializer.serialize(realSplit); <START> serializer.close(); <END> }</code><technical_language>q re: finally</technical_language>

Target:
public void write(DataOutput out) throws IOException { SplitUtil.serializeInputSplit(conf, (DataOutputStream) out, realSplit); }
Source:
<code>public static ByteString compress(String data) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteBuffer dataLength = ByteBuffer.allocate(4); dataLength.order(ByteOrder.LITTLE_ENDIAN); dataLength.putInt(data.length()); outputStream.write(dataLength.array()); DeflaterOutputStream inflaterStream = new DeflaterOutputStream(outputStream); inflaterStream.write(data.getBytes(Charset.defaultCharset())); <START> inflaterStream.close(); <END> return new ByteString(outputStream.toByteArray()); } catch (IOException e) { return null; } }</code><technical_language>MySQL > This function requires MySQL compiled a compression library zlib follow</technical_language>

Target:
public static ByteString compress(String data) { try { if (data == null) { return null; } if (StringUtils.isEmpty(data)) { return new ByteString(new byte[0]); } ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteBuffer dataLength = ByteBuffer.allocate(4); dataLength.order(ByteOrder.LITTLE_ENDIAN); dataLength.putInt(data.length()); outputStream.write(dataLength.array()); DeflaterOutputStream inflaterStream = new DeflaterOutputStream(outputStream); inflaterStream.write(data.getBytes(Charset.defaultCharset())); inflaterStream.close(); return new ByteString(outputStream.toByteArray()); } catch (IOException e) { return null; } }
Source:
<code>public ReplicationMetrics(String name, MetricRegistry registry, List<ReplicaThread> replicaThreads) { interColoReplicationBytesCount = <START> registry.counter(MetricRegistry.name(ReplicaThread.class, name + ".interColoReplicationBytesCount")); <END> intraColoReplicationBytesCount = registry.counter(MetricRegistry.name(ReplicaThread.class, name + ".intraColoReplicationBytesCount")); interColoBlobsReplicatedCount = registry.counter(MetricRegistry.name(ReplicaThread.class, name + ".interColoReplicationBlobsCount")); intraColoBlobsReplicatedCount = registry.counter(MetricRegistry.name(ReplicaThread.class, name + ".intraColoReplicationBlobsCount")); replicationErrors = registry.counter(MetricRegistry.name(ReplicaThread.class, name + ".replicationErrors")); interColoReplicationLatency = registry.timer(MetricRegistry.name(ReplicaThread.class, name + ".interColoReplicationLatency")); intraColoReplicationLatency = registry.timer(MetricRegistry.name(ReplicaThread.class, name + ".intraColoReplicationLatency")); this.replicaThreads = replicaThreads; numberOfReplicaThreads = new Gauge<Integer>() { @Override public Integer getValue() { return getLiveThreads(); } }; registry.register(MetricRegistry.name(ReplicaThread.class, ".numberOfReplicaThreads"), numberOfReplicaThreads); }</code><technical_language>Recommend: MetricRegistry.name(ReplicaThread.class, name, "interColoReplicationBytesCount") name method "." concatentation of strings elides nulls</technical_language>

Target:
public ReplicationMetrics(String name, MetricRegistry registry, List<ReplicaThread> replicaThreads) { interColoReplicationBytesCount = registry.counter(MetricRegistry.name(ReplicaThread.class, name + "interColoReplicationBytesCount")); intraColoReplicationBytesCount = registry.counter(MetricRegistry.name(ReplicaThread.class, name + "intraColoReplicationBytesCount")); interColoBlobsReplicatedCount = registry.counter(MetricRegistry.name(ReplicaThread.class, name + "interColoReplicationBlobsCount")); intraColoBlobsReplicatedCount = registry.counter(MetricRegistry.name(ReplicaThread.class, name + "intraColoReplicationBlobsCount")); replicationErrors = registry.counter(MetricRegistry.name(ReplicaThread.class, name + "replicationErrors")); interColoReplicationLatency = registry.timer(MetricRegistry.name(ReplicaThread.class, name + "interColoReplicationLatency")); intraColoReplicationLatency = registry.timer(MetricRegistry.name(ReplicaThread.class, name + "intraColoReplicationLatency")); this.replicaThreads = replicaThreads; numberOfReplicaThreads = new Gauge<Integer>() { @Override public Integer getValue() { return getLiveThreads(); } }; registry.register(MetricRegistry.name(ReplicaThread.class, "numberOfReplicaThreads"), numberOfReplicaThreads); }
Source:
<code>public void sendObject(Object data) throws IOException, EncodeException { <START> <END> }</code><technical_language>If implementing, throw upsupportedoperation exception</technical_language>

Target:
public void sendObject(Object data) throws IOException, EncodeException { throw new UnsupportedOperationException("Method is not supported"); }
Source:
<code>public void verifyEditModeContent(String targetText) { Assertion.assertStringContains(targetText, getArticleText()); <START> PageObjectLogging.log("verifyEditModeContent", <END> "verifying the article shows " + targetText, true); }</code><technical_language>wrong formatting - parameter in new line</technical_language>

Target:
public void verifyEditModeContent(String targetText) { Assertion.assertStringContains(targetText, articleText.getText()); PageObjectLogging.log( "verifyEditModeContent", "The article shows " + targetText, true ); }
Source:
<code><START> public InputStream getRestoreStream() { <END> if (reference == null) { return getInMemoryStream(); } else { return getStreamFromReference(); } }</code><technical_language>@phillipm Bumping this</technical_language>

Target:
public InputStream getRestoreStream() { if (reference != null) { return getStreamFromReference(); } else { return getInMemoryStream(); } }
Source:
<code>public static String getCurrentFileName() { if (status == Status.PARSING) return (currentFile != null) ? currentFile.getName() : null; <START> <END> return (status == Status.NONE) ? null : ""; }</code><technical_language>whitespace, prefer if change existing code style</technical_language>

Target:
public static String getCurrentFileName() { if (status == Status.PARSING) return (currentFile != null) ? currentFile.getName() : null; else return (status == Status.NONE) ? null : ""; }
Source:
<code>public boolean process(AudioEvent audioEvent) { if (stopped) { return true; } <START> if (audioEvent.getTimeStamp() > secondsToSkip) { <END> audioEvent.setBytesProcessed(0); if (!hasFinished) { callback.onFinished(); hasFinished = true; } return false; } else { return false; } }</code><technical_language>This processor changed. do: git checkout feature-beatmatch contextproject-ms3/src/main/java/contextproject/audio/SkipAudioProcessor.java , update code check if works? need call skipProcessor.notify() instead of stop() in onFinished</technical_language>

Target:
public boolean process(AudioEvent audioEvent) { if (stopped) { return true; } if (audioEvent.getTimeStamp() > secondsToSkip) { callback.onFinished(); stopped = true; if(waitForNotify) { blockThread(); } } return false; }
Source:
<code>protected IStatus testBuildWorkspaceBeforeExport(IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 50); if (fInfo.useWorkspaceCompiledClasses) { getWorkspaceExportHelper().buildBeforeExport(fInfo.items, subMonitor.newChild(45)); Set<?> errors = getWorkspaceExportHelper().checkForErrors(fInfo.items); if (!errors.isEmpty()) { subMonitor.worked(5); return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.FeatureExportOperation_workspaceBuildErrorsFoundDuringExport, errors.toString())); } <START> monitor.worked(5); <END> } return Status.OK_STATUS; }</code><technical_language>This subMonitor.worked(5), monitor.worked(5) Move this if statement remove duplicate call subMonitor.worked(5) If checkForErrors is API, suggest making accept IProgressMonitor invoking worked returns</technical_language>

Target:
protected IStatus testBuildWorkspaceBeforeExport(IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 50); if (fInfo.useWorkspaceCompiledClasses) { getWorkspaceExportHelper().buildBeforeExport(fInfo.items, subMonitor.newChild(45)); Set<?> errors = getWorkspaceExportHelper().checkForErrors(fInfo.items); subMonitor.worked(5); if (!errors.isEmpty()) { return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.FeatureExportOperation_workspaceBuildErrorsFoundDuringExport, errors.toString())); } } return Status.OK_STATUS; }
Source:
<code>public int getSelectedIndex() { <START> return ((ScrollableToolbarMenuBar)menuBar_).getSelectedIndex(); <END> }</code><technical_language>accessing superclass menuBar_ member, casting it, consider making private in ThemedPopupPanel, a protected method returns it. override return-type in subclasses return type need for casts</technical_language>

Target:
public int getSelectedIndex() { return getMenuBar().getSelectedIndex(); }
Source:
<code>private Properties addMappingsForRemoteQuery(Properties indexingProperties, ComponentRegistry cr, ClassLoader cl) { Class<?> fbClass; try { fbClass = Class.forName("org.infinispan.query.remote.indexing.ProtobufValueWrapperFieldBridge", true, cl); <START> } catch (ClassNotFoundException e) { <END> return indexingProperties; } try { SearchMapping mapping = (SearchMapping) indexingProperties.get(Environment.MODEL_MAPPING); if (mapping == null) { mapping = new SearchMapping(); Properties amendedProperties = new Properties(); amendedProperties.putAll(indexingProperties); amendedProperties.put(Environment.MODEL_MAPPING, mapping); indexingProperties = amendedProperties; } Cache cache = cr.getComponent(Cache.class); FieldBridge fb = (FieldBridge) fbClass.getConstructor(Cache.class).newInstance(cache); mapping.entity(Class.forName("org.infinispan.query.remote.indexing.ProtobufValueWrapper", true, cl)) .indexed().classBridgeInstance(fb).norms(Norms.NO).analyze(Analyze.YES).store(Store.YES); } catch (Exception e) { throw new CacheException("Failed to configure indexing for remote query", e); } return indexingProperties; }</code><technical_language>Guys, need beautify this method (it's a monstrosity noted in TODO) :)</technical_language>

Target:
private Properties addMappingsForRemoteQuery(Properties indexingProperties, ComponentRegistry cr, ClassLoader cl) { Class<?> fbClass; try { fbClass = Util.loadClassStrict("org.infinispan.query.remote.indexing.ProtobufValueWrapperFieldBridge", cl); } catch (ClassNotFoundException e) { return indexingProperties; } try { SearchMapping mapping = (SearchMapping) indexingProperties.get(Environment.MODEL_MAPPING); if (mapping == null) { mapping = new SearchMapping(); Properties amendedProperties = new Properties(); amendedProperties.putAll(indexingProperties); amendedProperties.put(Environment.MODEL_MAPPING, mapping); indexingProperties = amendedProperties; } Cache cache = cr.getComponent(Cache.class); FieldBridge fb = (FieldBridge) fbClass.getConstructor(Cache.class).newInstance(cache); mapping.entity(Util.loadClassStrict("org.infinispan.query.remote.indexing.ProtobufValueWrapper", cl)) .indexed().classBridgeInstance(fb).norms(Norms.NO).analyze(Analyze.YES).store(Store.YES); } catch (Exception e) { throw new CacheException("Failed to configure indexing for remote query", e); } return indexingProperties; }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelection(event); <START> TmfTraceElement trace = (TmfTraceElement) ((StructuredSelection) selection).getFirstElement(); <END> Shell shell = HandlerUtil.getActiveShellChecked(event); CopyTraceDialog dialog = new CopyTraceDialog(shell, trace); dialog.open(); return null; }</code><technical_language>need add a check: if (!(selection instanceof IStructuredSelection)) { return null; } This selection is null; Also, cast IStructuredSelection instead of StructuredSelection</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelectionChecked(event); if (!(selection instanceof IStructuredSelection)) { return null; } TmfTraceElement trace = (TmfTraceElement) ((IStructuredSelection) selection).getFirstElement(); Shell shell = HandlerUtil.getActiveShellChecked(event); CopyTraceDialog dialog = new CopyTraceDialog(shell, trace); dialog.open(); return null; }
Source:
<code>public void onError(YouTubePlayer.ErrorReason errorReason) { if (attempts <= 3) { releaseYoutubePlayer(); <START> initializeYoutubePlayer(); <END> attempts++; } else { Toast.makeText(getActivity(), errorReason.toString(), Toast.LENGTH_LONG).show(); } }</code><technical_language>add some delay 500ms next attempt</technical_language>

Target:
public void onError(YouTubePlayer.ErrorReason errorReason) { if (attempts <= 3) { releaseYoutubePlayer(); initializeHandler.postDelayed(CourseUnitYoutubePlayerFragment.this::initializeYoutubePlayer, 500); attempts++; } else { redirectToYoutubeDialog(); } }
Source:
<code>private void renegotiateOnEventLoop(final Promise<Channel> newHandshakePromise) { final Promise<Channel> oldHandshakePromise = handshakePromise; if (!oldHandshakePromise.isDone()) { <START> oldHandshakePromise.addListener(new FutureListener<Channel>() { <END> @Override public void operationComplete(Future<Channel> future) throws Exception { if (future.isSuccess()) { newHandshakePromise.setSuccess(future.getNow()); } else { newHandshakePromise.setFailure(future.cause()); } } }); } else { handshakePromise = newHandshakePromise; handshake(); applyHandshakeTimeout(); } }</code><technical_language>I this existed PromiseNotifier ? code == code :)</technical_language>

Target:
private void renegotiateOnEventLoop(final Promise<Channel> newHandshakePromise) { final Promise<Channel> oldHandshakePromise = handshakePromise; if (!oldHandshakePromise.isDone()) { oldHandshakePromise.addListener(new PromiseNotifier<Channel, Future<Channel>>(newHandshakePromise)); } else { handshakePromise = newHandshakePromise; handshake(); applyHandshakeTimeout(); } }
Source:
<code>public String execute(final JobExecutionContext context) { final JobArguments args = context.getJobArguments(); <START> final String productUuid = args.getAsString(JobStatus.TARGET_ID); <END> final Boolean lazy = args.getAsBoolean(LAZY_REGEN); final StringBuilder result = new StringBuilder(); final Product product = this.productCurator.get(productUuid); if (product != null) { final Refresher refresher = poolManager.getRefresher(this.subAdapter, this.ownerAdapter, lazy); refresher.add(product); refresher.run(); result.append("Pools refreshed for product: ") .append(productUuid) .append("\n"); } else { result.append("Unable to refresh pools for product \"") .append(productUuid) .append("\": Could not find a product with the specified UUID"); } return result.toString(); }</code><technical_language>dependent org.candlepin.pinsetter.core.model.JobStatus, statics pinsetter in general more, away. need is a private static final String PRODUCT_KEY = "product_uuid";, similarly new ExportJob ImportJob protected static final String OWNER_KEY = "org"; protected static final String CONSUMER_KEY = "consumer_uuid";</technical_language>

Target:
public String execute(final JobExecutionContext context) { final JobArguments args = context.getJobArguments(); final String productUuid = args.getAsString(PRODUCT_KEY); final Boolean lazy = args.getAsBoolean(LAZY_KEY); final StringBuilder result = new StringBuilder(); final Product product = this.productCurator.get(productUuid); if (product != null) { final Refresher refresher = poolManager.getRefresher(this.subAdapter, this.ownerAdapter, lazy); refresher.add(product); refresher.run(); result.append("Pools refreshed for product: ") .append(productUuid) .append("\n"); } else { result.append("Unable to refresh pools for product \"") .append(productUuid) .append("\": Could not find a product with the specified UUID"); } return result.toString(); }
Source:
<code><START> private List<OncoTreeNode> setupOncotreeRepositoryMockResponseHistoryChange() { <END> List<OncoTreeNode> tmpOncoTreeRepositoryMockResponseHistoryChange = new ArrayList<>(); for (OncoTreeNode oncotreeNode : oncoTreeRepositoryMockResponse) { OncoTreeNode newOncotreeNode = new OncoTreeNode(oncotreeNode); if ("SEZS".equals(newOncotreeNode.getCode())) { newOncotreeNode.setCode("SS"); } if ("URMM".equals(newOncotreeNode.getCode())) { newOncotreeNode.setRescinds("ONC000503"); } tmpOncoTreeRepositoryMockResponseHistoryChange.add(newOncotreeNode); } OncoTreeNode newOncotreeNode = new OncoTreeNode(); newOncotreeNode.setURI("<LINK_0>"); newOncotreeNode.setCode("CLLSLL"); newOncotreeNode.setName("DLBCL Associated with Chronic Inflammation"); newOncotreeNode.setMainType("Mature B-Cell Neoplasms"); newOncotreeNode.setColor("LimeGreen"); newOncotreeNode.setParentCode("BCL"); newOncotreeNode.setPrecursors("ONC000413 ONC000820"); tmpOncoTreeRepositoryMockResponseHistoryChange.add(newOncotreeNode); return tmpOncoTreeRepositoryMockResponseHistoryChange; }</code><technical_language>want create a general function for applying sets of modifications timepoints. destination version argument this function prior set of oncotree nodes, changes intended happen point in time applied construct new version</technical_language>

Target:
private List<OncoTreeNode> setupOncotreeRepositoryMockResponseHistoryChange() { List<OncoTreeNode> tmpOncoTreeRepositoryMockResponseHistoryChange = new ArrayList<>(); for (OncoTreeNode oncotreeNode : oncoTreeRepositoryMockResponse) { OncoTreeNode newOncotreeNode = new OncoTreeNode(oncotreeNode); if ("SEZS".equals(newOncotreeNode.getCode())) { newOncotreeNode.setCode("SS"); } if ("URMM".equals(newOncotreeNode.getCode())) { newOncotreeNode.setRevocations("ONC000503"); } tmpOncoTreeRepositoryMockResponseHistoryChange.add(newOncotreeNode); } OncoTreeNode newOncotreeNode = new OncoTreeNode(); newOncotreeNode.setURI("<LINK_0>"); newOncotreeNode.setCode("CLLSLL"); newOncotreeNode.setName("DLBCL Associated with Chronic Inflammation"); newOncotreeNode.setMainType("Mature B-Cell Neoplasms"); newOncotreeNode.setColor("LimeGreen"); newOncotreeNode.setParentCode("BCL"); newOncotreeNode.setPrecursors("ONC000413 ONC000820"); tmpOncoTreeRepositoryMockResponseHistoryChange.add(newOncotreeNode); return tmpOncoTreeRepositoryMockResponseHistoryChange; }
Source:
<code>protected boolean hasSourceMimeType(ConverterDescriptor converterDescriptor, String mimeType) { <START> if (!Framework.getService(ConfigurationService.class).getBoolean(ENFORCE_SOURCE_MIME_TYPE_CHECK, true)) { <END> return true; } return translationHelper.hasCompatibleMimeType(converterDescriptor.getSourceMimeTypes(), mimeType); }</code><technical_language>migrating isBooleanPropertyTrue default false</technical_language>

Target:
protected boolean hasSourceMimeType(ConverterDescriptor converterDescriptor, String mimeType) { if (!Framework.getService(ConfigurationService.class).isBooleanTrue(ENFORCE_SOURCE_MIME_TYPE_CHECK)) { return true; } return translationHelper.hasCompatibleMimeType(converterDescriptor.getSourceMimeTypes(), mimeType); }
Source:
<code>protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { ChannelBuffer buf = (ChannelBuffer) msg; if (channel instanceof DatagramChannel) { <START> return decodeUDP(channel, remoteAddress, buf); <END> } else { return decodeTCP(channel, remoteAddress, buf); } }</code><technical_language>Names camel-case. abbreviations UDP TCP</technical_language>

Target:
protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { ChannelBuffer buf = (ChannelBuffer) msg; if (channel instanceof DatagramChannel) { return decodeUdp(channel, remoteAddress, buf); } else { return decodeTcp(channel, remoteAddress, buf); } }
Source:
<code>private static Image getSWTImage(int imageID) { Display display = Display.getCurrent(); if (display == null) display = Display.getDefault(); if (display.isDisposed()) return null; <START> return Display.getCurrent().getSystemImage(imageID); <END> }</code><technical_language>I PlatformUI.getWorkbench().getDisplay() is</technical_language>

Target:
private static Image getSWTImage(int imageID) { Display display = PlatformUI.getWorkbench().getDisplay(); if (display == null || display.isDisposed()) return null; return display.getSystemImage(imageID); }
Source:
<code>protected Stanza(Stanza p) { id = p.getStanzaId(); to = p.getTo(); from = p.getFrom(); error = p.error; for (ExtensionElement pe : p.getExtensions()) { addExtension(pe); } <START> if (isCustomAttributesEnabled()) { <END> customAttributes.clear(); customAttributes.putAll(p.getCustomAttributes()); } }</code><technical_language>need check here</technical_language>

Target:
protected Stanza(Stanza p) { id = p.getStanzaId(); to = p.getTo(); from = p.getFrom(); error = p.error; for (ExtensionElement pe : p.getExtensions()) { addExtension(pe); } if (p.customAttributes != null) { customAttributes = new LinkedHashMap<>(p.customAttributes); } }