auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public T deserialize(TypeToken<?> type, ConfigurationNode value) throws ObjectMappingException { <START> return this.dataTranslator.translate(ConfigurateTranslator.instance().translateFrom(value)); <END> }</code><technical_language>surround a try catch throw ObjectMappingException provided exception</technical_language>

Target:
public T deserialize(TypeToken<?> type, ConfigurationNode value) throws ObjectMappingException { try { return this.dataTranslator.translate(ConfigurateTranslator.instance().translateFrom(value)); } catch (InvalidDataException e) { return null; } }
Source:
<code>public ByteBuffer encode(BaseOperation<K> operation) { if (!(operation instanceof PutOperation)) { <START> throw new AssertionError(this.getClass().getName() + " can only decode " + PutOperation.class.getName()); <END> } PutOperation<K, V> putOperation = (PutOperation<K, V>)operation; K key = putOperation.getKey(); V value = putOperation.getValue(); ByteBuffer keyBuf = keySerializer.serialize(key); ByteBuffer valueBuf = valueSerializer.serialize(value); ByteBuffer buffer = ByteBuffer.allocate(BYTE_SIZE_BYTES + INT_SIZE_BYTES + keyBuf.remaining() + INT_SIZE_BYTES + valueBuf.remaining()); buffer.put(PUT.getValue()); buffer.putInt(keyBuf.remaining()); buffer.put(keyBuf); buffer.putInt(valueBuf.remaining()); buffer.put(valueBuf); buffer.flip(); return buffer; }</code><technical_language>I throw IllegalArgumentException here</technical_language>

Target:
public ByteBuffer encode(BaseOperation<K> operation) { if (!(operation instanceof PutOperation)) { throw new IllegalArgumentException(this.getClass().getName() + " can only decode " + PutOperation.class.getName()); } PutOperation<K, V> putOperation = (PutOperation<K, V>)operation; K key = putOperation.getKey(); V value = putOperation.getValue(); ByteBuffer keyBuf = keySerializer.serialize(key); ByteBuffer valueBuf = valueSerializer.serialize(value); ByteBuffer buffer = ByteBuffer.allocate(BYTE_SIZE_BYTES + INT_SIZE_BYTES + keyBuf.remaining() + INT_SIZE_BYTES + valueBuf.remaining()); buffer.put(PUT.getValue()); buffer.putInt(keyBuf.remaining()); buffer.put(keyBuf); buffer.putInt(valueBuf.remaining()); buffer.put(valueBuf); buffer.flip(); return buffer; }
Source:
<code>public void onMessage(final ByteBuffer buffer) { final Request req = AbstractServerWebSocketHandler.Decoder.parseRequest(buffer); <START> LOG.error("Error: {}", req.getSessionInfo()); <END> final String[] sessionInfo = req.getSessionInfo().split("\\+"); LOG.error("Error: {}", sessionInfo[1]); final AnswerConnectionState state = (AnswerConnectionState) getStateFromId(sessionInfo[1]); LOG.error("State: {}", state); if (req.getRequestType() == MessageType.DATA_REQUEST) { final Request.Builder builder = Request.newBuilder(req); builder.setSessionInfo(sessionInfo[0]); this.getParentServer().send(getConnectionFromState(state), builder.build()); } else if (req.getRequestType() == MessageType.SUBMISSION) { final Request.Builder builder = Request.newBuilder(req); builder.setSessionInfo(sessionInfo[0]); final SocketSession connection = getConnectionFromState(state); if (connection == null) { LOG.error("SOCKET IS NULL"); } this.getParentServer().send(getConnectionFromState(state), builder.build()); } }</code><technical_language>error messages. printing out err display faster. I get rid of log messages</technical_language>

Target:
public void onMessage(final ByteBuffer buffer) { final Request req = AbstractServerWebSocketHandler.Decoder.parseRequest(buffer); final String[] sessionInfo = req.getSessionInfo().split("\\+"); final AnswerConnectionState state = (AnswerConnectionState) getStateFromId(sessionInfo[1]); if (req.getRequestType() == MessageType.DATA_REQUEST) { final Request.Builder builder = Request.newBuilder(req); builder.setSessionInfo(sessionInfo[0]); this.getParentServer().send(getConnectionFromState(state), builder.build()); } else if (req.getRequestType() == MessageType.SUBMISSION) { final Request.Builder builder = Request.newBuilder(req); builder.setSessionInfo(sessionInfo[0]); final SocketSession connection = getConnectionFromState(state); if (connection == null) { LOG.error("SOCKET IS NULL"); } this.getParentServer().send(getConnectionFromState(state), builder.build()); } }
Source:
<code><START> public void initialize() throws Exception { super.initialize(); <END> if (initializer == null) { initializer = new DefaultInitializer(sessionSPI); } try { brokerConsumer = initializer.init(this); onflowControlReady = brokerConsumer::promptDelivery; } catch (ActiveMQAMQPResourceLimitExceededException e1) { throw e1; } catch (ActiveMQSecurityException e) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingConsumer(e.getMessage()); } catch (ActiveMQQueueMaxConsumerLimitReached e) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.errorCreatingConsumer(e.getMessage()); } catch (ActiveMQException e) { throw e; } catch (Exception e) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.errorCreatingConsumer(e.getMessage()); } }</code><technical_language>guess @SuppressWarnings("unchecked") this wont needed anymore</technical_language>

Target:
public void initialize() throws Exception { super.initialize(); if (controller == null) { controller = new DefaultController(sessionSPI); } try { brokerConsumer = controller.init(this); onflowControlReady = brokerConsumer::promptDelivery; } catch (ActiveMQAMQPResourceLimitExceededException e1) { throw e1; } catch (ActiveMQSecurityException e) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.securityErrorCreatingConsumer(e.getMessage()); } catch (ActiveMQQueueMaxConsumerLimitReached e) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.errorCreatingConsumer(e.getMessage()); } catch (ActiveMQException e) { throw e; } catch (Exception e) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.errorCreatingConsumer(e.getMessage()); } }
Source:
<code>public QueryRequest createQueryRequest(String localSource, FilterBuilder filterBuilder) { List<SortBy> sortBys = sorts .stream() .filter( s -> StringUtils.isNotEmpty(s.getAttribute()) && StringUtils.isNotEmpty(s.getDirection())) .map(s -> parseSort(s.getAttribute(), s.getDirection())) .collect(Collectors.toList()); if (sortBys.isEmpty()) { sortBys.add(new SortByImpl(Result.TEMPORAL, DEFAULT_SORT_ORDER)); } Query query = new QueryImpl(createFilter(filterBuilder), start, count, sortBys.get(0), true, timeout); String source = parseSrc(localSource); QueryRequest queryRequest; if (CACHE_SOURCE.equals(source)) { queryRequest = new QueryRequestImpl(query, true); queryRequest.getProperties().put("mode", CACHE_SOURCE); } else { queryRequest = new QueryRequestImpl(query, Collections.singleton(source)); queryRequest.getProperties().put("mode", "update"); } <START> queryRequest.getProperties().put("id", this.getId()); <END> if (excludeUnnecessaryAttributes) { queryRequest .getProperties() .put("excludeAttributes", Sets.newHashSet(Metacard.METADATA, "lux")); } if (sortBys.size() > 1) { queryRequest .getProperties() .put(ADDITIONAL_SORT_BYS, sortBys.subList(1, sortBys.size()).toArray(new SortBy[0])); } if (StringUtils.isNotEmpty(queryType)) { queryRequest.getProperties().put("queryType", queryType); } return queryRequest; }</code><technical_language>this</technical_language>

Target:
public QueryRequest createQueryRequest(String localSource, FilterBuilder filterBuilder) { List<SortBy> sortBys = sorts .stream() .filter( s -> StringUtils.isNotEmpty(s.getAttribute()) && StringUtils.isNotEmpty(s.getDirection())) .map(s -> parseSort(s.getAttribute(), s.getDirection())) .collect(Collectors.toList()); if (sortBys.isEmpty()) { sortBys.add(new SortByImpl(Result.TEMPORAL, DEFAULT_SORT_ORDER)); } Query query = new QueryImpl(createFilter(filterBuilder), start, count, sortBys.get(0), true, timeout); String source = parseSrc(localSource); QueryRequest queryRequest; if (CACHE_SOURCE.equals(source)) { queryRequest = new QueryRequestImpl(query, true); queryRequest.getProperties().put("mode", CACHE_SOURCE); } else { queryRequest = new QueryRequestImpl(query, Collections.singleton(source)); queryRequest.getProperties().put("mode", "update"); } queryRequest.getProperties().put("id", getId()); if (excludeUnnecessaryAttributes) { queryRequest .getProperties() .put("excludeAttributes", Sets.newHashSet(Metacard.METADATA, "lux")); } if (sortBys.size() > 1) { queryRequest .getProperties() .put(ADDITIONAL_SORT_BYS, sortBys.subList(1, sortBys.size()).toArray(new SortBy[0])); } if (StringUtils.isNotEmpty(queryType)) { queryRequest.getProperties().put("queryType", queryType); } return queryRequest; }
Source:
<code>public void run() { JsonRpcRequest request = null; try { request = JsonRpcRequest.fromByteArray(message); ContextHolder.init(); ContextHolder.setServerName(client.getHostname()); ResponseBuilder builder = new ResponseBuilder(request.getId()); String methodName = request.getMethod(); builder = CommandFactory.createCommand(methodName).run(request.getParams(), builder); send(builder.build(), request.getMethod()); } catch (Throwable e) { log.error("Failure in processing request", e); Map<String, Object> error = new HashMap<>(); error.put("code", 100); error.put("message", e.getMessage()); <START> send(new ResponseBuilder(request.getId()).withError(error).build(), request.getMethod()); <END> } }</code><technical_language>request null this point, if request parsing failed</technical_language>

Target:
public void run() { JsonRpcRequest request = null; try { request = JsonRpcRequest.fromByteArray(message); ContextHolder.init(); ContextHolder.setServerName(client.getHostname()); ResponseBuilder builder = new ResponseBuilder(request.getId()); String methodName = request.getMethod(); builder = CommandFactory.createCommand(methodName).run(request.getParams(), builder); send(builder.build(), request.getMethod()); } catch (Throwable e) { log.error("Failure in processing request", e); Map<String, Object> error = new HashMap<>(); error.put("code", 100); error.put("message", e.getMessage()); if (request != null) { send(new ResponseBuilder(request.getId()).withError(error).build(), request.getMethod()); } } }
Source:
<code>private void cleanConnection(StorageServerConnections connection, Guid hostId) { <START> if (connection.getid()!=null && !connection.getid().equalsIgnoreCase("")) { <END> Frontend.RunAction(VdcActionType.RemoveStorageServerConnection, new StorageServerConnectionParametersBase(connection, hostId), null, this); } }</code><technical_language>is point in case sensitive check for empty string. Also, StringUtils.isEmpty(connection.getId())</technical_language>

Target:
private void cleanConnection(StorageServerConnections connection, Guid hostId) { if (connection.getid() != null && !connection.getid().equals("")) { Frontend.RunAction(VdcActionType.RemoveStorageServerConnection, new StorageServerConnectionParametersBase(connection, hostId), null, this); } }
Source:
<code>public static void stopSequentially(Iterable<? extends Startable> entities) { List<Exception> exceptions = Lists.newArrayList(); List<Startable> failedEntities = Lists.newArrayList(); for (final Startable entity : entities) { Task<Object> task = Tasks.builder() .name("stopping "+entity) .body(new Runnable() { @Override public void run() { DynamicTasks.markInessential(); entity.stop(); }}) .build(); try { <START> DynamicTasks.queueIfPossible(task).orSubmitAsync((Entity)entity).andWaitForSuccess(); <END> } catch (Exception e) { log.warn("Error stopping "+entity+"; continuing with shutdown", e); exceptions.add(e); failedEntities.add(entity); } } if (exceptions.size() > 0) { throw new CompoundRuntimeException("Error stopping "+(failedEntities.size() > 1 ? "entities" : "entity")+": "+failedEntities, exceptions); } }</code><technical_language>Leave inline do TaskTags.markInessential( Effectors.invocation(...) )</technical_language>

Target:
public static void stopSequentially(Iterable<? extends Startable> entities) { List<Exception> exceptions = Lists.newArrayList(); List<Startable> failedEntities = Lists.newArrayList(); for (final Startable entity : entities) { try { TaskAdaptable<Void> task = TaskTags.markInessential(Effectors.invocation((Entity)entity, Startable.STOP, Collections.emptyMap())); DynamicTasks.queueIfPossible(task).orSubmitAsync((Entity)entity).andWaitForSuccess(); } catch (Exception e) { log.warn("Error stopping "+entity+"; continuing with shutdown", e); exceptions.add(e); failedEntities.add(entity); } } if (exceptions.size() > 0) { throw new CompoundRuntimeException("Error stopping "+(failedEntities.size() > 1 ? "entities" : "entity")+": "+failedEntities, exceptions); } }
Source:
<code>public static String escape(String text) { String specials = "&<>\'\""; String[] replacements = new String[]{"&amp;", "&lt;", "&gt;", <START> "&#39;", "&quot;"}; <END> StringBuilder sb = null; int low = 0; for (int i = 0; i < text.length(); ++i) { int s = specials.indexOf(text.charAt(i)); if (s != -1) { if (sb == null) { sb = new StringBuilder(); } sb.append(text.substring(low, i)); sb.append(replacements[s]); low = i + 1; } } if (sb == null) { return text; } sb.append(text.substring(low)); return sb.toString(); }</code><technical_language>&apos; if prefer (the numeric entity out of place otherwise). previously people nonstandard, (a) browser supports regardless, (b) part of HTML5 anyway</technical_language>

Target:
public static String escape(String text) { String specials = "&<>\'\""; String[] replacements = new String[]{"&amp;", "&lt;", "&gt;", "&apos;", "&quot;"}; StringBuilder sb = null; int low = 0; for (int i = 0; i < text.length(); ++i) { int s = specials.indexOf(text.charAt(i)); if (s != -1) { if (sb == null) { sb = new StringBuilder(); } sb.append(text.substring(low, i)); sb.append(replacements[s]); low = i + 1; } } if (sb == null) { return text; } sb.append(text.substring(low)); return sb.toString(); }
Source:
<code>public boolean isHammingSimilar(RoaringBitmap other, int tolerance) { final int size1 = highLowContainer.size(); final int size2 = other.highLowContainer.size(); int pos1 = 0; int pos2 = 0; int budget = tolerance; while(budget >= 0 && pos1 < size1 && pos2 < size2) { final short key1 = this.highLowContainer.getKeyAtIndex(pos1); final short key2 = other.highLowContainer.getKeyAtIndex(pos2); Container left = highLowContainer.getContainerAtIndex(pos1); Container right = other.highLowContainer.getContainerAtIndex(pos2); if(key1 == key2) { <START> budget -= (left.getCardinality() <END> + right.getCardinality() - (2 * left.andCardinality(right))); ++pos1; ++pos2; } else if(key1 < key2) { budget -= left.getCardinality(); ++pos1; } else { budget -= right.getCardinality(); ++pos2; } } while(budget >= 0 && pos1 < size1) { Container container = highLowContainer.getContainerAtIndex(pos1++); budget -= container.getCardinality(); } while(budget >= 0 && pos2 < size2) { Container container = other.highLowContainer.getContainerAtIndex(pos2++); budget -= container.getCardinality(); } return budget >= 0; }</code><technical_language>Implementing XorCardinality container level is improvement sounds promising me..</technical_language>

Target:
public boolean isHammingSimilar(RoaringBitmap other, int tolerance) { final int size1 = highLowContainer.size(); final int size2 = other.highLowContainer.size(); int pos1 = 0; int pos2 = 0; int budget = tolerance; while(budget >= 0 && pos1 < size1 && pos2 < size2) { final short key1 = this.highLowContainer.getKeyAtIndex(pos1); final short key2 = other.highLowContainer.getKeyAtIndex(pos2); Container left = highLowContainer.getContainerAtIndex(pos1); Container right = other.highLowContainer.getContainerAtIndex(pos2); if(key1 == key2) { budget -= left.xorCardinality(right); ++pos1; ++pos2; } else if(Util.compareUnsigned(key1, key2) < 0) { budget -= left.getCardinality(); ++pos1; } else { budget -= right.getCardinality(); ++pos2; } } while(budget >= 0 && pos1 < size1) { Container container = highLowContainer.getContainerAtIndex(pos1++); budget -= container.getCardinality(); } while(budget >= 0 && pos2 < size2) { Container container = other.highLowContainer.getContainerAtIndex(pos2++); budget -= container.getCardinality(); } return budget >= 0; }
Source:
<code>public static Map<String, String> loadFromFile(final File secretsFile) throws DotRuntimeException { if (!secretsFile.exists()) { throw new DotRuntimeException( "Unable to read secrets from file at [" + secretsFile.toPath() + "]"); } final Map<String, String> secrets = new HashMap<>(); try { <START> final List<String> lines = Files.readAllLines(secretsFile.toPath(), Charset.defaultCharset()); <END> for (String line : lines) { final int index = line.indexOf("="); if (index < 0) { throw new DotRuntimeException( "Invalid secrets in file at [" + secretsFile.toPath() + "]"); } final String key = line.substring(0, index); final String value = line.substring(index + 1); secrets.put(key, value); } } catch (IOException e) { throw new DotRuntimeException( "Unable to read secrets from file at [" + secretsFile.toPath() + "]"); } return secrets; }</code><technical_language>unit test? check diff scenarios</technical_language>

Target:
public static Map<String, String> loadFromFile(final File secretsFile) throws DotRuntimeException { if (!secretsFile.exists() || !secretsFile.canRead()) { throw new DotRuntimeException( "Unable to read secrets from file at [" + secretsFile.toPath() + "]"); } final Map<String, String> secrets = new HashMap<>(); try { final List<String> lines = Files.readAllLines(secretsFile.toPath(), Charset.defaultCharset()); for (final String line : lines) { final int index = line.indexOf('='); if (index < 0) { throw new DotRuntimeException( "Invalid secrets in file at [" + secretsFile.toPath() + "]"); } final String key = line.substring(0, index); final String value = line.substring(index + 1); secrets.put(key, value); } } catch (IOException e) { throw new DotRuntimeException( "Unable to read secrets from file at [" + secretsFile.toPath() + "]"); } return secrets; }
Source:
<code>public void resourceChanged(IResourceChangeEvent event) { try { if (event.getType() == IResourceChangeEvent.POST_CHANGE){ event.getDelta().accept(new IResourceDeltaVisitor(){ @Override public boolean visit(IResourceDelta delta) throws CoreException { if (delta.getKind() == IResourceDelta.REMOVED) { Set<IMarker> markerSet = fixitResourceMap.get(delta.getResource()); if (markerSet != null) { for (IMarker marker : markerSet) { deleteMarker(marker); } <START> return false; <END> } return true; } return false; } }); } } catch (CoreException e) { e.printStackTrace(); } }</code><technical_language>do: fixitResourceMap.remove(delta.getResource())</technical_language>

Target:
public void resourceChanged(IResourceChangeEvent event) { try { if (event.getType() == IResourceChangeEvent.POST_CHANGE){ event.getDelta().accept(new IResourceDeltaVisitor(){ @Override public boolean visit(IResourceDelta delta) throws CoreException { if (delta.getKind() == IResourceDelta.REMOVED) { Set<IMarker> markerSet = fixitResourceMap.get(delta.getResource()); if (markerSet != null) { for (IMarker marker : markerSet) { deleteMarker(marker); } return false; } return true; } return false; } }); } } catch (CoreException e) { CCorePlugin.log(e); } }
Source:
<code>protected void init() { setContentView(R.layout.wallpaper_cropper); mCropView = (CropView) findViewById(R.id.cropView); Intent cropIntent = getIntent(); final Uri imageUri = cropIntent.getData(); if (imageUri == null) { Log.e(LOGTAG, "No URI passed in intent, exiting WallpaperCropActivity"); finish(); return; } final ActionBar actionBar = getActionBar(); actionBar.setCustomView(R.layout.actionbar_set_wallpaper); actionBar.getCustomView().setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { boolean finishActivityWhenDone = true; <START> if (isClick == false) { isClick = true; <END> cropImageAndSetWallpaper(imageUri, null, finishActivityWhenDone); } } }); mSetWallpaperButton = findViewById(R.id.set_wallpaper_button); final BitmapRegionTileSource.UriBitmapSource bitmapSource = new BitmapRegionTileSource.UriBitmapSource(this, imageUri, 1024); mSetWallpaperButton.setVisibility(View.INVISIBLE); Runnable onLoad = new Runnable() { public void run() { if (bitmapSource.getLoadingState() != BitmapSource.State.LOADED) { Toast.makeText(WallpaperCropActivity.this, getString(R.string.wallpaper_load_fail), Toast.LENGTH_LONG).show(); finish(); } else { mSetWallpaperButton.setVisibility(View.VISIBLE); } } }; setCropViewTileSource(bitmapSource, true, false, onLoad); }</code><technical_language>disable button instead</technical_language>

Target:
protected void init() { setContentView(R.layout.wallpaper_cropper); mCropView = (CropView) findViewById(R.id.cropView); Intent cropIntent = getIntent(); final Uri imageUri = cropIntent.getData(); if (imageUri == null) { Log.e(LOGTAG, "No URI passed in intent, exiting WallpaperCropActivity"); finish(); return; } final ActionBar actionBar = getActionBar(); actionBar.setCustomView(R.layout.actionbar_set_wallpaper); actionBar.getCustomView().setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { boolean finishActivityWhenDone = true; actionBar.getCustomView().setEnabled(false); cropImageAndSetWallpaper(imageUri, null, finishActivityWhenDone); } }); mSetWallpaperButton = findViewById(R.id.set_wallpaper_button); final BitmapRegionTileSource.UriBitmapSource bitmapSource = new BitmapRegionTileSource.UriBitmapSource(this, imageUri, 1024); mSetWallpaperButton.setVisibility(View.INVISIBLE); Runnable onLoad = new Runnable() { public void run() { if (bitmapSource.getLoadingState() != BitmapSource.State.LOADED) { Toast.makeText(WallpaperCropActivity.this, getString(R.string.wallpaper_load_fail), Toast.LENGTH_LONG).show(); finish(); } else { mSetWallpaperButton.setVisibility(View.VISIBLE); } } }; setCropViewTileSource(bitmapSource, true, false, onLoad); }
Source:
<code>public void verifyUserLoggedIn(final String userName) { changeImplicitWait(0, TimeUnit.MILLISECONDS); try { if (driver.findElements(By.cssSelector("#PreviewFrame")).size() > 0) { driver.switchTo().frame("PreviewFrame"); } if (driver.findElements(MERCURY_SKIN).size() > 0) { <START> wait.forElementPresent(MERCURY_NAV_ICON); <END> driver.findElement(MERCURY_NAV_ICON).click(); } wait.forElementPresent(By .cssSelector(LOGGED_IN_USER_SELECTOR.replace("%userName%", userName.replace(" ", "_")))); if (driver.findElements(MERCURY_NAV_ICON).size() > 0) { wait.forElementClickable(MERCURY_NAV_ICON); driver.findElement(MERCURY_NAV_ICON).click(); } } finally { restoreDeaultImplicitWait(); driver.switchTo().defaultContent(); } PageObjectLogging.log("verifyUserLoggedIn", "user " + userName + " logged in", true); }</code><technical_language>change VISIBLE present :)</technical_language>

Target:
public void verifyUserLoggedIn(final String userName) { changeImplicitWait(0, TimeUnit.MILLISECONDS); try { if (driver.findElements(By.cssSelector("#PreviewFrame")).size() > 0) { driver.switchTo().frame("PreviewFrame"); } if (driver.findElements(MERCURY_SKIN).size() > 0) { wait.forElementClickable(MERCURY_NAV_ICON); driver.findElement(MERCURY_NAV_ICON).click(); } wait.forElementPresent(By .cssSelector(LOGGED_IN_USER_SELECTOR.replace("%userName%", userName.replace(" ", "_")))); if (driver.findElements(MERCURY_SKIN).size() > 0) { wait.forElementClickable(MERCURY_NAV_ICON); driver.findElement(MERCURY_NAV_ICON).click(); } } finally { restoreDeaultImplicitWait(); driver.switchTo().defaultContent(); } PageObjectLogging.log("verifyUserLoggedIn", "user " + userName + " logged in", true); }
Source:
<code>private boolean matchesFilenames(LanguageDescription language, String path) { if (language.getFileNames() != null) { for (String name : language.getFileNames()) { if (name.equals(new File(path).getName())) { return true; } } <START> } <END> return false; }</code><technical_language>java streams more readable/smaller</technical_language>

Target:
private boolean matchesFilenames(LanguageDescription language, String path) { return language.getFileNames().stream().anyMatch(name->path.endsWith(name)); }
Source:
<code>private UpdateEventResponse doHandle(UpdateEventRequest request) { String name = request.getName(); <START> checkArgument(name == null || name.length() <= 100, "The name must not be longer then 100 characters."); <END> try (DbSession dbSession = dbClient.openSession(false)) { return Stream .of(getDbEvent(dbSession, request)) .peek(checkPermissions()) .peek(checkModifiable()) .map(updateNameAndDescription(name)) .peek(checkNonConflictingOtherEvents(dbSession)) .peek(updateInDb(dbSession)) .map(toWsResponse()) .findAny() .orElseThrow(() -> new IllegalStateException("Event not found")); } }</code><technical_language>form is elsewhere: Event name length (%s) is longer maximum authorized (%s). '%s' provided</technical_language>

Target:
private UpdateEventResponse doHandle(UpdateEventRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { return Stream .of(getDbEvent(dbSession, request)) .peek(checkPermissions()) .peek(checkModifiable()) .peek(checkVersionNameLength(request)) .map(updateNameAndDescription(request)) .peek(checkNonConflictingOtherEvents(dbSession)) .peek(updateInDb(dbSession)) .map(toWsResponse()) .findAny() .orElseThrow(() -> new IllegalStateException("Event not found")); } }
Source:
<code>public void testValueOfJms() throws Exception{ ModelNode address = getAddress(); ModelNode operation = getOperation(address); try{ <START> ModelNode result=executeOperation(operation); ModelNode value = result.get("java: contexts", "java:", "JmsXA","value"); <END> Boolean val = !(value.equals(null)); Assert.assertTrue(val); } catch (MgmtOperationException e) { return; } }</code><technical_language>correct formatting</technical_language>

Target:
public void testValueOfJms() throws Exception { ModelNode address = null; try { address = setup(); ModelNode addr = getAddress(); ModelNode operation = getOperation(addr); ModelNode result = executeOperation(operation); ModelNode value = result.get("java: contexts", "java:jboss", "Name3", "class-name"); Assert.assertEquals("org.jboss.as.test.integration.jca.rar.MultipleAdminObject1Impl", value.asString()); } finally { if (address != null) { remove(address); } } }
Source:
<code>public String getPresentationValue() { <START> return PhoneUtil.resolve(this); <END> }</code><technical_language>PartyContact depend PhoneUtil? a strange dependency. PartyContact class PhoneUtil</technical_language>

Target:
public String getPresentationValue() { final ContactResolver resolver = getResolver(getClass()); return resolver == null ? null : resolver.getPresentationValue(this); }
Source:
<code>public GuiceBundle<T> build() { <START> return new GuiceBundle<T>(Stage.PRODUCTION, autoConfig, modules, configurationClass); <END> }</code><technical_language>simply call? return build(Stage.PRODUCTION);</technical_language>

Target:
public GuiceBundle<T> build() { return build(Stage.PRODUCTION); }
Source:
<code>protected void resolve(StyleInfo style) { setId(style); WorkspaceInfo resolved = ResolvingProxy.resolve(getCatalog(), style.getWorkspace()); if (resolved != null) { resolved = unwrap(resolved); style.setWorkspace(resolved); } else { <START> System.out.println("this means the workspace has not yet been added to the catalog, keep the proxy around"); <END> } }</code><technical_language>Well, no, a System.out here. A log replace instead</technical_language>

Target:
protected void resolve(StyleInfo style) { setId(style); WorkspaceInfo resolved = ResolvingProxy.resolve(getCatalog(), style.getWorkspace()); if (resolved != null) { resolved = unwrap(resolved); style.setWorkspace(resolved); } else { LOGGER.log(Level.INFO, "Failed to resolve woekspace for style \""+style.getName()+ "\". This means the workspace has not yet been added to the catalog, keep the proxy around"); } }
Source:
<code>private <T> T <START> executeCall(String <END> methodName, Class<T> returnType, Object[] params) throws ESException { if (client == null) { throw new ConnectionException(ConnectionManager.REMOTE); } if (Configuration.getClientBehavior().getChangePackageFragmentSize().isPresent()) { for (int i = 0; i < params.length; i++) { final Object param = params[i]; if (param instanceof AbstractChangePackage && !ChangePackageProxy.class.isInstance(param)) { params[i] = fragmentChangePackage( ESCollections.find(params, SessionId.class), ESCollections.find(params, ProjectId.class), AbstractChangePackage.class.cast(param)); } } } try { T result = (T) client.execute(serverInterface + "." + methodName, params); if (result instanceof Object[]) { final Object[] objects = (Object[]) result; final Optional<SessionId> maybeSession = ESCollections.find(params, SessionId.class); for (int i = 0; i < objects.length; i++) { final Object item = objects[i]; if (ChangePackageProxy.class.isInstance(item)) { objects[i] = aggregateChangePackageFragments((ChangePackageProxy) item, maybeSession); } } result = (T) objects; } return result; } catch (final XmlRpcException e) { if (e.getCause() instanceof ESException) { throw (ESException) e.getCause(); } else if (e.linkedException instanceof SAXException && ((SAXException) e.linkedException).getException() instanceof SerializationException) { final SerializationException serialE = (SerializationException) ((SAXException) e.linkedException) .getException(); throw new org.eclipse.emf.emfstore.internal.server.exceptions.SerializationException(serialE); } else { throw new ConnectionException(ConnectionManager.REMOTE + e.getMessage(), e); } } }</code><technical_language>executeCall delegate adjustParameters adjustResult methods, easier understand/maintain is on</technical_language>

Target:
private <T> T executeCall(String methodName, Class<T> returnType, Object[] params) throws ESException { if (client == null) { throw new ConnectionException(ConnectionManager.REMOTE); } final Object[] adjustedParams = adjustParameters(params); try { final T result = (T) client.execute(serverInterface + "." + methodName, adjustedParams); return adjustResult(ESCollections.find(params, SessionId.class), result); } catch (final XmlRpcException e) { if (e.getCause() instanceof ESException) { throw (ESException) e.getCause(); } else if (e.linkedException instanceof SAXException && ((SAXException) e.linkedException).getException() instanceof SerializationException) { final SerializationException serialE = (SerializationException) ((SAXException) e.linkedException) .getException(); throw new org.eclipse.emf.emfstore.internal.server.exceptions.SerializationException(serialE); } else { throw new ConnectionException(ConnectionManager.REMOTE + e.getMessage(), e); } } }
Source:
<code>protected RoleHierarchy getRoleHierarchy() { <START> if(! roleHierarchySet && context != null) { <END> RoleHierarchy contextRoleHierarchy = getSingleBeanOrNull(RoleHierarchy.class); if(contextRoleHierarchy != null){ roleHierarchy = contextRoleHierarchy; } roleHierarchySet = true; } return roleHierarchy; }</code><technical_language>extract this if sentence a conditional method code easier read e.g. private boolean roleHerarchyNotSetForValidContext(){ ! roleHierarchySet && context != null }</technical_language>

Target:
protected RoleHierarchy getRoleHierarchy() { if(roleHerarchyNotSetForValidContext()) { RoleHierarchy contextRoleHierarchy = getSingleBeanOrNull(RoleHierarchy.class); if(contextRoleHierarchy != null){ roleHierarchy = contextRoleHierarchy; } roleHierarchySet = true; } return roleHierarchy; }
Source:
<code>public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateTimerEvent emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); <START> assertTimerEventEmpty(emptyTopEvent.getExecutionSet(), NON_CANCELLING, ""); <END> }</code><technical_language>suggestion assertTimerEventEmpty(emptyTopEvent.getExecutionSet(), NON_CANCELLING, EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateTimerEvent emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertTimerEventEmpty(emptyTopEvent.getExecutionSet(), NON_CANCELLING, EMPTY_VALUE); }
Source:
<code>public List<? extends Module> getJacksonModules() { return Arrays.<Module>asList( new SimpleModule("FirehoseModule") .registerSubtypes( new NamedType(ClippedFirehoseFactory.class, "clipped"), new NamedType(TimedShutoffFirehoseFactory.class, "timed"), new NamedType(IrcFirehoseFactory.class, "irc"), new NamedType(LocalFirehoseFactory.class, "local"), new NamedType(ProtoBufInputRowParser.class, "protobuf"), <START> new NamedType(EventReceiverFirehoseFactory.class, "receiver") <END> ) ); }</code><technical_language>is another class named IndexingServiceFirehoseModule, wondering if delete class FireshoseModule in indexing service also</technical_language>

Target:
public List<? extends Module> getJacksonModules() { return Arrays.<Module>asList( new SimpleModule("FirehoseModule") .registerSubtypes( new NamedType(ClippedFirehoseFactory.class, "clipped"), new NamedType(TimedShutoffFirehoseFactory.class, "timed"), new NamedType(IrcFirehoseFactory.class, "irc"), new NamedType(LocalFirehoseFactory.class, "local"), new NamedType(EventReceiverFirehoseFactory.class, "receiver") ) ); }
Source:
<code>public void testValidRequest() { try { HttpServletRequest req = EasyMock.createStrictMock(HttpServletRequest.class); HttpServletResponse resp = EasyMock.createStrictMock(HttpServletResponse.class); FilterChain filterChain = EasyMock.createNiceMock(FilterChain.class); ServletOutputStream outputStream = EasyMock.createNiceMock(ServletOutputStream.class); EasyMock.expect(resp.getOutputStream()).andReturn(outputStream).once(); EasyMock.expect(req.getAttribute(AuthConfig.DRUID_AUTH_TOKEN)).andReturn("so-very-valid").once(); EasyMock.expect(req.getAttribute(AuthConfig.DRUID_AUTH_TOKEN_CHECKED)).andReturn(true).once(); EasyMock.replay(req, resp, filterChain, outputStream); PreResponseAuthorizationCheckFilter filter = new PreResponseAuthorizationCheckFilter( authConfig, authenticators, new DefaultObjectMapper() ); filter.doFilter(req, resp, filterChain); EasyMock.verify(req, resp, filterChain, outputStream); } <START> catch (Exception ex) { <END> throw new RuntimeException(ex); } }</code><technical_language>add exceptions method signature</technical_language>

Target:
public void testValidRequest() throws Exception { AuthenticationResult authenticationResult = new AuthenticationResult("so-very-valid", "so-very-valid"); HttpServletRequest req = EasyMock.createStrictMock(HttpServletRequest.class); HttpServletResponse resp = EasyMock.createStrictMock(HttpServletResponse.class); FilterChain filterChain = EasyMock.createNiceMock(FilterChain.class); ServletOutputStream outputStream = EasyMock.createNiceMock(ServletOutputStream.class); EasyMock.expect(req.getAttribute(AuthConfig.DRUID_AUTHENTICATION_RESULT)).andReturn(authenticationResult).once(); EasyMock.expect(req.getAttribute(AuthConfig.DRUID_AUTHORIZATION_CHECKED)).andReturn(true).once(); EasyMock.replay(req, resp, filterChain, outputStream); PreResponseAuthorizationCheckFilter filter = new PreResponseAuthorizationCheckFilter( authenticators, new DefaultObjectMapper() ); filter.doFilter(req, resp, filterChain); EasyMock.verify(req, resp, filterChain, outputStream); }
Source:
<code>public int compareValueTo( ZonedDateTimeSchemaKey other ) { int compare = Long.compare( epochSecondUTC, other.epochSecondUTC ); <START> if ( compare == 0 ) <END> { compare = Integer.compare( nanoOfSecond, other.nanoOfSecond ); } if ( compare == 0 ) { compare = zoneId >= 0 ? Integer.compare( zoneId, other.zoneId ) : Integer.compare( zoneOffsetSeconds, zoneOffsetSeconds ); } return compare; }</code><technical_language>This is consistent do comparison in DateTimeValue code. There, comparing underlying Java values, i.e. compareTo method of Java's ChronoZonedDateTime.java instant local time comparing zoneIDs (the chronology care is in case). I if thought case of values a zoneId >= 0 other not? In general I need more test coverage for cases, cover in comparability PR either..</technical_language>

Target:
public int compareValueTo( ZonedDateTimeSchemaKey other ) { int compare = Long.compare( epochSecondUTC, other.epochSecondUTC ); if ( compare == 0 ) { compare = Integer.compare( nanoOfSecond, other.nanoOfSecond ); if ( compare == 0 && ( differentValidZoneId( other ) || differentValidZoneOffset( other ) ) ) { compare = Values.COMPARATOR.compare( asValue(), other.asValue() ); } } return compare; }
Source:
<code>private Object wrapTopLevelContainer(Object handle){ if (handle instanceof Map){ return new MapWrapper((Map)handle); } if (handle instanceof List){ return new ListWrapper((List)handle); } if (handle instanceof Set){ return new SetWrapper((Set)handle); } if (handle.getClass().isArray()){ <START> return new ArrayWrapper((Object[])handle); <END> } return handle; }</code><technical_language>@dmmiller612, removed this conversion tests passing, is for ... If this version is ok for you, I merge</technical_language>

Target:
private Object wrapTopLevelContainer(Object handle){ if (handle instanceof Map){ return new MapWrapper((Map)handle); } if (handle instanceof List){ return new ListWrapper((List)handle); } if (handle instanceof Set){ return new SetWrapper((Set)handle); } if (handle.getClass().isArray()){ return new ArrayWrapper(convertToObjectArray(handle)); } return handle; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dev_auth); recyclerView = (RecyclerView) findViewById(R.id.devAuthRecyclerView); <START> String json = getIntent().getStringExtra("emails_json"); <END> List<String> emails = new ArrayList<>(); int direct_admin_size = 1; connectionProgressDialog = new ProgressDialog(this); connectionProgressDialog.setMessage(getString(R.string.signing_in)); try { JSONObject jsonObject = new JSONObject(json); JSONArray jsonArray = jsonObject.getJSONArray("direct_admins"); for (int i = 0; i < jsonArray.length(); i++) { emails.add(jsonArray.get(i).toString()); } direct_admin_size = jsonArray.length(); jsonArray = jsonObject.getJSONArray("direct_users"); for (int i = 0; i < jsonArray.length(); i++) { emails.add(jsonArray.get(i).toString()); } } catch (JSONException e) { e.printStackTrace(); } AuthEmailAdapter authEmailAdapter = new AuthEmailAdapter(emails, direct_admin_size); recyclerView.setAdapter(authEmailAdapter); recyclerView.setLayoutManager(new LinearLayoutManager(DevAuthActivity.this) { }); }</code><technical_language>nice move emails_json a constant referenced app</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dev_auth); String json = getIntent().getStringExtra(AsyncDevGetEmails.EMAIL_JSON); recyclerView = (RecyclerView) findViewById(R.id.devAuthRecyclerView); List<String> emails = new ArrayList<>(); int directAdminSize = 1; connectionProgressDialog = new ProgressDialog(this); connectionProgressDialog.setMessage(getString(R.string.signing_in)); try { JSONObject jsonObject = new JSONObject(json); JSONArray jsonArray = jsonObject.getJSONArray("direct_admins"); for (int i = 0; i < jsonArray.length(); i++) { emails.add(jsonArray.get(i).toString()); } directAdminSize = jsonArray.length(); jsonArray = jsonObject.getJSONArray("direct_users"); for (int i = 0; i < jsonArray.length(); i++) { emails.add(jsonArray.get(i).toString()); } } catch (JSONException e) { ZLog.logException(e); } AuthEmailAdapter authEmailAdapter = new AuthEmailAdapter(emails, directAdminSize, DevAuthActivity.this); recyclerView.setAdapter(authEmailAdapter); authEmailAdapter.setOnItemClickListener(new AuthClickListener() { @Override public void onItemClick(String email) { AsyncLogin asyncLogin = new AsyncLogin(DevAuthActivity.this, email, null, true); asyncLogin.execute(); connectionProgressDialog.show(); } }); recyclerView.setLayoutManager(new LinearLayoutManager(DevAuthActivity.this) { }); }
Source:
<code>public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { boolean retry = false; try { switch (response.getStatusCode()) { case 401: Multimap<String, String> headers = command.getCurrentRequest().getHeaders(); if (headers != null && headers.containsKey(AuthHeaders.AUTH_USER) && headers.containsKey(AuthHeaders.AUTH_KEY) && !headers.containsKey(AuthHeaders.AUTH_TOKEN)) { retry = false; } else { closeClientButKeepContentStream(response); Integer count = retryCountMap.getIfPresent(command); if (count == null) { logger.debug("invalidating authentication token - first time for %s", command); retryCountMap.put(command, 1); authenticationResponseCache.invalidateAll(); retry = true; } else { if (count + 1 >= NUM_RETRIES) { logger.debug("too many 401s - giving up after: %s for %s", count, command); retry = false; } else { logger.debug("invalidating authentication token - retry %s for %s", count, command); retryCountMap.put(command, count + 1); authenticationResponseCache.invalidateAll(); Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS); retry = true; } } } break; } return retry; } finally { <START> closeClientButKeepContentStream(response); <END> } }</code><technical_language>Is retry handler payload? If not, remove finally block avoid buffering in memory unnecessarily</technical_language>

Target:
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { boolean retry = false; switch (response.getStatusCode()) { case 401: Multimap<String, String> headers = command.getCurrentRequest().getHeaders(); if (headers != null && headers.containsKey(AuthHeaders.AUTH_USER) && headers.containsKey(AuthHeaders.AUTH_KEY) && !headers.containsKey(AuthHeaders.AUTH_TOKEN)) { retry = false; } else { Integer count = retryCountMap.getIfPresent(command); if (count == null) { logger.debug("invalidating authentication token - first time for %s", command); retryCountMap.put(command, 1); authenticationResponseCache.invalidateAll(); retry = true; } else { if (count + 1 >= NUM_RETRIES) { logger.debug("too many 401s - giving up after: %s for %s", count, command); retry = false; } else { logger.debug("invalidating authentication token - retry %s for %s", count, command); retryCountMap.put(command, count + 1); authenticationResponseCache.invalidateAll(); Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS); retry = true; } } } break; } return retry; }
Source:
<code>private void updateChunkingAndSizeMetricsOnSuccessfulGet() { routerMetrics.getBlobSizeBytes.update(bytesWritten); routerMetrics.getBlobChunkCount.update(numChunksTotal); if (hasRange) { <START> routerMetrics.getBlobWithRangeSizeBytes.update(bytesWritten); <END> routerMetrics.getBlobWithRangeChunkCount.update(numChunksTotal); } if (numChunksTotal == 1) { routerMetrics.simpleBlobGetCount.inc(); } else { routerMetrics.compositeBlobGetCount.inc(); } }</code><technical_language>metrics useful. do envision usage</technical_language>

Target:
private void updateChunkingAndSizeMetricsOnSuccessfulGet() { routerMetrics.getBlobSizeBytes.update(bytesWritten); routerMetrics.getBlobChunkCount.update(numChunksTotal); if (options != null && options.getRange() != null) { routerMetrics.getBlobWithRangeSizeBytes.update(bytesWritten); routerMetrics.getBlobWithRangeTotalBlobSizeBytes.update(totalSize); } if (numChunksTotal == 1) { routerMetrics.simpleBlobGetCount.inc(); } else { routerMetrics.compositeBlobGetCount.inc(); } }
Source:
<code>private InputFile inputFile(String relativePath, Type type) { DefaultInputFile inputFile = new DefaultInputFile("moduleKey", relativePath) .setModuleBaseDir(moduleBaseDir.toPath()) .setLanguage("js") .setType(type); <START> inputFile.initMetadata(new FileMetadata().readMetadata(inputFile.file(), Charset.defaultCharset())); <END> context.fileSystem().add(inputFile); return inputFile; }</code><technical_language>@vilchik-elena Charset.defaultCharset()</technical_language>

Target:
private InputFile inputFile(String relativePath, Type type) { DefaultInputFile inputFile = new DefaultInputFile("moduleKey", relativePath) .setModuleBaseDir(moduleBaseDir.toPath()) .setLanguage("js") .setType(type); inputFile.initMetadata(new FileMetadata().readMetadata(inputFile.file(), Charsets.UTF_8)); context.fileSystem().add(inputFile); return inputFile; }
Source:
<code>private void pushToDownstream() { downstream().push(rows.get(rowIdx)); rowIdx++; requested--; if (rowIdx >= rows.size() && waiting == -1 && requested > 0) <START> downstream().end(); <END> }</code><technical_language>this call level (in doPush methods), in case of requested==rows.size() end() invoked</technical_language>

Target:
private void pushToDownstream() { inLoop = true; downstream().push(rows.get(rowIdx)); inLoop = false; rowIdx++; requested--; if (rowIdx >= rows.size() && waiting == -1 && requested > 0) downstream().end(); }
Source:
<code>public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (qName.equals(MODULE)) { final String originalName = attributes.getValue(NAME); final String name; <START> if (threadModeSettings == null) { <END> name = originalName; } else { name = threadModeSettings.resolveName(originalName); } final DefaultConfiguration conf = new DefaultConfiguration(name, threadModeSettings); if (configuration == null) { configuration = conf; } if (!configStack.isEmpty()) { final DefaultConfiguration top = configStack.peek(); top.addChild(conf); } configStack.push(conf); } else if (qName.equals(PROPERTY)) { final String value; try { value = replaceProperties(attributes.getValue(VALUE), overridePropsResolver, attributes.getValue(DEFAULT)); } catch (final CheckstyleException ex) { throw new SAXException(ex); } final String name = attributes.getValue(NAME); final DefaultConfiguration top = configStack.peek(); top.addAttribute(name, value); } else if (qName.equals(MESSAGE)) { final String key = attributes.getValue(KEY); final String value = attributes.getValue(VALUE); final DefaultConfiguration top = configStack.peek(); top.addMessage(key, value); } else { if (!qName.equals(METADATA)) { throw new IllegalStateException("Unknown name:" + qName + "."); } } }</code><technical_language>Talked <LINK_0> . null left in. This field null IMO point a specific reason remove null</technical_language>

Target:
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (qName.equals(MODULE)) { final String originalName = attributes.getValue(NAME); final String name = threadModeSettings.resolveName(originalName); final DefaultConfiguration conf = new DefaultConfiguration(name, threadModeSettings); if (configuration == null) { configuration = conf; } if (!configStack.isEmpty()) { final DefaultConfiguration top = configStack.peek(); top.addChild(conf); } configStack.push(conf); } else if (qName.equals(PROPERTY)) { final String value; try { value = replaceProperties(attributes.getValue(VALUE), overridePropsResolver, attributes.getValue(DEFAULT)); } catch (final CheckstyleException ex) { throw new SAXException(ex); } final String name = attributes.getValue(NAME); final DefaultConfiguration top = configStack.peek(); top.addAttribute(name, value); } else if (qName.equals(MESSAGE)) { final String key = attributes.getValue(KEY); final String value = attributes.getValue(VALUE); final DefaultConfiguration top = configStack.peek(); top.addMessage(key, value); } else { if (!qName.equals(METADATA)) { throw new IllegalStateException("Unknown name:" + qName + "."); } } }
Source:
<code>public ValidationLayer getValidationLayer() throws CatalogException { if(valLayer != null) { return valLayer; } else { <START> throw new CatalogException("validation layer is not initialized"); <END> } }</code><technical_language>this method unchanged is modify interface Catalog. Instead add null checks this method is used</technical_language>

Target:
public ValidationLayer getValidationLayer() { return valLayer; }